Eclipse SUMO - Simulation of Urban MObility
GNEPersonStop.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-2021 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 person 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  GNEPersonStop(GNENet* net, GNEDemandElement* personParent, GNEAdditional* stoppingPlace, const SUMOVehicleParameter::Stop& stopParameter);
37 
39  GNEPersonStop(GNENet* net, GNEDemandElement* personParent, GNEEdge* edge, const SUMOVehicleParameter::Stop& stopParameter);
40 
43 
47  GNEMoveOperation* getMoveOperation(const double shapeOffset);
48 
53  std::string getBegin() const;
54 
58  void writeDemandElement(OutputDevice& device) const;
59 
61  bool isDemandElementValid() const;
62 
64  std::string getDemandElementProblem() const;
65 
68 
73 
75  const RGBColor& getColor() const;
76 
78 
82  void updateGeometry();
83 
87 
90 
93  std::string getParentName() const;
94 
99 
101  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
102 
107  void drawGL(const GUIVisualizationSettings& s) const;
108 
110 
113 
115  void computePathElement();
116 
123  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
124 
132  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
133 
135  GNELane* getFirstPathLane() const;
136 
138  GNELane* getLastPathLane() const;
140 
143  /* @brief method for getting the Attribute of an XML key
144  * @param[in] key The attribute key
145  * @return string with the value associated to key
146  */
147  std::string getAttribute(SumoXMLAttr key) const;
148 
149  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
150  * @param[in] key The attribute key
151  * @return double with the value associated to key
152  */
153  double getAttributeDouble(SumoXMLAttr key) const;
154 
155  /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
156  * @param[in] key The attribute key
157  * @return double with the value associated to key
158  */
160 
161  /* @brief method for setting the attribute and letting the object perform demand element changes
162  * @param[in] key The attribute key
163  * @param[in] value The new value
164  * @param[in] undoList The undoList on which to register changes
165  * @param[in] net optionally the GNENet to inform about gui updates
166  */
167  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
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  */
174  bool isValid(SumoXMLAttr key, const std::string& value);
175 
176  /* @brief method for enable attribute
177  * @param[in] key The attribute key
178  * @param[in] undoList The undoList on which to register changes
179  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
180  */
181  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
182 
183  /* @brief method for disable attribute
184  * @param[in] key The attribute key
185  * @param[in] undoList The undoList on which to register changes
186  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
187  */
188  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
189 
190  /* @brief method for check if the value for certain attribute is set
191  * @param[in] key The attribute key
192  */
193  bool isAttributeEnabled(SumoXMLAttr key) const;
194 
196  std::string getPopUpID() const;
197 
199  std::string getHierarchyName() const;
201 
203  const std::map<std::string, std::string>& getACParametersMap() const;
204 
205 protected:
207  const GNELane* getFirstAllowedLane() const;
208 
210  void drawPersonStopOverLane(const GUIVisualizationSettings& s, const double exaggeration, const RGBColor& stopColor) const;
211 
213  void drawPersonStopOverBusStop(const GUIVisualizationSettings& s, const double exaggeration, const RGBColor& stopColor) const;
214 
215 private:
217  void setAttribute(SumoXMLAttr key, const std::string& value);
218 
220  void setEnabledAttribute(const int enabledAttributes);
221 
223  void setMoveShape(const GNEMoveResult& moveResult);
224 
226  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
227 
229  GNEPersonStop(const GNEPersonStop&) = delete;
230 
232  GNEPersonStop& operator=(const GNEPersonStop&) = delete;
233 };
GNEPersonStop::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEPersonStop.cpp:731
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:131
GNEPersonStop::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPersonStop.cpp:227
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:52
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
SUMOVehicleParameter::Stop::edge
std::string edge
The edge to stop at (used only in NETEDIT)
Definition: SUMOVehicleParameter.h:338
GNEPersonStop::drawPartialGL
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNEPersonStop.cpp:273
GNEMoveOperation
move operation
Definition: GNEMoveElement.h:37
SUMOVehicleParameter::Stop::lane
std::string lane
The lane to stop at.
Definition: SUMOVehicleParameter.h:341
GNEPersonStop::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPersonStop.cpp:191
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:61
GNEPersonStop::getPositionInView
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEPersonStop.cpp:171
GNEPersonStop::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPersonStop.cpp:556
GNENet
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNEPersonStop::getDemandElementProblem
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEPersonStop.cpp:105
GNEPersonStop::getFirstPathLane
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEPersonStop.cpp:285
GNEMoveResult
move result
Definition: GNEMoveElement.h:146
GNEPersonStop::getColor
const RGBColor & getColor() const
get color
Definition: GNEPersonStop.cpp:138
GNEPersonStop::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPersonStop.cpp:562
GNEPersonStop::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPersonStop.cpp:546
GNEPersonStop::getACParametersMap
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEPersonStop.cpp:572
GNEPersonStop::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEPersonStop.cpp:76
GNEPersonStop::drawPersonStopOverBusStop
void drawPersonStopOverBusStop(const GUIVisualizationSettings &s, const double exaggeration, const RGBColor &stopColor) const
draw personStop over busStop
Definition: GNEPersonStop.cpp:637
SUMOVehicleParameter.h
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEPersonStop::computePathElement
void computePathElement()
compute pathElement
Definition: GNEPersonStop.cpp:266
GNEPersonStop::getMoveOperation
GNEMoveOperation * getMoveOperation(const double shapeOffset)
get move operation for the given shapeOffset
Definition: GNEPersonStop.cpp:58
RGBColor
Definition: RGBColor.h:37
GNEPersonStop::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEPersonStop.cpp:221
GNEDemandElement.h
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
GNEPersonStop::operator=
GNEPersonStop & operator=(const GNEPersonStop &)=delete
Invalidated assignment operator.
GNEPersonStop::commitMoveShape
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEPersonStop.cpp:746
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
GNEPersonStop::isDemandElementValid
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEPersonStop.cpp:82
GNEPersonStop::setMoveShape
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEPersonStop.cpp:737
GNEPersonStop::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPersonStop.cpp:491
GNEPersonStop::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPersonStop.cpp:523
GNEPersonStop::getLastPathLane
GNELane * getLastPathLane() const
get last path lane
Definition: GNEPersonStop.cpp:296
GNEPersonStop::drawPersonStopOverLane
void drawPersonStopOverLane(const GUIVisualizationSettings &s, const double exaggeration, const RGBColor &stopColor) const
draw personStop over lane
Definition: GNEPersonStop.cpp:592
GNEPersonStop::getAttribute
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEPersonStop.cpp:303
GNEPersonStop
Definition: GNEPersonStop.h:32
GNEPersonStop::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPersonStop.cpp:343
GNEPersonStop::getFirstAllowedLane
const GNELane * getFirstAllowedLane() const
get first valid lane
Definition: GNEPersonStop.cpp:578
GNEPersonStop::GNEPersonStop
GNEPersonStop(GNENet *net, GNEDemandElement *personParent, GNEAdditional *stoppingPlace, const SUMOVehicleParameter::Stop &stopParameter)
constructor used for stops over busStops
Definition: GNEPersonStop.cpp:40
GNEPersonStop::getBegin
std::string getBegin() const
get begin time of demand element
Definition: GNEPersonStop.cpp:70
GNEPersonStop::~GNEPersonStop
~GNEPersonStop()
destructor
Definition: GNEPersonStop.cpp:54
GNEPersonStop::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPersonStop.cpp:126
GNENetworkElement
Definition: GNENetworkElement.h:41
config.h
GNEPersonStop::setAttribute
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition: GNEPersonStop.cpp:386
GNEPersonStop::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPersonStop.cpp:207
GNEPersonStop::getVClass
SUMOVehicleClass getVClass() const
Definition: GNEPersonStop.cpp:132
GNEPersonStop::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEPersonStop.cpp:144
GNEUndoList
Definition: GNEUndoList.h:46
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:505
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:432
GNEPersonStop::getAttributePosition
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEPersonStop.cpp:359
GNEPathManager::Segment
segment
Definition: GNEPathManager.h:44
GNELane
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
GNEPersonStop::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEPersonStop.cpp:453
SUMOVehicleParameter::Stop
Definition of vehicle stop (position and duration)
Definition: SUMOVehicleParameter.h:322