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-2023 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// ===========================================================================
27// class declarations
28// ===========================================================================
29class GNEEdge;
30class GNEConnection;
31class GNEVehicle;
32
33
34// ===========================================================================
35// class definitions
36// ===========================================================================
37class GNEWalk : public GNEDemandElement, public Parameterised {
38public:
40 GNEWalk(SumoXMLTag tag, GNENet* net);
41
49 GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEEdge* toEdge, double arrivalPosition);
50
59 GNEWalk(const bool isTrain, GNENet* net, GNEDemandElement* personParent, GNEEdge* fromEdge, GNEAdditional* toAdditional, double arrivalPosition);
60
67 GNEWalk(GNENet* net, GNEDemandElement* personParent, std::vector<GNEEdge*> edges, double arrivalPosition);
68
75 GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEDemandElement* route, double arrivalPosition);
76
84 GNEWalk(GNENet* net, GNEDemandElement* personParent, GNEJunction* fromJunction, GNEJunction* toJunction, double arrivalPosition);
85
87 ~GNEWalk();
88
93
97 void writeDemandElement(OutputDevice& device) const;
98
101
103 std::string getDemandElementProblem() const;
104
107
112
114 const RGBColor& getColor() const;
115
117
121 void updateGeometry();
122
126
129
138
142 std::string getParentName() const;
143
148
150 void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
151
156 void drawGL(const GUIVisualizationSettings& s) const;
157
159
162
164 void computePathElement();
165
172 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const GNEPathManager::Segment* segment, const double offsetFront) const;
173
181 void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const GNEPathManager::Segment* segment, const double offsetFront) const;
182
184 GNELane* getFirstPathLane() const;
185
187 GNELane* getLastPathLane() const;
189
192 /* @brief method for getting the Attribute of an XML key
193 * @param[in] key The attribute key
194 * @return string with the value associated to key
195 */
196 std::string getAttribute(SumoXMLAttr key) const;
197
198 /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
199 * @param[in] key The attribute key
200 * @return double with the value associated to key
201 */
202 double getAttributeDouble(SumoXMLAttr key) const;
203
204 /* @brief method for getting the Attribute of an XML key in Position format (used in person plans)
205 * @param[in] key The attribute key
206 * @return double with the value associated to key
207 */
209
210 /* @brief method for setting the attribute and letting the object perform additional changes
211 * @param[in] key The attribute key
212 * @param[in] value The new value
213 * @param[in] undoList The undoList on which to register changes
214 * @param[in] net optionally the GNENet to inform about gui updates
215 */
216 void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
217
218 /* @brief method for setting the attribute and letting the object perform additional changes
219 * @param[in] key The attribute key
220 * @param[in] value The new value
221 * @param[in] undoList The undoList on which to register changes
222 */
223 bool isValid(SumoXMLAttr key, const std::string& value);
224
225 /* @brief method for check if the value for certain attribute is set
226 * @param[in] key The attribute key
227 */
228 bool isAttributeEnabled(SumoXMLAttr key) const;
229
231 std::string getPopUpID() const;
232
234 std::string getHierarchyName() const;
236
239
240protected:
243
244private:
246 void setAttribute(SumoXMLAttr key, const std::string& value);
247
249 void setMoveShape(const GNEMoveResult& moveResult);
250
252 void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
253
255 GNEWalk(GNEWalk*) = delete;
256
259};
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.
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:217
SUMOVehicleClass getVClass() const
Definition GNEWalk.cpp:196
bool isAttributeEnabled(SumoXMLAttr key) const
Definition GNEWalk.cpp:613
double myArrivalPosition
arrival position
Definition GNEWalk.h:242
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition GNEWalk.cpp:235
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition GNEWalk.cpp:251
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition GNEWalk.cpp:625
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition GNEWalk.cpp:631
GNELane * getFirstPathLane() const
get first path lane
Definition GNEWalk.cpp:331
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition GNEWalk.cpp:317
void updateGeometry()
update pre-computed geometry information
Definition GNEWalk.cpp:208
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:190
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition GNEWalk.cpp:553
GNEMoveOperation * getMoveOperation()
get move operation
Definition GNEWalk.cpp:87
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition GNEWalk.cpp:265
GNEWalk(GNEWalk *)=delete
Invalidated copy constructor.
void setMoveShape(const GNEMoveResult &moveResult)
set move shape
Definition GNEWalk.cpp:736
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:178
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:649
std::string getParentName() const
Returns the name of the parent object.
Definition GNEWalk.cpp:229
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition GNEWalk.cpp:359
GNEWalk & operator=(GNEWalk *)=delete
Invalidated assignment operator.
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition GNEWalk.cpp:745
const RGBColor & getColor() const
get color
Definition GNEWalk.cpp:202
void computePathElement()
compute pathElement
Definition GNEWalk.cpp:280
GNELane * getLastPathLane() const
get last path lane
Definition GNEWalk.cpp:344
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition GNEWalk.cpp:184
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.
An upper class for objects with additional parameters.
std::map< std::string, std::string > Map
parameters map
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37