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 // ===========================================================================
28 class GNEEdge;
29 class GNEConnection;
30 class GNEVehicle;
31 
32 // ===========================================================================
33 // class definitions
34 // ===========================================================================
35 
36 class GNEWalk : public GNEDemandElement, public Parameterised {
37 
38 public:
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 
110  SUMOVehicleClass getVClass() const;
111 
113  const RGBColor& getColor() const;
114 
116 
120  void updateGeometry();
121 
123  Position getPositionInView() const;
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 enable attribute
228  * @param[in] key The attribute key
229  * @param[in] undoList The undoList on which to register changes
230  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
231  */
232  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
233 
234  /* @brief method for disable attribute
235  * @param[in] key The attribute key
236  * @param[in] undoList The undoList on which to register changes
237  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
238  */
239  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
240 
241  /* @brief method for check if the value for certain attribute is set
242  * @param[in] key The attribute key
243  */
244  bool isAttributeEnabled(SumoXMLAttr key) const;
245 
247  std::string getPopUpID() const;
248 
250  std::string getHierarchyName() const;
252 
254  const std::map<std::string, std::string>& getACParametersMap() const;
255 
256 protected:
259 
260 private:
262  void setAttribute(SumoXMLAttr key, const std::string& value);
263 
265  void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters);
266 
268  void setMoveShape(const GNEMoveResult& moveResult);
269 
271  void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
272 
274  GNEWalk(GNEWalk*) = delete;
275 
277  GNEWalk& operator=(GNEWalk*) = delete;
278 };
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 belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
An Element which don't belongs to GNENet but has influency 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:213
SUMOVehicleClass getVClass() const
Definition: GNEWalk.cpp:192
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEWalk.cpp:587
GNEWalk & operator=(GNEWalk *)=delete
Invalidated assignment operator.
double myArrivalPosition
arrival position
Definition: GNEWalk.h:258
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:599
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEWalk.cpp:605
GNELane * getFirstPathLane() const
get first path lane
Definition: GNEWalk.cpp:319
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEWalk.cpp:581
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const GNEPathManager::Segment *segment, const double offsetFront) const
Draws partial object.
Definition: GNEWalk.cpp:305
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEWalk.cpp:623
void updateGeometry()
update pre-computed geometry information
Definition: GNEWalk.cpp:204
Position getAttributePosition(SumoXMLAttr key) const
Definition: GNEWalk.cpp:411
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEWalk.cpp:110
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEWalk.cpp:186
double getExaggeration(const GUIVisualizationSettings &s) const
return exaggeration asociated with this GLObject
Definition: GNEWalk.cpp:229
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEWalk.cpp:526
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEWalk.cpp:575
GNEMoveOperation * getMoveOperation()
get move operation
Definition: GNEWalk.cpp:86
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:706
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEWalk.cpp:394
Problem isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEWalk.cpp:174
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:436
~GNEWalk()
destructor
Definition: GNEWalk.cpp:82
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEWalk.cpp:223
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEWalk.cpp:347
void commitMoveShape(const GNEMoveResult &moveResult, GNEUndoList *undoList)
commit move shape
Definition: GNEWalk.cpp:715
const RGBColor & getColor() const
get color
Definition: GNEWalk.cpp:198
void computePathElement()
compute pathElement
Definition: GNEWalk.cpp:280
GNELane * getLastPathLane() const
get last path lane
Definition: GNEWalk.cpp:332
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEWalk.cpp:180
GNEWalk(SumoXMLTag tag, GNENet *net)
default constructor
Definition: GNEWalk.cpp:37
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEWalk.cpp:135
void toogleAttribute(SumoXMLAttr key, const bool value, const int previousParameters)
method for enable or disable the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEWalk.cpp:700
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
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37