Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GNEStop.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// Representation of Stops in netedit
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include "GNEDemandElement.h"
25
26// ===========================================================================
27// class declaration
28// ===========================================================================
29
31
32// ===========================================================================
33// class definitions
34// ===========================================================================
35
37
38public:
40 GNEStop(SumoXMLTag tag, GNENet* net);
41
43 GNEStop(SumoXMLTag tag, GNEDemandElement* stopParent, GNEAdditional* stoppingPlace, const SUMOVehicleParameter::Stop& stopParameter);
44
46 GNEStop(SumoXMLTag tag, GNEDemandElement* stopParent, GNELane* lane, const SUMOVehicleParameter::Stop& stopParameter);
47
49 ~GNEStop();
50
53
55 GNEMoveElement* getMoveElement() const override;
56
58 Parameterised* getParameters() override;
59
61 const Parameterised* getParameters() const override;
62
64
68 void writeDemandElement(OutputDevice& device) const;
69
72
74 std::string getDemandElementProblem() const;
75
78
83
85 const RGBColor& getColor() const;
86
88
92 void updateGeometry() override;
93
97
100
103 std::string getParentName() const;
104
106 double getExaggeration(const GUIVisualizationSettings& s) const;
107
112
114 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
115
120 void drawGL(const GUIVisualizationSettings& s) const;
121
123
126
128 void computePathElement();
129
135 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
136
142 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
143
145 GNELane* getFirstPathLane() const;
146
148 GNELane* getLastPathLane() const;
150
153 /* @brief method for getting the Attribute of an XML key
154 * @param[in] key The attribute key
155 * @return string with the value associated to key
156 */
157 std::string getAttribute(SumoXMLAttr key) const override;
158
159 /* @brief method for getting the Attribute of an XML key in double format
160 * @param[in] key The attribute key
161 * @return double with the value associated to key
162 */
163 double getAttributeDouble(SumoXMLAttr key) const override;
164
165 /* @brief method for getting the Attribute of an XML key in position format
166 * @param[in] key The attribute key
167 * @return position with the value associated to key
168 */
169 Position getAttributePosition(SumoXMLAttr key) const override;
170
171 /* @brief method for setting the attribute and letting the object perform demand element changes
172 * @param[in] key The attribute key
173 * @param[in] value The new value
174 * @param[in] undoList The undoList on which to register changes
175 * @param[in] net optionally the GNENet to inform about gui updates
176 */
177 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
178
179 /* @brief method for setting the attribute and letting the object perform demand element changes
180 * @param[in] key The attribute key
181 * @param[in] value The new value
182 * @param[in] undoList The undoList on which to register changes
183 */
184 bool isValid(SumoXMLAttr key, const std::string& value) override;
185
186 /* @brief method for enable attribute
187 * @param[in] key The attribute key
188 * @param[in] undoList The undoList on which to register changes
189 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
190 */
191 void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
192
193 /* @brief method for disable attribute
194 * @param[in] key The attribute key
195 * @param[in] undoList The undoList on which to register changes
196 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
197 */
198 void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
199
200 /* @brief method for check if the value for certain attribute is set
201 * @param[in] key The attribute key
202 */
203 bool isAttributeEnabled(SumoXMLAttr key) const;
204
206 std::string getPopUpID() const override;
207
209 std::string getHierarchyName() const override;
210
212
215
217 double getEndGeometryPositionOverLane() const;
218
219protected:
222
225
228
231
234
237
240
242 bool canDrawVehicleStop() const;
243
245 bool drawIndex() const;
246
249 const RGBColor& color, const double width, const double exaggeration) const;
250
253 const double width, const double exaggeration) const;
254
255 void drawStopLabel(const GUIVisualizationSettings& s) const;
256
257private:
259 void setAttribute(SumoXMLAttr key, const std::string& value) override;
260
262 void toggleAttribute(SumoXMLAttr key, const bool value);
263
265 void drawGeometryPoints(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d, const RGBColor& baseColor) const;
266
268 int getPathStopIndex() const;
269
271 void setStopMicrosimID();
272
274 GNEStop(const GNEStop&) = delete;
275
277 GNEStop& operator=(const GNEStop&) = delete;
278};
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
A class that stores a 2D geometrical boundary.
Definition Boundary.h:39
Problem
enum class for demandElement problems
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
const RGBColor & getColor() const
get color
Definition GNEStop.cpp:244
int getPathStopIndex() const
get pathStopIndex
Definition GNEStop.cpp:1339
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this stop
Definition GNEStop.cpp:152
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition GNEStop.cpp:238
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:843
~GNEStop()
destructor
Definition GNEStop.cpp:148
void setStopMicrosimID()
set stop microsim ID
Definition GNEStop.cpp:1356
bool drawIndex() const
draw index
Definition GNEStop.cpp:967
GNEMoveElementLaneDouble * myMoveElementLaneDouble
move element lane double
Definition GNEStop.h:221
GNELane * getFirstPathLane() const
get first path lane
Definition GNEStop.cpp:475
GNEContour myStopContour
variable used for draw contours
Definition GNEStop.h:224
Position getPositionInView() const
Returns position of demand element in view.
Definition GNEStop.cpp:280
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNEStop.cpp:330
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
Definition GNEStop.cpp:493
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNEStop.cpp:857
GNELane * getLastPathLane() const
get last path lane
Definition GNEStop.cpp:486
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNEStop.cpp:170
Boundary myMovingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
Definition GNEStop.h:227
void drawStopOverStoppingPlace(const GUIVisualizationSettings::Detail d, const RGBColor &color, const double width, const double exaggeration) const
draw stop over stoppingPlace
Definition GNEStop.cpp:1035
std::string getParentName() const
Returns the name of the parent object.
Definition GNEStop.cpp:292
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:829
GNEStop & operator=(const GNEStop &)=delete
Invalidated assignment operator.
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition GNEStop.cpp:205
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
Definition GNEStop.cpp:463
void computePathElement()
compute pathElement
Definition GNEStop.cpp:456
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEStop.cpp:312
void drawStopOverLane(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const RGBColor &color, const double width, const double exaggeration) const
draw stop over lane
Definition GNEStop.cpp:983
double getAttributeDouble(SumoXMLAttr key) const override
Definition GNEStop.cpp:608
Parameterised * getParameters() override
get parameters associated with this stop
Definition GNEStop.cpp:158
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNEStop.cpp:336
void drawStopLabel(const GUIVisualizationSettings &s) const
Definition GNEStop.cpp:390
std::string mySecondOriginalPosition
value for saving second original position over lane before moving
Definition GNEStop.h:236
bool isValid(SumoXMLAttr key, const std::string &value) override
Definition GNEStop.cpp:710
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNEStop.cpp:229
std::string myFirstOriginalLanePosition
value for saving first original position over lane before moving
Definition GNEStop.h:233
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition GNEStop.cpp:306
void updateGeometry() override
update pre-computed geometry information
Definition GNEStop.cpp:267
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEStop.cpp:896
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
Definition GNEStop.cpp:669
const int myCreationIndex
creation index (using for saving sorted)
Definition GNEStop.h:239
Position getAttributePosition(SumoXMLAttr key) const override
Definition GNEStop.cpp:643
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition GNEStop.cpp:918
Position myOriginalViewPosition
value for saving first original position over lane before moving
Definition GNEStop.h:230
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNEStop.cpp:469
void drawGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const RGBColor &baseColor) const
draw geometry points
Definition GNEStop.cpp:1302
bool canDrawVehicleStop() const
check if vehicle stop can be draw
Definition GNEStop.cpp:943
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNEStop.cpp:890
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition GNEStop.cpp:929
GNEStop(const GNEStop &)=delete
Invalidated copy constructor.
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
Definition GNEStop.cpp:1251
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNEStop.cpp:217
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
Definition of vehicle stop (position and duration)
std::string lane
The lane to stop at.