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:
180  GUIContainerPopupMenu() : myVehiclesAdditionalVisualizations(dummy) { }
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 
double getAngle() const
return the current angle of the container
GUIContainer(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan)
Constructor.
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the person shall be tracked.
double getWaitingSeconds() const
the time this container spent waiting in seconds
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.
double getEdgePos() const
return the offset from the start of the current edge
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:42
The car-following model and parameter.
Definition: MSVehicleType.h:66
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIContainer.h:187
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
std::vector< MSTransportable::Stage * > MSTransportablePlan
the structure holding the plan of a transportable
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
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
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
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:197
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
The popup menu of a globject.
void drawAction_drawAsPoly(const GUIVisualizationSettings &s) const
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.
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIContainer.h:194
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
~GUIContainer()
destructor
A window containing a gl-object&#39;s parameter.
double getSpeed() const
the current speed of the container