SUMO - Simulation of Urban MObility
GNEConnection.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // A class for represent connections between Lanes
8 /****************************************************************************/
9 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
10 // Copyright (C) 2016-2017 DLR (http://www.dlr.de/) and contributors
11 /****************************************************************************/
12 //
13 // This file is part of SUMO.
14 // SUMO is free software: you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation, either version 3 of the License, or
17 // (at your option) any later version.
18 //
19 /****************************************************************************/
20 #ifndef GNEConnection_h
21 #define GNEConnection_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include "GNENetElement.h"
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 class GNEEdge;
39 
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
44 
45 class GNEConnection : public GNENetElement {
46 public:
52  GNEConnection(GNELane* from, GNELane* to);
53 
56 
59  void updateGeometry();
60 
62  Boundary getBoundary() const;
63 
65  GNEEdge* getEdgeFrom() const;
66 
68  GNEEdge* getEdgeTo() const;
69 
71  GNELane* getLaneFrom() const;
72 
74  GNELane* getLaneTo() const;
75 
77  int getFromLaneIndex() const;
78 
80  int getToLaneIndex() const;
81 
84 
87 
89  LinkState getLinkState() const;
90 
92  void updateID();
93 
95  void updateLinkState();
96 
98  bool getDrawConnection() const;
99 
101  void setDrawConnection(bool drawConnection);
102 
105 
113 
122 
128 
133  void drawGL(const GUIVisualizationSettings& s) const;
135 
138  /* @brief method for getting the Attribute of an XML key
139  * @param[in] key The attribute key
140  * @return string with the value associated to key
141  */
142  std::string getAttribute(SumoXMLAttr key) const;
143 
144  /* @brief method for setting the attribute and letting the object perform additional changes
145  * @param[in] key The attribute key
146  * @param[in] value The new value
147  * @param[in] undoList The undoList on which to register changes
148  */
149  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
150 
151  /* @brief method for checking if the key and their conrrespond attribute are valids
152  * @param[in] key The attribute key
153  * @param[in] value The value asociated to key key
154  * @return true if the value is valid, false in other case
155  */
156  bool isValid(SumoXMLAttr key, const std::string& value);
158 
159 protected:
162 
165 
168 
172  std::vector<double> myShapeRotations;
173 
175  std::vector<double> myShapeLengths;
177 
180 
184 
185 private:
187  void setAttribute(SumoXMLAttr key, const std::string& value);
188 
191 
194 };
195 
196 
197 #endif
198 
199 /****************************************************************************/
200 
void updateGeometry()
update pre-computed geometry information
std::vector< double > myShapeLengths
The lengths of the shape parts.
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:164
bool isValid(SumoXMLAttr key, const std::string &value)
bool myDrawConnection
Enable or disable draw connection.
LinkState getLinkState() const
get LinkState
void setDrawConnection(bool drawConnection)
enable or disable draw connection
Stores the information about how to visualize structures.
bool getDrawConnection() const
get Draw connection
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:54
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:48
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
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
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
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.
GNEConnection & operator=(const GNEConnection &)
Invalidated assignment operator.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:57
NBConnection getNBConnection() const
get NBConnection
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
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.
A window containing a gl-object&#39;s parameter.