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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // A class for visualizing walks in Netedit
16 /****************************************************************************/
17 #ifndef GNEWalk_h
18 #define GNEWalk_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 
25 #include "GNEDemandElement.h"
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
31 class GNEEdge;
32 class GNEConnection;
33 class GNEVehicle;
34 
35 // ===========================================================================
36 // class definitions
37 // ===========================================================================
38 
39 class GNEWalk : public GNEDemandElement, public Parameterised {
40 
41 public:
49  GNEWalk(GNEViewNet* viewNet, GNEDemandElement* personParent, SumoXMLTag walkTag, const std::vector<GNEEdge*>& edges, double arrivalPosition);
50 
57  GNEWalk(GNEViewNet* viewNet, GNEDemandElement* personParent, const std::vector<GNEEdge*>& edges, GNEAdditional* busStop);
58 
65  GNEWalk(GNEViewNet* viewNet, GNEDemandElement* personParent, GNEDemandElement* routeParent, double arrivalPosition);
66 
68  ~GNEWalk();
69 
73  void writeDemandElement(OutputDevice& device) const;
74 
76  bool isDemandElementValid() const;
77 
79  std::string getDemandElementProblem() const;
80 
83 
87  GNEEdge* getFromEdge() const;
88 
90  GNEEdge* getToEdge() const;
91 
94 
96  const RGBColor& getColor() const;
97 
99  void compute();
100 
102 
106  void startGeometryMoving();
107 
109  void endGeometryMoving();
110 
114  void moveGeometry(const Position& offset);
115 
119  void commitGeometryMoving(GNEUndoList* undoList);
120 
122  void updateGeometry();
123 
125  Position getPositionInView() const;
127 
130 
139 
143  std::string getParentName() const;
144 
149 
154  void drawGL(const GUIVisualizationSettings& s) const;
156 
160  void selectAttributeCarrier(bool changeFlag = true);
161 
163  void unselectAttributeCarrier(bool changeFlag = true);
164 
165  /* @brief method for getting the Attribute of an XML key
166  * @param[in] key The attribute key
167  * @return string with the value associated to key
168  */
169  std::string getAttribute(SumoXMLAttr key) const;
170 
171  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
172  * @param[in] key The attribute key
173  * @return double with the value associated to key
174  */
175  double getAttributeDouble(SumoXMLAttr key) const;
176 
177  /* @brief method for setting the attribute and letting the object perform additional changes
178  * @param[in] key The attribute key
179  * @param[in] value The new value
180  * @param[in] undoList The undoList on which to register changes
181  * @param[in] net optionally the GNENet to inform about gui updates
182  */
183  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
184 
185  /* @brief method for setting the attribute and letting the object perform additional changes
186  * @param[in] key The attribute key
187  * @param[in] value The new value
188  * @param[in] undoList The undoList on which to register changes
189  */
190  bool isValid(SumoXMLAttr key, const std::string& value);
191 
192  /* @brief method for enabling attribute
193  * @param[in] key The attribute key
194  * @param[in] undoList The undoList on which to register changes
195  * @note only certain attributes can be enabled, and can produce the disabling of other attributes
196  */
197  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
198 
199  /* @brief method for check if the value for certain attribute is set
200  * @param[in] key The attribute key
201  */
202  bool isAttributeEnabled(SumoXMLAttr key) const;
203 
205  std::string getPopUpID() const;
206 
208  std::string getHierarchyName() const;
210 
214  std::string getGenericParametersStr() const;
215 
217  std::vector<std::pair<std::string, std::string> > getGenericParameters() const;
218 
220  void setGenericParametersStr(const std::string& value);
221 
223 
224 protected:
226  DemandElementMove myWalkMove;
227 
229  std::vector<std::string> myVia;
230 
233 
234 private:
236  void setAttribute(SumoXMLAttr key, const std::string& value);
237 
239  void setEnabledAttribute(const int enabledAttributes);
240 
242  GNEWalk(GNEWalk*) = delete;
243 
245  GNEWalk& operator=(GNEWalk*) = delete;
246 };
247 
248 
249 #endif
250 
251 /****************************************************************************/
252 
GNEWalk::GNEWalk
GNEWalk(GNEViewNet *viewNet, GNEDemandElement *personParent, SumoXMLTag walkTag, const std::vector< GNEEdge * > &edges, double arrivalPosition)
parameter constructor
Definition: GNEWalk.cpp:44
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:134
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:54
GNEAdditional
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
Parameterised
An upper class for objects with additional parameters.
Definition: Parameterised.h:43
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
GNEWalk::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEWalk.cpp:346
GNEWalk::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEWalk.cpp:237
GNEWalk::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEWalk.cpp:259
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:64
GNEWalk::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEWalk.cpp:610
GNEWalk::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEWalk.cpp:464
GNEWalk::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEWalk.cpp:452
GUIGLObjectPopupMenu.h
GNEWalk::compute
void compute()
compute demand element
Definition: GNEWalk.cpp:207
GNEWalk
Definition: GNEWalk.h:39
GNEViewNet
Definition: GNEViewNet.h:43
GNEWalk::getGenericParametersStr
std::string getGenericParametersStr() const
return generic parameters in string format
Definition: GNEWalk.cpp:476
GNEWalk::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEWalk.cpp:195
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:48
GNEWalk::operator=
GNEWalk & operator=(GNEWalk *)=delete
Invalidated assignment operator.
GNEWalk::myWalkMove
DemandElementMove myWalkMove
variable for move walks
Definition: GNEWalk.h:226
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:42
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
GNEWalk::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEWalk.cpp:97
RGBColor
Definition: RGBColor.h:40
GNEWalk::isDemandElementValid
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEWalk.cpp:127
GNEWalk::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEWalk.cpp:408
GNEWalk::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEWalk.cpp:72
GNEWalk::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEWalk.cpp:375
GNEWalk::getColor
const RGBColor & getColor() const
get color
Definition: GNEWalk.cpp:201
GNEDemandElement.h
GNEWalk::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEWalk.cpp:458
GNEWalk::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEWalk.cpp:330
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GNEWalk::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEWalk.cpp:446
GNEWalk::getPositionInView
Position getPositionInView() const
Returns position of additional in view.
Definition: GNEWalk.cpp:281
GNEWalk::startGeometryMoving
void startGeometryMoving()
Definition: GNEWalk.cpp:213
GNEWalk::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEWalk.cpp:270
GNEWalk::setAttribute
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:386
GNEWalk::~GNEWalk
~GNEWalk()
destructor
Definition: GNEWalk.cpp:68
GNEWalk::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEWalk.cpp:315
GNEWalk::myArrivalPosition
double myArrivalPosition
arrival position
Definition: GNEWalk.h:232
GUIMainWindow
Definition: GUIMainWindow.h:47
GNEWalk::myVia
std::vector< std::string > myVia
List of the via-edges that Person must visit.
Definition: GNEWalk.h:229
GNEWalk::getGenericParameters
std::vector< std::pair< std::string, std::string > > getGenericParameters() const
return generic parameters as vector of pairs format
Definition: GNEWalk.cpp:491
GNEWalk::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEWalk.cpp:184
GNEWalk::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEWalk.cpp:167
GNEVehicle
Definition: GNEVehicle.h:36
GNEWalk::setGenericParametersStr
void setGenericParametersStr(const std::string &value)
set generic parameters in string format
Definition: GNEWalk.cpp:502
GNEConnection
Definition: GNEConnection.h:38
GNEWalk::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNEWalk.cpp:227
GNEWalk::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEWalk.cpp:309
GNEWalk::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEWalk.cpp:293
GNEUndoList
Definition: GNEUndoList.h:49
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GNEWalk::getDemandElementProblem
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEWalk.cpp:148
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:373
GNEWalk::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEWalk.cpp:173
GNEWalk::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEWalk.cpp:287