Eclipse SUMO - Simulation of Urban MObility
GNEPerson.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-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 /****************************************************************************/
14 // Representation of persons in NETEDIT
15 /****************************************************************************/
16 #ifndef GNEPerson_h
17 #define GNEPerson_h
18 
19 
20 // ===========================================================================
21 // included modules
22 // ===========================================================================
23 
26 
27 
28 #include "GNEDemandElement.h"
29 
30 // ===========================================================================
31 // class definitions
32 // ===========================================================================
37 
38 public:
41  FXDECLARE(GNEPersonPopupMenu)
42 
43  public:
50 
53 
55  long onCmdTransform(FXObject* obj, FXSelector, void*);
56 
57  protected:
60 
61  private:
64 
66  FXMenuCommand* myTransformToPerson;
67 
69  FXMenuCommand* myTransformToPersonFlow;
70  };
71 
75 
76  public:
83  GNESelectedPersonsPopupMenu(GNEPerson* person, const std::vector<GNEPerson*>& selectedPerson, GUIMainWindow& app, GUISUMOAbstractView& parent);
84 
87 
89  long onCmdTransform(FXObject* obj, FXSelector, void*);
90 
91  protected:
94 
95  private:
98 
100  std::vector<GNEPerson*> mySelectedPersons;
101 
103  FXMenuCommand* myTransformToPerson;
104 
106  FXMenuCommand* myTransformToPersonFlow;
107  };
108 
110  GNEPerson(SumoXMLTag tag, GNEViewNet* viewNet, GNEDemandElement* pType, const SUMOVehicleParameter& personparameters);
111 
113  ~GNEPerson();
114 
119  std::string getBegin() const;
120 
124  void writeDemandElement(OutputDevice& device) const;
125 
127  bool isDemandElementValid() const;
128 
130  std::string getDemandElementProblem() const;
131 
134 
138  GNEEdge* getFromEdge() const;
139 
141  GNEEdge* getToEdge() const;
142 
144  SUMOVehicleClass getVClass() const;
145 
147  const RGBColor& getColor() const;
148 
150 
154  void startGeometryMoving();
155 
157  void endGeometryMoving();
158 
162  void moveGeometry(const Position& offset);
163 
167  void commitGeometryMoving(GNEUndoList* undoList);
168 
170  void updateGeometry();
171 
173  void updatePartialGeometry(const GNEEdge* edge);
174 
176  void computePath();
177 
179  void invalidatePath();
180 
182  Position getPositionInView() const;
184 
187 
195 
199  std::string getParentName() const;
200 
205 
207  void splitEdgeGeometry(const double splitPosition, const GNENetElement* originalElement, const GNENetElement* newElement, GNEUndoList* undoList);
208 
213  void drawGL(const GUIVisualizationSettings& s) const;
215 
219  void selectAttributeCarrier(bool changeFlag = true);
220 
222  void unselectAttributeCarrier(bool changeFlag = true);
223 
224  /* @brief method for getting the Attribute of an XML key
225  * @param[in] key The attribute key
226  * @return string with the value associated to key
227  */
228  std::string getAttribute(SumoXMLAttr key) const;
229 
230  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
231  * @param[in] key The attribute key
232  * @return double with the value associated to key
233  */
234  double getAttributeDouble(SumoXMLAttr key) const;
235 
236  /* @brief method for setting the attribute and letting the object perform demand element changes
237  * @param[in] key The attribute key
238  * @param[in] value The new value
239  * @param[in] undoList The undoList on which to register changes
240  * @param[in] net optionally the GNENet to inform about gui updates
241  */
242  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
243 
244  /* @brief method for setting the attribute and letting the object perform demand element changes
245  * @param[in] key The attribute key
246  * @param[in] value The new value
247  * @param[in] undoList The undoList on which to register changes
248  */
249  bool isValid(SumoXMLAttr key, const std::string& value);
250 
251  /* @brief method for enable attribute
252  * @param[in] key The attribute key
253  * @param[in] undoList The undoList on which to register changes
254  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
255  */
256  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
257 
258  /* @brief method for disable attribute
259  * @param[in] key The attribute key
260  * @param[in] undoList The undoList on which to register changes
261  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
262  */
263  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
264 
265  /* @brief method for check if the value for certain attribute is set
266  * @param[in] key The attribute key
267  */
268  bool isAttributeEnabled(SumoXMLAttr key) const;
269 
271  std::string getPopUpID() const;
272 
274  std::string getHierarchyName() const;
276 
277 protected:
279  void setColor(const GUIVisualizationSettings& s) const;
280 
282  bool setFunctionalColor(int activeScheme) const;
283 
284 private:
285  // @brief struct used for calculating person plan geometry segments
288  personPlanSegment(GNEDemandElement* _personPlan);
289 
292 
295 
297  std::vector<GNEAdditional*> busStops;
298 
300  std::vector<GNEDemandElement*> stops;
301 
303  double arrivalPos;
304 
305  private:
308  };
309 
311  void setAttribute(SumoXMLAttr key, const std::string& value);
312 
314  void setEnabledAttribute(const int enabledAttributes);
315 
317  GNEPerson(const GNEPerson&) = delete;
318 
320  GNEPerson& operator=(const GNEPerson&) = delete;
321 };
322 
323 #endif
324 /****************************************************************************/
GNEPerson::GNESelectedPersonsPopupMenu::onCmdTransform
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:153
GNEPerson::personPlanSegment
Definition: GNEPerson.h:286
GNEPerson::splitEdgeGeometry
void splitEdgeGeometry(const double splitPosition, const GNENetElement *originalElement, const GNENetElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEPerson.cpp:399
SUMOVehicleClass
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
Definition: SUMOVehicleClass.h:133
GNEPerson::setColor
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GNEPerson.cpp:761
GNEDemandElement
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEDemandElement.h:55
GNEPerson::enableAttribute
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:690
GNEPerson::getAttributeDouble
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPerson.cpp:556
GNEPerson::GNEPerson
GNEPerson(SumoXMLTag tag, GNEViewNet *viewNet, GNEDemandElement *pType, const SUMOVehicleParameter &personparameters)
constructor for persons
Definition: GNEPerson.cpp:171
GNEPerson::GNESelectedPersonsPopupMenu::GNESelectedPersonsPopupMenu
GNESelectedPersonsPopupMenu()
default constructor needed by FOX
Definition: GNEPerson.h:93
GNEPerson::personPlanSegment::edge
GNEEdge * edge
edge
Definition: GNEPerson.h:294
GNEPerson::GNEPersonPopupMenu::myTransformToPerson
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:66
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
OutputDevice
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:63
GNEPerson::getBegin
std::string getBegin() const
get begin time of demand element
Definition: GNEPerson.cpp:184
GNEPerson::commitGeometryMoving
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEPerson.cpp:311
GNEPerson::unselectAttributeCarrier
void unselectAttributeCarrier(bool changeFlag=true)
unselect attribute carrier using GUIGlobalSelection
Definition: GNEPerson.cpp:492
GNEPerson::GNEPersonPopupMenu::myTransformToPersonFlow
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:69
GNEPerson::GNESelectedPersonsPopupMenu::myTransformToPersonFlow
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:106
GUIGLObjectPopupMenu.h
GNEPerson::~GNEPerson
~GNEPerson()
destructor
Definition: GNEPerson.cpp:180
GNEPerson::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPerson.cpp:386
GNEPerson::getColor
const RGBColor & getColor() const
get color
Definition: GNEPerson.cpp:287
GNEPerson::personPlanSegment::arrivalPos
double arrivalPos
arrival position
Definition: GNEPerson.h:303
GNEPerson::GNEPersonPopupMenu
class used in GUIGLObjectPopupMenu for person transformations
Definition: GNEPerson.h:40
GNEViewNet
Definition: GNEViewNet.h:42
GNEPerson::invalidatePath
void invalidatePath()
invalidate path
Definition: GNEPerson.cpp:341
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:297
GNEPerson::GNESelectedPersonsPopupMenu
class used in GUIGLObjectPopupMenu for single person transformations
Definition: GNEPerson.h:73
GNEPerson::writeDemandElement
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEPerson.cpp:203
GNEPerson::moveGeometry
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEPerson.cpp:305
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GNEPerson::GNESelectedPersonsPopupMenu::mySelectedPersons
std::vector< GNEPerson * > mySelectedPersons
current selected persons
Definition: GNEPerson.h:100
SumoXMLTag
SumoXMLTag
Numbers representing SUMO-XML - element names.
Definition: SUMOXMLDefinitions.h:41
GNEPerson::isDemandElementValid
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEPerson.cpp:249
GNEPerson::computePath
void computePath()
compute path
Definition: GNEPerson.cpp:335
GNEPerson::GNEPersonPopupMenu::GNEPersonPopupMenu
GNEPersonPopupMenu()
default constructor needed by FOX
Definition: GNEPerson.h:59
SUMOVehicleParameter::tag
SumoXMLTag tag
The vehicle tag.
Definition: SUMOVehicleParameter.h:465
SUMOVehicleParameter.h
GNEPerson::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPerson.cpp:405
GNEEdge
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:51
GNEPerson::getDemandElementProblem
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEPerson.cpp:256
RGBColor
Definition: RGBColor.h:39
GNEPerson::GNESelectedPersonsPopupMenu::~GNESelectedPersonsPopupMenu
~GNESelectedPersonsPopupMenu()
Destructor.
Definition: GNEPerson.cpp:149
GNEPerson::selectAttributeCarrier
void selectAttributeCarrier(bool changeFlag=true)
inherited from GNEAttributeCarrier
Definition: GNEPerson.cpp:477
GNEPerson::getPopUpID
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPerson.cpp:726
GNEPerson::getFromEdge
GNEEdge * getFromEdge() const
Definition: GNEPerson.cpp:269
GNEDemandElement.h
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GNEPerson::isValid
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEPerson.cpp:601
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GNEPerson::setEnabledAttribute
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEPerson.cpp:920
GNENetElement
Definition: GNENetElement.h:43
GNEPerson
Definition: GNEPerson.h:36
GNEPerson::GNESelectedPersonsPopupMenu::myPersonTag
SumoXMLTag myPersonTag
tag of clicked person
Definition: GNEPerson.h:97
GNEPerson::updatePartialGeometry
void updatePartialGeometry(const GNEEdge *edge)
partial update pre-computed geometry information
Definition: GNEPerson.cpp:326
GNEPerson::setFunctionalColor
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GNEPerson.cpp:770
GNEPerson::getVClass
SUMOVehicleClass getVClass() const
obtain VClass related with this demand element
Definition: GNEPerson.cpp:281
GNEPerson::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: GNEPerson.cpp:571
GUIMainWindow
Definition: GUIMainWindow.h:46
GNEPerson::getToEdge
GNEEdge * getToEdge() const
obtain to edge of this demand element
Definition: GNEPerson.cpp:275
GNEPerson::GNESelectedPersonsPopupMenu::myTransformToPerson
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:103
GNEPerson::fixDemandElementProblem
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPerson.cpp:263
GNEPerson::personPlanSegment::stops
std::vector< GNEDemandElement * > stops
stops placed in this segment
Definition: GNEPerson.h:300
GNEPerson::personPlanSegment::personPlanSegment
personPlanSegment()
constructor
Definition: GNEPerson.cpp:827
GNEPerson::getHierarchyName
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPerson.cpp:732
GNEPerson::GNEPersonPopupMenu::onCmdTransform
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:104
GNEPerson::GNEPersonPopupMenu::myPerson
GNEPerson * myPerson
current person
Definition: GNEPerson.h:63
GNEPerson::personPlanSegment::busStops
std::vector< GNEAdditional * > busStops
busStops placed in this segment
Definition: GNEPerson.h:297
GNEPerson::endGeometryMoving
void endGeometryMoving()
end geometry movement
Definition: GNEPerson.cpp:299
GNEUndoList
Definition: GNEUndoList.h:48
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GNEPerson::operator=
GNEPerson & operator=(const GNEPerson &)=delete
Invalidated assignment operator.
GNEPerson::updateGeometry
void updateGeometry()
update pre-computed geometry information
Definition: GNEPerson.cpp:317
GNEPerson::getParentName
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPerson.cpp:380
SumoXMLAttr
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Definition: SUMOXMLDefinitions.h:372
GNEPerson::getAttribute
std::string getAttribute(SumoXMLAttr key) const
Definition: GNEPerson.cpp:508
GNEPerson::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPerson.cpp:373
GNEPerson::disableAttribute
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:701
GNEPerson::isAttributeEnabled
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPerson.cpp:707
GNEPerson::personPlanSegment::personPlan
const GNEDemandElement * personPlan
person plan
Definition: GNEPerson.h:291
GNEPerson::startGeometryMoving
void startGeometryMoving()
Definition: GNEPerson.cpp:293
GNEPerson::getPositionInView
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEPerson.cpp:347
GNEPerson::GNEPersonPopupMenu::~GNEPersonPopupMenu
~GNEPersonPopupMenu()
Destructor.
Definition: GNEPerson.cpp:100