Eclipse SUMO - Simulation of Urban MObility
GUIContainer.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 /****************************************************************************/
15 // A MSVehicle extended by some values for usage within the gui
16 /****************************************************************************/
17 #ifndef GUIContainer_h
18 #define GUIContainer_h
19 
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include <config.h>
25 
26 #include <vector>
27 #include <set>
28 #include <string>
29 #include <fx.h>
31 #include <utils/common/RGBColor.h>
32 #include <microsim/MSContainer.h>
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
42 class MSDevice_Vehroutes;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
51 class GUIContainer : public MSContainer, public GUIGlObject {
52 public:
56 
57 
59  ~GUIContainer();
60 
61 
63 
64 
73 
74 
83 
91 
98 
99 
104  void drawGL(const GUIVisualizationSettings& s) const;
105 
106 
107 
112  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
114 
115  /* @brief set the position of a container while being transported by a vehicle
116  * @note This must be called by the vehicle before the call to drawGl */
117  void setPositionInVehicle(const Position& pos) {
118  myPositionInVehicle = pos;
119  }
120 
122 
123 
125  double getEdgePos() const;
126 
128  // @note overrides the base method and returns myPositionInVehicle while in driving stage
129  Position getPosition() const;
130 
132  double getAngle() const;
133 
135  double getWaitingSeconds() const;
136 
138  double getSpeed() const;
139 
141 
142 
150  FXDECLARE(GUIContainerPopupMenu)
151  public:
158 
161 
163  long onCmdShowPlan(FXObject*, FXSelector, void*);
165  long onCmdStartTrack(FXObject*, FXSelector, void*);
167  long onCmdStopTrack(FXObject*, FXSelector, void*);
168 
169  protected:
172 
173  };
174 
175 
176 
178  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
179 
180 
181 
182 
183 private:
185  mutable FXMutex myLock;
186 
189 
191  void setColor(const GUIVisualizationSettings& s) const;
192 
194  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
195 
197  bool setFunctionalColor(int activeScheme) const;
198 
201  void drawAction_drawAsPoly(const GUIVisualizationSettings& s) const;
204 };
205 
206 
207 #endif
208 
209 /****************************************************************************/
210 
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:65
GUIContainer::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIContainer.cpp:203
GUIContainer::setColor
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIContainer.cpp:300
GUIContainer::drawAction_drawAsImage
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
Definition: GUIContainer.cpp:430
GUIGlObject.h
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GUIContainer::GUIContainerPopupMenu
Definition: GUIContainer.h:149
GUIGLObjectPopupMenu.h
GUIContainer::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIContainer.cpp:134
GUIContainer::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIContainer.cpp:159
GUIContainer::getSpeed
double getSpeed() const
the current speed of the container
Definition: GUIContainer.cpp:401
GUIContainer::GUIContainerPopupMenu::onCmdStopTrack
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIContainer.cpp:111
GUIContainer::setFunctionalColor
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIContainer.cpp:309
GUIContainer::GUIContainerPopupMenu::onCmdShowPlan
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
Definition: GUIContainer.cpp:84
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:297
GUIContainer::setPositionInVehicle
void setPositionInVehicle(const Position &pos)
Definition: GUIContainer.h:117
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:47
RGBColor.h
GUIContainer::GUIContainerPopupMenu::~GUIContainerPopupMenu
~GUIContainerPopupMenu()
Destructor.
Definition: GUIContainer.cpp:80
GUIContainer::getPosition
Position getPosition() const
return the Network coordinate of the container
Definition: GUIContainer.cpp:375
GUIContainer::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIContainer.cpp:213
GUIContainer::myPositionInVehicle
Position myPositionInVehicle
The position of a container while riding a vehicle.
Definition: GUIContainer.h:188
GUIContainer::drawAction_drawAsPoly
void drawAction_drawAsPoly(const GUIVisualizationSettings &s) const
Definition: GUIContainer.cpp:408
GUIContainer
Definition: GUIContainer.h:51
GUIContainer::GUIContainerPopupMenu::GUIContainerPopupMenu
GUIContainerPopupMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, GUIGlObject &o)
Constructor.
Definition: GUIContainer.cpp:74
MSContainer
Definition: MSContainer.h:60
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:41
GUIContainer::myLock
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIContainer.h:185
FOX_CONSTRUCTOR
#define FOX_CONSTRUCTOR(classname)
Definition: config.h:13
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GUIContainer::getEdgePos
double getEdgePos() const
return the offset from the start of the current edge
Definition: GUIContainer.cpp:368
GUIContainer::~GUIContainer
~GUIContainer()
destructor
Definition: GUIContainer.cpp:129
GUIContainer::getTypeParameterWindow
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIContainer.cpp:184
GUIGlObject
Definition: GUIGlObject.h:65
MSContainer.h
MSTransportable::MSTransportablePlan
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
Definition: MSTransportable.h:587
GUIMainWindow
Definition: GUIMainWindow.h:46
MSDevice_Vehroutes
A device which collects info on the vehicle trip (mainly on departure and arrival)
Definition: MSDevice_Vehroutes.h:52
GUIContainer::drawGLAdditional
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Definition: GUIContainer.cpp:246
GUIContainer::myAdditionalVisualizations
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIContainer.h:178
GUIContainer::getColorValue
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIContainer.cpp:348
GUIContainer::getWaitingSeconds
double getWaitingSeconds() const
the time this container spent waiting in seconds
Definition: GUIContainer.cpp:394
GUIPropertySchemeStorage.h
GUIContainer::getAngle
double getAngle() const
return the current angle of the container
Definition: GUIContainer.cpp:387
GUIContainer::GUIContainer
GUIContainer(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan)
Constructor.
Definition: GUIContainer.cpp:123
GUIContainer::GUIContainerPopupMenu::onCmdStartTrack
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the person shall be tracked.
Definition: GUIContainer.cpp:102
config.h
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345