Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNEStoppingPlace.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 abstract class to define common parameters of lane area in which vehicles can halt (GNE version)
19/****************************************************************************/
20#pragma once
21#include <config.h>
22
23#include "GNEAdditional.h"
24
25// ===========================================================================
26// class definitions
27// ===========================================================================
28
30
31public:
37
51 GNEStoppingPlace(const std::string& id, GNENet* net, const std::string& filename, SumoXMLTag tag, GNELane* lane,
52 const double startPos, const double endPos, const std::string& name, bool friendlyPosition,
53 const RGBColor& color, const Parameterised::Map& parameters);
54
57
62
65
68 virtual void writeAdditional(OutputDevice& device) const = 0;
69
71 bool isAdditionalValid() const;
72
74 std::string getAdditionalProblem() const;
75
78
80
83
85 bool checkDrawMoveContour() const;
86
88
92 virtual void updateGeometry() = 0;
93
96
98 void updateCenteringBoundary(const bool updateGrid);
99
101 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
102
104
109 std::string getParentName() const;
110
115 virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
116
118
121 /* @brief method for getting the Attribute of an XML key
122 * @param[in] key The attribute key
123 * @return string with the value associated to key
124 */
125 virtual std::string getAttribute(SumoXMLAttr key) const = 0;
126
127 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
128 * @param[in] key The attribute key
129 * @return double with the value associated to key
130 */
131 virtual double getAttributeDouble(SumoXMLAttr key) const = 0;
132
135
136 /* @brief method for setting the attribute and letting the object perform additional changes
137 * @param[in] key The attribute key
138 * @param[in] value The new value
139 * @param[in] undoList The undoList on which to register changes
140 */
141 virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
142
143 /* @brief method for checking if the key and their conrrespond attribute are valids
144 * @param[in] key The attribute key
145 * @param[in] value The value associated to key key
146 * @return true if the value is valid, false in other case
147 */
148 virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
149
150 /* @brief method for check if the value for certain attribute is set
151 * @param[in] key The attribute key
152 */
153 bool isAttributeEnabled(SumoXMLAttr key) const;
154
156 std::string getPopUpID() const;
157
159 std::string getHierarchyName() const;
160
162
163protected:
165 double myStartPosition = 0;
166
168 double myEndPosition = 0;
169
171 bool myFriendlyPosition = false;
172
175
177 double mySize = 10;
178
180 bool myForceSize = false;
181
184
187
190
193
195 void writeStoppingPlaceAttributes(OutputDevice& device) const;
196
197 /* @brief method for getting the stoppingPlace attribute of an XML key
198 * @param[in] key The attribute key
199 * @return string with the value associated to key
200 */
201 std::string getStoppingPlaceAttribute(const Parameterised* parameterised, SumoXMLAttr key) const;
202
203 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
204 * @param[in] key The attribute key
205 * @return double with the value associated to key
206 */
208
209 /* @brief method for setting the stoppingPlace attribute and letting the object perform additional changes
210 * @param[in] key The attribute key
211 * @param[in] value The new value
212 * @param[in] undoList The undoList on which to register changes
213 */
214 void setStoppingPlaceAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
215
216 /* @brief method for check if new value for certain stoppingPlace attribute is valid
217 * @param[in] key The attribute key
218 * @param[in] value The new value
219 */
220 bool isStoppingPlaceValid(SumoXMLAttr key, const std::string& value) const;
221
223 void setStoppingPlaceAttribute(Parameterised* parameterised, SumoXMLAttr key, const std::string& value);
224
226
228 void setStoppingPlaceGeometry(double movingToSide);
229
231 void drawLines(const GUIVisualizationSettings::Detail d, const std::vector<std::string>& lines,
232 const RGBColor& color) const;
233
235 void drawSign(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d, const double exaggeration,
236 const RGBColor& baseColor, const RGBColor& signColor, const std::string& word) const;
237
240 const double width, const double exaggeration, const bool movingGeometryPoints) const;
241
242private:
244 virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
245
248
250 double getEndGeometryPositionOverLane() const;
251
253 void setMoveShape(const GNEMoveResult& moveResult);
254
256 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
257
259 void adjustLenght(const double length, GNEUndoList* undoList);
260
262 void setPosition(const Position& pos) = delete;
263};
ReferencePosition
Reference position.
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
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
void fixAdditionalProblem()
fix additional problem (must be reimplemented in all detector children)
void updateCenteringBoundary(const bool updateGrid)
update centering boundary (implies change in RTREE)
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
virtual bool isValid(SumoXMLAttr key, const std::string &value)=0
method for checking if the key and their correspondent attribute are valids
bool isStoppingPlaceValid(SumoXMLAttr key, const std::string &value) const
void setStoppingPlaceAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
GNEMoveOperation * getMoveOperation()
get move operation
void writeStoppingPlaceAttributes(OutputDevice &device) const
write common stoppingPlace attributes
Position getPositionInView() const
Returns position of additional in view.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
virtual void setAttribute(SumoXMLAttr key, const std::string &value)=0
set attribute after validation
bool checkDrawMoveContour() const
check if draw move contour (red)
virtual double getAttributeDouble(SumoXMLAttr key) const =0
void drawSign(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double exaggeration, const RGBColor &baseColor, const RGBColor &signColor, const std::string &word) const
draw sign
~GNEStoppingPlace()
Destructor.
std::string getStoppingPlaceAttribute(const Parameterised *parameterised, SumoXMLAttr key) const
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
double getStoppingPlaceAttributeDouble(SumoXMLAttr key) const
bool myForceSize
force size (only used in templates
RGBColor myColor
RGB color.
const Parameterised::Map & getACParametersMap() const
get parameters map
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
void calculateStoppingPlaceContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double width, const double exaggeration, const bool movingGeometryPoints) const
check object in view
virtual void updateGeometry()=0
update pre-computed geometry information
bool myFriendlyPosition
Flag for friendly position.
void drawLines(const GUIVisualizationSettings::Detail d, const std::vector< std::string > &lines, const RGBColor &color) const
draw lines
void adjustLenght(const double length, GNEUndoList *undoList)
adjust lenght
std::string getAdditionalProblem() const
return a string with the current additional problem (must be reimplemented in all detector children)
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Position mySymbolPosition
The position of the sign.
bool isAdditionalValid() const
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
ReferencePosition myReferencePosition
reference position
virtual void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)=0
method for setting the attribute and letting the object perform additional changes
void setStoppingPlaceGeometry(double movingToSide)
set geometry common to all stopping places
bool isAttributeEnabled(SumoXMLAttr key) const
double myEndPosition
The position this stopping place is located at (-1 means empty)
GNEContour mySymbolContour
circle contour
void setPosition(const Position &pos)=delete
Invalidate set new position in the view.
std::string getParentName() const
Returns the name of the parent object (if any)
virtual std::string getAttribute(SumoXMLAttr key) const =0
double mySize
size (only use in templates)
virtual void writeAdditional(OutputDevice &device) const =0
write additional element into a xml file
double myStartPosition
The relative start position this stopping place is located at (-1 means empty)
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
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.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
static const RGBColor INVISIBLE
Definition RGBColor.h:198