SUMO - Simulation of Urban MObility
GUIContainer.h
Go to the documentation of this file.
1 /****************************************************************************/
8 // A MSVehicle extended by some values for usage within the gui
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef GUIContainer_h
22 #define GUIContainer_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <vector>
35 #include <set>
36 #include <string>
38 #include <utils/common/RGBColor.h>
39 #include <microsim/MSContainer.h>
43 
44 
45 // ===========================================================================
46 // class declarations
47 // ===========================================================================
50 class MSDevice_Vehroutes;
51 
52 
53 // ===========================================================================
54 // class definitions
55 // ===========================================================================
59 class GUIContainer : public MSContainer, public GUIGlObject {
60 public:
64 
65 
67  ~GUIContainer();
68 
69 
71 
72 
81 
82 
91 
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  SUMOReal getEdgePos() const;
127 
129  // @note overrides the base method and returns myPositionInVehicle while in driving stage
130  Position getPosition() const;
131 
133  SUMOReal getAngle() const;
134 
136  SUMOReal getWaitingSeconds() const;
137 
139  SUMOReal getSpeed() const;
140 
142 
143 
151  //FXDECLARE(GUIContainerPopupMenu)
152  public:
160  GUISUMOAbstractView& parent, GUIGlObject& o, std::map<GUISUMOAbstractView*, int>& additionalVisualizations);
161 
164 
165 
166  protected:
168  std::map<GUISUMOAbstractView*, int>& myVehiclesAdditionalVisualizations;
170  std::map<GUISUMOAbstractView*, int> dummy;
171 
172  protected:
174  GUIContainerPopupMenu() : myVehiclesAdditionalVisualizations(dummy) { }
175 
176  };
177 
178 
179 
181  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
182 
183 
184 
185 
186 private:
188  mutable MFXMutex myLock;
189 
192 
194  void setColor(const GUIVisualizationSettings& s) const;
195 
197  SUMOReal getColorValue(size_t activeScheme) const;
198 
200  bool setFunctionalColor(size_t activeScheme) const;
201 
204  void drawAction_drawAsPoly(const GUIVisualizationSettings& s) const;
207 };
208 
209 
210 #endif
211 
212 /****************************************************************************/
213 
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
std::map< GUISUMOAbstractView *, int > dummy
Needed for parameterless instantiation.
Definition: GUIContainer.h:170
std::map< GUISUMOAbstractView *, int > & myVehiclesAdditionalVisualizations
Information which additional visualisations are enabled (per view)
Definition: GUIContainer.h:168
GUIContainerPopupMenu()
default constructor needed by FOX
Definition: GUIContainer.h:174
Stores the information about how to visualize structures.
SUMOReal getAngle() const
return the current angle of the container
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIContainer.h:188
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:48
bool setFunctionalColor(size_t activeScheme) const
sets the color according to the current scheme index and some vehicle function
The car-following model and parameter.
Definition: MSVehicleType.h:74
SUMOReal getSpeed() const
the current speed of the container
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIContainer.h:181
GUIContainer(const SUMOVehicleParameter *pars, const MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan)
Constructor.
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
Position getPosition() const
return the Network coordinate of the container
SUMOReal getEdgePos() const
return the offset from the start of the current edge
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void setPositionInVehicle(const Position &pos)
Definition: GUIContainer.h:118
Structure representing possible vehicle parameter.
Position myPositionInVehicle
The position of a container while riding a vehicle.
Definition: GUIContainer.h:191
void drawAction_drawAsPoly(const GUIVisualizationSettings &s) const
The popup menu of a globject.
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
SUMOReal getWaitingSeconds() const
the time this container spent waiting in seconds
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
#define SUMOReal
Definition: config.h:213
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
~GUIContainer()
destructor
A window containing a gl-object&#39;s parameter.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.