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 /****************************************************************************/
14 // A class for represent connections between Lanes
15 /****************************************************************************/
16 #ifndef GNEConnection_h
17 #define GNEConnection_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
24 #include "GNENetElement.h"
25 
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  const PositionVector& getConnectionShape() const;
57 
59  void updateGeometry();
60 
63 
65 
67  Boundary getBoundary() const;
68 
70  GNEEdge* getEdgeFrom() const;
71 
73  GNEEdge* getEdgeTo() const;
74 
76  GNELane* getLaneFrom() const;
77 
79  GNELane* getLaneTo() const;
80 
82  int getFromLaneIndex() const;
83 
85  int getToLaneIndex() const;
86 
89 
92 
94  LinkState getLinkState() 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);
155 
156  /* @brief method for check if the value for certain attribute is set
157  * @param[in] key The attribute key
158  */
159  bool isAttributeEnabled(SumoXMLAttr key) const;
161 
162 protected:
165 
168 
171 
174 
177 
180 
183 
184 private:
186  void setAttribute(SumoXMLAttr key, const std::string& value);
187 
189  void changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList* undoList);
190 
192  GNEConnection(const GNEConnection&) = delete;
193 
195  GNEConnection& operator=(const GNEConnection&) = delete;
196 };
197 
198 
199 #endif
200 
201 /****************************************************************************/
202 
GNEConnection::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNEConnection.cpp:497
GNEConnection::mySpecialColor
const RGBColor * mySpecialColor
optional special color
Definition: GNEConnection.h:173
GNEConnection::changeTLIndex
void changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList *undoList)
manage change of tlLinkindices
Definition: GNEConnection.cpp:471
GNEConnection::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEConnection.cpp:85
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GNEConnection::getLinkState
LinkState getLinkState() const
get LinkState
Definition: GNEConnection.cpp:223
GNEConnection::myFromLane
GNELane * myFromLane
incoming lane of this connection
Definition: GNEConnection.h:164
GNEConnection::generateChildID
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNEConnection.cpp:68
GNEConnection::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNEConnection.cpp:429
GNEConnection::getEdgeTo
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
Definition: GNEConnection.cpp:172
PositionVector
A list of positions.
Definition: PositionVector.h:45
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GNEConnection::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEConnection.cpp:247
GNEConnection::getLaneFrom
GNELane * getLaneFrom() const
@briefthe get lane of the incoming lane
Definition: GNEConnection.cpp:178
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
RGBColor
Definition: RGBColor.h:39
LinkState
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
Definition: SUMOXMLDefinitions.h:1137
GNEConnection::setSpecialColor
void setSpecialColor(const RGBColor *Color2)
Definition: GNEConnection.cpp:361
GNEConnection::updateID
void updateID()
update internal ID of Connection
Definition: GNEConnection.cpp:217
GNEConnection::getLaneTo
GNELane * getLaneTo() const
@briefthe get lane of the outgoing lane
Definition: GNEConnection.cpp:184
GNEConnection::GNEConnection
GNEConnection(GNELane *from, GNELane *to)
Definition: GNEConnection.cpp:52
GNEConnection::operator=
GNEConnection & operator=(const GNEConnection &)=delete
Invalidated assignment operator.
GNEConnection::getEdgeFrom
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
Definition: GNEConnection.cpp:166
GNEConnection::getConnectionShape
const PositionVector & getConnectionShape() const
Definition: GNEConnection.cpp:75
GNEConnection::getToLaneIndex
int getToLaneIndex() const
@briefthe get lane index of the outgoing lane
Definition: GNEConnection.cpp:196
GNEConnection::getFromLaneIndex
int getFromLaneIndex() const
@briefthe get lane index of the incoming lane
Definition: GNEConnection.cpp:190
GNEConnection::getNBEdgeConnection
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
Definition: GNEConnection.cpp:202
GNEConnection::myShapeDeprecated
bool myShapeDeprecated
flag to indicate that connection's shape has to be updated
Definition: GNEConnection.h:179
GNENetElement.h
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNEConnection::getBoundary
Boundary getBoundary() const
Returns the street's geometry.
Definition: GNEConnection.cpp:153
GNEConnection::myToLane
GNELane * myToLane
outgoing lane of this connection
Definition: GNEConnection.h:167
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEConnection::myLinkState
LinkState myLinkState
Linkstate.
Definition: GNEConnection.h:170
GNEConnection::~GNEConnection
~GNEConnection()
Destructor.
Definition: GNEConnection.cpp:63
GNEGeometry::Geometry
struct for pack all variables related with geometry of stop
Definition: GNEGeometry.h:56
GNENetElement
Definition: GNENetElement.h:43
NBConnection
Definition: NBConnection.h:43
GNEConnection::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEConnection.cpp:552
GNEConnection::getNBConnection
NBConnection getNBConnection() const
get NBConnection
Definition: GNEConnection.cpp:208
GNEConnection::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEConnection.cpp:281
GUIMainWindow
Definition: GUIMainWindow.h:46
GNEConnection::myInternalJunctionMarker
PositionVector myInternalJunctionMarker
waiting position for internal junction
Definition: GNEConnection.h:182
GNEConnection::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEConnection.cpp:366
GNEConnection
Definition: GNEConnection.h:38
GNEConnection::updateLinkState
void updateLinkState()
recompute cached myLinkState
Definition: GNEConnection.cpp:235
GNEConnection::markConnectionGeometryDeprecated
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
Definition: GNEConnection.cpp:229
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
NBEdge::Connection
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:189
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNEConnection::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEConnection.cpp:273
GNEConnection::getPositionInView
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNEConnection.cpp:146
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
GNEConnection::myConnectionGeometry
GNEGeometry::Geometry myConnectionGeometry
connection geometry
Definition: GNEConnection.h:176
NBEdge.h