Eclipse SUMO - Simulation of Urban MObility
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-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 // 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 #include "GNEAdditional.h"
23 
24 // ===========================================================================
25 // class definitions
26 // ===========================================================================
32 
33 public:
46  GNEStoppingPlace(const std::string& id, GNENet* net, GUIGlObjectType type, SumoXMLTag tag, FXIcon* icon, GNELane* lane,
47  const double startPos, const double endPos, const std::string& name, bool friendlyPosition,
48  const Parameterised::Map& parameters);
49 
52 
57 
60 
63  virtual void writeAdditional(OutputDevice& device) const = 0;
64 
66  bool isAdditionalValid() const;
67 
69  std::string getAdditionalProblem() const;
70 
72  void fixAdditionalProblem();
73 
75 
78 
80  bool checkDrawMoveContour() const;
81 
83 
87  virtual void updateGeometry() = 0;
88 
91 
93  void updateCenteringBoundary(const bool updateGrid);
94 
96  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
98 
103  std::string getParentName() const;
104 
109  virtual void drawGL(const GUIVisualizationSettings& s) const = 0;
111 
114  /* @brief method for getting the Attribute of an XML key
115  * @param[in] key The attribute key
116  * @return string with the value associated to key
117  */
118  virtual std::string getAttribute(SumoXMLAttr key) const = 0;
119 
120  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
121  * @param[in] key The attribute key
122  * @return double with the value associated to key
123  */
124  virtual double getAttributeDouble(SumoXMLAttr key) const;
125 
127  const Parameterised::Map& getACParametersMap() const;
128 
129  /* @brief method for setting the attribute and letting the object perform additional changes
130  * @param[in] key The attribute key
131  * @param[in] value The new value
132  * @param[in] undoList The undoList on which to register changes
133  */
134  virtual void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) = 0;
135 
136  /* @brief method for checking if the key and their conrrespond attribute are valids
137  * @param[in] key The attribute key
138  * @param[in] value The value associated to key key
139  * @return true if the value is valid, false in other case
140  */
141  virtual bool isValid(SumoXMLAttr key, const std::string& value) = 0;
142 
144  std::string getPopUpID() const;
145 
147  std::string getHierarchyName() const;
149 
150 protected:
153 
156 
159 
162 
164  static const double myCircleWidth;
165 
167  static const double myCircleWidthSquared;
168 
170  static const double myCircleInWidth;
171 
173  static const double myCircleInText;
174 
176  void setStoppingPlaceGeometry(double movingToSide);
177 
179  void drawLines(const GUIVisualizationSettings::Detail d, const std::vector<std::string>& lines,
180  const RGBColor& color) const;
181 
183  void drawSign(const GUIVisualizationSettings::Detail d, const double exaggeration,
184  const RGBColor& baseColor, const RGBColor& signColor, const std::string& word) const;
185 
188  const double width, const bool movingGeometryPoints) const;
189 
190 private:
192  virtual void setAttribute(SumoXMLAttr key, const std::string& value) = 0;
193 
195  double getStartGeometryPositionOverLane() const;
196 
198  double getEndGeometryPositionOverLane() const;
199 
201  void setMoveShape(const GNEMoveResult& moveResult);
202 
204  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
205 
207  void setPosition(const Position& pos) = delete;
208 };
GUIGlObjectType
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:49
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
virtual double getAttributeDouble(SumoXMLAttr key) const
virtual void drawGL(const GUIVisualizationSettings &s) const =0
Draws the object.
GNEMoveOperation * getMoveOperation()
get move operation
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)
void drawSign(const GUIVisualizationSettings::Detail d, const double exaggeration, const RGBColor &baseColor, const RGBColor &signColor, const std::string &word) const
draw sign
static const double myCircleWidthSquared
squared circle width resolution for all stopping places
~GNEStoppingPlace()
Destructor.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
const Parameterised::Map & getACParametersMap() const
get parameters map
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
static const double myCircleWidth
circle width resolution for all stopping places
virtual void updateGeometry()=0
update pre-computed geometry information
bool myFriendlyPosition
Flag for friendly position.
static const double myCircleInText
text inner circle width resolution for all stopping places
void drawLines(const GUIVisualizationSettings::Detail d, const std::vector< std::string > &lines, const RGBColor &color) const
draw lines
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
static const double myCircleInWidth
inner circle width resolution for all stopping places
GNEStoppingPlace(const std::string &id, GNENet *net, GUIGlObjectType type, SumoXMLTag tag, FXIcon *icon, GNELane *lane, const double startPos, const double endPos, const std::string &name, bool friendlyPosition, const Parameterised::Map &parameters)
Constructor.
bool isAdditionalValid() const
check if current additional is valid to be written into XML (must be reimplemented in all detector ch...
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
void calculateStoppingPlaceContour(const GUIVisualizationSettings &s, const GUIVisualizationSettings::Detail d, const double width, const bool movingGeometryPoints) const
check object in view
double myEndPosition
The position this stopping place is located at (-1 means empty)
void setPosition(const Position &pos)=delete
Invalidate set new position in the view.
Position mySignPos
The position of the sign.
std::string getParentName() const
Returns the name of the parent object (if any)
virtual std::string getAttribute(SumoXMLAttr key) const =0
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.
Definition: OutputDevice.h:61
An upper class for objects with additional parameters.
Definition: Parameterised.h:41
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