SUMO - Simulation of Urban MObility
GUIPerson.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // A MSVehicle extended by some values for usage within the gui
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef GUIPerson_h
24 #define GUIPerson_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <vector>
37 #include <set>
38 #include <string>
40 #include <utils/common/RGBColor.h>
45 
46 
47 // ===========================================================================
48 // class declarations
49 // ===========================================================================
52 class MSDevice_Vehroutes;
53 
54 
55 // ===========================================================================
56 // class definitions
57 // ===========================================================================
61 class GUIPerson : public MSPerson, public GUIGlObject {
62 public:
66 
67 
69  ~GUIPerson();
70 
71 
73 
74 
83 
84 
93 
101 
108 
109 
114  void drawGL(const GUIVisualizationSettings& s) const;
115 
116 
121  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
123 
124  /* @brief set the position of a person while riding in a vehicle
125  * @note This must be called by the vehicle before the call to drawGl */
126  void setPositionInVehicle(const Position& pos) {
127  myPositionInVehicle = pos;
128  }
129 
131 
132 
134  double getEdgePos() const;
135 
137  // @note overrides the base method and returns myPositionInVehicle while in driving stage
138  Position getPosition() const;
139 
141  double getNaviDegree() const;
142 
144  double getWaitingSeconds() const;
145 
147  double getSpeed() const;
148 
150 
152  bool isSelected() const;
153 
161  FXDECLARE(GUIPersonPopupMenu)
162  public:
170  GUISUMOAbstractView& parent, GUIGlObject& o, std::map<GUISUMOAbstractView*, int>& additionalVisualizations);
171 
174 
176  long onCmdShowCurrentRoute(FXObject*, FXSelector, void*);
178  long onCmdHideCurrentRoute(FXObject*, FXSelector, void*);
180  long onCmdShowWalkingareaPath(FXObject*, FXSelector, void*);
182  long onCmdHideWalkingareaPath(FXObject*, FXSelector, void*);
184  long onCmdStartTrack(FXObject*, FXSelector, void*);
186  long onCmdStopTrack(FXObject*, FXSelector, void*);
187 
188 
189  protected:
191  std::map<GUISUMOAbstractView*, int>& myVehiclesAdditionalVisualizations;
193  std::map<GUISUMOAbstractView*, int> dummy;
194 
195  protected:
197  GUIPersonPopupMenu() : myVehiclesAdditionalVisualizations(dummy) { }
198 
199  };
200 
201 
211  };
212 
214  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
215 
216 
219 
225  bool hasActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) const;
226 
227 
233  void addActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
234 
235 
241  void removeActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
243 
244 
245 private:
247  mutable MFXMutex myLock;
248 
251 
253  void setColor(const GUIVisualizationSettings& s) const;
254 
256  double getColorValue(int activeScheme) const;
257 
259  bool setFunctionalColor(int activeScheme) const;
260 
264  void drawAction_drawAsPoly(const GUIVisualizationSettings& s) const;
266 
269 };
270 
271 
272 #endif
273 
274 /****************************************************************************/
275 
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIPerson.h:214
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:295
show persons&#39;s current route
Definition: GUIPerson.h:208
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:126
track person
Definition: GUIPerson.h:210
double getEdgePos() const
return the offset from the start of the current edge
Definition: GUIPerson.cpp:418
double getWaitingSeconds() const
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:439
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:501
Stores the information about how to visualize structures.
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIPerson.cpp:523
std::map< GUISUMOAbstractView *, int > dummy
Needed for parameterless instantiation.
Definition: GUIPerson.h:193
GUIPersonPopupMenu()
default constructor needed by FOX
Definition: GUIPerson.h:197
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:344
void drawAction_drawAsPoly(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:475
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
The car-following model and parameter.
Definition: MSVehicleType.h:73
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPerson.cpp:208
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:398
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:96
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIPerson.h:247
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition: GUIPerson.cpp:108
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the person shall be tracked.
Definition: GUIPerson.cpp:134
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIPerson.cpp:175
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPerson.cpp:249
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:313
VisualisationFeatures
Additional visualisation feature ids.
Definition: GUIPerson.h:204
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition: GUIPerson.cpp:117
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIPerson.cpp:229
void setPositionInVehicle(const Position &pos)
Definition: GUIPerson.h:126
void drawAction_drawAsTriangle(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:453
double getSpeed() const
the current speed of the person
Definition: GUIPerson.cpp:446
show the current walkingarea path
Definition: GUIPerson.h:206
double getNaviDegree() const
return the current angle of the person
Definition: GUIPerson.cpp:432
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:539
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:259
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIPerson.cpp:143
Structure representing possible vehicle parameter.
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan)
Constructor.
Definition: GUIPerson.cpp:155
std::map< GUISUMOAbstractView *, int > & myVehiclesAdditionalVisualizations
Information which additional visualisations are enabled (per view)
Definition: GUIPerson.h:191
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:529
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:162
bool isSelected() const
whether this person is selected in the GUI
Definition: GUIPerson.cpp:545
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition: GUIPerson.cpp:99
Position getPosition() const
return the Network coordinate of the person
Definition: GUIPerson.cpp:425
Position myPositionInVehicle
The position of a person while riding a vehicle.
Definition: GUIPerson.h:250
A window containing a gl-object&#39;s parameter.
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:353