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 
GNEConnection::getGenericParametersStr
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNEConnection.cpp:507
GNEConnection::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
Definition: GNEConnection.cpp:458
GNEConnection::mySpecialColor
const RGBColor * mySpecialColor
optional special color
Definition: GNEConnection.h:182
GNEConnection::setGenericParametersStr
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEConnection.cpp:533
GNEConnection::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEConnection.cpp:76
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
GNEConnection::getLinkState
LinkState getLinkState() const
get LinkState
Definition: GNEConnection.cpp:217
GNEConnection::myFromLane
GNELane * myFromLane
incoming lane of this connection
Definition: GNEConnection.h:173
GNEConnection::generateChildID
std::string generateChildID(SumoXMLTag childTag)
gererate a new ID for an element child
Definition: GNEConnection.cpp:69
GNEConnection::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
Definition: GNEConnection.cpp:403
GNEConnection::getEdgeTo
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
Definition: GNEConnection.cpp:167
PositionVector
A list of positions.
Definition: PositionVector.h:46
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:48
GNEConnection::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEConnection.cpp:251
GNEConnection::getLaneFrom
GNELane * getLaneFrom() const
@briefthe get lane of the incoming lane
Definition: GNEConnection.cpp:173
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
RGBColor
Definition: RGBColor.h:40
LinkState
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
Definition: SUMOXMLDefinitions.h:1132
GNEConnection::setSpecialColor
void setSpecialColor(const RGBColor *Color2)
Definition: GNEConnection.cpp:349
GNEConnection::updateID
void updateID()
update internal ID of Connection
Definition: GNEConnection.cpp:211
GNEConnection::getLaneTo
GNELane * getLaneTo() const
@briefthe get lane of the outgoing lane
Definition: GNEConnection.cpp:179
GNEConnection::GNEConnection
GNEConnection(GNELane *from, GNELane *to)
Definition: GNEConnection.cpp:53
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:161
GNEConnection::getToLaneIndex
int getToLaneIndex() const
@briefthe get lane index of the outgoing lane
Definition: GNEConnection.cpp:191
GNEConnection::getFromLaneIndex
int getFromLaneIndex() const
@briefthe get lane index of the incoming lane
Definition: GNEConnection.cpp:185
GNEConnection::getNBEdgeConnection
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
Definition: GNEConnection.cpp:197
GNEConnection::myShapeDeprecated
bool myShapeDeprecated
flag to indicate that connection's shape has to be updated
Definition: GNEConnection.h:185
GNENetElement.h
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GNEConnection::getBoundary
Boundary getBoundary() const
Returns the street's geometry.
Definition: GNEConnection.cpp:148
GNEConnection::myToLane
GNELane * myToLane
outgoing lane of this connection
Definition: GNEConnection.h:176
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNEConnection::myLinkState
LinkState myLinkState
Linkstate.
Definition: GNEConnection.h:179
GNEConnection::~GNEConnection
~GNEConnection()
Destructor.
Definition: GNEConnection.cpp:64
GNENetElement
Definition: GNENetElement.h:42
NBConnection
Definition: NBConnection.h:44
GNEConnection::getNBConnection
NBConnection getNBConnection() const
get NBConnection
Definition: GNEConnection.cpp:203
GNEConnection::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEConnection.cpp:282
GUIMainWindow
Definition: GUIMainWindow.h:47
GNEConnection::myInternalJunctionMarker
PositionVector myInternalJunctionMarker
waiting position for internal junction
Definition: GNEConnection.h:188
GNEConnection::getGenericParameters
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEConnection.cpp:522
GNEConnection::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEConnection.cpp:354
GNEConnection
Definition: GNEConnection.h:38
GNEConnection::updateLinkState
void updateLinkState()
recompute cached myLinkState
Definition: GNEConnection.cpp:239
GNEConnection::markConnectionGeometryDeprecated
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
Definition: GNEConnection.cpp:233
GNEUndoList
Definition: GNEUndoList.h:49
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
NBEdge::Connection
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:184
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
GNEConnection::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEConnection.cpp:274
GNEConnection::getPositionInView
Position getPositionInView() const
Returns position of hierarchical element in view.
Definition: GNEConnection.cpp:141
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
GNEConnection::getShape
const PositionVector & getShape() const
get Position vector calculated in updateGeometry()
Definition: GNEConnection.cpp:223
NBEdge.h