Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNEConnection.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2016-2025 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 <config.h>
22#include "GNENetworkElement.h"
23
24#include <netbuild/NBEdge.h>
25
26// ===========================================================================
27// class declarations
28// ===========================================================================
29class GNEEdge;
30
31
32// ===========================================================================
33// class definitions
34// ===========================================================================
35
37public:
43 GNEConnection(GNELane* from, GNELane* to);
44
47
50
53
55 void updateGeometry();
56
59
61
64
66 bool checkDrawFromContour() const;
67
69 bool checkDrawToContour() const;
70
72 bool checkDrawRelatedContour() const;
73
75 bool checkDrawOverContour() const;
76
78 bool checkDrawDeleteContour() const;
79
81 bool checkDrawDeleteContourSmall() const;
82
84 bool checkDrawSelectContour() const;
85
87 bool checkDrawMoveContour() const;
88
90
93
96
98 void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
99
101
103 GNEEdge* getEdgeFrom() const;
104
106 GNEEdge* getEdgeTo() const;
107
109 GNELane* getLaneFrom() const;
110
112 GNELane* getLaneTo() const;
113
115 int getFromLaneIndex() const;
116
118 int getToLaneIndex() const;
121
124
126 LinkState getLinkState() const;
127
130
132 void updateConnectionID();
133
135 void updateLinkState();
136
138 void smootShape();
139
142
150
152 double getExaggeration(const GUIVisualizationSettings& s) const;
153
156
158 void updateCenteringBoundary(const bool updateGrid);
159
164 void drawGL(const GUIVisualizationSettings& s) const;
165
167 void deleteGLObject();
168
170 void updateGLObject();
171
173
174 /* @brief method for setting the special color of the connection
175 * @param[in] color Pointer to new special color
176 */
177 void setSpecialColor(const RGBColor* Color2);
178
181 /* @brief method for getting the Attribute of an XML key
182 * @param[in] key The attribute key
183 * @return string with the value associated to key
184 */
185 std::string getAttribute(SumoXMLAttr key) const;
186
187 /* @brief method for getting the Attribute of an XML key in PositionVector format
188 * @param[in] key The attribute key
189 * @return position with the value associated to key
190 */
192
193 /* @brief method for setting the attribute and letting the object perform additional changes
194 * @param[in] key The attribute key
195 * @param[in] value The new value
196 * @param[in] undoList The undoList on which to register changes
197 */
198 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
199
200 /* @brief method for checking if the key and their conrrespond attribute are valids
201 * @param[in] key The attribute key
202 * @param[in] value The value associated to key key
203 * @return true if the value is valid, false in other case
204 */
205 bool isValid(SumoXMLAttr key, const std::string& value);
206
207 /* @brief method for check if the value for certain attribute is set
208 * @param[in] key The attribute key
209 */
210 bool isAttributeEnabled(SumoXMLAttr key) const;
211
212 /* @brief method for check if the value for certain attribute is computed (for example, due a network recomputing)
213 * @param[in] key The attribute key
214 */
215 bool isAttributeComputed(SumoXMLAttr key) const;
217
220
221protected:
224
227
230
233
236
237private:
239 void setAttribute(SumoXMLAttr key, const std::string& value);
240
242 void setMoveShape(const GNEMoveResult& moveResult);
243
245 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
246
248 void changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList* undoList);
249
251 bool existNBEdgeConnection() const;
252
254 bool checkDrawConnection() const;
255
258
261 const GUIGeometry& superposedGeometry, const double exaggeration) const;
262
264 void drawConnectionArrows(const GUIVisualizationSettings& s, const GUIGeometry& superposedGeometry,
265 const RGBColor& color) const;
266
268 void drawEdgeValues(const GUIVisualizationSettings& s, const PositionVector& shape) const;
269
272 const PositionVector& shape, const double exaggeration) const;
273
275 GNEConnection(const GNEConnection&) = delete;
276
279};
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
void updateConnectionID()
update internal ID of Connection
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
void smootShape()
smoothShape
const PositionVector & getConnectionShape() const
get connection shape
bool checkDrawSelectContour() const
check if draw select contour (blue)
GNELane * getLaneTo() const
@briefthe get lane of the outgoing lane
LinkState getLinkState() const
get LinkState
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
void drawConnectionArrows(const GUIVisualizationSettings &s, const GUIGeometry &superposedGeometry, const RGBColor &color) const
draw arrows over connections
int getFromLaneIndex() const
@briefthe get lane index of the incoming lane
void deleteGLObject()
delete element
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)
GUIGeometry myConnectionGeometry
connection geometry
bool checkDrawOverContour() const
check if draw over contour (orange)
void drawEdgeValues(const GUIVisualizationSettings &s, const PositionVector &shape) const
draw edge value
bool checkDrawFromContour() const
check if draw from contour (green)
void drawConnection(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGeometry &superposedGeometry, const double exaggeration) const
draw connection
bool existNBEdgeConnection() const
check if the edgeConnection vinculated with this connection exists
std::string getAttribute(SumoXMLAttr key) const
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
bool isAttributeComputed(SumoXMLAttr key) const
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
PositionVector getAttributePositionVector(SumoXMLAttr key) const
bool checkDrawDeleteContourSmall() const
check if draw delete contour small (pink/white)
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)
GNEMoveOperation * getMoveOperation()
get move operation for the given shapeOffset (can be nullptr)
void updateGeometry()
update pre-computed geometry information
GUIGeometry myInternalJunctionMarkerGeometry
junction maker geometry
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
GNEConnection(const GNEConnection &)=delete
Invalidated copy constructor.
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
bool isValid(SumoXMLAttr key, const std::string &value)
const RGBColor * mySpecialColor
optional special color
~GNEConnection()
Destructor.
GNEConnection & operator=(const GNEConnection &)=delete
Invalidated assignment operator.
int getToLaneIndex() const
@briefthe get lane index of the outgoing lane
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show 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 calculateConnectionContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const PositionVector &shape, const double exaggeration) const
calculate connection contour
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
void updateLinkState()
recompute cached myLinkState
const Parameterised::Map & getACParametersMap() const
get parameters map
bool checkDrawConnection() const
check if draw connection
RGBColor getConnectionColor(const GUIVisualizationSettings &s) const
get connection color
bool checkDrawMoveContour() const
check if draw move contour (red)
bool isAttributeEnabled(SumoXMLAttr key) const
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
LinkState myLinkState
Linkstate.
void updateGLObject()
update GLObject (geometry, ID, etc.)
bool checkDrawToContour() const
check if draw from contour (magenta)
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:53
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
move operation
move result
The popup menu of a globject.
Stores the information about how to visualize structures.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
A list of positions.
A structure which describes a connection between edges or lanes.
Definition NBEdge.h:201