Eclipse SUMO - Simulation of Urban MObility
GNEWalk.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2016-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 // A class for visualizing walks in Netedit
19 /****************************************************************************/
20 #pragma once
21 #include "GNEDemandElement.h"
23 
24 // ===========================================================================
25 // class declarations
26 // ===========================================================================
27 class GNEEdge;
28 class GNEConnection;
29 class GNEVehicle;
30 
31 // ===========================================================================
32 // class definitions
33 // ===========================================================================
34 
35 class GNEWalk : public GNEDemandElement, public Parameterised {
36 
37 public:
45  GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge, double arrivalPosition);
46 
54  GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toBusStop, double arrivalPosition);
55 
63  GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEAdditional* fromBusStop, GNEEdge* toEdge, double arrivalPosition);
64 
72  GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEAdditional* fromBusStop, GNEAdditional* toBusStop, double arrivalPosition);
73 
80  GNEWalk(GNENet* net, GNEDemandElement* personParent, std::vector<GNEEdge*> edges, double arrivalPosition);
81 
88  GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEDemandElement* route, double arrivalPosition);
89 
91  ~GNEWalk();
92 
96  void writeDemandElement(OutputDevice& device) const;
97 
99  bool isDemandElementValid() const;
100 
102  std::string getDemandElementProblem() const;
103 
106 
110  SUMOVehicleClass getVClass() const;
111 
113  const RGBColor& getColor() const;
114 
116 
120  void startGeometryMoving();
121 
123  void endGeometryMoving();
124 
128  void moveGeometry(const Position& offset);
129 
133  void commitGeometryMoving(GNEUndoList* undoList);
134 
136  void updateGeometry();
137 
139  void computePath();
140 
142  void invalidatePath();
143 
145  Position getPositionInView() const;
147 
150 
159 
163  std::string getParentName() const;
164 
169 
171  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
172 
177  void drawGL(const GUIVisualizationSettings& s) const;
178 
184  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const double offsetFront) const;
185 
192  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const double offsetFront) const;
194 
197  /* @brief method for getting the Attribute of an XML key
198  * @param[in] key The attribute key
199  * @return string with the value associated to key
200  */
201  std::string getAttribute(SumoXMLAttr key) const;
202 
203  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
204  * @param[in] key The attribute key
205  * @return double with the value associated to key
206  */
207  double getAttributeDouble(SumoXMLAttr key) const;
208 
209  /* @brief method for setting the attribute and letting the object perform additional changes
210  * @param[in] key The attribute key
211  * @param[in] value The new value
212  * @param[in] undoList The undoList on which to register changes
213  * @param[in] net optionally the GNENet to inform about gui updates
214  */
215  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
216 
217  /* @brief method for setting the attribute and letting the object perform additional changes
218  * @param[in] key The attribute key
219  * @param[in] value The new value
220  * @param[in] undoList The undoList on which to register changes
221  */
222  bool isValid(SumoXMLAttr key, const std::string& value);
223 
224  /* @brief method for enable attribute
225  * @param[in] key The attribute key
226  * @param[in] undoList The undoList on which to register changes
227  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
228  */
229  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
230 
231  /* @brief method for disable attribute
232  * @param[in] key The attribute key
233  * @param[in] undoList The undoList on which to register changes
234  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
235  */
236  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
237 
238  /* @brief method for check if the value for certain attribute is set
239  * @param[in] key The attribute key
240  */
241  bool isAttributeEnabled(SumoXMLAttr key) const;
242 
244  std::string getPopUpID() const;
245 
247  std::string getHierarchyName() const;
249 
251  const std::map<std::string, std::string>& getACParametersMap() const;
252 
253 protected:
256 
259 
260 private:
262  void setAttribute(SumoXMLAttr key, const std::string& value);
263 
265  void setEnabledAttribute(const int enabledAttributes);
266 
268  GNEWalk(GNEWalk*) = delete;
269 
271  GNEWalk& operator=(GNEWalk*) = delete;
272 };
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
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEWalk.cpp:364
DemandElementMove myWalkMove
variable for move walks
Definition: GNEWalk.h:255
SUMOVehicleClass getVClass() const
Definition: GNEWalk.cpp:203
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEWalk.cpp:558
GNEWalk & operator=(GNEWalk *)=delete
Invalidated assignment operator.
void invalidatePath()
invalidate path
Definition: GNEWalk.cpp:327
double myArrivalPosition
arrival position
Definition: GNEWalk.h:258
void endGeometryMoving()
end geometry movement
Definition: GNEWalk.cpp:229
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEWalk.cpp:376
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEWalk.cpp:392
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEWalk.cpp:663
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEWalk.cpp:564
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEWalk.cpp:570
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEWalk.cpp:552
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEWalk.cpp:590
void updateGeometry()
update pre-computed geometry information
Definition: GNEWalk.cpp:271
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEWalk.cpp:94
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEWalk.cpp:197
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEWalk.cpp:503
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEWalk.cpp:546
GNEWalk(GNENet *net, GNEDemandElement *personParent, GNEEdge *fromEdge, GNEEdge *toEdge, double arrivalPosition)
parameter constructor for person edge->edge
Definition: GNEWalk.cpp:37
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEWalk.cpp:406
GNEWalk(GNEWalk *)=delete
Invalidated copy constructor.
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEWalk.cpp:239
void computePath()
compute path
Definition: GNEWalk.cpp:290
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEWalk.cpp:463
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList)
method for setting the attribute and letting the object perform demand element changes
Definition: GNEWalk.cpp:478
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEWalk.cpp:156
~GNEWalk()
destructor
Definition: GNEWalk.cpp:90
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEWalk.cpp:370
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEWalk.cpp:426
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEWalk.cpp:260
const RGBColor & getColor() const
get color
Definition: GNEWalk.cpp:209
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEWalk.cpp:178
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object.
Definition: GNEWalk.cpp:412
void startGeometryMoving()
Definition: GNEWalk.cpp:215
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEWalk.cpp:119
The popup menu of a globject.
Stores the information about how to visualize structures.
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
An upper class for objects with additional parameters.
Definition: Parameterised.h:39
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
struct for pack all variables related with Demand Element moving