Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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
23#include <netbuild/NBEdge.h>
25
26#include "GNENetworkElement.h"
27
28// ===========================================================================
29// class declarations
30// ===========================================================================
31
32class GNEEdge;
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
38
40
43
44public:
50 GNEConnection(GNELane* from, GNELane* to);
51
54
57
59 GNEMoveElement* getMoveElement() const override;
60
62 Parameterised* getParameters() override;
63
65 const Parameterised* getParameters() const override;
66
68
71
74
76 void updateGeometry() override;
77
80
82
85
87 bool checkDrawFromContour() const override;
88
90 bool checkDrawToContour() const override;
91
93 bool checkDrawRelatedContour() const override;
94
96 bool checkDrawOverContour() const override;
97
99 bool checkDrawDeleteContour() const override;
100
102 bool checkDrawDeleteContourSmall() const override;
103
105 bool checkDrawSelectContour() const override;
106
108 bool checkDrawMoveContour() const override;
109
111
113 GNEEdge* getEdgeFrom() const;
114
116 GNEEdge* getEdgeTo() const;
117
119 GNELane* getLaneFrom() const;
120
122 GNELane* getLaneTo() const;
123
125 int getFromLaneIndex() const;
126
128 int getToLaneIndex() const;
129
132
135
137 LinkState getLinkState() const;
138
141
143 void updateConnectionID();
144
146 void updateLinkState();
147
149 void smootShape();
150
153
161
163 double getExaggeration(const GUIVisualizationSettings& s) const;
164
167
169 void updateCenteringBoundary(const bool updateGrid);
170
175 void drawGL(const GUIVisualizationSettings& s) const;
176
178 void deleteGLObject();
179
181 void updateGLObject();
182
184
185 /* @brief method for setting the special color of the connection
186 * @param[in] color Pointer to new special color
187 */
188 void setSpecialColor(const RGBColor* Color2);
189
192 /* @brief method for getting the Attribute of an XML key
193 * @param[in] key The attribute key
194 * @return string with the value associated to key
195 */
196 std::string getAttribute(SumoXMLAttr key) const override;
197
198 /* @brief method for getting the Attribute of an XML key in double format
199 * @param[in] key The attribute key
200 * @return double with the value associated to key
201 */
202 double getAttributeDouble(SumoXMLAttr key) const override;
203
204 /* @brief method for getting the Attribute of an XML key in position format
205 * @param[in] key The attribute key
206 * @return position with the value associated to key
207 */
208 Position getAttributePosition(SumoXMLAttr key) const override;
209
210 /* @brief method for getting the Attribute of an XML key in positionVector format
211 * @param[in] key The attribute key
212 * @return positionVector with the value associated to key
213 */
215
216 /* @brief method for setting the attribute and letting the object perform additional changes
217 * @param[in] key The attribute key
218 * @param[in] value The new value
219 * @param[in] undoList The undoList on which to register changes
220 */
221 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
222
223 /* @brief method for checking if the key and their conrrespond attribute are valids
224 * @param[in] key The attribute key
225 * @param[in] value The value associated to key key
226 * @return true if the value is valid, false in other case
227 */
228 bool isValid(SumoXMLAttr key, const std::string& value) override;
229
230 /* @brief method for check if the value for certain attribute is set
231 * @param[in] key The attribute key
232 */
233 bool isAttributeEnabled(SumoXMLAttr key) const;
234
235 /* @brief method for check if the value for certain attribute is computed (for example, due a network recomputing)
236 * @param[in] key The attribute key
237 */
238 bool isAttributeComputed(SumoXMLAttr key) const;
239
241
242protected:
245
248
251
254
257
260
261private:
263 void setAttribute(SumoXMLAttr key, const std::string& value) override;
264
266 void changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList* undoList);
267
269 bool existNBEdgeConnection() const;
270
272 bool checkDrawConnection() const;
273
276
279 const GUIGeometry& superposedGeometry, const double exaggeration) const;
280
282 void drawConnectionArrows(const GUIVisualizationSettings& s, const GUIGeometry& superposedGeometry,
283 const RGBColor& color) const;
284
286 void drawEdgeValues(const GUIVisualizationSettings& s, const PositionVector& shape) const;
287
290 const PositionVector& shape, const double exaggeration) const;
291
293 GNEConnection(const GNEConnection&) = delete;
294
297};
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
double getAttributeDouble(SumoXMLAttr key) const override
Position getAttributePosition(SumoXMLAttr key) const override
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 override
check if draw select contour (blue)
bool checkDrawOverContour() const override
check if draw over contour (orange)
GNELane * getLaneTo() const
@briefthe get lane of the outgoing lane
LinkState getLinkState() const
get LinkState
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 updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
GUIGeometry myConnectionGeometry
connection geometry
bool isValid(SumoXMLAttr key, const std::string &value) override
bool checkDrawFromContour() const override
check if draw from contour (green)
void drawEdgeValues(const GUIVisualizationSettings &s, const PositionVector &shape) const
draw edge value
void drawConnection(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const GUIGeometry &superposedGeometry, const double exaggeration) const
draw connection
Parameterised * getParameters() override
get parameters associated with this connection
bool existNBEdgeConnection() const
check if the edgeConnection vinculated with this connection exists
void updateGeometry() override
update pre-computed geometry information
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
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
bool checkDrawDeleteContour() const override
check if draw delete contour (pink/white)
bool checkDrawRelatedContour() const override
check if draw related contour (cyan)
bool checkDrawToContour() const override
check if draw from contour (magenta)
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)
bool checkDrawMoveContour() const override
check if draw move contour (red)
GUIGeometry myInternalJunctionMarkerGeometry
junction maker geometry
GNEConnection(const GNEConnection &)=delete
Invalidated copy constructor.
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
const RGBColor * mySpecialColor
optional special color
GNEMoveElementConnection * myMoveElementConnection
move element connection
~GNEConnection()
Destructor.
GNEConnection & operator=(const GNEConnection &)=delete
Invalidated assignment operator.
int getToLaneIndex() const
@briefthe get lane index of the outgoing lane
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this connection
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
void updateLinkState()
recompute cached myLinkState
PositionVector getAttributePositionVector(SumoXMLAttr key) const override
bool checkDrawConnection() const
check if draw connection
RGBColor getConnectionColor(const GUIVisualizationSettings &s) const
get connection color
bool checkDrawDeleteContourSmall() const override
check if draw delete contour small (pink/white)
bool isAttributeEnabled(SumoXMLAttr key) const
LinkState myLinkState
Linkstate.
void updateGLObject()
update GLObject (geometry, ID, etc.)
std::string getAttribute(SumoXMLAttr key) const override
void changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList *undoList)
manage change of tlLinkindices
The popup menu of a globject.
Stores the information about how to visualize structures.
An upper class for objects with additional parameters.
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