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.dev/sumo
3 // Copyright (C) 2016-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 // A class for visualizing walks in Netedit
19 /****************************************************************************/
20 #pragma once
21 #include <config.h>
23 
24 #include "GNEDemandElement.h"
25 #include "GNEDemandElementPlan.h"
26 
27 // ===========================================================================
28 // class declarations
29 // ===========================================================================
30 
31 class GNEEdge;
32 class GNEConnection;
33 class GNEVehicle;
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
38 
40 
41 public:
43  GNEWalk(SumoXMLTag tag, GNENet* net);
44 
55  GNEWalk(GNENet* net, SumoXMLTag tag, GUIIcon icon, GNEDemandElement* personParent, const GNEPlanParents& planParameters,
56  const double arrivalPosition, const double speed, const SUMOTime duration);
57 
59  ~GNEWalk();
60 
65 
69  void writeDemandElement(OutputDevice& device) const;
70 
73 
75  std::string getDemandElementProblem() const;
76 
79 
84 
86  const RGBColor& getColor() const;
87 
89 
93  void updateGeometry();
94 
98 
101 
110 
114  std::string getParentName() const;
115 
120 
122  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
123 
128  void drawGL(const GUIVisualizationSettings& s) const;
129 
131 
134 
136  void computePathElement();
137 
143  void drawLanePartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
144 
150  void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNEPathManager::Segment* segment, const double offsetFront) const;
151 
153  GNELane* getFirstPathLane() const;
154 
156  GNELane* getLastPathLane() const;
158 
161  /* @brief method for getting the Attribute of an XML key
162  * @param[in] key The attribute key
163  * @return string with the value associated to key
164  */
165  std::string getAttribute(SumoXMLAttr key) const;
166 
167  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
168  * @param[in] key The attribute key
169  * @return double with the value associated to key
170  */
171  double getAttributeDouble(SumoXMLAttr key) const;
172 
173  /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
174  * @param[in] key The attribute key
175  * @return double with the value associated to key
176  */
178 
179  /* @brief method for setting the attribute and letting the object perform additional changes
180  * @param[in] key The attribute key
181  * @param[in] value The new value
182  * @param[in] undoList The undoList on which to register changes
183  * @param[in] net optionally the GNENet to inform about gui updates
184  */
185  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
186 
187  /* @brief method for setting the attribute and letting the object perform additional changes
188  * @param[in] key The attribute key
189  * @param[in] value The new value
190  * @param[in] undoList The undoList on which to register changes
191  */
192  bool isValid(SumoXMLAttr key, const std::string& value);
193 
194  /* @brief method for check if the value for certain attribute is set
195  * @param[in] key The attribute key
196  */
197  bool isAttributeEnabled(SumoXMLAttr key) const;
198 
200  std::string getPopUpID() const;
201 
203  std::string getHierarchyName() const;
205 
207  const Parameterised::Map& getACParametersMap() const;
208 
209 protected:
211  double mySpeed = 0;
212 
215 
216 private:
218  void setAttribute(SumoXMLAttr key, const std::string& value);
219 
221  void setMoveShape(const GNEMoveResult& moveResult);
222 
224  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
225 
227  GNEWalk(GNEWalk*) = delete;
228 
230  GNEWalk& operator=(GNEWalk*) = delete;
231 };
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
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
GNEPlanParents (used for group all plan parents)
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEWalk.cpp:128
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEWalk.cpp:110
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEWalk.cpp:261
GNEWalk & operator=(GNEWalk *)=delete
Invalidated assignment operator.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEWalk.cpp:140
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEWalk.cpp:146
SUMOTime myDuration
duration
Definition: GNEWalk.h:214
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEWalk.cpp:267
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEWalk.cpp:273
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEWalk.cpp:184
void updateGeometry()
update pre-computed geometry information
Definition: GNEWalk.cpp:122
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEWalk.cpp:228
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEWalk.cpp:67
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEWalk.cpp:104
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEWalk.cpp:248
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over junction.
Definition: GNEWalk.cpp:178
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEWalk.cpp:61
double mySpeed
speed
Definition: GNEWalk.h:211
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEWalk.cpp:160
GNEWalk(GNEWalk *)=delete
Invalidated copy constructor.
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object over lane.
Definition: GNEWalk.cpp:172
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEWalk.cpp:312
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEWalk.cpp:217
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition: GNEWalk.cpp:92
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:234
~GNEWalk()
destructor
Definition: GNEWalk.cpp:57
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNEWalk.cpp:279
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEWalk.cpp:134
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEWalk.cpp:196
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEWalk.cpp:321
const RGBColor & getColor() const
get color
Definition: GNEWalk.cpp:116
void computePathElement()
compute pathElement
Definition: GNEWalk.cpp:166
GNELane * getLastPathLane() const
get last path lane
Definition: GNEWalk.cpp:190
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEWalk.cpp:98
GNEWalk(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEWalk.cpp:36
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition: GNEWalk.cpp:73
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: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