Eclipse SUMO - Simulation of Urban MObility
GNEHierarchicalElementParents.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A abstract class for representation of Hierarchical Elements
16 /****************************************************************************/
17 #ifndef GNEHierarchicalElementParents_h
18 #define GNEHierarchicalElementParents_h
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include <config.h>
25 
27 #include <utils/geom/Position.h>
28 
29 #include "GNEAttributeCarrier.h"
30 
31 // ===========================================================================
32 // class declarations
33 // ===========================================================================
34 
35 class GNEAdditional;
36 class GNEDemandElement;
37 class GNEShape;
38 class GNEConnection;
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
43 
49 
50 public:
51 
53  friend class GNEChange_Children;
54 
64  const std::vector<GNEEdge*>& edgeParents,
65  const std::vector<GNELane*>& laneParents,
66  const std::vector<GNEShape*>& shapeParents,
67  const std::vector<GNEAdditional*>& additionalParents,
68  const std::vector<GNEDemandElement*>& demandElementParents);
69 
72 
76  virtual void updateGeometry() = 0;
77 
79  virtual Position getPositionInView() const = 0;
81 
85  void addEdgeParent(GNEEdge* edge);
86 
88  void removeEdgeParent(GNEEdge* edge);
89 
91  const std::vector<GNEEdge*>& getEdgeParents() const;
92 
94 
98  void addLaneParent(GNELane* lane);
99 
101  void removeLaneParent(GNELane* lane);
102 
104  const std::vector<GNELane*>& getLaneParents() const;
105 
107 
111  void addShapeParent(GNEShape* shape);
112 
114  void removeShapeParent(GNEShape* shape);
115 
117  const std::vector<GNEShape*>& getShapeParents() const;
118 
120 
124  void addAdditionalParent(GNEAdditional* additional);
125 
127  void removeAdditionalParent(GNEAdditional* additional);
128 
130  const std::vector<GNEAdditional*>& getAdditionalParents() const;
131 
133 
137  void addDemandElementParent(GNEDemandElement* demandElement);
138 
140  void removeDemandElementParent(GNEDemandElement* demandElement);
141 
143  const std::vector<GNEDemandElement*>& getDemandElementParents() const;
144 
146 
147 protected:
151  ParentConnections(GNEHierarchicalElementParents* hierarchicalElement);
152 
154  void update();
155 
157  void draw(const GUIVisualizationSettings& s, const GUIGlObjectType parentType) const;
158 
160  std::vector<std::pair<Position, double> > symbolsPositionAndRotation;
161 
163  std::vector<PositionVector> connectionPositions;
164 
165  private:
168  };
169 
172 
174  void changeEdgeParents(GNEShape* elementChild, const std::string& newEdgeIDs);
175 
177  void changeEdgeParents(GNEAdditional* elementChild, const std::string& newEdgeIDs);
178 
180  void changeEdgeParents(GNEDemandElement* elementChild, const std::string& newEdgeIDs);
181 
183  void changeEdgeParents(GNEDemandElement* elementChild, const std::vector<GNEEdge*>& newEdges);
184 
186  void changeLaneParents(GNEShape* elementChild, const std::string& newLaneIDs);
187 
189  void changeLaneParents(GNEAdditional* elementChild, const std::string& newLaneIDs);
190 
192  void changeLaneParents(GNEDemandElement* elementChild, const std::string& newLaneIDs);
193 
198  void changeAdditionalParent(GNEShape* shapeTobeChanged, const std::string& newAdditionalParentID, int additionalParentIndex);
199 
204  void changeAdditionalParent(GNEAdditional* additionalTobeChanged, const std::string& newAdditionalParentID, int additionalParentIndex);
205 
210  void changeAdditionalParent(GNEDemandElement* demandElementTobeChanged, const std::string& newAdditionalParentID, int additionalParentIndex);
211 
216  void changeDemandElementParent(GNEShape* shapeTobeChanged, const std::string& newDemandElementParentID, int demandElementParentIndex);
217 
222  void changeDemandElementParent(GNEAdditional* additionalTobeChanged, const std::string& newDemandElementParentID, int demandElementParentIndex);
223 
228  void changeDemandElementParent(GNEDemandElement* demandElementTobeChanged, const std::string& newDemandElementParentID, int demandElementParentIndex);
229 
231 
234 
235 private:
237  std::vector<GNEEdge*> myEdgeParents;
238 
240  std::vector<GNELane*> myLaneParents;
241 
243  std::vector<GNEShape*> myShapeParents;
244 
246  std::vector<GNEAdditional*> myAdditionalParents;
247 
249  std::vector<GNEDemandElement*> myDemandElementParents;
250 
253 
256 
259 };
260 
261 #endif
GNEHierarchicalElementParents::myDemandElementParents
std::vector< GNEDemandElement * > myDemandElementParents
list of demand elements parents of this element
Definition: GNEHierarchicalElementParents.h:249
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:54
GUIGlObjectTypes.h
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
GNEHierarchicalElementParents::myAC
GNEAttributeCarrier * myAC
pointer to AC (needed to avoid diamond problem)
Definition: GNEHierarchicalElementParents.h:252
GNEHierarchicalElementParents::changeAdditionalParent
void changeAdditionalParent(GNEShape *shapeTobeChanged, const std::string &newAdditionalParentID, int additionalParentIndex)
change additional parent of a shape
Definition: GNEHierarchicalElementParents.cpp:480
GNEHierarchicalElementParents::GNEHierarchicalElementParents
GNEHierarchicalElementParents(GNEAttributeCarrier *AC, const std::vector< GNEEdge * > &edgeParents, const std::vector< GNELane * > &laneParents, const std::vector< GNEShape * > &shapeParents, const std::vector< GNEAdditional * > &additionalParents, const std::vector< GNEDemandElement * > &demandElementParents)
Constructor used by elements that have another additionals as parent.
Definition: GNEHierarchicalElementParents.cpp:43
GNEHierarchicalElementParents::getShapeParents
const std::vector< GNEShape * > & getShapeParents() const
get shapes of VSS
Definition: GNEHierarchicalElementParents.cpp:214
GNEHierarchicalElementParents::myParentConnections
ParentConnections myParentConnections
variable ParentConnections
Definition: GNEHierarchicalElementParents.h:233
GNEHierarchicalElementParents::getEdgeParents
const std::vector< GNEEdge * > & getEdgeParents() const
get edge parents
Definition: GNEHierarchicalElementParents.cpp:150
GNEHierarchicalElementParents::operator=
GNEHierarchicalElementParents & operator=(const GNEHierarchicalElementParents &)=delete
Invalidated assignment operator.
GNEHierarchicalElementParents::myAdditionalParents
std::vector< GNEAdditional * > myAdditionalParents
list of additional parents of this element
Definition: GNEHierarchicalElementParents.h:246
GNEHierarchicalElementParents::ParentConnections::draw
void draw(const GUIVisualizationSettings &s, const GUIGlObjectType parentType) const
draw connections between Parent and childrens
Definition: GNEHierarchicalElementParents.cpp:316
GNEHierarchicalElementParents
An special type of Attribute carrier that owns hierarchical elements.
Definition: GNEHierarchicalElementParents.h:48
GNEHierarchicalElementParents::addLaneParent
void addLaneParent(GNELane *lane)
Definition: GNEHierarchicalElementParents.cpp:156
GNEHierarchicalElementParents::addDemandElementParent
void addDemandElementParent(GNEDemandElement *demandElement)
Definition: GNEHierarchicalElementParents.cpp:92
GNEChange_Children
Definition: GNEChange_Children.h:41
GUIGlObjectType
GUIGlObjectType
Definition: GUIGlObjectTypes.h:40
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEHierarchicalElementParents::removeShapeParent
void removeShapeParent(GNEShape *shape)
remove shape parent
Definition: GNEHierarchicalElementParents.cpp:201
GNEHierarchicalElementParents::getLaneParents
const std::vector< GNELane * > & getLaneParents() const
get lanes of VSS
Definition: GNEHierarchicalElementParents.cpp:182
GNEHierarchicalElementParents::myLaneParents
std::vector< GNELane * > myLaneParents
list of lane parents of this element
Definition: GNEHierarchicalElementParents.h:240
GNEHierarchicalElementParents::ParentConnections
struct for pack all variables and functions relative to connections between hierarchical element and ...
Definition: GNEHierarchicalElementParents.h:149
GNEHierarchicalElementParents::ParentConnections::myHierarchicalElement
GNEHierarchicalElementParents * myHierarchicalElement
pointer to hierarchical element parent
Definition: GNEHierarchicalElementParents.h:167
GNEShape
Definition: GNEShape.h:35
GNEHierarchicalElementParents::removeLaneParent
void removeLaneParent(GNELane *lane)
remove lane parent
Definition: GNEHierarchicalElementParents.cpp:169
GNEHierarchicalElementParents::changeDemandElementParent
void changeDemandElementParent(GNEShape *shapeTobeChanged, const std::string &newDemandElementParentID, int demandElementParentIndex)
change first demand element parent of a shape
Definition: GNEHierarchicalElementParents.cpp:531
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNEHierarchicalElementParents::ParentConnections::symbolsPositionAndRotation
std::vector< std::pair< Position, double > > symbolsPositionAndRotation
position and rotation of every symbol over lane
Definition: GNEHierarchicalElementParents.h:160
GNEHierarchicalElementParents::addAdditionalParent
void addAdditionalParent(GNEAdditional *additional)
Definition: GNEHierarchicalElementParents.cpp:63
GNEHierarchicalElementParents::getPositionInView
virtual Position getPositionInView() const =0
Returns position of hierarchical element in view.
GNEHierarchicalElementParents::addEdgeParent
void addEdgeParent(GNEEdge *edge)
Definition: GNEHierarchicalElementParents.cpp:121
GNEHierarchicalElementParents::myShapeParents
std::vector< GNEShape * > myShapeParents
list of shape parents of this element
Definition: GNEHierarchicalElementParents.h:243
Position.h
GNEHierarchicalElementParents::removeDemandElementParent
void removeDemandElementParent(GNEDemandElement *demandElement)
remove demand element parent from this demand element
Definition: GNEHierarchicalElementParents.cpp:103
GNEHierarchicalElementParents::getDemandElementParents
const std::vector< GNEDemandElement * > & getDemandElementParents() const
return vector of demand elements that have as Parent this edge (For example, Calibrators)
Definition: GNEHierarchicalElementParents.cpp:115
GNEHierarchicalElementParents::getAdditionalParents
const std::vector< GNEAdditional * > & getAdditionalParents() const
return vector of additionals that have as Parent this edge (For example, Calibrators)
Definition: GNEHierarchicalElementParents.cpp:86
GNEHierarchicalElementParents::ParentConnections::ParentConnections
ParentConnections(GNEHierarchicalElementParents *hierarchicalElement)
constructor
Definition: GNEHierarchicalElementParents.cpp:222
GNEHierarchicalElementParents::addShapeParent
void addShapeParent(GNEShape *shape)
Definition: GNEHierarchicalElementParents.cpp:188
GNEHierarchicalElementParents::changeLaneParents
void changeLaneParents(GNEShape *elementChild, const std::string &newLaneIDs)
change edge parents of a shape
Definition: GNEHierarchicalElementParents.cpp:460
GNEConnection
Definition: GNEConnection.h:38
GNEAttributeCarrier.h
GNEHierarchicalElementParents::updateGeometry
virtual void updateGeometry()=0
config.h
GNEHierarchicalElementParents::ParentConnections::update
void update()
update Connection's geometry
Definition: GNEHierarchicalElementParents.cpp:227
GNEHierarchicalElementParents::removeAdditionalParent
void removeAdditionalParent(GNEAdditional *additional)
remove additional parent from this additional
Definition: GNEHierarchicalElementParents.cpp:74
GNEHierarchicalElementParents::myEdgeParents
std::vector< GNEEdge * > myEdgeParents
list of edge parents of this element
Definition: GNEHierarchicalElementParents.h:237
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GNEHierarchicalElementParents::changeEdgeParents
void changeEdgeParents(GNEShape *elementChild, const std::string &newEdgeIDs)
change edge parents of a shape
Definition: GNEHierarchicalElementParents.cpp:340
GNEHierarchicalElementParents::ParentConnections::connectionPositions
std::vector< PositionVector > connectionPositions
Matrix with the Vertex's positions of connections between parents an their children.
Definition: GNEHierarchicalElementParents.h:163
GNEHierarchicalElementParents::~GNEHierarchicalElementParents
~GNEHierarchicalElementParents()
Destructor.
Definition: GNEHierarchicalElementParents.cpp:59
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNEAttributeCarrier
Definition: GNEAttributeCarrier.h:54
GNEHierarchicalElementParents::removeEdgeParent
void removeEdgeParent(GNEEdge *edge)
remove edge parent
Definition: GNEHierarchicalElementParents.cpp:134