Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEInternalLane.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-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 visualizing Inner Lanes (used when editing traffic lights)
19/****************************************************************************/
20#pragma once
21#include <config.h>
22#include "GNENetworkElement.h"
23
24// ===========================================================================
25// class declarations
26// ===========================================================================
29class PositionVector;
30
31
32// ===========================================================================
33// class definitions
34// ===========================================================================
41class GNEInternalLane : public GNENetworkElement, public FXDelegator {
43 FXDECLARE(GNEInternalLane)
44
45public:
53 GNEInternalLane(GNETLSEditorFrame* editor, GNEJunction* junctionParent, const std::string& id,
54 const PositionVector& shape, int tlIndex, LinkState state = LINKSTATE_DEADEND);
55
58
61
63 void updateGeometry();
64
67
69
72
74 bool checkDrawFromContour() const;
75
77 bool checkDrawToContour() const;
78
80 bool checkDrawRelatedContour() const;
81
83 bool checkDrawOverContour() const;
84
86 bool checkDrawDeleteContour() const;
87
89 bool checkDrawDeleteContourSmall() const;
90
92 bool checkDrawSelectContour() const;
93
95 bool checkDrawMoveContour() const;
96
98
103
105 void removeGeometryPoint(const Position clickedPosition, GNEUndoList* undoList);
107
110
118
127
130
132 void updateCenteringBoundary(const bool updateGrid);
133
138 void drawGL(const GUIVisualizationSettings& s) const;
139
141 void deleteGLObject();
142
144 void updateGLObject();
145
147
149 void setLinkState(LinkState state);
150
152 LinkState getLinkState() const;
153
155 long onDefault(FXObject*, FXSelector, void*);
156
158 int getTLIndex() const;
159
162
164 static RGBColor colorForLinksState(FXuint state);
165
168 /* @brief method for getting the Attribute of an XML key
169 * @param[in] key The attribute key
170 * @return string with the value associated to key
171 */
172 std::string getAttribute(SumoXMLAttr key) const;
173
174 /* @brief method for getting the Attribute of an XML key in Position format
175 * @param[in] key The attribute key
176 * @return position with the value associated to key
177 */
179
180 /* @brief method for setting the attribute and letting the object perform additional changes
181 * @param[in] key The attribute key
182 * @param[in] value The new value
183 * @param[in] undoList The undoList on which to register changes
184 */
185 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
186
187 /* @brief method for checking if the key and their conrrespond attribute are valids
188 * @param[in] key The attribute key
189 * @param[in] value The value associated to key key
190 * @return true if the value is valid, false in other case
191 */
192 bool isValid(SumoXMLAttr key, const std::string& value);
193
194 /* @brief method for check if the value for certain attribute is set
195 * @param[in] key The attribute key
196 */
197 bool isAttributeEnabled(SumoXMLAttr key) const;
198
200
203
204protected:
207
208private:
211
214
216 FXuint myState;
217 FXDataTarget myStateTarget;
218
221
223 FXDataTarget stateTarget;
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
249
252};
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
@ LINKSTATE_DEADEND
This is a dead end link.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
void deleteGLObject()
delete element
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
GNEInternalLane()
FOX needs this.
bool checkDrawDeleteContourSmall() const
check if draw delete contour small (pink/white)
long onDefault(FXObject *, FXSelector, void *)
multiplexes message to two targets
static RGBColor colorForLinksState(FXuint state)
return the color for each linkstate
LinkState myOrigState
the original state of the link (used for tracking modification)
PositionVector getAttributePositionVector(SumoXMLAttr key) const
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
void updateGeometry()
update pre-computed geometry information
GNEInternalLane & operator=(const GNEInternalLane &)=delete
Invalidated assignment operator.
std::string getAttribute(SumoXMLAttr key) const
FXuint myState
the state of the link (used for visualization)
LinkState getLinkState() const
whether link state has been modified
bool checkDrawSelectContour() const
check if draw select contour (blue)
FXDataTarget myStateTarget
int myTlIndex
the tl-index of this lane
GUIGLObjectPopupMenu * myPopup
the created popup
bool checkDrawFromContour() const
check if draw from contour (green)
bool checkDrawOverContour() const
check if draw over contour (orange)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Position getPositionInView() const
Returns position of hierarchical element in view.
bool checkDrawToContour() const
check if draw from contour (magenta)
void removeGeometryPoint(const Position clickedPosition, GNEUndoList *undoList)
remove geometry point in the clicked position
GNEMoveOperation * getMoveOperation()
get move operation
static StringBijection< FXuint >::Entry linkStateNamesValues[]
linkstates names values
FXDataTarget stateTarget
data target for selection state
bool checkDrawRelatedContour() const
check if draw related contour (cyan)
GUIGeometry myInternalLaneGeometry
internal lane geometry
bool checkDrawDeleteContour() const
check if draw delete contour (pink/white)
bool isValid(SumoXMLAttr key, const std::string &value)
static const StringBijection< FXuint > LinkStateNames
long names for link states
bool checkDrawMoveContour() const
check if draw move contour (red)
int getTLIndex() const
get Traffic Light index
const Parameterised::Map & getACParametersMap() const
get parameters map
GNEInternalLane(const GNEInternalLane &)=delete
Invalidated copy constructor.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void updateGLObject()
update GLObject (geometry, ID, etc.)
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
~GNEInternalLane()
Destructor.
void setLinkState(LinkState state)
set the linkState (controls drawing color)
GNETLSEditorFrame * myEditor
the editor to inform about changes
bool isAttributeEnabled(SumoXMLAttr key) const
GNEJunction * myJunctionParent
pointer to junction parent
move operation
move result
The popup menu of a globject.
A window containing a gl-object's parameter.
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.
bijection entry