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.dev/sumo
3 // Copyright (C) 2001-2024 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>
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 
90  double getExaggeration(const GUIVisualizationSettings& s) const override;
91 
97  Boundary getCenteringBoundary() const override;
98 
103  void drawGL(const GUIVisualizationSettings& s) const override;
104 
109  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const override;
110  //* @}
111 
112  /* @brief proceeds to the next step of the route,
113  * @return Whether the transportables plan continues */
114  bool proceed(MSNet* net, SUMOTime time, const bool vehicleArrived = false) override;
115 
116  /* @brief set the position of a person while riding in a vehicle
117  * @note This must be called by the vehicle before the call to drawGl */
119 
123  double getEdgePos() const override;
124 
126  int getDirection() const override;
127 
129  // @note overrides the base method and returns myPositionInVehicle while in driving stage
130  Position getPosition() const override;
131 
133  Position getGUIPosition(const GUIVisualizationSettings* s = nullptr) const;
134 
136  double getGUIAngle() const;
137 
139  double getNaviDegree() const;
140 
142  double getWaitingSeconds() const override;
143 
145  double getSpeed() const override;
146 
148  std::string getStageIndexDescription() const;
149 
151  std::string getEdgeID() const;
152 
154  std::string getFromEdgeID() const;
155 
157  std::string getDestinationEdgeID() const;
158 
160  std::string getDestinationStopID() const;
161 
163  std::string getVehicleID() const;
164 
166  double getStopDuration() const;
167 
169  double getStageArrivalPos() const;
170 
172 
174  bool isSelected() const override;
175 
177  static bool setFunctionalColor(int activeScheme, const MSPerson* person, RGBColor& col);
178 
180  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const override;
181 
189  FXDECLARE(GUIPersonPopupMenu)
190 
191  public:
198 
201 
203  long onCmdShowCurrentRoute(FXObject*, FXSelector, void*);
204 
206  long onCmdHideCurrentRoute(FXObject*, FXSelector, void*);
207 
209  long onCmdShowWalkingareaPath(FXObject*, FXSelector, void*);
210 
212  long onCmdHideWalkingareaPath(FXObject*, FXSelector, void*);
213 
215  long onCmdShowPlan(FXObject*, FXSelector, void*);
216 
218  long onCmdStartTrack(FXObject*, FXSelector, void*);
219 
221  long onCmdStopTrack(FXObject*, FXSelector, void*);
222 
224  long onCmdRemoveObject(FXObject*, FXSelector, void*);
225 
226  protected:
228  FOX_CONSTRUCTOR(GUIPersonPopupMenu)
229  };
230 
238  VO_TRACKED = 8
239  };
240 
243 
248  bool hasActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) const;
249 
255  void addActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
256 
262  void removeActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) override;
263 
265 
266 private:
268  void setColor(const GUIVisualizationSettings& s) const;
269 
272 
274  mutable FXMutex myLock;
275 
278 
280  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
281 };
long long int SUMOTime
Definition: GUI.h:35
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:135
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
Definition: GUIPerson.cpp:117
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the person.
Definition: GUIPerson.cpp:153
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition: GUIPerson.cpp:91
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:109
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:77
GUIPersonPopupMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, GUIGlObject &o)
Constructor.
Definition: GUIPerson.cpp:71
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIPerson.cpp:145
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition: GUIPerson.cpp:81
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition: GUIPerson.cpp:99
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:379
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
draw walking area path
Definition: GUIPerson.cpp:325
bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false) override
Definition: GUIPerson.cpp:656
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
Definition: GUIPerson.cpp:267
std::string getDestinationStopID() const
get destination stop ID
Definition: GUIPerson.cpp:603
std::string getDestinationEdgeID() const
get destination edge ID
Definition: GUIPerson.cpp:593
std::string getStageIndexDescription() const
get stage index description
Definition: GUIPerson.cpp:562
Position getPosition() const override
return the Network coordinate of the person
Definition: GUIPerson.cpp:483
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const override
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:343
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition: GUIPerson.cpp:190
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const override
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:435
~GUIPerson()
destructor
Definition: GUIPerson.cpp:177
double getGUIAngle() const
return the angle of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:518
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPerson.cpp:273
bool isSelected() const override
whether this person is selected in the GUI
Definition: GUIPerson.cpp:690
Position getGUIPosition(const GUIVisualizationSettings *s=nullptr) const
return the Network coordinate of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:493
double getStopDuration() const
get remaining duration of current stop or -1
Definition: GUIPerson.cpp:633
GUIBaseVehicle::Seat myPositionInVehicle
The position of a person while riding a vehicle.
Definition: GUIPerson.h:277
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIPerson.h:280
VisualisationFeatures
Additional visualisation feature ids.
Definition: GUIPerson.h:232
@ VO_TRACKED
track person
Definition: GUIPerson.h:238
@ VO_SHOW_WALKINGAREA_PATH
show the current walkingarea path
Definition: GUIPerson.h:234
@ VO_SHOW_ROUTE
show persons's current route
Definition: GUIPerson.h:236
double getEdgePos() const override
Return the position on the edge.
Definition: GUIPerson.cpp:464
double getSpeed() const override
the current speed of the person
Definition: GUIPerson.cpp:552
double getNaviDegree() const
return the current angle of the person
Definition: GUIPerson.cpp:532
std::string getVehicleID() const
get current vehicle id if applicable
Definition: GUIPerson.cpp:618
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
Constructor.
Definition: GUIPerson.cpp:170
std::string getEdgeID() const
get edge ID
Definition: GUIPerson.cpp:573
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIPerson.cpp:668
double getWaitingSeconds() const override
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:542
void setPositionInVehicle(const GUIBaseVehicle::Seat &pos)
Definition: GUIPerson.cpp:373
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) override
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:684
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition: GUIPerson.cpp:225
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIPerson.h:274
int getDirection() const override
Return the movement directon on the edge.
Definition: GUIPerson.cpp:473
std::string getFromEdgeID() const
ger from edge ID
Definition: GUIPerson.cpp:583
double getStageArrivalPos() const
get stage arrival position
Definition: GUIPerson.cpp:647
static bool setFunctionalColor(int activeScheme, const MSPerson *person, RGBColor &col)
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:390
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own type parameter window.
Definition: GUIPerson.cpp:252
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:674
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition: GUIPerson.cpp:283
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:63
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
Structure representing possible vehicle parameter.