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 /****************************************************************************/
17 // A MSVehicle extended by some values for usage within the gui
18 /****************************************************************************/
19 #ifndef GUIPerson_h
20 #define GUIPerson_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <vector>
29 #include <set>
30 #include <string>
31 #include <fx.h>
33 #include <utils/common/RGBColor.h>
37 
38 
39 // ===========================================================================
40 // class declarations
41 // ===========================================================================
44 class MSDevice_Vehroutes;
45 
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
53 class GUIPerson : public MSPerson, public GUIGlObject {
54 
55 public:
57  GUIPerson(const SUMOVehicleParameter* pars, MSVehicleType* vtype, MSTransportable::MSTransportablePlan* plan, const double speedFactor);
58 
60  ~GUIPerson();
61 
64 
72 
81 
89 
96 
101  void drawGL(const GUIVisualizationSettings& s) const;
102 
107  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
108  //* @}
109 
110  /* @brief set the position of a person while riding in a vehicle
111  * @note This must be called by the vehicle before the call to drawGl */
112  void setPositionInVehicle(const Position& pos);
113 
117  double getEdgePos() const;
118 
120  // @note overrides the base method and returns myPositionInVehicle while in driving stage
121  Position getPosition() const;
122 
124  Position getGUIPosition() const;
125 
127  double getNaviDegree() const;
128 
130  double getWaitingSeconds() const;
131 
133  double getSpeed() const;
134 
136  std::string getStageIndexDescription() const;
137 
139  std::string getEdgeID() const;
140 
142  std::string getFromEdgeID() const;
143 
145  std::string getDestinationEdgeID() const;
146 
148  double getStageArrivalPos() const;
149 
151 
153  bool isSelected() const;
154 
162  FXDECLARE(GUIPersonPopupMenu)
163 
164  public:
171 
174 
176  long onCmdShowCurrentRoute(FXObject*, FXSelector, void*);
177 
179  long onCmdHideCurrentRoute(FXObject*, FXSelector, void*);
180 
182  long onCmdShowWalkingareaPath(FXObject*, FXSelector, void*);
183 
185  long onCmdHideWalkingareaPath(FXObject*, FXSelector, void*);
186 
188  long onCmdShowPlan(FXObject*, FXSelector, void*);
189 
191  long onCmdStartTrack(FXObject*, FXSelector, void*);
192 
194  long onCmdStopTrack(FXObject*, FXSelector, void*);
195 
197  long onCmdRemoveObject(FXObject*, FXSelector, void*);
198 
199  protected:
202  };
203 
212  };
213 
216 
221  bool hasActiveAddVisualisation(GUISUMOAbstractView* const parent, int which) const;
222 
228  void addActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
229 
235  void removeActiveAddVisualisation(GUISUMOAbstractView* const parent, int which);
236 
238 
239 private:
241  void setColor(const GUIVisualizationSettings& s) const;
242 
244  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
245 
247  bool setFunctionalColor(int activeScheme) const;
248 
251 
253  mutable FXMutex myLock;
254 
257 
259  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
260 };
261 
262 
263 #endif
264 
265 /****************************************************************************/
266 
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:65
GUIPerson::getStageIndexDescription
std::string getStageIndexDescription() const
get stage index description
Definition: GUIPerson.cpp:490
GUIPerson::getGUIPosition
Position getGUIPosition() const
return the Network coordinate of the person (only for drawing centering and tracking)
Definition: GUIPerson.cpp:458
GUIGlObject.h
GUIPerson::getSpeed
double getSpeed() const
the current speed of the person
Definition: GUIPerson.cpp:483
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
GUIPerson::setColor
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIPerson.cpp:370
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GUIPerson::drawAction_drawWalkingareaPath
void drawAction_drawWalkingareaPath(const GUIVisualizationSettings &s) const
draw walking area path
Definition: GUIPerson.cpp:316
GUIPerson::getEdgeID
std::string getEdgeID() const
get edge ID
Definition: GUIPerson.cpp:497
GUIGLObjectPopupMenu.h
GUIPerson::setPositionInVehicle
void setPositionInVehicle(const Position &pos)
Definition: GUIPerson.cpp:364
MSPerson
Definition: MSPerson.h:63
GUIPerson::GUIPersonPopupMenu::onCmdHideCurrentRoute
long onCmdHideCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be hidden.
Definition: GUIPerson.cpp:86
GUIPerson::GUIPersonPopupMenu::onCmdStartTrack
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the person shall be tracked.
Definition: GUIPerson.cpp:130
GUIPerson::isSelected
bool isSelected() const
whether this person is selected in the GUI
Definition: GUIPerson.cpp:550
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:297
GUIPerson::GUIPersonPopupMenu::onCmdHideWalkingareaPath
long onCmdHideWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be hidden.
Definition: GUIPerson.cpp:104
GUIPerson::myLock
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIPerson.h:253
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
GUIPerson::getDestinationEdgeID
std::string getDestinationEdgeID() const
get destination edge ID
Definition: GUIPerson.cpp:511
GUIPerson::GUIPersonPopupMenu::~GUIPersonPopupMenu
~GUIPersonPopupMenu()
Destructor.
Definition: GUIPerson.cpp:72
RGBColor.h
GUIPerson::GUIPersonPopupMenu::onCmdShowWalkingareaPath
long onCmdShowWalkingareaPath(FXObject *, FXSelector, void *)
Called if the walkingarea path of the person shall be shown.
Definition: GUIPerson.cpp:94
GUIPerson::GUIPerson
GUIPerson(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan, const double speedFactor)
Constructor.
Definition: GUIPerson.cpp:165
GUIPerson::getColorValue
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIPerson.cpp:424
GUIPerson::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIPerson.cpp:220
GUIPerson::VisualisationFeatures
VisualisationFeatures
Additional visualisation feature ids.
Definition: GUIPerson.h:205
GUIPerson::~GUIPerson
~GUIPerson()
destructor
Definition: GUIPerson.cpp:172
GUIPerson::hasActiveAddVisualisation
bool hasActiveAddVisualisation(GUISUMOAbstractView *const parent, int which) const
Returns whether the named feature is enabled in the given view.
Definition: GUIPerson.cpp:528
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
FOX_CONSTRUCTOR
#define FOX_CONSTRUCTOR(classname)
Definition: config.h:13
GUIPerson::getFromEdgeID
std::string getFromEdgeID() const
ger from edge ID
Definition: GUIPerson.cpp:504
GUIPerson::addActiveAddVisualisation
void addActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:534
GUIPerson::GUIPersonPopupMenu::GUIPersonPopupMenu
GUIPersonPopupMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, GUIGlObject &o)
Constructor.
Definition: GUIPerson.cpp:66
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GUIPerson::GUIPersonPopupMenu::onCmdStopTrack
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIPerson.cpp:140
GUIPerson::GUIPersonPopupMenu
Definition: GUIPerson.h:161
GUIGlObject
Definition: GUIGlObject.h:65
GUIPerson::getWaitingSeconds
double getWaitingSeconds() const
the time this person spent waiting in seconds
Definition: GUIPerson.cpp:476
MSPerson.h
GUIPerson::getPosition
Position getPosition() const
return the Network coordinate of the person
Definition: GUIPerson.cpp:451
MSTransportable::MSTransportablePlan
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
Definition: MSTransportable.h:587
GUIPerson::VO_SHOW_WALKINGAREA_PATH
show the current walkingarea path
Definition: GUIPerson.h:207
GUIPerson::GUIPersonPopupMenu::onCmdShowCurrentRoute
long onCmdShowCurrentRoute(FXObject *, FXSelector, void *)
Called if the current route of the person shall be shown.
Definition: GUIPerson.cpp:76
GUIMainWindow
Definition: GUIMainWindow.h:46
GUIPerson::removeActiveAddVisualisation
void removeActiveAddVisualisation(GUISUMOAbstractView *const parent, int which)
Adds the named visualisation feature to the given view.
Definition: GUIPerson.cpp:544
MSDevice_Vehroutes
A device which collects info on the vehicle trip (mainly on departure and arrival)
Definition: MSDevice_Vehroutes.h:52
GUIPerson::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIPerson.cpp:274
GUIPropertySchemeStorage.h
GUIPerson
Definition: GUIPerson.h:53
GUIPerson::setFunctionalColor
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIPerson.cpp:379
GUIPerson::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIPerson.cpp:264
GUIPerson::VO_SHOW_ROUTE
show persons's current route
Definition: GUIPerson.h:209
GUIPerson::getTypeParameterWindow
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIPerson.cpp:245
config.h
GUIPerson::drawGLAdditional
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Definition: GUIPerson.cpp:335
GUIPerson::GUIPersonPopupMenu::onCmdShowPlan
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
Definition: GUIPerson.cpp:112
GUIPerson::myPositionInVehicle
Position myPositionInVehicle
The position of a person while riding a vehicle.
Definition: GUIPerson.h:256
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GUIPerson::getNaviDegree
double getNaviDegree() const
return the current angle of the person
Definition: GUIPerson.cpp:469
GUIPerson::GUIPersonPopupMenu::onCmdRemoveObject
long onCmdRemoveObject(FXObject *, FXSelector, void *)
Called when removing the person.
Definition: GUIPerson.cpp:148
GUIPerson::myAdditionalVisualizations
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIPerson.h:259
GUIPerson::getEdgePos
double getEdgePos() const
Return the position on the edge.
Definition: GUIPerson.cpp:444
GUIPerson::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIPerson.cpp:185
GUIPerson::VO_TRACKED
track person
Definition: GUIPerson.h:211
GUIPerson::getStageArrivalPos
double getStageArrivalPos() const
get stage arrival position
Definition: GUIPerson.cpp:518