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-2022 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>
22#include "GNEDemandElement.h"
24
25// ===========================================================================
26// class declarations
27// ===========================================================================
28class GNEEdge;
29class GNEConnection;
30class GNEVehicle;
31
32// ===========================================================================
33// class definitions
34// ===========================================================================
35
36class GNEWalk : public GNEDemandElement, public Parameterised {
37
38public:
40 GNEWalk(SumoXMLTag tag, GNENet* net);
41
49 GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge, double arrivalPosition);
50
58 GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toBusStop, double arrivalPosition);
59
66 GNEWalk(GNENet* net, GNEDemandElement* personParent, std::vector<GNEEdge*> edges, double arrivalPosition);
67
74 GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEDemandElement* route, double arrivalPosition);
75
83 GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEJunction* fromJunction, GNEJunction* toJunction, double arrivalPosition);
84
86 ~GNEWalk();
87
92
96 void writeDemandElement(OutputDevice& device) const;
97
100
102 std::string getDemandElementProblem() const;
103
106
111
113 const RGBColor& getColor() const;
114
116
120 void updateGeometry();
121
125
128
137
141 std::string getParentName() const;
142
144 double getExaggeration(const GUIVisualizationSettings& s) const;
145
150
152 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
153
158 void drawGL(const GUIVisualizationSettings& s) const;
159
161
164
166 void computePathElement();
167
174 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
175
183 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
184
186 GNELane* getFirstPathLane() const;
187
189 GNELane* getLastPathLane() const;
191
194 /* @brief method for getting the Attribute of an XML key
195 * @param[in] key The attribute key
196 * @return string with the value associated to key
197 */
198 std::string getAttribute(SumoXMLAttr key) const;
199
200 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
201 * @param[in] key The attribute key
202 * @return double with the value associated to key
203 */
204 double getAttributeDouble(SumoXMLAttr key) const;
205
206 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
207 * @param[in] key The attribute key
208 * @return double with the value associated to key
209 */
211
212 /* @brief method for setting the attribute and letting the object perform additional changes
213 * @param[in] key The attribute key
214 * @param[in] value The new value
215 * @param[in] undoList The undoList on which to register changes
216 * @param[in] net optionally the GNENet to inform about gui updates
217 */
218 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
219
220 /* @brief method for setting the attribute and letting the object perform additional changes
221 * @param[in] key The attribute key
222 * @param[in] value The new value
223 * @param[in] undoList The undoList on which to register changes
224 */
225 bool isValid(SumoXMLAttr key, const std::string& value);
226
227 /* @brief method for check if the value for certain attribute is set
228 * @param[in] key The attribute key
229 */
230 bool isAttributeEnabled(SumoXMLAttr key) const;
231
233 std::string getPopUpID() const;
234
236 std::string getHierarchyName() const;
238
241
242protected:
245
246private:
248 void setAttribute(SumoXMLAttr key, const std::string& value);
249
251 void setMoveShape(const GNEMoveResult& moveResult);
252
254 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
255
257 GNEWalk(GNEWalk*) = delete;
258
261};
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
An Element which don't belong to GNENet but has influence in the simulation.
Definition: GNEAdditional.h:48
An Element which don't belong to GNENet but has influence in the simulation.
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
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEWalk.cpp:212
SUMOVehicleClass getVClass() const
Definition: GNEWalk.cpp:191
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEWalk.cpp:594
double myArrivalPosition
arrival position
Definition: GNEWalk.h:244
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEWalk.cpp:236
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEWalk.cpp:252
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEWalk.cpp:606
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEWalk.cpp:612
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEWalk.cpp:332
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNEWalk.cpp:318
void updateGeometry()
update pre-computed geometry information
Definition: GNEWalk.cpp:203
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEWalk.cpp:421
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEWalk.cpp:111
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEWalk.cpp:185
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration associated with this GLObject
Definition: GNEWalk.cpp:230
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEWalk.cpp:536
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEWalk.cpp:87
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEWalk.cpp:266
GNEWalk(GNEWalk *)=delete
Invalidated copy constructor.
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition: GNEWalk.cpp:712
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEWalk.cpp:404
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEWalk.cpp:173
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:446
~GNEWalk()
destructor
Definition: GNEWalk.cpp:83
const Parameterised::Map & getACParametersMap() const
get parameters map
Definition: GNEWalk.cpp:630
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEWalk.cpp:224
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEWalk.cpp:360
GNEWalk & operator=(GNEWalk *)=delete
Invalidated assignment operator.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEWalk.cpp:721
const RGBColor & getColor() const
get color
Definition: GNEWalk.cpp:197
void computePathElement()
compute pathElement
Definition: GNEWalk.cpp:281
GNELane * getLastPathLane() const
get last path lane
Definition: GNEWalk.cpp:345
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEWalk.cpp:179
GNEWalk(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEWalk.cpp:37
void writeDemandElement(OutputDevice &device) const
write demand element element into a xml file
Definition: GNEWalk.cpp:136
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