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.dev/sumo
3 // Copyright (C) 2001-2024 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>
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 
57  ~GUIContainer();
58 
60 
61 
70 
79 
87 
89  double getExaggeration(const GUIVisualizationSettings& s) const override;
90 
96  Boundary getCenteringBoundary() const override;
97 
102  void drawGL(const GUIVisualizationSettings& s) const override;
103 
108  virtual void drawGLAdditional(GUISUMOAbstractView* const parent, const GUIVisualizationSettings& s) const override;
110 
111  /* @brief set the position of a container while being transported by a vehicle
112  * @note This must be called by the vehicle before the call to drawGl */
114  myPositionInVehicle = pos;
115  }
116 
118 
119 
121  double getEdgePos() const override;
122 
124  int getDirection() const override;
125 
127  // @note overrides the base method and returns myPositionInVehicle while in driving stage
128  Position getPosition() const override;
129 
131  double getAngle() const override;
132 
134  double getWaitingSeconds() const override;
135 
137  double getSpeed() const override;
138 
140 
142  bool isSelected() const override;
143 
151  FXDECLARE(GUIContainerPopupMenu)
152  public:
159 
162 
164  long onCmdShowPlan(FXObject*, FXSelector, void*);
166  long onCmdStartTrack(FXObject*, FXSelector, void*);
168  long onCmdStopTrack(FXObject*, FXSelector, void*);
169 
170  protected:
172  FOX_CONSTRUCTOR(GUIContainerPopupMenu)
173 
174  };
175 
176 
177 
179  std::map<GUISUMOAbstractView*, int> myAdditionalVisualizations;
180 
181 
182 
183 
184 private:
186  mutable FXMutex myLock;
187 
190 
192  void setColor(const GUIVisualizationSettings& s) const;
193 
195  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const override;
196 
198  bool setFunctionalColor(int activeScheme) const;
199 
202  void drawAction_drawAsPoly(const GUIVisualizationSettings& s) const;
205 };
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 setPositionInVehicle(const GUIBaseVehicle::Seat &pos)
Definition: GUIContainer.h:113
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
double getWaitingSeconds() const override
the time this container spent waiting in seconds
Position getPosition() const override
return the Network coordinate of the container
void drawGL(const GUIVisualizationSettings &s) const override
Draws the object.
bool isSelected() const override
whether this container is selected in the GUI
void drawAction_drawAsImage(const GUIVisualizationSettings &s) const
double getSpeed() const override
the current speed of the container
Boundary getCenteringBoundary() const override
Returns the boundary to which the view shall be centered in order to show the object.
GUIContainer(const SUMOVehicleParameter *pars, MSVehicleType *vtype, MSTransportable::MSTransportablePlan *plan)
Constructor.
GUIGLObjectPopupMenu * getPopUpMenu(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own popup-menu.
double getAngle() const override
return the current angle of the container
FXMutex myLock
The mutex used to avoid concurrent updates of the vehicle buffer.
Definition: GUIContainer.h:186
double getEdgePos() const override
return the offset from the start of the current edge
GUIBaseVehicle::Seat myPositionInVehicle
The position of a container while riding a vehicle.
Definition: GUIContainer.h:189
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own type parameter window.
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
std::map< GUISUMOAbstractView *, int > myAdditionalVisualizations
Enabled visualisations, per view.
Definition: GUIContainer.h:179
~GUIContainer()
destructor
int getDirection() const override
Return the movement directon on the edge.
virtual void drawGLAdditional(GUISUMOAbstractView *const parent, const GUIVisualizationSettings &s) const override
Draws additionally triggered visualisations.
void setColor(const GUIVisualizationSettings &s) const
sets the color according to the currente settings
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const override
gets the color value according to the current scheme index
double getExaggeration(const GUIVisualizationSettings &s) const override
return exaggeration associated with this GLObject
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:63
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
Structure representing possible vehicle parameter.