Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/network/GNEInternalLane.h
185851 views
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
/****************************************************************************/
14
/// @file GNEInternalLane.h
15
/// @author Jakob Erdmann
16
/// @date June 2011
17
///
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
// ===========================================================================
27
class GUIGLObjectPopupMenu;
28
class GNETLSEditorFrame;
29
class PositionVector;
30
31
32
// ===========================================================================
33
// class definitions
34
// ===========================================================================
35
36
class GNEInternalLane : public GNENetworkElement, public FXDelegator {
37
/// @brief FOX-declaration
38
FXDECLARE_OVERRIDE(GNEInternalLane)
39
40
public:
41
/**@brief Constructor
42
* @param[in] editor The editor to notify about changes
43
* @param[in] junctionParent junction parent
44
* @param[in] id The id of this internal lane
45
* @param[in] shape The shape of the lane
46
* @param[in] tlIndex The tl-index of the lane
47
*/
48
GNEInternalLane(GNETLSEditorFrame* editor, GNEJunction* junctionParent, const std::string& id,
49
const PositionVector& shape, int tlIndex, LinkState state = LINKSTATE_DEADEND);
50
51
/// @brief Destructor
52
~GNEInternalLane();
53
54
/// @brief methods to retrieve the elements linked to this internalLane
55
/// @{
56
57
/// @brief get GNEMoveElement associated with this internalLane
58
GNEMoveElement* getMoveElement() const override;
59
60
/// @brief get parameters associated with this internalLane
61
Parameterised* getParameters() override;
62
63
/// @brief get parameters associated with this internalLane (constant)
64
const Parameterised* getParameters() const override;
65
66
/// @}
67
68
/// @name Functions related with geometry of element
69
/// @{
70
71
/// @brief update pre-computed geometry information
72
void updateGeometry() override;
73
74
/// @brief Returns position of hierarchical element in view
75
Position getPositionInView() const;
76
77
/// @}
78
79
/// @name Function related with contour drawing
80
/// @{
81
82
/// @brief check if draw from contour (green)
83
bool checkDrawFromContour() const override;
84
85
/// @brief check if draw from contour (magenta)
86
bool checkDrawToContour() const override;
87
88
/// @brief check if draw related contour (cyan)
89
bool checkDrawRelatedContour() const override;
90
91
/// @brief check if draw over contour (orange)
92
bool checkDrawOverContour() const override;
93
94
/// @brief check if draw delete contour (pink/white)
95
bool checkDrawDeleteContour() const override;
96
97
/// @brief check if draw delete contour small (pink/white)
98
bool checkDrawDeleteContourSmall() const override;
99
100
/// @brief check if draw select contour (blue)
101
bool checkDrawSelectContour() const override;
102
103
/// @brief check if draw move contour (red)
104
bool checkDrawMoveContour() const override;
105
106
/// @}
107
108
/// @name inherited from GUIGlObject
109
/// @{
110
/**@brief Returns an own popup-menu
111
*
112
* @param[in] app The application needed to build the popup-menu
113
* @param[in] parent The parent window needed to build the popup-menu
114
* @return The built popup-menu
115
* @see GUIGlObject::getPopUpMenu
116
*/
117
GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;
118
119
/**@brief Returns an own parameter window
120
*
121
* @param[in] app The application needed to build the parameter window
122
* @param[in] parent The parent window needed to build the parameter window
123
* @return The built parameter window
124
* @see GUIGlObject::getParameterWindow
125
*/
126
GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent) override;
127
128
/// @brief Returns the boundary to which the view shall be centered in order to show the object
129
Boundary getCenteringBoundary() const override;
130
131
/// @brief update centering boundary (implies change in RTREE)
132
void updateCenteringBoundary(const bool updateGrid);
133
134
/**@brief Draws the object
135
* @param[in] s The settings for the current view (may influence drawing)
136
* @see GUIGlObject::drawGL
137
*/
138
void drawGL(const GUIVisualizationSettings& s) const override;
139
140
/// @brief delete element
141
void deleteGLObject() override;
142
143
/// @brief update GLObject (geometry, ID, etc.)
144
void updateGLObject() override;
145
146
/// @}
147
148
/// @brief set the linkState (controls drawing color)
149
void setLinkState(LinkState state);
150
151
/// @brief whether link state has been modified
152
LinkState getLinkState() const;
153
154
/// @brief multiplexes message to two targets
155
long onDefault(FXObject*, FXSelector, void*) override;
156
157
/// @brief get Traffic Light index
158
int getTLIndex() const;
159
160
/// @brief long names for link states
161
static const StringBijection<FXuint> LinkStateNames;
162
163
/// @brief return the color for each linkstate
164
static RGBColor colorForLinksState(FXuint state);
165
166
/// @name inherited from GNEAttributeCarrier
167
/// @{
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 override;
173
174
/* @brief method for getting the Attribute of an XML key in double format
175
* @param[in] key The attribute key
176
* @return double with the value associated to key
177
*/
178
double getAttributeDouble(SumoXMLAttr key) const override;
179
180
/* @brief method for getting the Attribute of an XML key in position format
181
* @param[in] key The attribute key
182
* @return position with the value associated to key
183
*/
184
Position getAttributePosition(SumoXMLAttr key) const override;
185
186
/* @brief method for getting the Attribute of an XML key in Position format
187
* @param[in] key The attribute key
188
* @return position with the value associated to key
189
*/
190
PositionVector getAttributePositionVector(SumoXMLAttr key) const override;
191
192
/* @brief method for setting the attribute and letting the object perform additional changes
193
* @param[in] key The attribute key
194
* @param[in] value The new value
195
* @param[in] undoList The undoList on which to register changes
196
*/
197
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
198
199
/* @brief method for checking if the key and their conrrespond attribute are valids
200
* @param[in] key The attribute key
201
* @param[in] value The value associated to key key
202
* @return true if the value is valid, false in other case
203
*/
204
bool isValid(SumoXMLAttr key, const std::string& value) override;
205
206
/// @}
207
208
protected:
209
/// @brief FOX needs this
210
GNEInternalLane();
211
212
private:
213
/// @brief pointer to junction parent
214
GNEJunction* myJunctionParent;
215
216
/// @brief internal lane geometry
217
GUIGeometry myInternalLaneGeometry;
218
219
/// @brief the state of the link (used for visualization)
220
FXuint myState;
221
FXDataTarget myStateTarget;
222
223
/// @brief the original state of the link (used for tracking modification)
224
LinkState myOrigState;
225
226
/// @brief data target for selection state
227
FXDataTarget stateTarget;
228
229
/// @brief the editor to inform about changes
230
GNETLSEditorFrame* myEditor;
231
232
/// @brief the tl-index of this lane
233
int myTlIndex;
234
235
/// @brief the created popup
236
GUIGLObjectPopupMenu* myPopup;
237
238
/// @brief linkstates names values
239
static StringBijection<FXuint>::Entry linkStateNamesValues[];
240
241
private:
242
/// @brief set attribute after validation
243
void setAttribute(SumoXMLAttr key, const std::string& value) override;
244
245
/// @brief Invalidated copy constructor.
246
GNEInternalLane(const GNEInternalLane&) = delete;
247
248
/// @brief Invalidated assignment operator.
249
GNEInternalLane& operator=(const GNEInternalLane&) = delete;
250
};
251
252