Eclipse SUMO - Simulation of Urban MObility
GNEConnection.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2016-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 class for represent connections between Lanes
16 /****************************************************************************/
17 #ifndef GNEConnection_h
18 #define GNEConnection_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
25 #include "GNENetElement.h"
26 #include <netbuild/NBEdge.h>
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
31 class GNEEdge;
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
37 
38 class GNEConnection : public GNENetElement {
39 public:
45  GNEConnection(GNELane* from, GNELane* to);
46 
49 
51  std::string generateChildID(SumoXMLTag childTag);
52 
56  void updateGeometry();
57 
60 
62 
64  Boundary getBoundary() const;
65 
67  GNEEdge* getEdgeFrom() const;
68 
70  GNEEdge* getEdgeTo() const;
71 
73  GNELane* getLaneFrom() const;
74 
76  GNELane* getLaneTo() const;
77 
79  int getFromLaneIndex() const;
80 
82  int getToLaneIndex() const;
83 
86 
89 
91  LinkState getLinkState() const;
92 
94  const PositionVector& getShape() const;
95 
98 
100  void updateID();
101 
103  void updateLinkState();
104 
107 
115 
121 
126  void drawGL(const GUIVisualizationSettings& s) const;
128 
129  /* @brief method for setting the special color of the connection
130  * @param[in] color Pointer to new special color
131  */
132  void setSpecialColor(const RGBColor* Color2);
133 
136  /* @brief method for getting the Attribute of an XML key
137  * @param[in] key The attribute key
138  * @return string with the value associated to key
139  */
140  std::string getAttribute(SumoXMLAttr key) const;
141 
142  /* @brief method for setting the attribute and letting the object perform additional changes
143  * @param[in] key The attribute key
144  * @param[in] value The new value
145  * @param[in] undoList The undoList on which to register changes
146  */
147  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
148 
149  /* @brief method for checking if the key and their conrrespond attribute are valids
150  * @param[in] key The attribute key
151  * @param[in] value The value asociated to key key
152  * @return true if the value is valid, false in other case
153  */
154  bool isValid(SumoXMLAttr key, const std::string& value);
156 
159 
161  std::string getGenericParametersStr() const;
162 
164  std::vector<std::pair<std::string, std::string> > getGenericParameters() const;
165 
167  void setGenericParametersStr(const std::string& value);
168 
170 
171 protected:
174 
177 
180 
183 
186 
189 
190 private:
192  void setAttribute(SumoXMLAttr key, const std::string& value);
193 
195  GNEConnection(const GNEConnection&) = delete;
196 
198  GNEConnection& operator=(const GNEConnection&) = delete;
199 };
200 
201 
202 #endif
203 
204 /****************************************************************************/
205 
void updateGeometry()
update pre-computed geometry information
SumoXMLTag
Numbers representing SUMO-XML - element names.
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:184
bool isValid(SumoXMLAttr key, const std::string &value)
LinkState getLinkState() const
get LinkState
Stores the information about how to visualize structures.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNELane * myFromLane
incoming lane of this connection
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
void setSpecialColor(const RGBColor *Color2)
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
GNELane * getLaneFrom() const
get lane of the incoming lane
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
bool myShapeDeprecated
flag to indicate that connection&#39;s shape has to be updated
int getFromLaneIndex() const
get lane index of the incoming lane
int getToLaneIndex() const
get lane index of the outgoing lane
void updateID()
update internal ID of Connection
LinkState myLinkState
Linkstate.
GNEConnection(GNELane *from, GNELane *to)
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNELane * getLaneTo() const
get lane of the outgoing lane
A list of positions.
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
GNEConnection & operator=(const GNEConnection &)=delete
Invalidated assignment operator.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
Boundary getBoundary() const
Returns the street&#39;s geometry.
GNELane * myToLane
outgoing lane of this connection
~GNEConnection()
Destructor.
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
NBConnection getNBConnection() const
get NBConnection
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
PositionVector myInternalJunctionMarker
waiting position for internal junction
void markConnectionGeometryDeprecated()
check that connection&#39;s Geometry has to be updated
The popup menu of a globject.
std::string getAttribute(SumoXMLAttr key) const
void updateLinkState()
recompute cached myLinkState
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
const PositionVector & getShape() const
get Position vector calculated in updateGeometry()
std::string getGenericParametersStr() const
return generic parameters in string format
const RGBColor * mySpecialColor
optional special color
Position getPositionInView() const
Returns position of hierarchical element in view.
void setGenericParametersStr(const std::string &value)
set generic parameters in string format