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-2020 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 // Representation of persons in NETEDIT
19 /****************************************************************************/
20 #pragma once
23 
24 
25 #include "GNEDemandElement.h"
26 
27 // ===========================================================================
28 // class definitions
29 // ===========================================================================
34 
35 public:
38  FXDECLARE(GNEPersonPopupMenu)
39 
40  public:
47 
50 
52  long onCmdTransform(FXObject* obj, FXSelector, void*);
53 
54  protected:
55  FOX_CONSTRUCTOR(GNEPersonPopupMenu)
56 
57  private:
60 
62  FXMenuCommand* myTransformToPerson;
63 
65  FXMenuCommand* myTransformToPersonFlow;
66  };
67 
71 
72  public:
79  GNESelectedPersonsPopupMenu(GNEPerson* person, const std::vector<GNEPerson*>& selectedPerson, GUIMainWindow& app, GUISUMOAbstractView& parent);
80 
83 
85  long onCmdTransform(FXObject* obj, FXSelector, void*);
86 
87  protected:
88  FOX_CONSTRUCTOR(GNESelectedPersonsPopupMenu)
89 
90  private:
93 
95  std::vector<GNEPerson*> mySelectedPersons;
96 
98  FXMenuCommand* myTransformToPerson;
99 
101  FXMenuCommand* myTransformToPersonFlow;
102  };
103 
105  GNEPerson(SumoXMLTag tag, GNENet* net, GNEDemandElement* pType, const SUMOVehicleParameter& personparameters);
106 
108  ~GNEPerson();
109 
114  std::string getBegin() const;
115 
119  void writeDemandElement(OutputDevice& device) const;
120 
122  bool isDemandElementValid() const;
123 
125  std::string getDemandElementProblem() const;
126 
129 
133  SUMOVehicleClass getVClass() const;
134 
136  const RGBColor& getColor() const;
137 
139 
143  void startGeometryMoving();
144 
146  void endGeometryMoving();
147 
151  void moveGeometry(const Position& offset);
152 
156  void commitGeometryMoving(GNEUndoList* undoList);
157 
159  void updateGeometry();
160 
162  void computePath();
163 
165  void invalidatePath();
166 
168  Position getPositionInView() const;
170 
173 
181 
185  std::string getParentName() const;
186 
191 
193  void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
194 
199  void drawGL(const GUIVisualizationSettings& s) const;
200 
206  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* lane, const double offsetFront) const;
207 
214  void drawPartialGL(const GUIVisualizationSettings& s, const GNELane* fromLane, const GNELane* toLane, const double offsetFront) const;
216 
219  /* @brief method for getting the Attribute of an XML key
220  * @param[in] key The attribute key
221  * @return string with the value associated to key
222  */
223  std::string getAttribute(SumoXMLAttr key) const;
224 
225  /* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
226  * @param[in] key The attribute key
227  * @return double with the value associated to key
228  */
229  double getAttributeDouble(SumoXMLAttr key) const;
230 
231  /* @brief method for setting the attribute and letting the object perform demand element changes
232  * @param[in] key The attribute key
233  * @param[in] value The new value
234  * @param[in] undoList The undoList on which to register changes
235  * @param[in] net optionally the GNENet to inform about gui updates
236  */
237  void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
238 
239  /* @brief method for setting the attribute and letting the object perform demand element changes
240  * @param[in] key The attribute key
241  * @param[in] value The new value
242  * @param[in] undoList The undoList on which to register changes
243  */
244  bool isValid(SumoXMLAttr key, const std::string& value);
245 
246  /* @brief method for enable attribute
247  * @param[in] key The attribute key
248  * @param[in] undoList The undoList on which to register changes
249  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
250  */
251  void enableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
252 
253  /* @brief method for disable attribute
254  * @param[in] key The attribute key
255  * @param[in] undoList The undoList on which to register changes
256  * @note certain attributes can be only enabled, and can produce the disabling of other attributes
257  */
258  void disableAttribute(SumoXMLAttr key, GNEUndoList* undoList);
259 
260  /* @brief method for check if the value for certain attribute is set
261  * @param[in] key The attribute key
262  */
263  bool isAttributeEnabled(SumoXMLAttr key) const;
264 
266  std::string getPopUpID() const;
267 
269  std::string getHierarchyName() const;
271 
273  const std::map<std::string, std::string>& getACParametersMap() const;
274 
275 protected:
277  void setColor(const GUIVisualizationSettings& s) const;
278 
280  bool setFunctionalColor(int activeScheme) const;
281 
282 private:
283  // @brief struct used for calculating person plan geometry segments
286  personPlanSegment(GNEDemandElement* _personPlan);
287 
290 
293 
295  std::vector<GNEAdditional*> busStops;
296 
298  std::vector<GNEDemandElement*> stops;
299 
301  double arrivalPos;
302 
303  private:
306  };
307 
309  void setAttribute(SumoXMLAttr key, const std::string& value);
310 
312  void setEnabledAttribute(const int enabledAttributes);
313 
315  GNEPerson(const GNEPerson&) = delete;
316 
318  GNEPerson& operator=(const GNEPerson&) = delete;
319 };
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.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:49
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:45
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
class used in GUIGLObjectPopupMenu for person transformations
Definition: GNEPerson.h:37
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:65
GNEPerson * myPerson
current person
Definition: GNEPerson.h:59
GNEPersonPopupMenu(GNEPerson *person, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
Definition: GNEPerson.cpp:56
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:62
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:96
~GNEPersonPopupMenu()
Destructor.
Definition: GNEPerson.cpp:92
class used in GUIGLObjectPopupMenu for single person transformations
Definition: GNEPerson.h:69
GNESelectedPersonsPopupMenu(GNEPerson *person, const std::vector< GNEPerson * > &selectedPerson, GUIMainWindow &app, GUISUMOAbstractView &parent)
Constructor.
Definition: GNEPerson.cpp:110
SumoXMLTag myPersonTag
tag of clicked person
Definition: GNEPerson.h:92
long onCmdTransform(FXObject *obj, FXSelector, void *)
Called to transform the current person to another person type.
Definition: GNEPerson.cpp:145
FXMenuCommand * myTransformToPerson
menu command for transform to person
Definition: GNEPerson.h:98
std::vector< GNEPerson * > mySelectedPersons
current selected persons
Definition: GNEPerson.h:95
FXMenuCommand * myTransformToPersonFlow
menu command for transform to personFlow
Definition: GNEPerson.h:101
void drawPartialGL(const GUIVisualizationSettings &s, const GNELane *lane, const double offsetFront) const
Draws partial object.
Definition: GNEPerson.cpp:464
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GNEPerson.cpp:382
GNEPerson & operator=(const GNEPerson &)=delete
Invalidated assignment operator.
Position getPositionInView() const
Returns position of demand element in view.
Definition: GNEPerson.cpp:318
GNEPerson(SumoXMLTag tag, GNENet *net, GNEDemandElement *pType, const SUMOVehicleParameter &personparameters)
constructor for persons
Definition: GNEPerson.cpp:163
void updateGeometry()
update pre-computed geometry information
Definition: GNEPerson.cpp:297
const RGBColor & getColor() const
get color
Definition: GNEPerson.cpp:267
GNEPerson(const GNEPerson &)=delete
Invalidated copy constructor.
bool isAttributeEnabled(SumoXMLAttr key) const
Definition: GNEPerson.cpp:675
void writeDemandElement(OutputDevice &device) const
writte demand element element into a xml file
Definition: GNEPerson.cpp:195
void endGeometryMoving()
end geometry movement
Definition: GNEPerson.cpp:279
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GNEPerson.cpp:735
void fixDemandElementProblem()
fix demand element problem (by default throw an exception, has to be reimplemented in children)
Definition: GNEPerson.cpp:255
void moveGeometry(const Position &offset)
change the position of the element geometry without saving in undoList
Definition: GNEPerson.cpp:285
void computePath()
compute path
Definition: GNEPerson.cpp:306
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GNEPerson.cpp:744
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
Definition: GNEPerson.cpp:700
void setEnabledAttribute(const int enabledAttributes)
method for enabling the attribute and nothing else (used in GNEChange_EnableAttribute)
Definition: GNEPerson.cpp:894
bool isDemandElementValid() const
check if current demand element is valid to be writed into XML (by default true, can be reimplemented...
Definition: GNEPerson.cpp:241
std::string getBegin() const
get begin time of demand element
Definition: GNEPerson.cpp:176
void enableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:658
~GNEPerson()
destructor
Definition: GNEPerson.cpp:172
const std::map< std::string, std::string > & getACParametersMap() const
get parameters map
Definition: GNEPerson.cpp:726
SUMOVehicleClass getVClass() const
Definition: GNEPerson.cpp:261
std::string getParentName() const
Returns the name of the parent object.
Definition: GNEPerson.cpp:351
bool isValid(SumoXMLAttr key, const std::string &value)
method for checking if the key and their conrrespond attribute are valids
Definition: GNEPerson.cpp:569
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement *originalElement, const GNENetworkElement *newElement, GNEUndoList *undoList)
split geometry
Definition: GNEPerson.cpp:376
void disableAttribute(SumoXMLAttr key, GNEUndoList *undoList)
Definition: GNEPerson.cpp:669
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:539
std::string getAttribute(SumoXMLAttr key) const
inherited from GNEAttributeCarrier
Definition: GNEPerson.cpp:476
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GNEPerson.cpp:357
double getAttributeDouble(SumoXMLAttr key) const
Definition: GNEPerson.cpp:524
void commitGeometryMoving(GNEUndoList *undoList)
commit geometry changes in the attributes of an element after use of moveGeometry(....
Definition: GNEPerson.cpp:291
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GNEPerson.cpp:344
void invalidatePath()
invalidate path
Definition: GNEPerson.cpp:312
std::string getDemandElementProblem() const
return a string with the current demand element problem (by default empty, can be reimplemented in ch...
Definition: GNEPerson.cpp:248
void startGeometryMoving()
Definition: GNEPerson.cpp:273
std::string getPopUpID() const
get PopPup ID (Used in AC Hierarchy)
Definition: GNEPerson.cpp:694
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:60
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
Structure representing possible vehicle parameter.
SumoXMLTag tag
The vehicle tag.
double arrivalPos
arrival position
Definition: GNEPerson.h:301
const GNEDemandElement * personPlan
person plan
Definition: GNEPerson.h:289
std::vector< GNEDemandElement * > stops
stops placed in this segment
Definition: GNEPerson.h:298
std::vector< GNEAdditional * > busStops
busStops placed in this segment
Definition: GNEPerson.h:295