Eclipse SUMO - Simulation of Urban MObility
GNEStopPlan.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"
24 #include "GNEDemandElementPlan.h"
25 
26 // ===========================================================================
27 // class definitions
28 // ===========================================================================
29 
31 
32 public:
34  GNEStopPlan(SumoXMLTag tag, GNENet* net);
35 
49  GNEStopPlan(GNENet* net, SumoXMLTag tag, GUIIcon icon, GNEDemandElement* personParent, const GNEPlanParents& planParameters,
50  const double endPos, const SUMOTime duration, const SUMOTime until, const std::string& actType, bool friendlyPos, const int parameterSet);
51 
53  ~GNEStopPlan();
54 
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 
130  void drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
131 
137  void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
138 
140  GNELane* getFirstPathLane() const;
141 
143  GNELane* getLastPathLane() const;
145 
148  /* @brief method for getting the Attribute of an XML key
149  * @param[in] key The attribute key
150  * @return string with the value associated to key
151  */
152  std::string getAttribute(SumoXMLAttr key) const;
153 
154  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
155  * @param[in] key The attribute key
156  * @return double with the value associated to key
157  */
158  double getAttributeDouble(SumoXMLAttr key) const;
159 
160  /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
161  * @param[in] key The attribute key
162  * @return double with the value associated to key
163  */
165 
166  /* @brief method for setting the attribute and letting the object perform demand element changes
167  * @param[in] key The attribute key
168  * @param[in] value The new value
169  * @param[in] undoList The undoList on which to register changes
170  * @param[in] net optionally the GNENet to inform about gui updates
171  */
172  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
173 
174  /* @brief method for setting the attribute and letting the object perform demand element changes
175  * @param[in] key The attribute key
176  * @param[in] value The new value
177  * @param[in] undoList The undoList on which to register changes
178  */
179  bool isValid(SumoXMLAttr key, const std::string& value);
180 
181  /* @brief method for enable attribute
182  * @param[in] key The attribute key
183  * @param[in] undoList The undoList on which to register changes
184  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
185  */
186  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
187 
188  /* @brief method for disable attribute
189  * @param[in] key The attribute key
190  * @param[in] undoList The undoList on which to register changes
191  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
192  */
193  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
194 
195  /* @brief method for check if the value for certain attribute is set
196  * @param[in] key The attribute key
197  */
198  bool isAttributeEnabled(SumoXMLAttr key) const;
199 
201  std::string getPopUpID() const;
202 
204  std::string getHierarchyName() const;
206 
208  const Parameterised::Map& getACParametersMap() const;
209 
210 protected:
213 
216 
219 
222 
225 
227  std::string myActType;
228 
231 
234 
235 private:
237  void setAttribute(SumoXMLAttr key, const std::string& value);
238 
240  void toggleAttribute(SumoXMLAttr key, const bool value);
241 
243  void setMoveShape(const GNEMoveResult& moveResult);
244 
246  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
247 
249  GNEStopPlan(const GNEStopPlan&) = delete;
250 
252  GNEStopPlan& operator=(const GNEStopPlan&) = delete;
253 };
long long int SUMOTime
Definition: GUI.h:35
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
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
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
GNEPlanParents (used for group all plan parents)
GNEContour myStopContour
variable used for draw contours
Definition: GNEStopPlan.h:212
GNEStopPlan(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEStopPlan.cpp:36
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
bool isAttributeEnabled(SumoXMLAttr key) const
GNEStopPlan & operator=(const GNEStopPlan &)=delete
Invalidated assignment operator.
std::string getParentName() const
Returns the name of the parent object.
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
SUMOTime myDuration
duration
Definition: GNEStopPlan.h:221
GNEContour myStopSignContour
variable used for draw sign contours
Definition: GNEStopPlan.h:215
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
bool myFriendlyPos
friendly pos
Definition: GNEStopPlan.h:230
void toggleAttribute(SumoXMLAttr key, const bool value)
method for enable or disable the attribute and nothing else (used in GNEChange_ToggleAttribute)
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
GNEStopPlan(const GNEStopPlan &)=delete
Invalidated copy constructor.
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEStopPlan.cpp:64
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
SUMOTime myUntil
until
Definition: GNEStopPlan.h:224
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition: GNEStopPlan.cpp:91
GNELane * getLastPathLane() const
get last path lane
void updateGeometry()
update pre-computed geometry information
void computePathElement()
compute pathElement
Position mySignPosition
sign position
Definition: GNEStopPlan.h:218
double getAttributeDouble(SumoXMLAttr key) const
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
const Parameterised::Map & getACParametersMap() const
get parameters map
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEStopPlan.cpp:97
std::string myActType
act type
Definition: GNEStopPlan.h:227
Position getPositionInView() const
Returns position of demand element in view.
GNELane * getFirstPathLane() const
get first path lane
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
~GNEStopPlan()
destructor
Definition: GNEStopPlan.cpp:60
const RGBColor & getColor() const
get color
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition: GNEStopPlan.cpp:70
Position getAttributePosition(SumoXMLAttr key) const
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
int myParametersSet
parameter set
Definition: GNEStopPlan.h:233
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
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