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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
17 // A class for represent connections between Lanes
18 /****************************************************************************/
19 #ifndef GNEConnection_h
20 #define GNEConnection_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #include "GNENetElement.h"
33 
34 // ===========================================================================
35 // class declarations
36 // ===========================================================================
37 class GNEEdge;
38 
39 
40 // ===========================================================================
41 // class definitions
42 // ===========================================================================
43 
44 class GNEConnection : public GNENetElement {
45 public:
51  GNEConnection(GNELane* from, GNELane* to);
52 
55 
58  void updateGeometry();
59 
61  Boundary getBoundary() const;
62 
64  GNEEdge* getEdgeFrom() const;
65 
67  GNEEdge* getEdgeTo() const;
68 
70  GNELane* getLaneFrom() const;
71 
73  GNELane* getLaneTo() const;
74 
76  int getFromLaneIndex() const;
77 
79  int getToLaneIndex() const;
80 
83 
86 
88  LinkState getLinkState() const;
89 
91  PositionVector getShape() const;
92 
94  void updateID();
95 
97  void updateLinkState();
98 
101 
109 
115 
120  void drawGL(const GUIVisualizationSettings& s) const;
122 
125  /* @brief method for getting the Attribute of an XML key
126  * @param[in] key The attribute key
127  * @return string with the value associated to key
128  */
129  std::string getAttribute(SumoXMLAttr key) const;
130 
131  /* @brief method for setting the attribute and letting the object perform additional changes
132  * @param[in] key The attribute key
133  * @param[in] value The new value
134  * @param[in] undoList The undoList on which to register changes
135  */
136  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
137 
138  /* @brief method for checking if the key and their conrrespond attribute are valids
139  * @param[in] key The attribute key
140  * @param[in] value The value asociated to key key
141  * @return true if the value is valid, false in other case
142  */
143  bool isValid(SumoXMLAttr key, const std::string& value);
145 
146 protected:
149 
152 
155 
159  std::vector<double> myShapeRotations;
160 
162  std::vector<double> myShapeLengths;
163 
167 
170 
171 private:
173  void setAttribute(SumoXMLAttr key, const std::string& value);
174 
176  GNEConnection(const GNEConnection&) = delete;
177 
179  GNEConnection& operator=(const GNEConnection&) = delete;
180 };
181 
182 
183 #endif
184 
185 /****************************************************************************/
186 
void updateGeometry()
update pre-computed geometry information
PositionVector getShape() const
get Position vector calculated in updateGeometry()
std::vector< double > myShapeLengths
The lengths of the shape parts.
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:161
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:53
GNELane * myFromLane
incoming lane of this connection
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:47
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
int getFromLaneIndex() const
get lane index of the incoming lane
int getToLaneIndex() const
get lane index of the outgoing lane
PositionVector myShape
the shape of the connection
void updateID()
update internal ID of Connection
std::vector< double > myShapeRotations
LinkState myLinkState
Linkstate.
GNEConnection(GNELane *from, GNELane *to)
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.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:56
NBConnection getNBConnection() const
get NBConnection
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
PositionVector myInternalJunctionMarker
waiting position for internal junction
The popup menu of a globject.
std::string getAttribute(SumoXMLAttr key) const
This functions has to be implemented in all GNEAttributeCarriers.
void updateLinkState()
recompute cached myLinkState
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.