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>
35#include "GUIBaseVehicle.h"
36
37
38// ===========================================================================
39// class declarations
40// ===========================================================================
44
45
46// ===========================================================================
47// class definitions
48// ===========================================================================
52class GUIPerson : public MSPerson, public GUIGlObject {
53
54public:
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
260private:
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 mutable FXMutex myLock;
275
278
280 std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
281};
long long int SUMOTime
Definition: GUI.h:36
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:133
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
Definition: GUIPerson.cpp:115
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the person.
Definition: GUIPerson.cpp:151
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition: GUIPerson.cpp:89
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:107
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:75
GUIPersonPopupMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, GUIGlObject &o)
Constructor.
Definition: GUIPerson.cpp:69
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIPerson.cpp:143
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition: GUIPerson.cpp:79
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition: GUIPerson.cpp:97
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:380
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
draw walking area path
Definition: GUIPerson.cpp:327
bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false) override
Definition: GUIPerson.cpp:654
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
Definition: GUIPerson.cpp:269
std::string getDestinationStopID() const
get destination stop ID
Definition: GUIPerson.cpp:601
std::string getDestinationEdgeID() const
get destination edge ID
Definition: GUIPerson.cpp:591
std::string getStageIndexDescription() const
get stage index description
Definition: GUIPerson.cpp:561
Position getPosition() const override
return the Network coordinate of the person
Definition: GUIPerson.cpp:482
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const override
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:345
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
Definition: GUIPerson.cpp:188
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const override
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:434
~GUIPerson()
destructor
Definition: GUIPerson.cpp:175
double getGUIAngle() const
return the angle of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:517
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPerson.cpp:275
bool isSelected() const override
whether this person is selected in the GUI
Definition: GUIPerson.cpp:688
Position getGUIPosition(const GUIVisualizationSettings *s=nullptr) const
return the Network coordinate of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:492
double getStopDuration() const
get remaining duration of current stop or -1
Definition: GUIPerson.cpp:631
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: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:463
double getSpeed() const override
the current speed of the person
Definition: GUIPerson.cpp:551
double getNaviDegree() const
return the current angle of the person
Definition: GUIPerson.cpp:531
std::string getVehicleID() const
get current vehicle id if applicable
Definition: GUIPerson.cpp:616
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
Constructor.
Definition: GUIPerson.cpp:168
std::string getEdgeID() const
get edge ID
Definition: GUIPerson.cpp:571
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIPerson.cpp:666
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:389
double getWaitingSeconds() const override
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:541
void setPositionInVehicle(const GUIBaseVehicle::Seat &pos)
Definition: GUIPerson.cpp:374
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) override
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:682
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition: GUIPerson.cpp:223
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:472
std::string getFromEdgeID() const
ger from edge ID
Definition: GUIPerson.cpp:581
double getStageArrivalPos() const
get stage arrival position
Definition: GUIPerson.cpp:645
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own type parameter window.
Definition: GUIPerson.cpp:250
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:672
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
Definition: GUIPerson.cpp:285
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:63
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
Structure representing possible vehicle parameter.