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 
181 private:
183  void setAttribute(SumoXMLAttr key, const std::string& value);
184 
187 
190 };
191 
192 
193 #endif
194 
195 /****************************************************************************/
196 
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:165
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
Boundary getBoundary() const
Returns the street&#39;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:54
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)
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
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.
void updateID()
update internal ID of Connection
std::vector< double > myShapeRotations
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:58
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
This functions has to be implemented in allGNEAttributeCarrier.
A window containing a gl-object&#39;s parameter.