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-2023 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
52
54 void updateGeometry();
55
59
64
66 void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
68
70 GNEEdge* getEdgeFrom() const;
71
73 GNEEdge* getEdgeTo() const;
74
76 GNELane* getLaneFrom() const;
77
79 GNELane* getLaneTo() const;
80
82 int getFromLaneIndex() const;
83
85 int getToLaneIndex() const;
86
89
92
94 LinkState getLinkState() const;
95
98
100 void updateID();
101
103 void updateLinkState();
104
106 void smootShape();
107
110
118
120 double getExaggeration(const GUIVisualizationSettings& s) const;
121
123 void updateCenteringBoundary(const bool updateGrid);
124
129 void drawGL(const GUIVisualizationSettings& s) const;
130
132 void deleteGLObject();
133
135 void updateGLObject();
136
138
139 /* @brief method for setting the special color of the connection
140 * @param[in] color Pointer to new special color
141 */
142 void setSpecialColor(const RGBColor* Color2);
143
146 /* @brief method for getting the Attribute of an XML key
147 * @param[in] key The attribute key
148 * @return string with the value associated to key
149 */
150 std::string getAttribute(SumoXMLAttr key) const;
151
152 /* @brief method for setting the attribute and letting the object perform additional changes
153 * @param[in] key The attribute key
154 * @param[in] value The new value
155 * @param[in] undoList The undoList on which to register changes
156 */
157 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
158
159 /* @brief method for checking if the key and their conrrespond attribute are valids
160 * @param[in] key The attribute key
161 * @param[in] value The value associated to key key
162 * @return true if the value is valid, false in other case
163 */
164 bool isValid(SumoXMLAttr key, const std::string& value);
165
166 /* @brief method for check if the value for certain attribute is set
167 * @param[in] key The attribute key
168 */
169 bool isAttributeEnabled(SumoXMLAttr key) const;
170
171 /* @brief method for check if the value for certain attribute is computed (for example, due a network recomputing)
172 * @param[in] key The attribute key
173 */
174 bool isAttributeComputed(SumoXMLAttr key) const;
176
179
180protected:
183
186
189
192
195
198
201
202private:
204 void setAttribute(SumoXMLAttr key, const std::string& value);
205
207 void setMoveShape(const GNEMoveResult& moveResult);
208
210 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
211
213 void changeTLIndex(SumoXMLAttr key, int tlIndex, int tlIndex2, GNEUndoList* undoList);
214
217
219 GNEConnection(const GNEConnection&) = delete;
220
223};
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
void smootShape()
smoothShape
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 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
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
bool isAttributeComputed(SumoXMLAttr key) const
void markConnectionGeometryDeprecated()
check that connection's Geometry has to be updated
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
void updateGeometry()
update pre-computed geometry information
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.
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
const Parameterised::Map & getACParametersMap() const
get parameters map
void drawConnectionArrows(const GUIVisualizationSettings &s) const
draw arrows over connections
PositionVector myInternalJunctionMarker
waiting position for internal junction
bool isAttributeEnabled(SumoXMLAttr key) const
LinkState myLinkState
Linkstate.
void updateGLObject()
update GLObject (geometry, ID, etc.)
void updateID()
update internal ID of Connection
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