Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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-2025 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"
26
27// ===========================================================================
28// class declarations
29// ===========================================================================
30
31class GNEEdge;
32class GNEConnection;
33class GNEVehicle;
34
35// ===========================================================================
36// class definitions
37// ===========================================================================
38
40
41public:
43 GNEWalk(SumoXMLTag tag, GNENet* net);
44
53 GNEWalk(SumoXMLTag tag, GNEDemandElement* personParent, const GNEPlanParents& planParameters,
54 const double arrivalPosition, const double speed, const SUMOTime duration);
55
57 ~GNEWalk();
58
61
63 GNEMoveElement* getMoveElement() const override;
64
66 Parameterised* getParameters() override;
67
69 const Parameterised* getParameters() const override;
70
72
76 void writeDemandElement(OutputDevice& device) const;
77
80
82 std::string getDemandElementProblem() const;
83
86
91
93 const RGBColor& getColor() const;
94
96
100 void updateGeometry() override;
101
105
108
117
121 std::string getParentName() const;
122
127
129 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
130
135 void drawGL(const GUIVisualizationSettings& s) const;
136
138
141
143 void computePathElement();
144
150 void drawLanePartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
151
157 void drawJunctionPartialGL(const GUIVisualizationSettings& s, const GNESegment* segment, const double offsetFront) const;
158
160 GNELane* getFirstPathLane() const;
161
163 GNELane* getLastPathLane() const;
165
168 /* @brief method for getting the Attribute of an XML key
169 * @param[in] key The attribute key
170 * @return string with the value associated to key
171 */
172 std::string getAttribute(SumoXMLAttr key) const override;
173
174 /* @brief method for getting the Attribute of an XML key in double format
175 * @param[in] key The attribute key
176 * @return double with the value associated to key
177 */
178 double getAttributeDouble(SumoXMLAttr key) const override;
179
180 /* @brief method for getting the Attribute of an XML key in position format
181 * @param[in] key The attribute key
182 * @return position with the value associated to key
183 */
184 Position getAttributePosition(SumoXMLAttr key) const override;
185
186 /* @brief method for setting the attribute and letting the object perform additional changes
187 * @param[in] key The attribute key
188 * @param[in] value The new value
189 * @param[in] undoList The undoList on which to register changes
190 * @param[in] net optionally the GNENet to inform about gui updates
191 */
192 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
193
194 /* @brief method for setting the attribute and letting the object perform additional changes
195 * @param[in] key The attribute key
196 * @param[in] value The new value
197 * @param[in] undoList The undoList on which to register changes
198 */
199 bool isValid(SumoXMLAttr key, const std::string& value) override;
200
201 /* @brief method for check if the value for certain attribute is set
202 * @param[in] key The attribute key
203 */
204 bool isAttributeEnabled(SumoXMLAttr key) const;
205
207 std::string getPopUpID() const override;
208
210 std::string getHierarchyName() const override;
212
213protected:
215 double mySpeed = 0;
216
219
220private:
222 void setAttribute(SumoXMLAttr key, const std::string& value) override;
223
225 GNEWalk(GNEWalk*) = delete;
226
229};
long long int SUMOTime
Definition GUI.h:36
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 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:140
std::string getHierarchyName() const override
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEWalk.cpp:285
std::string getPopUpID() const override
get PopPup ID (Used in AC Hierarchy)
Definition GNEWalk.cpp:279
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition GNEWalk.cpp:122
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNEWalk.cpp:273
double getAttributeDouble(SumoXMLAttr key) const override
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:152
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNEWalk.cpp:158
SUMOTime myDuration
duration
Definition GNEWalk.h:218
void updateGeometry() override
update pre-computed geometry information
Definition GNEWalk.cpp:134
GNELane * getFirstPathLane() const
get first path lane
Definition GNEWalk.cpp:196
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition GNEWalk.cpp:79
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition GNEWalk.cpp:116
GNEMoveElement * getMoveElement() const override
methods to retrieve the elements linked to this walk
Definition GNEWalk.cpp:61
void drawJunctionPartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over junction.
Definition GNEWalk.cpp:190
double mySpeed
speed
Definition GNEWalk.h:215
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNEWalk.cpp:172
GNEWalk(GNEWalk *)=delete
Invalidated copy constructor.
bool isValid(SumoXMLAttr key, const std::string &value) override
Definition GNEWalk.cpp:260
void setAttribute(SumoXMLAttr key, const std::string &value, GNEUndoList *undoList) override
Definition GNEWalk.cpp:246
Problem isDemandElementValid() const
check if current demand element is valid to be written into XML (by default true, can be reimplemente...
Definition GNEWalk.cpp:104
~GNEWalk()
destructor
Definition GNEWalk.cpp:57
std::string getParentName() const
Returns the name of the parent object.
Definition GNEWalk.cpp:146
GNEWalk & operator=(GNEWalk *)=delete
Invalidated assignment operator.
void drawLanePartialGL(const GUIVisualizationSettings &s, const GNESegment *segment, const double offsetFront) const
Draws partial object over lane.
Definition GNEWalk.cpp:184
Parameterised * getParameters() override
get parameters associated with this walk
Definition GNEWalk.cpp:67
const RGBColor & getColor() const
get color
Definition GNEWalk.cpp:128
void computePathElement()
compute pathElement
Definition GNEWalk.cpp:178
GNELane * getLastPathLane() const
get last path lane
Definition GNEWalk.cpp:202
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNEWalk.cpp:110
Position getAttributePosition(SumoXMLAttr key) const override
Definition GNEWalk.cpp:240
std::string getAttribute(SumoXMLAttr key) const override
inherited from GNEAttributeCarrier
Definition GNEWalk.cpp:208
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition GNEWalk.cpp:85
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.
An upper class for objects with additional parameters.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37