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-2024 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 definitions
28// ===========================================================================
29
31
32public:
34 GNEStop(SumoXMLTag tag, GNENet* net);
35
37 GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNEAdditional* stoppingPlace, const SUMOVehicleParameter::Stop& stopParameter);
38
40 GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNELane* lane, const SUMOVehicleParameter::Stop& stopParameter);
41
43 ~GNEStop();
44
49
53 void writeDemandElement(OutputDevice& device) const;
54
57
59 std::string getDemandElementProblem() const;
60
63
68
70 const RGBColor& getColor() const;
71
73
77 void updateGeometry();
78
82
85
88 std::string getParentName() const;
89
91 double getExaggeration(const GUIVisualizationSettings& s) const;
92
97
99 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
100
105 void drawGL(const GUIVisualizationSettings& s) const;
106
108
111
113 void computePathElement();
114
120 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
121
127 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
128
130 GNELane* getFirstPathLane() const;
131
133 GNELane* getLastPathLane() const;
135
138 /* @brief method for getting the Attribute of an XML key
139 * @param[in] key The attribute key
140 * @return string with the value associated to key
141 */
142 std::string getAttribute(SumoXMLAttr key) const;
143
144 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
145 * @param[in] key The attribute key
146 * @return double with the value associated to key
147 */
148 double getAttributeDouble(SumoXMLAttr key) const;
149
150 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
151 * @param[in] key The attribute key
152 * @return double with the value associated to key
153 */
155
156 /* @brief method for setting the attribute and letting the object perform demand element changes
157 * @param[in] key The attribute key
158 * @param[in] value The new value
159 * @param[in] undoList The undoList on which to register changes
160 * @param[in] net optionally the GNENet to inform about gui updates
161 */
162 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
163
164 /* @brief method for setting the attribute and letting the object perform demand element changes
165 * @param[in] key The attribute key
166 * @param[in] value The new value
167 * @param[in] undoList The undoList on which to register changes
168 */
169 bool isValid(SumoXMLAttr key, const std::string& value);
170
171 /* @brief method for enable attribute
172 * @param[in] key The attribute key
173 * @param[in] undoList The undoList on which to register changes
174 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
175 */
176 void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
177
178 /* @brief method for disable attribute
179 * @param[in] key The attribute key
180 * @param[in] undoList The undoList on which to register changes
181 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
182 */
183 void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
184
185 /* @brief method for check if the value for certain attribute is set
186 * @param[in] key The attribute key
187 */
188 bool isAttributeEnabled(SumoXMLAttr key) const;
189
191 std::string getPopUpID() const;
192
194 std::string getHierarchyName() const;
196
199
202
204 double getEndGeometryPositionOverLane() const;
205
206protected:
209
212
215
218
221
224
226 bool canDrawVehicleStop() const;
227
229 bool drawIndex() const;
230
233 const RGBColor& color, const double width, const double exaggeration) const;
234
237 const double width, const double exaggeration) const;
238
239private:
241 void setAttribute(SumoXMLAttr key, const std::string& value);
242
244 void toggleAttribute(SumoXMLAttr key, const bool value);
245
247 void setMoveShape(const GNEMoveResult& moveResult);
248
250 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
251
253 void drawGeometryPoints(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d, const RGBColor& baseColor) const;
254
256 int getPathStopIndex() const;
257
259 void setStopMicrosimID();
260
262 GNEStop(const GNEStop&) = delete;
263
265 GNEStop& operator=(const GNEStop&) = delete;
266};
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
An Element which don't belong to GNENet but has influence in the simulation.
Problem
enum class for demandElement problems
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition GNELane.h:46
move operation
move result
A NBNetBuilder extended by visualisation and editing capabilities.
Definition GNENet.h:42
const RGBColor & getColor() const
get color
Definition GNEStop.cpp:281
int getPathStopIndex() const
get pathStopIndex
Definition GNEStop.cpp:1458
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition GNEStop.cpp:713
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition GNEStop.cpp:275
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:874
~GNEStop()
destructor
Definition GNEStop.cpp:109
void setStopMicrosimID()
set stop microsim ID
Definition GNEStop.cpp:1475
bool drawIndex() const
draw index
Definition GNEStop.cpp:1002
GNELane * getFirstPathLane() const
get first path lane
Definition GNEStop.cpp:435
Position getAttributePosition(SumoXMLAttr key) const
Definition GNEStop.cpp:641
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition GNEStop.cpp:921
GNEContour myStopContour
variable used for draw contours
Definition GNEStop.h:208
Position getPositionInView() const
Returns position of demand element in view.
Definition GNEStop.cpp:317
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNEStop.cpp:367
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNEStop.cpp:888
GNELane * getLastPathLane() const
get last path lane
Definition GNEStop.cpp:446
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNEStop.cpp:160
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNEStop.cpp:113
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEStop.cpp:927
Boundary myMovingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
Definition GNEStop.h:211
void drawStopOverStoppingPlace(const GUIVisualizationSettings::Detail d, const RGBColor &color, const double width, const double exaggeration) const
draw stop over stoppingPlace
Definition GNEStop.cpp:1070
std::string getParentName() const
Returns the name of the parent object.
Definition GNEStop.cpp:329
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition GNEStop.cpp:860
GNEStop & operator=(const GNEStop &)=delete
Invalidated assignment operator.
double getAttributeDouble(SumoXMLAttr key) const
Definition GNEStop.cpp:588
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition GNEStop.cpp:453
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition GNEStop.cpp:1393
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition GNEStop.cpp:195
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
Definition GNEStop.cpp:423
void computePathElement()
compute pathElement
Definition GNEStop.cpp:416
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNEStop.cpp:429
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEStop.cpp:349
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:1018
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNEStop.cpp:373
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition GNEStop.cpp:667
std::string mySecondOriginalPosition
value for saving second original position over lane before moving
Definition GNEStop.h:220
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition GNEStop.cpp:1365
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNEStop.cpp:269
std::string myFirstOriginalLanePosition
value for saving first original position over lane before moving
Definition GNEStop.h:217
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition GNEStop.cpp:343
const int myCreationIndex
creation index (using for saving sorted)
Definition GNEStop.h:223
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition GNEStop.cpp:954
Position myOriginalViewPosition
value for saving first original position over lane before moving
Definition GNEStop.h:214
void drawGeometryPoints(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const RGBColor &baseColor) const
draw geometry points
Definition GNEStop.cpp:1419
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition GNEStop.cpp:949
bool canDrawVehicleStop() const
check if vehicle stop can be draw
Definition GNEStop.cpp:979
void updateGeometry()
update pre-computed geometry information
Definition GNEStop.cpp:304
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition GNEStop.cpp:965
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:1314
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNEStop.cpp:230
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
std::map< std::string, std::string > Map
parameters map
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.