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>
23 
24 #include "GNEDemandElement.h"
25 
26 // ===========================================================================
27 // class definitions
28 // ===========================================================================
33 
34 public:
36  GNEStop(SumoXMLTag tag, GNENet* net);
37 
39  GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNEAdditional* stoppingPlace, const SUMOVehicleParameter::Stop& stopParameter);
40 
42  GNEStop(GNENet* net, GNEDemandElement* stopParent, GNELane* lane, const SUMOVehicleParameter::Stop& stopParameter);
43 
45  GNEStop(SumoXMLTag tag, GNENet* net, GNEDemandElement* stopParent, GNEEdge* edge, const SUMOVehicleParameter::Stop& stopParameter);
46 
48  ~GNEStop();
49 
54 
59  std::string getBegin() const;
60 
64  void writeDemandElement(OutputDevice& device) const;
65 
68 
70  std::string getDemandElementProblem() const;
71 
74 
79 
81  const RGBColor& getColor() const;
82 
84 
88  void updateGeometry();
89 
93 
96 
99  std::string getParentName() const;
100 
102  double getExaggeration(const GUIVisualizationSettings& s) const;
103 
108 
110  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
111 
116  void drawGL(const GUIVisualizationSettings& s) const;
117 
119 
122 
124  void computePathElement();
125 
132  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
133 
141  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
142 
144  GNELane* getFirstPathLane() const;
145 
147  GNELane* getLastPathLane() const;
149 
152  /* @brief method for getting the Attribute of an XML key
153  * @param[in] key The attribute key
154  * @return string with the value associated to key
155  */
156  std::string getAttribute(SumoXMLAttr key) const;
157 
158  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
159  * @param[in] key The attribute key
160  * @return double with the value associated to key
161  */
162  double getAttributeDouble(SumoXMLAttr key) const;
163 
164  /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
165  * @param[in] key The attribute key
166  * @return double with the value associated to key
167  */
169 
170  /* @brief method for setting the attribute and letting the object perform demand element changes
171  * @param[in] key The attribute key
172  * @param[in] value The new value
173  * @param[in] undoList The undoList on which to register changes
174  * @param[in] net optionally the GNENet to inform about gui updates
175  */
176  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
177 
178  /* @brief method for setting the attribute and letting the object perform demand element changes
179  * @param[in] key The attribute key
180  * @param[in] value The new value
181  * @param[in] undoList The undoList on which to register changes
182  */
183  bool isValid(SumoXMLAttr key, const std::string& value);
184 
185  /* @brief method for enable attribute
186  * @param[in] key The attribute key
187  * @param[in] undoList The undoList on which to register changes
188  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
189  */
190  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
191 
192  /* @brief method for disable attribute
193  * @param[in] key The attribute key
194  * @param[in] undoList The undoList on which to register changes
195  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
196  */
197  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
198 
199  /* @brief method for check if the value for certain attribute is set
200  * @param[in] key The attribute key
201  */
202  bool isAttributeEnabled(SumoXMLAttr key) const;
203 
205  std::string getPopUpID() const;
206 
208  std::string getHierarchyName() const;
210 
212  const std::map<std::string, std::string>& getACParametersMap() const;
213 
215  double getStartGeometryPositionOverLane() const;
216 
218  double getEndGeometryPositionOverLane() const;
219 
220 protected:
223 
226 
229 
232 
234  const GNELane* getFirstAllowedLane() const;
235 
237  bool canDrawVehicleStop() const;
238 
240  void drawVehicleStop(const GUIVisualizationSettings& s, const double exaggeration) const;
241 
243  void drawStopPersonOverEdge(const GUIVisualizationSettings& s, const double exaggeration) const;
244 
246  void drawStopPersonOverBusStop(const GUIVisualizationSettings& s, const double exaggeration) const;
247 
248 private:
250  void setAttribute(SumoXMLAttr key, const std::string& value);
251 
253  void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters);
254 
256  void setMoveShape(const GNEMoveResult& moveResult);
257 
259  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
260 
262  void drawGeometryPoints(const GUIVisualizationSettings& s, const RGBColor& baseColor) const;
263 
265  GNEStop(const GNEStop&) = delete;
266 
268  GNEStop& operator=(const GNEStop&) = delete;
269 };
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 belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
An Element which don't belongs to GNENet but has influency 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:295
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEStop.cpp:725
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEStop.cpp:1295
std::string getBegin() const
get begin time of demand element
Definition: GNEStop.cpp:133
SUMOVehicleClass getVClass() const
Definition: GNEStop.cpp:289
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEStop.cpp:839
~GNEStop()
destructor
Definition: GNEStop.cpp:79
GNEStop(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEStop.cpp:38
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEStop.cpp:468
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEStop.cpp:592
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEStop.cpp:882
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEStop.cpp:346
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEStop.cpp:414
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEStop.cpp:855
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNEStop.cpp:456
GNELane * getLastPathLane() const
get last path lane
Definition: GNEStop.cpp:481
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEStop.cpp:139
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEStop.cpp:83
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEStop.cpp:888
Boundary myMovingGeometryBoundary
boundary used during moving of elements (to avoid insertion in RTREE)
Definition: GNEStop.h:222
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEStop.cpp:376
void drawStopPersonOverBusStop(const GUIVisualizationSettings &s, const double exaggeration) const
draw stopPerson over busStop
Definition: GNEStop.cpp:1107
GNEStop & operator=(const GNEStop &)=delete
Invalidated assignment operator.
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEStop.cpp:823
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEStop.cpp:570
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEStop.cpp:488
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEStop.cpp:1386
void drawGeometryPoints(const GUIVisualizationSettings &s, const RGBColor &baseColor) const
draw geometry points
Definition: GNEStop.cpp:1417
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEStop.cpp:173
void computePathElement()
compute pathElement
Definition: GNEStop.cpp:449
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEStop.cpp:396
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEStop.cpp:420
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:619
void drawStopPersonOverEdge(const GUIVisualizationSettings &s, const double exaggeration) const
draw stopPerson over lane
Definition: GNEStop.cpp:1039
std::string mySecondOriginalPosition
value for saving second original position over lane before moving
Definition: GNEStop.h:231
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEStop.cpp:1353
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEStop.cpp:283
std::string myFirstOriginalLanePosition
value for saving first original position over lane before moving
Definition: GNEStop.h:228
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
Definition: GNEStop.cpp:390
void drawVehicleStop(const GUIVisualizationSettings &s, const double exaggeration) const
draw vehicle stop
Definition: GNEStop.cpp:960
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
Definition: GNEStop.cpp:905
Position myOriginalViewPosition
value for saving first original position over lane before moving
Definition: GNEStop.h:225
bool canDrawVehicleStop() const
check if vehicle stop can be draw
Definition: GNEStop.cpp:944
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEStop.cpp:900
void updateGeometry()
update pre-computed geometry information
Definition: GNEStop.cpp:305
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
Definition: GNEStop.cpp:916
GNEStop(const GNEStop &)=delete
Invalidated copy constructor.
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEStop.cpp:229
const GNELane * getFirstAllowedLane() const
get first valid lane
Definition: GNEStop.cpp:930
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
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.