Eclipse SUMO - Simulation of Urban MObility
GNEStop.h
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3// Copyright (C) 2001-2022 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"
24
25// ===========================================================================
26// class definitions
27// ===========================================================================
32
33public:
35 GNEStop(SumoXMLTag tag, GNENet* net);
36
38 GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNEAdditional* stoppingPlace, const SUMOVehicleParameter::Stop& stopParameter);
39
41 GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNELane* lane, const SUMOVehicleParameter::Stop& stopParameter);
42
44 GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNEEdge* edge, const SUMOVehicleParameter::Stop& stopParameter);
45
47 ~GNEStop();
48
53
58 std::string getBegin() const;
59
63 void writeDemandElement(OutputDevice& device) const;
64
67
69 std::string getDemandElementProblem() const;
70
73
78
80 const RGBColor& getColor() const;
81
83
87 void updateGeometry();
88
92
95
98 std::string getParentName() const;
99
101 double getExaggeration(const GUIVisualizationSettings& s) const;
102
107
109 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
110
115 void drawGL(const GUIVisualizationSettings& s) const;
116
118
121
123 void computePathElement();
124
131 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
132
140 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
141
143 GNELane* getFirstPathLane() const;
144
146 GNELane* getLastPathLane() const;
148
151 /* @brief method for getting the Attribute of an XML key
152 * @param[in] key The attribute key
153 * @return string with the value associated to key
154 */
155 std::string getAttribute(SumoXMLAttr key) const;
156
157 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
158 * @param[in] key The attribute key
159 * @return double with the value associated to key
160 */
161 double getAttributeDouble(SumoXMLAttr key) const;
162
163 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
164 * @param[in] key The attribute key
165 * @return double with the value associated to key
166 */
168
169 /* @brief method for setting the attribute and letting the object perform demand element changes
170 * @param[in] key The attribute key
171 * @param[in] value The new value
172 * @param[in] undoList The undoList on which to register changes
173 * @param[in] net optionally the GNENet to inform about gui updates
174 */
175 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
176
177 /* @brief method for setting the attribute and letting the object perform demand element changes
178 * @param[in] key The attribute key
179 * @param[in] value The new value
180 * @param[in] undoList The undoList on which to register changes
181 */
182 bool isValid(SumoXMLAttr key, const std::string& value);
183
184 /* @brief method for enable attribute
185 * @param[in] key The attribute key
186 * @param[in] undoList The undoList on which to register changes
187 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
188 */
189 void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
190
191 /* @brief method for disable attribute
192 * @param[in] key The attribute key
193 * @param[in] undoList The undoList on which to register changes
194 * @note certain attributes can be only enabled, and can produce the disabling of other attributes
195 */
196 void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
197
198 /* @brief method for check if the value for certain attribute is set
199 * @param[in] key The attribute key
200 */
201 bool isAttributeEnabled(SumoXMLAttr key) const;
202
204 std::string getPopUpID() const;
205
207 std::string getHierarchyName() const;
209
212
215
217 double getEndGeometryPositionOverLane() const;
218
219protected:
222
225
228
231
234
236 const GNELane* getFirstAllowedLane() const;
237
239 bool canDrawVehicleStop() const;
240
242 void drawVehicleStop(const GUIVisualizationSettings& s, const double exaggeration) const;
243
245 void drawStopPersonOverEdge(const GUIVisualizationSettings& s, const double exaggeration) const;
246
248 void drawStopPersonOverBusStop(const GUIVisualizationSettings& s, const double exaggeration) const;
249
251 bool drawIndex() const;
252
253private:
255 void setAttribute(SumoXMLAttr key, const std::string& value);
256
258 void toggleAttribute(SumoXMLAttr key, const bool value);
259
261 void setMoveShape(const GNEMoveResult& moveResult);
262
264 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
265
267 void drawGeometryPoints(const GUIVisualizationSettings& s, const RGBColor& baseColor) const;
268
270 GNEStop(const GNEStop&) = delete;
271
273 GNEStop& operator=(const GNEStop&) = delete;
274};
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.
Definition: GNEAdditional.h:48
An Element which don't belong to GNENet but has influence in the simulation.
Problem
enum class for demandElement problems
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
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
const RGBColor & getColor() const
get color
Definition: GNEStop.cpp:342
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEStop.cpp:855
std::string getBegin() const
get begin time of demand element
Definition: GNEStop.cpp:180
SUMOVehicleClass getVClass() const
Definition: GNEStop.cpp:336
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEStop.cpp:1001
~GNEStop()
destructor
Definition: GNEStop.cpp:126
GNEStop(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEStop.cpp:42
bool drawIndex() const
draw index
Definition: GNEStop.cpp:1413
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEStop.cpp:537
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEStop.cpp:716
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEStop.cpp:1048
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEStop.cpp:408
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEStop.cpp:476
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEStop.cpp:1017
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNEStop.cpp:525
GNELane * getLastPathLane() const
get last path lane
Definition: GNEStop.cpp:550
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition: GNEStop.cpp:186
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEStop.cpp:130
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEStop.cpp:1054
Boundary myMovingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
Definition: GNEStop.h:221
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEStop.cpp:438
void drawStopPersonOverBusStop(const GUIVisualizationSettings &s, const double exaggeration) const
draw stopPerson over busStop
Definition: GNEStop.cpp:1342
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEStop.cpp:985
GNEStop & operator=(const GNEStop &)=delete
Invalidated assignment operator.
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEStop.cpp:670
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEStop.cpp:557
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEStop.cpp:1699
void drawGeometryPoints(const GUIVisualizationSettings &s, const RGBColor &baseColor) const
draw geometry points
Definition: GNEStop.cpp:1730
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEStop.cpp:220
void computePathElement()
compute pathElement
Definition: GNEStop.cpp:518
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEStop.cpp:458
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEStop.cpp:482
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:743
void drawStopPersonOverEdge(const GUIVisualizationSettings &s, const double exaggeration) const
draw stopPerson over lane
Definition: GNEStop.cpp:1261
std::string mySecondOriginalPosition
value for saving second original position over lane before moving
Definition: GNEStop.h:230
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEStop.cpp:1666
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEStop.cpp:330
std::string myFirstOriginalLanePosition
value for saving first original position over lane before moving
Definition: GNEStop.h:227
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNEStop.cpp:452
const int myCreationIndex
creation index (using for saving sorted)
Definition: GNEStop.h:233
void drawVehicleStop(const GUIVisualizationSettings &s, const double exaggeration) const
draw vehicle stop
Definition: GNEStop.cpp:1143
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition: GNEStop.cpp:1081
Position myOriginalViewPosition
value for saving first original position over lane before moving
Definition: GNEStop.h:224
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNEStop.cpp:1076
bool canDrawVehicleStop() const
check if vehicle stop can be draw
Definition: GNEStop.cpp:1120
void updateGeometry()
update pre-computed geometry information
Definition: GNEStop.cpp:367
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition: GNEStop.cpp:1092
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_EnableAttribute)
Definition: GNEStop.cpp:1615
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEStop.cpp:276
const GNELane * getFirstAllowedLane() const
get first valid lane
Definition: GNEStop.cpp:1106
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
std::map< std::string, std::string > Map
parameters map
Definition: Parameterised.h:45
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
Definition of vehicle stop (position and duration)
std::string edge
The edge to stop at (used only in NETEDIT)
std::string lane
The lane to stop at.