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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // A MSVehicle extended by some values for usage within the gui
19 /****************************************************************************/
20 #ifndef GUIPerson_h
21 #define GUIPerson_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <vector>
30 #include <set>
31 #include <string>
33 #include <utils/common/RGBColor.h>
38 
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
45 class MSDevice_Vehroutes;
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
54 class GUIPerson : public MSPerson, public GUIGlObject {
55 public:
58  GUIPerson(const SUMOVehicleParameter* pars, MSVehicleType* vtype, MSTransportable::MSTransportablePlan* plan, const double speedFactor);
59 
60 
62  ~GUIPerson();
63 
64 
66 
67 
76 
77 
86 
94 
101 
102 
107  void drawGL(const GUIVisualizationSettings& s) const;
108 
109 
114  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
116 
117  /* @brief set the position of a person while riding in a vehicle
118  * @note This must be called by the vehicle before the call to drawGl */
119  void setPositionInVehicle(const Position& pos) {
120  myPositionInVehicle = pos;
121  }
122 
124 
125 
127  double getEdgePos() const;
128 
130  // @note overrides the base method and returns myPositionInVehicle while in driving stage
131  Position getPosition() const;
132 
134  Position getGUIPosition() const;
135 
137  double getNaviDegree() const;
138 
140  double getWaitingSeconds() const;
141 
143  double getSpeed() const;
144 
146 
148  bool isSelected() const;
149 
157  FXDECLARE(GUIPersonPopupMenu)
158  public:
166  GUISUMOAbstractView& parent, GUIGlObject& o, std::map<GUISUMOAbstractView*, int>& additionalVisualizations);
167 
170 
172  long onCmdShowCurrentRoute(FXObject*, FXSelector, void*);
174  long onCmdHideCurrentRoute(FXObject*, FXSelector, void*);
176  long onCmdShowWalkingareaPath(FXObject*, FXSelector, void*);
178  long onCmdHideWalkingareaPath(FXObject*, FXSelector, void*);
180  long onCmdShowPlan(FXObject*, FXSelector, void*);
182  long onCmdStartTrack(FXObject*, FXSelector, void*);
184  long onCmdStopTrack(FXObject*, FXSelector, void*);
185 
186 
187  protected:
189  std::map<GUISUMOAbstractView*, int>& myVehiclesAdditionalVisualizations;
191  std::map<GUISUMOAbstractView*, int> dummy;
192 
193  protected:
195  GUIPersonPopupMenu() : myVehiclesAdditionalVisualizations(dummy) { }
196 
197  };
198 
199 
209  };
210 
212  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
213 
214 
217 
223  bool hasActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) const;
224 
225 
231  void addActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
232 
233 
239  void removeActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
241 
242 
243 private:
245  mutable MFXMutex myLock;
246 
249 
251  void setColor(const GUIVisualizationSettings& s) const;
252 
254  double getColorValue(int activeScheme) const;
255 
257  bool setFunctionalColor(int activeScheme) const;
258 
262  void drawAction_drawAsPoly(const GUIVisualizationSettings& s) const;
264 
267 };
268 
269 
270 #endif
271 
272 /****************************************************************************/
273 
bool isSelected() const
whether this person is selected in the GUI
Definition: GUIPerson.cpp:575
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:332
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIPerson.h:212
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIPerson.cpp:553
show persons&#39;s current route
Definition: GUIPerson.h:206
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:120
track person
Definition: GUIPerson.h:208
Position getPosition() const
return the Network coordinate of the person
Definition: GUIPerson.cpp:444
Stores the information about how to visualize structures.
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:531
std::map< GUISUMOAbstractView *, int > dummy
Needed for parameterless instantiation.
Definition: GUIPerson.h:191
GUIPersonPopupMenu()
default constructor needed by FOX
Definition: GUIPerson.h:195
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
Constructor.
Definition: GUIPerson.cpp:167
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
The car-following model and parameter.
Definition: MSVehicleType.h:66
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPerson.cpp:222
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:90
double getEdgePos() const
return the offset from the start of the current edge
Definition: GUIPerson.cpp:437
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIPerson.h:245
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:314
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition: GUIPerson.cpp:102
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the person shall be tracked.
Definition: GUIPerson.cpp:146
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIPerson.cpp:187
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
void drawAction_drawAsPoly(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:505
VisualisationFeatures
Additional visualisation feature ids.
Definition: GUIPerson.h:202
double getWaitingSeconds() const
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:469
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
double getNaviDegree() const
return the current angle of the person
Definition: GUIPerson.cpp:462
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition: GUIPerson.cpp:111
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:372
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIPerson.cpp:247
void setPositionInVehicle(const Position &pos)
Definition: GUIPerson.h:119
double getSpeed() const
the current speed of the person
Definition: GUIPerson.cpp:476
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:417
show the current walkingarea path
Definition: GUIPerson.h:204
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:276
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:569
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIPerson.cpp:155
Structure representing possible vehicle parameter.
std::map< GUISUMOAbstractView *, int > & myVehiclesAdditionalVisualizations
Information which additional visualisations are enabled (per view)
Definition: GUIPerson.h:189
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:363
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:559
The popup menu of a globject.
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
~GUIPerson()
destructor
Definition: GUIPerson.cpp:174
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPerson.cpp:266
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
Definition: GUIPerson.cpp:128
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition: GUIPerson.cpp:93
Position myPositionInVehicle
The position of a person while riding a vehicle.
Definition: GUIPerson.h:248
A window containing a gl-object&#39;s parameter.
void drawAction_drawAsTriangle(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:483
Position getGUIPosition() const
return the Network coordinate of the person (only for drawing centering and tracking) ...
Definition: GUIPerson.cpp:451