Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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-2025 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 getLaneID() const;
155
157 std::string getFromEdgeID() const;
158
160 std::string getDestinationEdgeID() const;
161
163 std::string getDestinationStopID() const;
164
166 std::string getVehicleID() const;
167
169 double getStopDuration() const;
170
172 double getStageArrivalPos() const;
173
175
177 bool isSelected() const override;
178
180 static bool setFunctionalColor(int activeScheme, const MSPerson* person, RGBColor& col);
181
183 double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const override;
184
192 FXDECLARE(GUIPersonPopupMenu)
193
194 public:
201
204
206 long onCmdShowCurrentRoute(FXObject*, FXSelector, void*);
207
209 long onCmdHideCurrentRoute(FXObject*, FXSelector, void*);
210
212 long onCmdShowWalkingareaPath(FXObject*, FXSelector, void*);
213
215 long onCmdHideWalkingareaPath(FXObject*, FXSelector, void*);
216
218 long onCmdShowPlan(FXObject*, FXSelector, void*);
219
221 long onCmdStartTrack(FXObject*, FXSelector, void*);
222
224 long onCmdStopTrack(FXObject*, FXSelector, void*);
225
227 long onCmdRemoveObject(FXObject*, FXSelector, void*);
228
229 protected:
231 FOX_CONSTRUCTOR(GUIPersonPopupMenu)
232 };
233
243
246
251 bool hasActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) const;
252
258 void addActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
259
265 void removeActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) override;
266
268
269private:
271 void setColor(const GUIVisualizationSettings& s) const;
272
275
277 mutable FXMutex myLock;
278
281
283 std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
284};
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.
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the person.
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.
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
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
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
draw walking area path
bool proceed(MSNet *net, SUMOTime time, const bool vehicleArrived=false) override
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
std::string getDestinationStopID() const
get destination stop ID
std::string getDestinationEdgeID() const
get destination edge ID
std::string getStageIndexDescription() const
get stage index description
Position getPosition() const override
return the Network coordinate of the person
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const override
Draws additionally triggered visualisations.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const override
gets the color value according to the current scheme index
~GUIPerson()
destructor
double getGUIAngle() const
return the angle of the person (only for drawing centering and tracking)
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
bool isSelected() const override
whether this person is selected in the GUI
Position getGUIPosition(const GUIVisualizationSettings *s=nullptr) const
return the Network coordinate of the person (only for drawing centering and tracking)
double getStopDuration() const
get remaining duration of current stop or -1
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:235
@ VO_TRACKED
track person
Definition GUIPerson.h:241
@ VO_SHOW_WALKINGAREA_PATH
show the current walkingarea path
Definition GUIPerson.h:237
@ VO_SHOW_ROUTE
show persons's current route
Definition GUIPerson.h:239
double getEdgePos() const override
Return the position on the edge.
double getSpeed() const override
the current speed of the person
double getNaviDegree() const
return the current angle of the person
std::string getVehicleID() const
get current vehicle id if applicable
std::string getEdgeID() const
get edge ID
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
double getWaitingSeconds() const override
the time this person spent waiting in seconds
void setPositionInVehicle(const GUIBaseVehicle::Seat &pos)
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) override
Adds the named visualisation feature to the given view.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
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.
std::string getLaneID() const
get lane ID
std::string getFromEdgeID() const
get from edge ID
double getStageArrivalPos() const
get stage arrival position
static bool setFunctionalColor(int activeScheme, const MSPerson *person, RGBColor &col)
sets the color according to the current scheme index and some vehicle function
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own type parameter window.
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
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.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
Structure representing possible vehicle parameter.