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:
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 
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:66
GUIPerson::getStageIndexDescription
std::string getStageIndexDescription() const
get stage index description
Definition: GUIPerson.cpp:493
GUIPerson::getGUIPosition
Position getGUIPosition() const
return the Network coordinate of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:461
GUIGlObject.h
GUIPerson::getSpeed
double getSpeed() const
the current speed of the person
Definition: GUIPerson.cpp:486
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:63
GUIPerson::setColor
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:373
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
GUIPerson::GUIPersonPopupMenu::GUIPersonPopupMenu
GUIPersonPopupMenu()
default constructor needed by FOX
Definition: GUIPerson.h:211
GUIPerson::drawAction_drawWalkingareaPath
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
draw walking area path
Definition: GUIPerson.cpp:319
GUIPerson::getEdgeID
std::string getEdgeID() const
get edge ID
Definition: GUIPerson.cpp:500
GUIGLObjectPopupMenu.h
GUIPerson::setPositionInVehicle
void setPositionInVehicle(const Position &pos)
Definition: GUIPerson.cpp:367
MSPerson
Definition: MSPerson.h:64
GUIPerson::GUIPersonPopupMenu::dummy
std::map< GUISUMOAbstractView *, int > dummy
Needed for parameterless instantiation.
Definition: GUIPerson.h:207
GUIPerson::GUIPersonPopupMenu::onCmdHideCurrentRoute
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition: GUIPerson.cpp:89
GUIPerson::GUIPersonPopupMenu::onCmdStartTrack
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the person shall be tracked.
Definition: GUIPerson.cpp:133
GUIPerson::isSelected
bool isSelected() const
whether this person is selected in the GUI
Definition: GUIPerson.cpp:553
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:291
GUIPerson::GUIPersonPopupMenu::onCmdHideWalkingareaPath
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:107
GUIPerson::myLock
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIPerson.h:263
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:48
GUIPerson::getDestinationEdgeID
std::string getDestinationEdgeID() const
get destination edge ID
Definition: GUIPerson.cpp:514
GUIPerson::GUIPersonPopupMenu::~GUIPersonPopupMenu
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:75
RGBColor.h
GUIPerson::GUIPersonPopupMenu::onCmdShowWalkingareaPath
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition: GUIPerson.cpp:97
GUIPerson::GUIPerson
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
Constructor.
Definition: GUIPerson.cpp:168
GUIPerson::getColorValue
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:427
GUIPerson::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPerson.cpp:223
GUIPerson::VisualisationFeatures
VisualisationFeatures
Additional visualisation feature ids.
Definition: GUIPerson.h:215
GUIPerson::~GUIPerson
~GUIPerson()
destructor
Definition: GUIPerson.cpp:175
GUIPerson::hasActiveAddVisualisation
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIPerson.cpp:531
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GUIPerson::getFromEdgeID
std::string getFromEdgeID() const
ger from edge ID
Definition: GUIPerson.cpp:507
GUIPerson::addActiveAddVisualisation
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:537
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GUIPerson::GUIPersonPopupMenu::onCmdStopTrack
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIPerson.cpp:143
GUIPerson::GUIPersonPopupMenu
Definition: GUIPerson.h:162
GUIGlObject
Definition: GUIGlObject.h:66
GUIPerson::getWaitingSeconds
double getWaitingSeconds() const
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:479
MSPerson.h
GUIPerson::GUIPersonPopupMenu::myVehiclesAdditionalVisualizations
std::map< GUISUMOAbstractView *, int > & myVehiclesAdditionalVisualizations
Information which additional visualisations are enabled (per view)
Definition: GUIPerson.h:204
GUIPerson::getPosition
Position getPosition() const
return the Network coordinate of the person
Definition: GUIPerson.cpp:454
MSTransportable::MSTransportablePlan
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
Definition: MSTransportable.h:588
GUIPerson::VO_SHOW_WALKINGAREA_PATH
show the current walkingarea path
Definition: GUIPerson.h:217
GUIPerson::GUIPersonPopupMenu::onCmdShowCurrentRoute
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition: GUIPerson.cpp:79
GUIMainWindow
Definition: GUIMainWindow.h:47
GUIPerson::removeActiveAddVisualisation
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:547
MSDevice_Vehroutes
A device which collects info on the vehicle trip (mainly on departure and arrival)
Definition: MSDevice_Vehroutes.h:53
GUIPerson::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:277
GUIPropertySchemeStorage.h
GUIPerson
Definition: GUIPerson.h:54
GUIPerson::setFunctionalColor
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:382
GUIPerson::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPerson.cpp:267
GUIPerson::VO_SHOW_ROUTE
show persons's current route
Definition: GUIPerson.h:219
GUIPerson::getTypeParameterWindow
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIPerson.cpp:248
config.h
GUIPerson::drawGLAdditional
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:338
GUIPerson::GUIPersonPopupMenu::onCmdShowPlan
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
Definition: GUIPerson.cpp:115
GUIPerson::myPositionInVehicle
Position myPositionInVehicle
The position of a person while riding a vehicle.
Definition: GUIPerson.h:266
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346
GUIPerson::getNaviDegree
double getNaviDegree() const
return the current angle of the person
Definition: GUIPerson.cpp:472
GUIPerson::GUIPersonPopupMenu::onCmdRemoveObject
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the person.
Definition: GUIPerson.cpp:151
GUIPerson::myAdditionalVisualizations
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIPerson.h:269
GUIPerson::getEdgePos
double getEdgePos() const
Return the position on the edge.
Definition: GUIPerson.cpp:447
GUIPerson::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIPerson.cpp:188
GUIPerson::VO_TRACKED
track person
Definition: GUIPerson.h:221
GUIPerson::getStageArrivalPos
double getStageArrivalPos() const
get stage arrival position
Definition: GUIPerson.cpp:521