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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
18 // A MSVehicle extended by some values for usage within the gui
19 /****************************************************************************/
20 #ifndef GUIContainer_h
21 #define GUIContainer_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #ifdef _MSC_VER
28 #include <windows_config.h>
29 #else
30 #include <config.h>
31 #endif
32 
33 #include <vector>
34 #include <set>
35 #include <string>
37 #include <utils/common/RGBColor.h>
38 #include <microsim/MSContainer.h>
42 
43 
44 // ===========================================================================
45 // class declarations
46 // ===========================================================================
49 class MSDevice_Vehroutes;
50 
51 
52 // ===========================================================================
53 // class definitions
54 // ===========================================================================
58 class GUIContainer : public MSContainer, public GUIGlObject {
59 public:
63 
64 
66  ~GUIContainer();
67 
68 
70 
71 
80 
81 
90 
98 
105 
106 
111  void drawGL(const GUIVisualizationSettings& s) const;
112 
113 
114 
119  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
121 
122  /* @brief set the position of a container while being transported by a vehicle
123  * @note This must be called by the vehicle before the call to drawGl */
124  void setPositionInVehicle(const Position& pos) {
125  myPositionInVehicle = pos;
126  }
127 
129 
130 
132  double getEdgePos() const;
133 
135  // @note overrides the base method and returns myPositionInVehicle while in driving stage
136  Position getPosition() const;
137 
139  double getAngle() const;
140 
142  double getWaitingSeconds() const;
143 
145  double getSpeed() const;
146 
148 
149 
157  //FXDECLARE(GUIContainerPopupMenu)
158  public:
166  GUISUMOAbstractView& parent, GUIGlObject& o, std::map<GUISUMOAbstractView*, int>& additionalVisualizations);
167 
170 
171 
172  protected:
174  std::map<GUISUMOAbstractView*, int>& myVehiclesAdditionalVisualizations;
176  std::map<GUISUMOAbstractView*, int> dummy;
177 
178  protected:
180  GUIContainerPopupMenu() : myVehiclesAdditionalVisualizations(dummy) { }
181 
182  };
183 
184 
185 
187  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
188 
189 
190 
191 
192 private:
194  mutable MFXMutex myLock;
195 
198 
200  void setColor(const GUIVisualizationSettings& s) const;
201 
203  double getColorValue(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 
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
GUIContainer(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan)
Constructor.
std::map< GUISUMOAbstractView *, int > dummy
Needed for parameterless instantiation.
Definition: GUIContainer.h:176
std::map< GUISUMOAbstractView *, int > & myVehiclesAdditionalVisualizations
Information which additional visualisations are enabled (per view)
Definition: GUIContainer.h:174
GUIContainerPopupMenu()
default constructor needed by FOX
Definition: GUIContainer.h:180
Stores the information about how to visualize structures.
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
MFXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIContainer.h:194
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:47
The car-following model and parameter.
Definition: MSVehicleType.h:72
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIContainer.h:187
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
double getEdgePos() const
return the offset from the start of the current edge
double getAngle() const
return the current angle of the container
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:45
Position getPosition() const
return the Network coordinate of the container
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
void setPositionInVehicle(const Position &pos)
Definition: GUIContainer.h:124
Structure representing possible vehicle parameter.
Position myPositionInVehicle
The position of a container while riding a vehicle.
Definition: GUIContainer.h:197
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
void drawAction_drawAsPoly(const GUIVisualizationSettings &s) const
The popup menu of a globject.
double getSpeed() const
the current speed of the container
A device which collects info on the vehicle trip (mainly on departure and arrival) ...
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
~GUIContainer()
destructor
double getWaitingSeconds() const
the time this container spent waiting in seconds
A window containing a gl-object&#39;s parameter.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.