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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // A MSVehicle extended by some values for usage within the gui
21 /****************************************************************************/
22 #ifndef GUIPerson_h
23 #define GUIPerson_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <vector>
36 #include <set>
37 #include <string>
39 #include <utils/common/RGBColor.h>
44 
45 
46 // ===========================================================================
47 // class declarations
48 // ===========================================================================
51 class MSDevice_Vehroutes;
52 
53 
54 // ===========================================================================
55 // class definitions
56 // ===========================================================================
60 class GUIPerson : public MSPerson, public GUIGlObject {
61 public:
64  GUIPerson(const SUMOVehicleParameter* pars, MSVehicleType* vtype, MSTransportable::MSTransportablePlan* plan, const double speedFactor);
65 
66 
68  ~GUIPerson();
69 
70 
72 
73 
82 
83 
92 
100 
107 
108 
113  void drawGL(const GUIVisualizationSettings& s) const;
114 
115 
120  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
122 
123  /* @brief set the position of a person while riding in a vehicle
124  * @note This must be called by the vehicle before the call to drawGl */
125  void setPositionInVehicle(const Position& pos) {
126  myPositionInVehicle = pos;
127  }
128 
130 
131 
133  double getEdgePos() const;
134 
136  // @note overrides the base method and returns myPositionInVehicle while in driving stage
137  Position getPosition() const;
138 
140  double getNaviDegree() const;
141 
143  double getWaitingSeconds() const;
144 
146  double getSpeed() const;
147 
149 
151  bool isSelected() const;
152 
160  FXDECLARE(GUIPersonPopupMenu)
161  public:
169  GUISUMOAbstractView& parent, GUIGlObject& o, std::map<GUISUMOAbstractView*, int>& additionalVisualizations);
170 
173 
175  long onCmdShowCurrentRoute(FXObject*, FXSelector, void*);
177  long onCmdHideCurrentRoute(FXObject*, FXSelector, void*);
179  long onCmdShowWalkingareaPath(FXObject*, FXSelector, void*);
181  long onCmdHideWalkingareaPath(FXObject*, FXSelector, void*);
183  long onCmdStartTrack(FXObject*, FXSelector, void*);
185  long onCmdStopTrack(FXObject*, FXSelector, void*);
186 
187 
188  protected:
190  std::map<GUISUMOAbstractView*, int>& myVehiclesAdditionalVisualizations;
192  std::map<GUISUMOAbstractView*, int> dummy;
193 
194  protected:
196  GUIPersonPopupMenu() : myVehiclesAdditionalVisualizations(dummy) { }
197 
198  };
199 
200 
210  };
211 
213  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
214 
215 
218 
224  bool hasActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) const;
225 
226 
232  void addActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
233 
234 
240  void removeActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
242 
243 
244 private:
246  mutable MFXMutex myLock;
247 
250 
252  void setColor(const GUIVisualizationSettings& s) const;
253 
255  double getColorValue(int activeScheme) const;
256 
258  bool setFunctionalColor(int activeScheme) const;
259 
263  void drawAction_drawAsPoly(const GUIVisualizationSettings& s) const;
265 
268 };
269 
270 
271 #endif
272 
273 /****************************************************************************/
274 
bool isSelected() const
whether this person is selected in the GUI
Definition: GUIPerson.cpp:543
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:311
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIPerson.h:213
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIPerson.cpp:521
show persons&#39;s current route
Definition: GUIPerson.h:207
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:124
track person
Definition: GUIPerson.h:209
Position getPosition() const
return the Network coordinate of the person
Definition: GUIPerson.cpp:423
Stores the information about how to visualize structures.
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:499
std::map< GUISUMOAbstractView *, int > dummy
Needed for parameterless instantiation.
Definition: GUIPerson.h:192
GUIPersonPopupMenu()
default constructor needed by FOX
Definition: GUIPerson.h:196
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
Constructor.
Definition: GUIPerson.cpp:153
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:47
The car-following model and parameter.
Definition: MSVehicleType.h:72
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPerson.cpp:206
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:94
double getEdgePos() const
return the offset from the start of the current edge
Definition: GUIPerson.cpp:416
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIPerson.h:246
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:293
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition: GUIPerson.cpp:106
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the person shall be tracked.
Definition: GUIPerson.cpp:132
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIPerson.cpp:173
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
void drawAction_drawAsPoly(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:473
VisualisationFeatures
Additional visualisation feature ids.
Definition: GUIPerson.h:203
double getWaitingSeconds() const
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:437
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
double getNaviDegree() const
return the current angle of the person
Definition: GUIPerson.cpp:430
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition: GUIPerson.cpp:115
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:351
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIPerson.cpp:228
void setPositionInVehicle(const Position &pos)
Definition: GUIPerson.h:125
double getSpeed() const
the current speed of the person
Definition: GUIPerson.cpp:444
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:396
show the current walkingarea path
Definition: GUIPerson.h:205
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:257
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:537
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIPerson.cpp:141
Structure representing possible vehicle parameter.
std::map< GUISUMOAbstractView *, int > & myVehiclesAdditionalVisualizations
Information which additional visualisations are enabled (per view)
Definition: GUIPerson.h:190
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:342
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:527
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:160
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPerson.cpp:247
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition: GUIPerson.cpp:97
Position myPositionInVehicle
The position of a person while riding a vehicle.
Definition: GUIPerson.h:249
A window containing a gl-object&#39;s parameter.
void drawAction_drawAsTriangle(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:451