Eclipse 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-2019 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>
32 #include <fx.h>
34 #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 
56 public:
58  GUIPerson(const SUMOVehicleParameter* pars, MSVehicleType* vtype, MSTransportable::MSTransportablePlan* plan, const double speedFactor);
59 
61  ~GUIPerson();
62 
65 
73 
82 
90 
97 
102  void drawGL(const GUIVisualizationSettings& s) const;
103 
108  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
109  //* @}
110 
111  /* @brief set the position of a person while riding in a vehicle
112  * @note This must be called by the vehicle before the call to drawGl */
113  void setPositionInVehicle(const Position& pos);
114 
118  double getEdgePos() const;
119 
121  // @note overrides the base method and returns myPositionInVehicle while in driving stage
122  Position getPosition() const;
123 
125  Position getGUIPosition() const;
126 
128  double getNaviDegree() const;
129 
131  double getWaitingSeconds() const;
132 
134  double getSpeed() const;
135 
137  std::string getStageIndexDescription() const;
138 
140  std::string getEdgeID() const;
141 
143  std::string getFromEdgeID() const;
144 
146  std::string getDestinationEdgeID() const;
147 
149  double getStageArrivalPos() const;
150 
152 
154  bool isSelected() const;
155 
163  FXDECLARE(GUIPersonPopupMenu)
164 
165  public:
173  GUISUMOAbstractView& parent, GUIGlObject& o, std::map<GUISUMOAbstractView*, int>& additionalVisualizations);
174 
177 
179  long onCmdShowCurrentRoute(FXObject*, FXSelector, void*);
180 
182  long onCmdHideCurrentRoute(FXObject*, FXSelector, void*);
183 
185  long onCmdShowWalkingareaPath(FXObject*, FXSelector, void*);
186 
188  long onCmdHideWalkingareaPath(FXObject*, FXSelector, void*);
189 
191  long onCmdShowPlan(FXObject*, FXSelector, void*);
192 
194  long onCmdStartTrack(FXObject*, FXSelector, void*);
195 
197  long onCmdStopTrack(FXObject*, FXSelector, void*);
198 
200  long onCmdRemoveObject(FXObject*, FXSelector, void*);
201 
202  protected:
204  std::map<GUISUMOAbstractView*, int>& myVehiclesAdditionalVisualizations;
205 
207  std::map<GUISUMOAbstractView*, int> dummy;
208 
209  protected:
211  GUIPersonPopupMenu() : myVehiclesAdditionalVisualizations(dummy) { }
212  };
213 
222  };
223 
226 
231  bool hasActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) const;
232 
238  void addActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
239 
245  void removeActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
246 
248 
249 private:
251  void setColor(const GUIVisualizationSettings& s) const;
252 
254  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
255 
257  bool setFunctionalColor(int activeScheme) const;
258 
261 
263  mutable FXMutex myLock;
264 
267 
269  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
270 };
271 
272 
273 #endif
274 
275 /****************************************************************************/
276 
bool isSelected() const
whether this person is selected in the GUI
Definition: GUIPerson.cpp:553
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:338
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIPerson.h:269
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIPerson.cpp:531
std::string getEdgeID() const
get edge ID
Definition: GUIPerson.cpp:500
show persons&#39;s current route
Definition: GUIPerson.h:219
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:107
track person
Definition: GUIPerson.h:221
Position getPosition() const
return the Network coordinate of the person
Definition: GUIPerson.cpp:454
Stores the information about how to visualize structures.
std::string getFromEdgeID() const
ger from edge ID
Definition: GUIPerson.cpp:507
std::map< GUISUMOAbstractView *, int > dummy
Needed for parameterless instantiation.
Definition: GUIPerson.h:207
GUIPersonPopupMenu()
default constructor needed by FOX
Definition: GUIPerson.h:211
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIPerson.h:263
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
Constructor.
Definition: GUIPerson.cpp:168
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:223
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:75
double getEdgePos() const
Return the position on the edge.
Definition: GUIPerson.cpp:447
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
draw walking area path
Definition: GUIPerson.cpp:319
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition: GUIPerson.cpp:89
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the person shall be tracked.
Definition: GUIPerson.cpp:133
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIPerson.cpp:188
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:427
std::string getStageIndexDescription() const
get stage index description
Definition: GUIPerson.cpp:493
VisualisationFeatures
Additional visualisation feature ids.
Definition: GUIPerson.h:215
double getWaitingSeconds() const
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:479
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:472
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition: GUIPerson.cpp:97
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:382
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIPerson.cpp:248
void setPositionInVehicle(const Position &pos)
Definition: GUIPerson.cpp:367
double getSpeed() const
the current speed of the person
Definition: GUIPerson.cpp:486
double getStageArrivalPos() const
get stage arrival position
Definition: GUIPerson.cpp:521
show the current walkingarea path
Definition: GUIPerson.h:217
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:277
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:547
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIPerson.cpp:143
Structure representing possible vehicle parameter.
std::map< GUISUMOAbstractView *, int > & myVehiclesAdditionalVisualizations
Information which additional visualisations are enabled (per view)
Definition: GUIPerson.h:204
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the person.
Definition: GUIPerson.cpp:151
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:373
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:537
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:175
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPerson.cpp:267
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
Definition: GUIPerson.cpp:115
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition: GUIPerson.cpp:79
std::string getDestinationEdgeID() const
get destination edge ID
Definition: GUIPerson.cpp:514
Position myPositionInVehicle
The position of a person while riding a vehicle.
Definition: GUIPerson.h:266
A window containing a gl-object&#39;s parameter.
Position getGUIPosition() const
return the Network coordinate of the person (only for drawing centering and tracking) ...
Definition: GUIPerson.cpp:461