Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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>
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
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
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
266private:
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: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: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.
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:274
int getDirection() const override
Return the movement directon on the edge.
std::string getFromEdgeID() const
ger 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.