SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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) 2001-2016 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  bool getDrawConnection() const;
90 
92  LinkState getLinkState() const;
93 
95  void updateLinkState();
96 
98  void setDrawConnection(bool drawConnection);
99 
102 
110 
119 
125 
130  void drawGL(const GUIVisualizationSettings& s) const;
132 
135  /* @brief method for getting the Attribute of an XML key
136  * @param[in] key The attribute key
137  * @return string with the value associated to key
138  */
139  std::string getAttribute(SumoXMLAttr key) const;
140 
141  /* @brief method for setting the attribute and letting the object perform additional changes
142  * @param[in] key The attribute key
143  * @param[in] value The new value
144  * @param[in] undoList The undoList on which to register changes
145  */
146  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
147 
148  /* @brief method for checking if the key and their conrrespond attribute are valids
149  * @param[in] key The attribute key
150  * @param[in] value The value asociated to key key
151  * @return true if the value is valid, false in other case
152  */
153  bool isValid(SumoXMLAttr key, const std::string& value);
155 
156 protected:
159 
162 
165 
169  std::vector<SUMOReal> myShapeRotations;
170 
172  std::vector<SUMOReal> myShapeLengths;
174 
178 
181 
182 private:
184  void setAttribute(SumoXMLAttr key, const std::string& value);
185 
188 
191 };
192 
193 
194 #endif
195 
196 /****************************************************************************/
197 
void updateGeometry()
update pre-computed geometry information
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:157
int getFromLaneIndex() const
get lane index of the incoming lane
bool isValid(SumoXMLAttr key, const std::string &value)
int getToLaneIndex() const
get lane index of the outgoing lane
bool myDrawConnection
Enable or disable draw connection.
Boundary getBoundary() const
Returns the street's geometry.
void setDrawConnection(bool drawConnection)
enable or disable draw connection
Stores the information about how to visualize structures.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:55
GNELane * myFromLane
incoming lane of this connection
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
std::vector< SUMOReal > myShapeRotations
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
GNELane * getLaneFrom() const
get lane of the incoming lane
NBConnection getNBConnection() const
get NBConnection
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
PositionVector myShape
the shape of the connection
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
LinkState myLinkState
Linkstate.
GNEConnection(GNELane *from, GNELane *to)
A list of positions.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
LinkState getLinkState() const
get LinkState
GNELane * myToLane
outgoing lane of this connection
~GNEConnection()
Destructor.
GNEConnection & operator=(const GNEConnection &)
Invalidated assignment operator.
bool getDrawConnection() const
get Draw connection
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:55
The popup menu of a globject.
GNELane * getLaneTo() const
get lane of the outgoing lane
void updateLinkState()
recompute cached myLinkState
std::string getAttribute(SumoXMLAttr key) const
A window containing a gl-object's parameter.