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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
19 // A MSVehicle extended by some values for usage within the gui
20 /****************************************************************************/
21 #pragma once
22 #include <config.h>
23 
24 #include <vector>
25 #include <set>
26 #include <string>
27 #include <fx.h>
29 #include <utils/common/RGBColor.h>
33 #include "GUIBaseVehicle.h"
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
41 class MSDevice_Vehroutes;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
50 class GUIContainer : public MSTransportable, public GUIGlObject {
51 public:
55 
56 
58  ~GUIContainer();
59 
60 
62 
63 
72 
73 
82 
90 
97 
98 
103  void drawGL(const GUIVisualizationSettings& s) const;
104 
105 
106 
111  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const;
113 
114  /* @brief set the position of a container while being transported by a vehicle
115  * @note This must be called by the vehicle before the call to drawGl */
117  myPositionInVehicle = pos;
118  }
119 
121 
122 
124  double getEdgePos() const;
125 
127  // @note overrides the base method and returns myPositionInVehicle while in driving stage
128  Position getPosition() const;
129 
131  double getAngle() const;
132 
134  double getWaitingSeconds() const;
135 
137  double getSpeed() const;
138 
140 
141 
149  FXDECLARE(GUIContainerPopupMenu)
150  public:
157 
160 
162  long onCmdShowPlan(FXObject*, FXSelector, void*);
164  long onCmdStartTrack(FXObject*, FXSelector, void*);
166  long onCmdStopTrack(FXObject*, FXSelector, void*);
167 
168  protected:
170  FOX_CONSTRUCTOR(GUIContainerPopupMenu)
171 
172  };
173 
174 
175 
177  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
178 
179 
180 
181 
182 private:
184  mutable FXMutex myLock;
185 
188 
190  void setColor(const GUIVisualizationSettings& s) const;
191 
193  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
194 
196  bool setFunctionalColor(int activeScheme) const;
197 
200  void drawAction_drawAsPoly(const GUIVisualizationSettings& s) const;
203 };
A class that stores a 2D geometrical boundary.
Definition: Boundary.h:39
long onCmdStartTrack(FXObject *, FXSelector, void *)
Called if the person shall be tracked.
long onCmdShowPlan(FXObject *, FXSelector, void *)
Called if the plan shall be shown.
long onCmdStopTrack(FXObject *, FXSelector, void *)
Called if the person shall not be tracked any longer.
GUIContainerPopupMenu(GUIMainWindow &app, GUISUMOAbstractView &parent, GUIGlObject &o)
Constructor.
void drawGL(const GUIVisualizationSettings &s) const
Draws the object.
void setPositionInVehicle(const GUIBaseVehicle::Seat &pos)
Definition: GUIContainer.h:116
double getAngle() const
return the current angle of the container
bool setFunctionalColor(int activeScheme) const
sets the color according to the current scheme index and some vehicle function
void drawAction_drawAsPoly(const GUIVisualizationSettings &s) const
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own popup-menu.
double getSpeed() const
the current speed of the container
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
Position getPosition() const
return the Network coordinate of the container
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
GUIContainer(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan)
Constructor.
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
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIContainer.h:184
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const
Draws additionally triggered visualisations.
GUIBaseVehicle::Seat myPositionInVehicle
The position of a container while riding a vehicle.
Definition: GUIContainer.h:187
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
double getWaitingSeconds() const
the time this container spent waiting in seconds
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIContainer.h:177
~GUIContainer()
destructor
Boundary getCenteringBoundary() const
Returns the boundary to which the view shall be centered in order to show the object.
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
The popup menu of a globject.
A window containing a gl-object's parameter.
Stores the information about how to visualize structures.
A device which collects info on the vehicle trip (mainly on departure and arrival)
std::vector< MSStage * > MSTransportablePlan
the structure holding the plan of a transportable
The car-following model and parameter.
Definition: MSVehicleType.h:62
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
Structure representing possible vehicle parameter.