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-2015 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:
65  GUIPerson(const SUMOVehicleParameter* pars, const MSVehicleType* vtype, MSPerson::MSPersonPlan* plan);
66 
67 
69  ~GUIPerson();
70 
71 
73 
74 
83 
84 
93 
94 
101 
102 
107  void drawGL(const GUIVisualizationSettings& s) const;
108 
109 
110 
115  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
117 
118  /* @brief set the position of a person while riding in a vehicle
119  * @note This must be called by the vehicle before the call to drawGl */
120  void setPositionInVehicle(const Position& pos) {
121  myPositionInVehicle = pos;
122  }
123 
125 
126 
128  SUMOReal getEdgePos() const;
129 
131  // @note overrides the base method and returns myPositionInVehicle while in driving stage
132  Position getPosition() const;
133 
135  SUMOReal getAngle() const;
136 
138  SUMOReal getWaitingSeconds() const;
139 
141  SUMOReal getSpeed() const;
142 
144 
145 
153  FXDECLARE(GUIPersonPopupMenu)
154  public:
162  GUISUMOAbstractView& parent, GUIGlObject& o, std::map<GUISUMOAbstractView*, int>& additionalVisualizations);
163 
166 
168  long onCmdShowWalkingareaPath(FXObject*, FXSelector, void*);
170  long onCmdHideWalkingareaPath(FXObject*, FXSelector, void*);
171 
172 
173  protected:
175  std::map<GUISUMOAbstractView*, int>& myVehiclesAdditionalVisualizations;
177  std::map<GUISUMOAbstractView*, int> dummy;
178 
179  protected:
181  GUIPersonPopupMenu() : myVehiclesAdditionalVisualizations(dummy) { }
182 
183  };
184 
185 
195  };
196 
198  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
199 
200 
203 
209  bool hasActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) const;
210 
211 
217  void addActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
218 
219 
225  void removeActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
227 
228 
229 private:
231  mutable MFXMutex myLock;
232 
235 
237  void setColor(const GUIVisualizationSettings& s) const;
238 
240  SUMOReal getColorValue(size_t activeScheme) const;
241 
243  bool setFunctionalColor(size_t activeScheme) const;
244 
248  void drawAction_drawAsPoly(const GUIVisualizationSettings& s) const;
250 
253 };
254 
255 
256 #endif
257 
258 /****************************************************************************/
259 
SUMOReal getSpeed() const
the current speed of the person
Definition: GUIPerson.cpp:351
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIPerson.h:198
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:213
show persons's current route
Definition: GUIPerson.h:192
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:105
track person
Definition: GUIPerson.h:194
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:406
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:428
std::map< GUISUMOAbstractView *, int > dummy
Needed for parameterless instantiation.
Definition: GUIPerson.h:177
SUMOReal getAngle() const
return the current angle of the person
Definition: GUIPerson.cpp:337
GUIPersonPopupMenu()
default constructor needed by FOX
Definition: GUIPerson.h:181
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:300
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:246
void drawAction_drawAsPoly(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:380
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
The car-following model and parameter.
Definition: MSVehicleType.h:74
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPerson.cpp:149
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:93
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIPerson.h:231
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIPerson.cpp:128
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPerson.cpp:170
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:231
VisualisationFeatures
Additional visualisation feature ids.
Definition: GUIPerson.h:188
bool setFunctionalColor(size_t activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:255
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:96
void setPositionInVehicle(const Position &pos)
Definition: GUIPerson.h:120
void drawAction_drawAsTriangle(const GUIVisualizationSettings &s) const
Definition: GUIPerson.cpp:358
show the current walkingarea path
Definition: GUIPerson.h:190
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:444
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:179
SUMOReal getWaitingSeconds() const
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:344
SUMOReal getEdgePos() const
return the offset from the start of the current edge
Definition: GUIPerson.cpp:320
Structure representing possible vehicle parameter.
std::map< GUISUMOAbstractView *, int > & myVehiclesAdditionalVisualizations
Information which additional visualisations are enabled (per view)
Definition: GUIPerson.h:175
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:434
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:123
GUIPerson(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSPerson::MSPersonPlan *plan)
Constructor.
Definition: GUIPerson.cpp:117
#define SUMOReal
Definition: config.h:218
Position getPosition() const
return the Network coordinate of the person
Definition: GUIPerson.cpp:327
Position myPositionInVehicle
The position of a person while riding a vehicle.
Definition: GUIPerson.h:234
std::vector< MSPersonStage * > MSPersonPlan
the structure holding the plan of a person
Definition: MSPerson.h:514
A window containing a gl-object's parameter.