Eclipse SUMO - Simulation of Urban MObility
GNEHierarchicalChildElements.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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A abstract class for representation of Hierarchical Elements
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
22 
24 
25 #include "GNEAttributeCarrier.h"
26 
27 // ===========================================================================
28 // class declarations
29 // ===========================================================================
30 
31 class GNEAdditional;
32 class GNETAZElement;
33 class GNEShape;
34 class GNEDemandElement;
35 class GNEGenericData;
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
40 
46 
47 public:
48 
50  friend class GNEChange_Children;
51 
64  const std::vector<GNEJunction*>& childJunctions,
65  const std::vector<GNEEdge*>& childEdges,
66  const std::vector<GNELane*>& childLanes,
67  const std::vector<GNEAdditional*>& childAdditionals,
68  const std::vector<GNEShape*>& childShapes,
69  const std::vector<GNETAZElement*>& childTAZElements,
70  const std::vector<GNEDemandElement*>& childDemandElements,
71  const std::vector<GNEGenericData*>& childGenericDataElements);
72 
75 
77  const Position& getChildPosition(const GNELane* lane);
78 
80  double getChildRotation(const GNELane* lane);
81 
84 
86  void drawChildConnections(const GUIVisualizationSettings& s, const GUIGlObjectType GLTypeParent, const double exaggeration) const;
87 
89  void drawChildDottedConnections(const GUIVisualizationSettings& s, const double exaggeration) const;
90 
94  virtual void updateGeometry() = 0;
95 
97  virtual Position getPositionInView() const = 0;
99 
101  template<typename T>
102  void addChildElement(T* element);
103 
105  template<typename T>
106  void removeChildElement(T* element);
107 
109  const std::vector<GNEEdge*>& getChildEdges() const;
110 
112  const std::vector<GNELane*>& getChildLanes() const;
113 
115  const std::vector<GNEAdditional*>& getChildAdditionals() const;
116 
118  const std::vector<GNEShape*>& getChildShapes() const;
119 
121  const std::vector<GNETAZElement*>& getChildTAZElements() const;
122 
124  const std::vector<GNEDemandElement*>& getChildDemandElements() const;
125 
127  const std::vector<GNEGenericData*>& getChildGenericDatas() const;
128 
130  void sortChildAdditionals();
131 
134 
136  const std::vector<GNEDemandElement*>& getChildDemandElementsByType(SumoXMLTag tag) const;
137 
140 
143 
146 
148  GNEDemandElement* getNextChildDemandElement(const GNEDemandElement* demandElement) const;
149 
151 
153  virtual void updateParentAdditional();
154 
156  virtual void updateParentDemandElement();
157 
158 protected:
159 
162 
163  private:
166 
167  public:
170 
172  const GNELane* getLane() const;
173 
175  const Position &getPosition() const;
176 
178  double getRotation() const;
179 
180  private:
183 
186 
188  double myRotation;
189 
192  };
193 
194  public:
196  ChildConnections(GNEHierarchicalChildElements* hierarchicalElement);
197 
199  void update();
200 
202  void drawConnection(const GUIVisualizationSettings& s, const GUIGlObjectType parentType, const double exaggeration) const;
203 
205  void drawDottedConnection(const GUIVisualizationSettings& s, const double exaggeration) const;
206 
208  std::vector<ConnectionGeometry> symbolsPositionAndRotation;
209 
211  std::vector<GNEGeometry::Geometry> connectionsGeometries;
212 
213  private:
216  };
217 
219  void changeChildEdges(GNEAdditional* elementChild, const std::string& newEdgeIDs);
220 
222  void changeChildLanes(GNEAdditional* elementChild, const std::string& newEdgeIDs);
223 
226 
227 private:
229  std::vector<GNEJunction*> myChildJunctions;
230 
232  std::vector<GNEEdge*> myChildEdges;
233 
235  std::vector<GNELane*> myChildLanes;
236 
238  std::vector<GNEAdditional*> myChildAdditionals;
239 
241  std::vector<GNEShape*> myChildShapes;
242 
244  std::vector<GNETAZElement*> myChildTAZElements;
245 
247  std::vector<GNEDemandElement*> myChildDemandElements;
248 
250  std::vector<GNEGenericData*> myChildGenericDataElements;
251 
253  std::map<SumoXMLTag, std::vector<GNEDemandElement* >> myDemandElementsByType;
254 
257 
260 
263 };
264 
void changeChildEdges(GNEAdditional *elementChild, const std::string &newEdgeIDs)
change child edges of an additional
const std::vector< GNEShape * > & getChildShapes() const
get child shapes
std::vector< GNEGeometry::Geometry > connectionsGeometries
geometry connections between parents an their children
SumoXMLTag
Numbers representing SUMO-XML - element names.
virtual Position getPositionInView() const =0
Returns position of hierarchical element in view.
GUIGlObjectType
const Position & getChildPosition(const GNELane *lane)
get child position calculated in ChildConnections
void updateChildConnections()
update child connections
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
void changeChildLanes(GNEAdditional *elementChild, const std::string &newEdgeIDs)
change child edges of an additional
virtual void updateGeometry()=0
bool checkChildAdditionalsOverlapping() const
check if children are overlapped (Used by Rerouters)
const GNEAttributeCarrier * myAC
pointer to AC (needed to avoid diamond problem)
Stores the information about how to visualize structures.
bool checkChildDemandElementsOverlapping() const
check if childs demand elements are overlapped
GNEHierarchicalChildElements * myHierarchicalElement
pointer to hierarchical element parent
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNETAZElement.h:46
ChildConnections myChildConnections
variable ChildConnections
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
std::vector< GNEGenericData * > myChildGenericDataElements
vector with the generic data elements children
std::vector< GNELane * > myChildLanes
vector with the child lanes
void drawDottedConnection(const GUIVisualizationSettings &s, const double exaggeration) const
draw dotted connections between Parent and childrens
void drawChildDottedConnections(const GUIVisualizationSettings &s, const double exaggeration) const
Draw dotted connections between parent and children.
std::vector< ConnectionGeometry > symbolsPositionAndRotation
position and rotation of every symbol over lane
virtual void updateParentAdditional()
update parent after add or remove a child (can be reimplemented, for example used for statistics) ...
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
class to pack all variables and functions relative to connections between hierarchical element and th...
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
const std::vector< GNEDemandElement * > & getChildDemandElementsByType(SumoXMLTag tag) const
return child demand elements by type
ChildConnections(GNEHierarchicalChildElements *hierarchicalElement)
constructor
virtual void updateParentDemandElement()
update parent after add or remove a child (can be reimplemented, for example used for statistics) ...
const std::vector< GNEEdge * > & getChildEdges() const
get child edges
GNEHierarchicalChildElements(const GNEAttributeCarrier *AC, const std::vector< GNEJunction *> &childJunctions, const std::vector< GNEEdge *> &childEdges, const std::vector< GNELane *> &childLanes, const std::vector< GNEAdditional *> &childAdditionals, const std::vector< GNEShape *> &childShapes, const std::vector< GNETAZElement *> &childTAZElements, const std::vector< GNEDemandElement *> &childDemandElements, const std::vector< GNEGenericData *> &childGenericDataElements)
Parameter Constructor.
std::map< SumoXMLTag, std::vector< GNEDemandElement *> > myDemandElementsByType
vector with the demand elements children sorted by type and filtered (to avoid duplicated ...
void addChildElement(T *element)
add child
std::vector< GNEAdditional * > myChildAdditionals
vector with the child additionas
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
void drawChildConnections(const GUIVisualizationSettings &s, const GUIGlObjectType GLTypeParent, const double exaggeration) const
Draw connections between parent and children.
void sortChildAdditionals()
sort child additionals (used by Rerouters, VSS, TAZs...)
const std::vector< GNETAZElement * > & getChildTAZElements() const
get child TAZElements
GNEHierarchicalChildElements & operator=(const GNEHierarchicalChildElements &)=delete
Invalidated assignment operator.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
std::vector< GNEShape * > myChildShapes
vector with the child lanes
std::vector< GNETAZElement * > myChildTAZElements
vector with the child TAZ Elements
double getChildRotation(const GNELane *lane)
get child rotation calculated in ChildConnections
void drawConnection(const GUIVisualizationSettings &s, const GUIGlObjectType parentType, const double exaggeration) const
draw connections between Parent and childrens
GNEDemandElement * getPreviousChildDemandElement(const GNEDemandElement *demandElement) const
get previous child demand element to the given demand element
void sortChildDemandElements()
sort child demand elements
std::vector< GNEJunction * > myChildJunctions
vector with the child junctions
std::vector< GNEDemandElement * > myChildDemandElements
vector with the demand elements children
void removeChildElement(T *element)
remove child
const std::vector< GNELane * > & getChildLanes() const
get child lanes
An special type of Attribute carrier that owns hierarchical elements.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
GNEDemandElement * getNextChildDemandElement(const GNEDemandElement *demandElement) const
get next child demand element to the given demand element
std::vector< GNEEdge * > myChildEdges
vector with the child edges