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
void removeEdgeParent(GNEEdge *edge)
remove edge parent
struct for pack all variables and functions relative to connections between hierarchical element and ...
GUIGlObjectType
void addDemandElementParent(GNEDemandElement *demandElement)
std::vector< GNEAdditional * > myAdditionalParents
list of additional parents of this element
Stores the information about how to visualize structures.
void changeAdditionalParent(GNEShape *shapeTobeChanged, const std::string &newAdditionalParentID, int additionalParentIndex)
change additional parent of a shape
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNEHierarchicalElementParents & operator=(const GNEHierarchicalElementParents &)=delete
Invalidated assignment operator.
void removeShapeParent(GNEShape *shape)
remove shape parent
void draw(const GUIVisualizationSettings &s, const GUIGlObjectType parentType) const
draw connections between Parent and childrens
ParentConnections myParentConnections
variable ParentConnections
GNEHierarchicalElementParents * myHierarchicalElement
pointer to hierarchical element parent
const std::vector< GNEEdge * > & getEdgeParents() const
get edge parents
const std::vector< GNEShape * > & getShapeParents() const
get shapes of VSS
An special type of Attribute carrier that owns hierarchical elements.
std::vector< GNELane * > myLaneParents
list of lane parents of this element
void addAdditionalParent(GNEAdditional *additional)
virtual Position getPositionInView() const =0
Returns position of hierarchical element in view.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
std::vector< std::pair< Position, double > > symbolsPositionAndRotation
position and rotation of every symbol over lane
void changeDemandElementParent(GNEShape *shapeTobeChanged, const std::string &newDemandElementParentID, int demandElementParentIndex)
change first demand element parent of a shape
const std::vector< GNELane * > & getLaneParents() const
get lanes of VSS
const std::vector< GNEAdditional * > & getAdditionalParents() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
void removeLaneParent(GNELane *lane)
remove lane parent
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.
ParentConnections(GNEHierarchicalElementParents *hierarchicalElement)
constructor
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
const std::vector< GNEDemandElement * > & getDemandElementParents() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
void changeLaneParents(GNEShape *elementChild, const std::string &newLaneIDs)
change edge parents of a shape
std::vector< GNEShape * > myShapeParents
list of shape parents of this element
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
std::vector< GNEDemandElement * > myDemandElementParents
list of demand elements parents of this element
void changeEdgeParents(GNEShape *elementChild, const std::string &newEdgeIDs)
change edge parents of a shape
void removeAdditionalParent(GNEAdditional *additional)
remove additional parent from this additional
virtual void updateGeometry()=0
std::vector< GNEEdge * > myEdgeParents
list of edge parents of this element
std::vector< PositionVector > connectionPositions
Matrix with the Vertex&#39;s positions of connections between parents an their children.
void removeDemandElementParent(GNEDemandElement *demandElement)
remove demand element parent from this demand element
GNEAttributeCarrier * myAC
pointer to AC (needed to avoid diamond problem)
An Element which don&#39;t belongs to GNENet but has influency in the simulation.