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-2022 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 
183  FXDECLARE(GUIPersonPopupMenu)
184 
185  public:
192 
195 
197  long onCmdShowCurrentRoute(FXObject*, FXSelector, void*);
198 
200  long onCmdHideCurrentRoute(FXObject*, FXSelector, void*);
201 
203  long onCmdShowWalkingareaPath(FXObject*, FXSelector, void*);
204 
206  long onCmdHideWalkingareaPath(FXObject*, FXSelector, void*);
207 
209  long onCmdShowPlan(FXObject*, FXSelector, void*);
210 
212  long onCmdStartTrack(FXObject*, FXSelector, void*);
213 
215  long onCmdStopTrack(FXObject*, FXSelector, void*);
216 
218  long onCmdRemoveObject(FXObject*, FXSelector, void*);
219 
220  protected:
222  FOX_CONSTRUCTOR(GUIPersonPopupMenu)
223  };
224 
232  VO_TRACKED = 8
233  };
234 
237 
242  bool hasActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) const;
243 
249  void addActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
250 
256  void removeActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) override;
257 
259 
260 private:
262  void setColor(const GUIVisualizationSettings& s) const;
263 
265  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const override;
266 
268  bool setFunctionalColor(int activeScheme) const;
269 
272 
274  bool isJammed() const;
275 
277  mutable FXMutex myLock;
278 
281 
283  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
284 };
long long int SUMOTime
Definition: SUMOTime.h:32
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:132
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
Definition: GUIPerson.cpp:114
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the person.
Definition: GUIPerson.cpp:150
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition: GUIPerson.cpp:88
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:106
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:74
GUIPersonPopupMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, GUIGlObject &o)
Constructor.
Definition: GUIPerson.cpp:68
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIPerson.cpp:142
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition: GUIPerson.cpp:78
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition: GUIPerson.cpp:96
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:388
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:662
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration asociated with this GLObject
Definition: GUIPerson.cpp:267
std::string getDestinationStopID() const
get destination stop ID
Definition: GUIPerson.cpp:609
std::string getDestinationEdgeID() const
get destination edge ID
Definition: GUIPerson.cpp:599
std::string getStageIndexDescription() const
get stage index description
Definition: GUIPerson.cpp:569
Position getPosition() const override
return the Network coordinate of the person
Definition: GUIPerson.cpp:490
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const override
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:353
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition: GUIPerson.cpp:187
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const override
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:442
~GUIPerson()
destructor
Definition: GUIPerson.cpp:174
double getGUIAngle() const
return the angle of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:525
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:696
Position getGUIPosition(const GUIVisualizationSettings *s=nullptr) const
return the Network coordinate of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:500
bool isJammed() const
whether the person is jammed as defined by the current pedestrian model
Definition: GUIPerson.cpp:343
double getStopDuration() const
get remaining duration of current stop or -1
Definition: GUIPerson.cpp:639
GUIBaseVehicle::Seat myPositionInVehicle
The position of a person while riding a vehicle.
Definition: GUIPerson.h:280
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIPerson.h:283
VisualisationFeatures
Additional visualisation feature ids.
Definition: GUIPerson.h:226
@ VO_TRACKED
track person
Definition: GUIPerson.h:232
@ VO_SHOW_WALKINGAREA_PATH
show the current walkingarea path
Definition: GUIPerson.h:228
@ VO_SHOW_ROUTE
show persons's current route
Definition: GUIPerson.h:230
double getEdgePos() const override
Return the position on the edge.
Definition: GUIPerson.cpp:471
double getSpeed() const override
the current speed of the person
Definition: GUIPerson.cpp:559
double getNaviDegree() const
return the current angle of the person
Definition: GUIPerson.cpp:539
std::string getVehicleID() const
get current vehicle id if applicable
Definition: GUIPerson.cpp:624
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
Constructor.
Definition: GUIPerson.cpp:167
std::string getEdgeID() const
get edge ID
Definition: GUIPerson.cpp:579
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIPerson.cpp:674
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:397
double getWaitingSeconds() const override
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:549
void setPositionInVehicle(const GUIBaseVehicle::Seat &pos)
Definition: GUIPerson.cpp:382
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) override
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:690
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition: GUIPerson.cpp:222
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIPerson.h:277
int getDirection() const override
Return the movement directon on the edge.
Definition: GUIPerson.cpp:480
std::string getFromEdgeID() const
ger from edge ID
Definition: GUIPerson.cpp:589
double getStageArrivalPos() const
get stage arrival position
Definition: GUIPerson.cpp:653
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own type parameter window.
Definition: GUIPerson.cpp:249
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:680
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:88
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:37
Structure representing possible vehicle parameter.