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 /****************************************************************************/
16 // A MSVehicle extended by some values for usage within the gui
17 /****************************************************************************/
18 #ifndef GUIContainer_h
19 #define GUIContainer_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <vector>
28 #include <set>
29 #include <string>
30 #include <fx.h>
32 #include <utils/common/RGBColor.h>
33 #include <microsim/MSContainer.h>
36 
37 
38 // ===========================================================================
39 // class declarations
40 // ===========================================================================
43 class MSDevice_Vehroutes;
44 
45 
46 // ===========================================================================
47 // class definitions
48 // ===========================================================================
52 class GUIContainer : public MSContainer, public GUIGlObject {
53 public:
57 
58 
60  ~GUIContainer();
61 
62 
64 
65 
74 
75 
84 
92 
99 
100 
105  void drawGL(const GUIVisualizationSettings& s) const;
106 
107 
108 
113  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
115 
116  /* @brief set the position of a container while being transported by a vehicle
117  * @note This must be called by the vehicle before the call to drawGl */
118  void setPositionInVehicle(const Position& pos) {
119  myPositionInVehicle = pos;
120  }
121 
123 
124 
126  double getEdgePos() const;
127 
129  // @note overrides the base method and returns myPositionInVehicle while in driving stage
130  Position getPosition() const;
131 
133  double getAngle() const;
134 
136  double getWaitingSeconds() const;
137 
139  double getSpeed() const;
140 
142 
143 
151  FXDECLARE(GUIContainerPopupMenu)
152  public:
160  GUISUMOAbstractView& parent, GUIGlObject& o, std::map<GUISUMOAbstractView*, int>& additionalVisualizations);
161 
164 
166  long onCmdShowPlan(FXObject*, FXSelector, void*);
168  long onCmdStartTrack(FXObject*, FXSelector, void*);
170  long onCmdStopTrack(FXObject*, FXSelector, void*);
171 
172  protected:
174  std::map<GUISUMOAbstractView*, int>& myVehiclesAdditionalVisualizations;
176  std::map<GUISUMOAbstractView*, int> dummy;
177 
178  protected:
181 
182  };
183 
184 
185 
187  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
188 
189 
190 
191 
192 private:
194  mutable FXMutex myLock;
195 
198 
200  void setColor(const GUIVisualizationSettings& s) const;
201 
203  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
204 
206  bool setFunctionalColor(int activeScheme) const;
207 
210  void drawAction_drawAsPoly(const GUIVisualizationSettings& s) const;
213 };
214 
215 
216 #endif
217 
218 /****************************************************************************/
219 
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:66
GUIContainer::GUIContainerPopupMenu::myVehiclesAdditionalVisualizations
std::map< GUISUMOAbstractView *, int > & myVehiclesAdditionalVisualizations
Information which additional visualisations are enabled (per view)
Definition: GUIContainer.h:174
GUIContainer::getCenteringBoundary
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
Definition: GUIContainer.cpp:205
GUIContainer::setColor
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
Definition: GUIContainer.cpp:302
GUIContainer::drawAction_drawAsImage
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
Definition: GUIContainer.cpp:432
GUIGlObject.h
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:63
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
GUIContainer::GUIContainerPopupMenu
Definition: GUIContainer.h:150
GUIGLObjectPopupMenu.h
GUIContainer::getPopUpMenu
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
Definition: GUIContainer.cpp:136
GUIContainer::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIContainer.cpp:161
GUIContainer::getSpeed
double getSpeed() const
the current speed of the container
Definition: GUIContainer.cpp:403
GUIContainer::GUIContainerPopupMenu::onCmdStopTrack
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
Definition: GUIContainer.cpp:113
GUIContainer::setFunctionalColor
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
Definition: GUIContainer.cpp:311
GUIContainer::GUIContainerPopupMenu::onCmdShowPlan
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
Definition: GUIContainer.cpp:86
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:291
GUIContainer::setPositionInVehicle
void setPositionInVehicle(const Position &pos)
Definition: GUIContainer.h:118
GUIGLObjectPopupMenu
The popup menu of a globject.
Definition: GUIGLObjectPopupMenu.h:48
GUIContainer::GUIContainerPopupMenu::dummy
std::map< GUISUMOAbstractView *, int > dummy
Needed for parameterless instantiation.
Definition: GUIContainer.h:176
RGBColor.h
GUIContainer::GUIContainerPopupMenu::GUIContainerPopupMenu
GUIContainerPopupMenu()
default constructor needed by FOX
Definition: GUIContainer.h:180
GUIContainer::GUIContainerPopupMenu::~GUIContainerPopupMenu
~GUIContainerPopupMenu()
Destructor.
Definition: GUIContainer.cpp:82
GUIContainer::getPosition
Position getPosition() const
return the Network coordinate of the container
Definition: GUIContainer.cpp:377
GUIContainer::drawGL
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
Definition: GUIContainer.cpp:215
GUIContainer::myPositionInVehicle
Position myPositionInVehicle
The position of a container while riding a vehicle.
Definition: GUIContainer.h:197
GUIContainer::drawAction_drawAsPoly
void drawAction_drawAsPoly(const GUIVisualizationSettings &s) const
Definition: GUIContainer.cpp:410
GUIContainer
Definition: GUIContainer.h:52
MSContainer
Definition: MSContainer.h:61
Boundary
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
GUIContainer::myLock
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIContainer.h:194
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GUIContainer::getEdgePos
double getEdgePos() const
return the offset from the start of the current edge
Definition: GUIContainer.cpp:370
GUIContainer::~GUIContainer
~GUIContainer()
destructor
Definition: GUIContainer.cpp:131
GUIContainer::getTypeParameterWindow
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIContainer.cpp:186
GUIGlObject
Definition: GUIGlObject.h:66
MSContainer.h
MSTransportable::MSTransportablePlan
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
Definition: MSTransportable.h:588
GUIMainWindow
Definition: GUIMainWindow.h:47
MSDevice_Vehroutes
A device which collects info on the vehicle trip (mainly on departure and arrival)
Definition: MSDevice_Vehroutes.h:53
GUIContainer::drawGLAdditional
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
Definition: GUIContainer.cpp:248
GUIContainer::myAdditionalVisualizations
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIContainer.h:187
GUIContainer::getColorValue
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIContainer.cpp:350
GUIContainer::getWaitingSeconds
double getWaitingSeconds() const
the time this container spent waiting in seconds
Definition: GUIContainer.cpp:396
GUIPropertySchemeStorage.h
GUIContainer::getAngle
double getAngle() const
return the current angle of the container
Definition: GUIContainer.cpp:389
GUIContainer::GUIContainer
GUIContainer(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan)
Constructor.
Definition: GUIContainer.cpp:125
GUIContainer::GUIContainerPopupMenu::onCmdStartTrack
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the person shall be tracked.
Definition: GUIContainer.cpp:104
config.h
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:346