Eclipse 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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A class for represent connections between Lanes
19 /****************************************************************************/
20 #pragma once
21 #include "GNENetworkElement.h"
22 
23 #include <netbuild/NBEdge.h>
24 
25 // ===========================================================================
26 // class declarations
27 // ===========================================================================
28 class GNEEdge;
29 
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
34 
36 public:
42  GNEConnection(GNELane* from, GNELane* to);
43 
46 
50  const PositionVector& getConnectionShape() const;
51 
53  void updateGeometry();
54 
58 
62  GNEMoveOperation* getMoveOperation(const double shapeOffset);
63 
65  void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
67 
69  GNEEdge* getEdgeFrom() const;
70 
72  GNEEdge* getEdgeTo() const;
73 
75  GNELane* getLaneFrom() const;
76 
78  GNELane* getLaneTo() const;
79 
81  int getFromLaneIndex() const;
82 
84  int getToLaneIndex() const;
85 
88 
91 
93  LinkState getLinkState() const;
94 
97 
99  void updateID();
100 
102  void updateLinkState();
103 
106 
114 
116  void updateCenteringBoundary(const bool updateGrid);
117 
122  void drawGL(const GUIVisualizationSettings& s) const;
124 
125  /* @brief method for setting the special color of the connection
126  * @param[in] color Pointer to new special color
127  */
128  void setSpecialColor(const RGBColor* Color2);
129 
132  /* @brief method for getting the Attribute of an XML key
133  * @param[in] key The attribute key
134  * @return string with the value associated to key
135  */
136  std::string getAttribute(SumoXMLAttr key) const;
137 
138  /* @brief method for setting the attribute and letting the object perform additional changes
139  * @param[in] key The attribute key
140  * @param[in] value The new value
141  * @param[in] undoList The undoList on which to register changes
142  */
143  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
144 
145  /* @brief method for checking if the key and their conrrespond attribute are valids
146  * @param[in] key The attribute key
147  * @param[in] value The value asociated to key key
148  * @return true if the value is valid, false in other case
149  */
150  bool isValid(SumoXMLAttr key, const std::string& value);
151 
152  /* @brief method for check if the value for certain attribute is set
153  * @param[in] key The attribute key
154  */
155  bool isAttributeEnabled(SumoXMLAttr key) const;
157 
159  const std::map<std::string, std::string>& getACParametersMap() const;
160 
161 protected:
164 
167 
170 
173 
176 
179 
182 
183 private:
185  void setAttribute(SumoXMLAttr key, const std::string& value);
186 
188  void setMoveShape(const GNEMoveResult& moveResult);
189 
191  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
192 
194  void changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList* undoList);
195 
197  GNEConnection(const GNEConnection&) = delete;
198 
201 };
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
NBConnection getNBConnection() const
get NBConnection
Position getPositionInView() const
Returns position of hierarchical element in view.
GNELane * getLaneFrom() const
@briefthe get lane of the incoming lane
const PositionVector & getConnectionShape() const
GNELane * getLaneTo() const
@briefthe get lane of the outgoing lane
GNELane * myFromLane
incoming lane of this connection
LinkState getLinkState() const
get LinkState
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
int getFromLaneIndex() const
@briefthe get lane index of the incoming lane
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
GNELane * myToLane
outgoing lane of this connection
std::string getAttribute(SumoXMLAttr key) const
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
GNEConnection(GNELane *from, GNELane *to)
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
NBEdge::Connection & getNBEdgeConnection() const
get Edge::Connection
void setSpecialColor(const RGBColor *Color2)
void updateGeometry()
update pre-computed geometry information
GNEGeometry::Geometry myConnectionGeometry
connection geometry
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
GNEConnection(const GNEConnection &)=delete
Invalidated copy constructor.
bool isValid(SumoXMLAttr key, const std::string &value)
const RGBColor * mySpecialColor
optional special color
~GNEConnection()
Destructor.
int getToLaneIndex() const
@briefthe get lane index of the outgoing lane
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
bool myShapeDeprecated
flag to indicate that connection's shape has to be updated
void updateLinkState()
recompute cached myLinkState
PositionVector myInternalJunctionMarker
waiting position for internal junction
bool isAttributeEnabled(SumoXMLAttr key) const
GNEConnection & operator=(const GNEConnection &)=delete
Invalidated assignment operator.
LinkState myLinkState
Linkstate.
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
void updateID()
update internal ID of Connection
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
void changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList *undoList)
manage change of tlLinkindices
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
class for NETEDIT geometries over lanes
Definition: GNEGeometry.h:76
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
move operation
move result
The popup menu of a globject.
Stores the information about how to visualize structures.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
A list of positions.
A structure which describes a connection between edges or lanes.
Definition: NBEdge.h:188