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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A class for represent connections between Lanes
16 /****************************************************************************/
17 #ifndef GNEConnection_h
18 #define GNEConnection_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
25 #include "GNENetElement.h"
26 #include <netbuild/NBEdge.h>
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
31 class GNEEdge;
32 
33 
34 // ===========================================================================
35 // class definitions
36 // ===========================================================================
37 
38 class GNEConnection : public GNENetElement {
39 public:
45  GNEConnection(GNELane* from, GNELane* to);
46 
49 
52  void updateGeometry(bool updateGrid);
53 
55  Boundary getBoundary() const;
56 
58  GNEEdge* getEdgeFrom() const;
59 
61  GNEEdge* getEdgeTo() const;
62 
64  GNELane* getLaneFrom() const;
65 
67  GNELane* getLaneTo() const;
68 
70  int getFromLaneIndex() const;
71 
73  int getToLaneIndex() const;
74 
77 
80 
82  LinkState getLinkState() const;
83 
85  const PositionVector& getShape() const;
86 
89 
91  void updateID();
92 
94  void updateLinkState();
95 
98 
106 
112 
117  void drawGL(const GUIVisualizationSettings& s) const;
119 
120  /* @brief method for setting the special color of the connection
121  * @param[in] color Pointer to new special color
122  */
123  void setSpecialColor(const RGBColor* Color2);
124 
127  /* @brief method for getting the Attribute of an XML key
128  * @param[in] key The attribute key
129  * @return string with the value associated to key
130  */
131  std::string getAttribute(SumoXMLAttr key) const;
132 
133  /* @brief method for setting the attribute and letting the object perform additional changes
134  * @param[in] key The attribute key
135  * @param[in] value The new value
136  * @param[in] undoList The undoList on which to register changes
137  */
138  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
139 
140  /* @brief method for checking if the key and their conrrespond attribute are valids
141  * @param[in] key The attribute key
142  * @param[in] value The value asociated to key key
143  * @return true if the value is valid, false in other case
144  */
145  bool isValid(SumoXMLAttr key, const std::string& value);
147 
150 
152  std::string getGenericParametersStr() const;
153 
155  std::vector<std::pair<std::string, std::string> > getGenericParameters() const;
156 
158  void setGenericParametersStr(const std::string& value);
159 
161 
162 protected:
165 
168 
171 
174 
177 
180 
184  std::vector<double> myShapeRotations;
185 
187  std::vector<double> myShapeLengths;
188 
192 
193 private:
195  void setAttribute(SumoXMLAttr key, const std::string& value);
196 
198  void mouseOverObject(const GUIVisualizationSettings& s) const;
199 
201  GNEConnection(const GNEConnection&) = delete;
202 
204  GNEConnection& operator=(const GNEConnection&) = delete;
205 };
206 
207 
208 #endif
209 
210 /****************************************************************************/
211 
std::vector< double > myShapeLengths
The lengths of the shape parts.
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:160
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:47
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:42
void setSpecialColor(const RGBColor *Color2)
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
void mouseOverObject(const GUIVisualizationSettings &s) const
method for check if mouse is over objects
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
bool myShapeDeprecated
flag to indicate that connection&#39;s shape has to be updated
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.
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
void updateGeometry(bool updateGrid)
update pre-computed geometry information
NBConnection getNBConnection() const
get NBConnection
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
PositionVector myInternalJunctionMarker
waiting position for internal junction
void markConnectionGeometryDeprecated()
check that connection&#39;s Geometry has to be updated
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.
const PositionVector & getShape() const
get Position vector calculated in updateGeometry(bool updateGrid)
std::string getGenericParametersStr() const
return generic parameters in string format
const RGBColor * mySpecialColor
optional special color
void setGenericParametersStr(const std::string &value)
set generic parameters in string format