Eclipse SUMO - Simulation of Urban MObility
GNEHierarchicalElementChildren.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 GNEHierarchicalElementChildren_h
18 #define GNEHierarchicalElementChildren_h
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include <config.h>
25 
27 
28 #include "GNEAttributeCarrier.h"
29 
30 // ===========================================================================
31 // class declarations
32 // ===========================================================================
33 
34 class GNEAdditional;
35 class GNEDemandElement;
36 class GNEShape;
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
41 
47 
48 public:
49 
51  friend class GNEChange_Children;
52 
61  const std::vector<GNEEdge*>& edgeChildren,
62  const std::vector<GNELane*>& laneChildren,
63  const std::vector<GNEShape*>& shapeChildren,
64  const std::vector<GNEAdditional*>& additionalChildren,
65  const std::vector<GNEDemandElement*>& demandElementChildren);
66 
69 
71  const Position& getChildPosition(const GNELane* lane);
72 
74  double getChildRotation(const GNELane* lane);
75 
78 
79  // Draw connections between parent and children
80  void drawChildConnections(const GUIVisualizationSettings& s, const GUIGlObjectType GLTypeParent) const;
81 
83  virtual std::string generateChildID(SumoXMLTag childTag) = 0;
84 
88  virtual void updateGeometry() = 0;
89 
91  virtual Position getPositionInView() const = 0;
93 
97  void addEdgeChild(GNEEdge* edge);
98 
100  void removeEdgeChild(GNEEdge* edge);
101 
103  const std::vector<GNEEdge*>& getEdgeChildren() const;
104 
106 
110  void addLaneChild(GNELane* lane);
111 
113  void removeLaneChild(GNELane* lane);
114 
116  const std::vector<GNELane*>& getLaneChildren() const;
117 
119 
123  void addShapeChild(GNEShape* shape);
124 
126  void removeShapeChild(GNEShape* shape);
127 
129  const std::vector<GNEShape*>& getShapeChildren() const;
130 
132 
136  void addAdditionalChild(GNEAdditional* additional);
137 
139  void removeAdditionalChild(GNEAdditional* additional);
140 
142  const std::vector<GNEAdditional*>& getAdditionalChildren() const;
143 
145  void sortAdditionalChildren();
146 
149 
151 
155  void addDemandElementChild(GNEDemandElement* demandElement);
156 
158  void removeDemandElementChild(GNEDemandElement* demandElement);
159 
161  const std::vector<GNEDemandElement*>& getDemandElementChildren() const;
162 
164  const std::set<GNEDemandElement*>& getSortedDemandElementChildrenByType(SumoXMLTag tag) const;
165 
168 
171 
173  GNEDemandElement* getPreviousemandElement(const GNEDemandElement* demandElement) const;
174 
176  GNEDemandElement* getNextDemandElement(const GNEDemandElement* demandElement) const;
177 
179 
181  virtual void updateAdditionalParent();
182 
184  virtual void updateDemandElementParent();
185 
186 protected:
187 
190 
191  private:
196 
198  ConnectionGeometry(GNELane* _lane, Position _pos, double _rot);
199 
202 
205 
207  double rot;
208  };
209 
210  public:
212  ChildConnections(GNEHierarchicalElementChildren* hierarchicalElement);
213 
215  void update();
216 
218  void draw(const GUIVisualizationSettings& s, const GUIGlObjectType parentType) const;
219 
221  std::vector<ConnectionGeometry> symbolsPositionAndRotation;
222 
224  std::vector<PositionVector> connectionPositions;
225 
226  private:
229  };
230 
232  void changeEdgeChildren(GNEAdditional* elementChild, const std::string& newEdgeIDs);
233 
235  void changeLaneChildren(GNEAdditional* elementChild, const std::string& newEdgeIDs);
236 
239 
240 private:
242  std::vector<GNEEdge*> myEdgeChildren;
243 
245  std::vector<GNELane*> myLaneChildren;
246 
248  std::vector<GNEShape*> myShapeChildren;
249 
251  std::vector<GNEAdditional*> myAdditionalChildren;
252 
254  std::vector<GNEDemandElement*> myDemandElementChildren;
255 
257  std::map<SumoXMLTag, std::set<GNEDemandElement*> > mySortedDemandElementChildrenByType;
258 
261 
264 
267 };
268 
269 #endif
void sortAdditionalChildren()
sort children (used by Rerouters, VSS, TAZs...)
An special type of Attribute carrier that owns hierarchical elements.
SumoXMLTag
Numbers representing SUMO-XML - element names.
const Position & getChildPosition(const GNELane *lane)
get child position calculated in ChildConnections
GUIGlObjectType
void removeEdgeChild(GNEEdge *edge)
remove edge child
virtual void updateDemandElementParent()
update parent after add or remove a child (can be reimplemented, for example used for statistics) ...
std::vector< GNEDemandElement * > myDemandElementChildren
vector with the demand elements children
void updateChildConnections()
update child connections
void removeDemandElementChild(GNEDemandElement *demandElement)
remove demand element child from this demand element
Stores the information about how to visualize structures.
const std::vector< GNEEdge * > & getEdgeChildren() const
get edge chidls
GNEAttributeCarrier * myAC
pointer to AC (needed to avoid diamond problem)
void removeShapeChild(GNEShape *shape)
remove shape child
const std::vector< GNELane * > & getLaneChildren() const
get lanes of VSS
void changeLaneChildren(GNEAdditional *elementChild, const std::string &newEdgeIDs)
change edge children of an additional
GNEHierarchicalElementChildren & operator=(const GNEHierarchicalElementChildren &)=delete
Invalidated assignment operator.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
double getChildRotation(const GNELane *lane)
get child rotation calculated in ChildConnections
void draw(const GUIVisualizationSettings &s, const GUIGlObjectType parentType) const
draw connections between Parent and childrens
const std::vector< GNEAdditional * > & getAdditionalChildren() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
GNEDemandElement * getPreviousemandElement(const GNEDemandElement *demandElement) const
get previous demand element to the given demand element
virtual Position getPositionInView() const =0
Returns position of hierarchical element in view.
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
const std::vector< GNEShape * > & getShapeChildren() const
get shapes of VSS
ChildConnections myChildConnections
variable ChildConnections
void sortDemandElementChildren()
sort children (used by Rerouters, VSS, TAZs...)
virtual void updateAdditionalParent()
update parent after add or remove a child (can be reimplemented, for example used for statistics) ...
virtual std::string generateChildID(SumoXMLTag childTag)=0
gererate a new ID for an element child
bool checkDemandElementChildrenOverlapping() const
check if children are overlapped (Used by Rerouters)
std::vector< GNEEdge * > myEdgeChildren
vector with the edge children of this element
const std::set< GNEDemandElement * > & getSortedDemandElementChildrenByType(SumoXMLTag tag) const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
virtual void updateGeometry()=0
struct for pack all variables and functions relative to connections between hierarchical element and ...
ChildConnections(GNEHierarchicalElementChildren *hierarchicalElement)
constructor
void addAdditionalChild(GNEAdditional *additional)
std::vector< GNEAdditional * > myAdditionalChildren
vector with the additional children
std::vector< GNELane * > myLaneChildren
vector with the lane children of this element
std::vector< ConnectionGeometry > symbolsPositionAndRotation
position and rotation of every symbol over lane
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
void addDemandElementChild(GNEDemandElement *demandElement)
GNEDemandElement * getNextDemandElement(const GNEDemandElement *demandElement) const
get next demand element to the given demand element
std::vector< PositionVector > connectionPositions
Matrix with the Vertex&#39;s positions of connections between parents an their children.
std::map< SumoXMLTag, std::set< GNEDemandElement * > > mySortedDemandElementChildrenByType
vector with the demand elements children sorted by type and filtered (to avoid duplicated ...
void drawChildConnections(const GUIVisualizationSettings &s, const GUIGlObjectType GLTypeParent) const
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
std::vector< GNEShape * > myShapeChildren
vector with the lane children of this element
GNEHierarchicalElementChildren(GNEAttributeCarrier *AC, const std::vector< GNEEdge *> &edgeChildren, const std::vector< GNELane *> &laneChildren, const std::vector< GNEShape *> &shapeChildren, const std::vector< GNEAdditional *> &additionalChildren, const std::vector< GNEDemandElement *> &demandElementChildren)
Parameter Constructor.
void removeLaneChild(GNELane *lane)
remove lane child
GNEHierarchicalElementChildren * myHierarchicalElement
pointer to hierarchical element parent
void changeEdgeChildren(GNEAdditional *elementChild, const std::string &newEdgeIDs)
change edge children of an additional
bool checkAdditionalChildrenOverlapping() const
check if children are overlapped (Used by Rerouters)
void removeAdditionalChild(GNEAdditional *additional)
remove additional child from this additional
An Element which don&#39;t belongs to GNENet but has influency in the simulation.