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-2020 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
22 
23 #include "GNEDemandElement.h"
24 
25 // ===========================================================================
26 // class definitions
27 // ===========================================================================
32 
33 public:
35  GNEPersonStop(GNENet* net, GNEDemandElement* personParent, GNEAdditional* stoppingPlace, const SUMOVehicleParameter::Stop& stopParameter);
36 
38  GNEPersonStop(GNENet* net, GNEDemandElement* personParent, GNEEdge* edge, const SUMOVehicleParameter::Stop& stopParameter);
39 
42 
47  std::string getBegin() const;
48 
52  void writeDemandElement(OutputDevice& device) const;
53 
55  bool isDemandElementValid() const;
56 
58  std::string getDemandElementProblem() const;
59 
62 
67 
69  const RGBColor& getColor() const;
70 
72 
76  void startGeometryMoving();
77 
79  void endGeometryMoving();
80 
84  void moveGeometry(const Position& offset);
85 
89  void commitGeometryMoving(GNEUndoList* undoList);
90 
92  void updateGeometry();
93 
95  void computePath();
96 
98  void invalidatePath();
99 
101  Position getPositionInView() const;
103 
106 
109  std::string getParentName() const;
110 
115 
117  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
118 
123  void drawGL(const GUIVisualizationSettings& s) const;
124 
130  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const double offsetFront) const;
131 
138  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const double offsetFront) 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 setting the attribute and letting the object perform demand element changes
156  * @param[in] key The attribute key
157  * @param[in] value The new value
158  * @param[in] undoList The undoList on which to register changes
159  * @param[in] net optionally the GNENet to inform about gui updates
160  */
161  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
162 
163  /* @brief method for setting the attribute and letting the object perform demand element changes
164  * @param[in] key The attribute key
165  * @param[in] value The new value
166  * @param[in] undoList The undoList on which to register changes
167  */
168  bool isValid(SumoXMLAttr key, const std::string& value);
169 
170  /* @brief method for enable attribute
171  * @param[in] key The attribute key
172  * @param[in] undoList The undoList on which to register changes
173  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
174  */
175  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
176 
177  /* @brief method for disable attribute
178  * @param[in] key The attribute key
179  * @param[in] undoList The undoList on which to register changes
180  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
181  */
182  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
183 
184  /* @brief method for check if the value for certain attribute is set
185  * @param[in] key The attribute key
186  */
187  bool isAttributeEnabled(SumoXMLAttr key) const;
188 
190  std::string getPopUpID() const;
191 
193  std::string getHierarchyName() const;
195 
197  const std::map<std::string, std::string>& getACParametersMap() const;
198 
200  double getStartGeometryPositionOverLane() const;
201 
203  double getEndGeometryPositionOverLane() const;
204 
205 protected:
208 
209 private:
211  void setAttribute(SumoXMLAttr key, const std::string& value);
212 
214  void setEnabledAttribute(const int enabledAttributes);
215 
217  GNEPersonStop(const GNEPersonStop&) = delete;
218 
221 };
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
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:47
An Element which don't belongs to GNENet but has influency in the simulation.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
const std::map< std::string, std::string > & 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...
double getEndGeometryPositionOverLane() const
get end position over lane that is applicable to the shape
GNEPersonStop(GNENet *net, GNEDemandElement *personParent, GNEAdditional *stoppingPlace, const SUMOVehicleParameter::Stop &stopParameter)
constructor used for stops over busStops
void invalidatePath()
invalidate path
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
DemandElementMove myStopMove
variable demand element move
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
GNEPersonStop & operator=(const GNEPersonStop &)=delete
Invalidated assignment operator.
const RGBColor & getColor() const
get color
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
std::string getBegin() const
get begin time of demand element
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
bool isAttributeEnabled(SumoXMLAttr key) const
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
void startGeometryMoving()
~GNEPersonStop()
destructor
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
void endGeometryMoving()
end movement
double getAttributeDouble(SumoXMLAttr key) const
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object.
double getStartGeometryPositionOverLane() const
get start position over lane that is applicable to the shape
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
SUMOVehicleClass getVClass() const
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
std::string getParentName() const
Returns the name of the parent object.
Position getPositionInView() const
Returns position of demand element in view.
void updateGeometry()
update pre-computed geometry information
GNEPersonStop(const GNEPersonStop &)=delete
Invalidated copy constructor.
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
void computePath()
compute path
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
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.
struct for pack all variables related with Demand Element moving