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) 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:
59  GNEConnection(GNEEdge &from, int fromLane, GNEEdge &to, int toLane, bool pass, bool keepClear, SUMOReal contPos, bool uncontrolled, int tlIndex = NBConnection::InvalidTlIndex);
60 
63 
66  void updateGeometry();
67 
69  Boundary getBoundary() const;
70 
72  GNEEdge &getEdgeFrom() const;
73 
75  GNEEdge &getEdgeTo() const;
76 
78  GNELane* getFromLane() const;
79 
81  GNELane* getToLane() const;
82 
84  int getFromLaneIndex() const;
85 
87  int getToLaneIndex() const;
88 
90  bool getPass();
91 
93  bool getKeepClear();
94 
97 
99  bool getUncontrolled();
100 
102  const NBConnection &getNBConnection() const;
103 
106 
108  void setPass(bool pass);
109 
111  void setKeepClear(bool keepClear);
112 
114  void setContPos(SUMOReal contPos);
115 
117  void setUncontrolled(bool uncontrolled);
118 
121 
129 
138 
144 
149  void drawGL(const GUIVisualizationSettings& s) const;
151 
154  /* @brief method for getting the Attribute of an XML key
155  * @param[in] key The attribute key
156  * @return string with the value associated to key
157  */
158  std::string getAttribute(SumoXMLAttr key) const;
159 
160  /* @brief method for setting the attribute and letting the object perform additional changes
161  * @param[in] key The attribute key
162  * @param[in] value The new value
163  * @param[in] undoList The undoList on which to register changes
164  */
165  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
166 
167  /* @brief method for checking if the key and their conrrespond attribute are valids
168  * @param[in] key The attribute key
169  * @param[in] value The value asociated to key key
170  * @return true if the value is valid, false in other case
171  */
172  bool isValid(SumoXMLAttr key, const std::string& value);
174 
175 protected:
178 
181 
184 
187 
190 
192  bool myPass;
193 
196 
199 
202 
205 
209  std::vector<SUMOReal> myShapeRotations;
210 
212  std::vector<SUMOReal> myShapeLengths;
214 
215 private:
217  void setAttribute(SumoXMLAttr key, const std::string& value);
218 
221 
224 };
225 
226 
227 #endif
228 
229 /****************************************************************************/
230 
GNEEdge & getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
void updateGeometry()
update pre-computed geometry information
void setKeepClear(bool keepClear)
set parameter keepClear
const NBEdge::Connection & getNBEdgeConnection() const
get Edge::NBConnection
GNELane * getToLane() const
get lane of the outgoing lane
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:150
GNEEdge & myFromEdge
incoming edge of this connection
int getFromLaneIndex() const
get lane index of the incoming lane
bool isValid(SumoXMLAttr key, const std::string &value)
NBConnection myNBConnection
NBConnection associated with this connection.
int getToLaneIndex() const
get lane index of the outgoing lane
GNEEdge & myToEdge
outcoming edge of this connection
Boundary getBoundary() const
Returns the street&#39;s geometry.
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
bool getKeepClear()
get parameter keepClear
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
std::vector< SUMOReal > myShapeRotations
bool myPass
if set, vehicles which pass this (lane-2-lane) connection) will not wait
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
std::vector< SUMOReal > myShapeLengths
The lengths of the shape parts.
PositionVector myShape
the shape of the edge
static const int InvalidTlIndex
Definition: NBConnection.h:127
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
bool getPass()
get parameter pass
NBNode * myJunction
junction in which this connection is placed
A list of positions.
bool myKeepClear
if set to false, vehicles which pass this (lane-2-lane) connection) will not worry about blocking the...
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
~GNEConnection()
Destructor.
GNEConnection(GNEEdge &from, int fromLane, GNEEdge &to, int toLane, bool pass, bool keepClear, SUMOReal contPos, bool uncontrolled, int tlIndex=NBConnection::InvalidTlIndex)
Constructor.
GNEConnection & operator=(const GNEConnection &)
Invalidated assignment operator.
SUMOReal myContPos
if set to 0, no internal junction will be built for this connection. If set to a positive value...
GNELane * getFromLane() const
get lane of the incoming lane
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:54
NBEdge::Connection myConnection
NBEdge::Connection associated with this connection.
void setUncontrolled(bool uncontrolled)
set parameter uncontrolled
void setPass(bool pass)
set parameter pass
The popup menu of a globject.
void setContPos(SUMOReal contPos)
set parameter ContPos
SUMOReal getContPos()
get parameter ContPos
Represents a single node (junction) during network building.
Definition: NBNode.h:74
#define SUMOReal
Definition: config.h:213
bool getUncontrolled()
get parameter uncontrolled
const NBConnection & getNBConnection() const
get NBConnection
std::string getAttribute(SumoXMLAttr key) const
A window containing a gl-object&#39;s parameter.
GNEEdge & getEdgeFrom() const
get the name of the edge the vehicles leave
bool myUncontrolled
if set to true, This connection will not be TLS-controlled despite its node being controlled...