Eclipse SUMO - Simulation of Urban MObility
GUIPerson.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 /****************************************************************************/
21 // A MSVehicle extended by some values for usage within the gui
22 /****************************************************************************/
23 #pragma once
24 #include <config.h>
25 
26 #include <vector>
27 #include <set>
28 #include <string>
29 #include <fx.h>
31 #include <utils/common/RGBColor.h>
35 #include "GUIBaseVehicle.h"
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
43 class MSDevice_Vehroutes;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
52 class GUIPerson : public MSPerson, public GUIGlObject {
53 
54 public:
56  GUIPerson(const SUMOVehicleParameter* pars, MSVehicleType* vtype, MSTransportable::MSTransportablePlan* plan, const double speedFactor);
57 
59  ~GUIPerson();
60 
63 
71 
80 
88 
95 
100  void drawGL(const GUIVisualizationSettings& s) const;
101 
106  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
107  //* @}
108 
109  /* @brief proceeds to the next step of the route,
110  * @return Whether the transportables plan continues */
111  bool proceed(MSNet* net, SUMOTime time, const bool vehicleArrived = false);
112 
113  /* @brief set the position of a person while riding in a vehicle
114  * @note This must be called by the vehicle before the call to drawGl */
116 
120  double getEdgePos() const;
121 
123  // @note overrides the base method and returns myPositionInVehicle while in driving stage
124  Position getPosition() const;
125 
127  Position getGUIPosition() const;
128 
130  double getGUIAngle() const;
131 
133  double getNaviDegree() const;
134 
136  double getWaitingSeconds() const;
137 
139  double getSpeed() const;
140 
142  std::string getStageIndexDescription() const;
143 
145  std::string getEdgeID() const;
146 
148  std::string getFromEdgeID() const;
149 
151  std::string getDestinationEdgeID() const;
152 
154  double getStageArrivalPos() const;
155 
157 
159  bool isSelected() const;
160 
168  FXDECLARE(GUIPersonPopupMenu)
169 
170  public:
177 
180 
182  long onCmdShowCurrentRoute(FXObject*, FXSelector, void*);
183 
185  long onCmdHideCurrentRoute(FXObject*, FXSelector, void*);
186 
188  long onCmdShowWalkingareaPath(FXObject*, FXSelector, void*);
189 
191  long onCmdHideWalkingareaPath(FXObject*, FXSelector, void*);
192 
194  long onCmdShowPlan(FXObject*, FXSelector, void*);
195 
197  long onCmdStartTrack(FXObject*, FXSelector, void*);
198 
200  long onCmdStopTrack(FXObject*, FXSelector, void*);
201 
203  long onCmdRemoveObject(FXObject*, FXSelector, void*);
204 
205  protected:
207  FOX_CONSTRUCTOR(GUIPersonPopupMenu)
208  };
209 
217  VO_TRACKED = 8
218  };
219 
222 
227  bool hasActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) const;
228 
234  void addActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
235 
241  void removeActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
242 
244 
245 private:
247  void setColor(const GUIVisualizationSettings& s) const;
248 
250  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
251 
253  bool setFunctionalColor(int activeScheme) const;
254 
257 
259  bool isJammed() const;
260 
262  mutable FXMutex myLock;
263 
266 
268  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
269 };
long long int SUMOTime
Definition: SUMOTime.h:31
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
The popup menu of a globject.
A window containing a gl-object's parameter.
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the person shall be tracked.
Definition: GUIPerson.cpp:131
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
Definition: GUIPerson.cpp:113
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the person.
Definition: GUIPerson.cpp:149
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition: GUIPerson.cpp:87
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:105
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:73
GUIPersonPopupMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, GUIGlObject &o)
Constructor.
Definition: GUIPerson.cpp:67
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIPerson.cpp:141
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition: GUIPerson.cpp:77
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition: GUIPerson.cpp:95
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:378
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
draw walking area path
Definition: GUIPerson.cpp:315
std::string getDestinationEdgeID() const
get destination edge ID
Definition: GUIPerson.cpp:562
std::string getStageIndexDescription() const
get stage index description
Definition: GUIPerson.cpp:532
Position getGUIPosition() const
return the Network coordinate of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:474
~GUIPerson()
destructor
Definition: GUIPerson.cpp:173
double getGUIAngle() const
return the angle of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:488
bool isJammed() const
whether the person is jammed as defined by the current pedestrian model
Definition: GUIPerson.cpp:333
GUIBaseVehicle::Seat myPositionInVehicle
The position of a person while riding a vehicle.
Definition: GUIPerson.h:265
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIPerson.h:268
VisualisationFeatures
Additional visualisation feature ids.
Definition: GUIPerson.h:211
@ VO_TRACKED
track person
Definition: GUIPerson.h:217
@ VO_SHOW_WALKINGAREA_PATH
show the current walkingarea path
Definition: GUIPerson.h:213
@ VO_SHOW_ROUTE
show persons's current route
Definition: GUIPerson.h:215
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPerson.cpp:221
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:607
double getSpeed() const
the current speed of the person
Definition: GUIPerson.cpp:522
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIPerson.cpp:186
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:273
double getNaviDegree() const
return the current angle of the person
Definition: GUIPerson.cpp:502
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:343
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIPerson.cpp:245
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
Constructor.
Definition: GUIPerson.cpp:166
std::string getEdgeID() const
get edge ID
Definition: GUIPerson.cpp:542
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIPerson.cpp:591
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:387
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPerson.cpp:263
bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false)
Definition: GUIPerson.cpp:581
Position getPosition() const
return the Network coordinate of the person
Definition: GUIPerson.cpp:464
void setPositionInVehicle(const GUIBaseVehicle::Seat &pos)
Definition: GUIPerson.cpp:372
bool isSelected() const
whether this person is selected in the GUI
Definition: GUIPerson.cpp:613
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIPerson.h:262
std::string getFromEdgeID() const
ger from edge ID
Definition: GUIPerson.cpp:552
double getStageArrivalPos() const
get stage arrival position
Definition: GUIPerson.cpp:572
double getWaitingSeconds() const
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:512
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:432
double getEdgePos() const
Return the position on the edge.
Definition: GUIPerson.cpp:454
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:597
Stores the information about how to visualize structures.
A device which collects info on the vehicle trip (mainly on departure and arrival)
The simulated network and simulation perfomer.
Definition: MSNet.h:89
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
The car-following model and parameter.
Definition: MSVehicleType.h:62
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
Structure representing possible vehicle parameter.