Eclipse SUMO - Simulation of Urban MObility
GUIVehicle.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 /****************************************************************************/
21 // A MSVehicle extended by some values for usage within the gui
22 /****************************************************************************/
23 #pragma once
24 #include <config.h>
25 
26 #include <vector>
27 #include <string>
29 #include <microsim/MSVehicle.h>
30 #include "GUIBaseVehicle.h"
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
37 
38 
39 // ===========================================================================
40 // class definitions
41 // ===========================================================================
51 class GUIVehicle : public MSVehicle, public GUIBaseVehicle {
52 public:
61  MSVehicleType* type, const double speedFactor);
62 
63 
65  ~GUIVehicle();
66 
71  Position getPosition(const double offset = 0) const {
72  return MSVehicle::getPosition(offset);
73  }
74 
75  Position getVisualPosition(bool s2, const double offset = 0) const;
76 
81  double getAngle() const {
82  return MSVehicle::getAngle();
83  }
84 
89  double getVisualAngle(bool s2) const;
90 
94  void drawRouteHelper(const GUIVisualizationSettings& s, ConstMSRoutePtr r, bool future, bool noLoop, const RGBColor& col) const;
95 
96  void drawAction_drawVehicleBlinker(double length) const;
97  void drawAction_drawVehicleBrakeLight(double length, bool onlyOne = false) const;
100 
105  double getLastLaneChangeOffset() const;
106 
107 
110  void drawBestLanes() const;
112 
114  void selectBlockingFoes() const;
115 
117  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
118 
127 
135 
137  bool isSelected() const;
138 
140  double getRightSideOnEdge2() const {
141  return getRightSideOnEdge();
142  }
144  double getLeftSideOnEdge() const {
146  }
147 
149  int getRightSublaneOnEdge() const;
150  int getLeftSublaneOnEdge() const;
151 
153  std::string getLCStateRight() const;
154  std::string getLCStateLeft() const;
155  std::string getLCStateCenter() const;
156 
158  std::string getLaneID() const;
159  std::string getBackLaneIDs() const;
160  std::string getShadowLaneID() const;
161  std::string getTargetLaneID() const;
162 
164  double getManeuverDist() const;
166  std::string getSpeedMode() const;
168  std::string getLaneChangeMode() const;
169 
171  std::string getDynamicAlignment() const;
172 
174  void rerouteDRTStop(MSStoppingPlace* busStop);
175 
176 protected:
178  void drawOutsideNetwork(bool add);
179 
180 private:
181 
182  /* @brief draw train with individual carriages. The number of carriages is
183  * determined from defaultLength of carriages and vehicle length
184  * passengerSeats are computed beginning at firstPassengerCarriage */
185  void drawAction_drawCarriageClass(const GUIVisualizationSettings& s, bool asImage) const;
186 
188  std::string getStopInfo() const;
189 
190 };
std::shared_ptr< const MSRoute > ConstMSRoutePtr
Definition: Route.h:31
A MSVehicle extended by some values for usage within the gui.
A window containing a gl-object's parameter.
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:51
bool isSelected() const
whether this vehicle is selected in the GUI
Definition: GUIVehicle.cpp:864
int getLeftSublaneOnEdge() const
Definition: GUIVehicle.cpp:881
double getAngle() const
Return current angle.
Definition: GUIVehicle.h:81
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: GUIVehicle.h:71
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:536
std::string getDynamicAlignment() const
return the current lateral alignment as string
Definition: GUIVehicle.cpp:276
double getVisualAngle(bool s2) const
Returns the vehicle's direction in radians taking into account secondary shape.
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:762
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:226
void drawBestLanes() const
Draws the vehicle's best lanes.
Definition: GUIVehicle.cpp:627
void drawOutsideNetwork(bool add)
register vehicle for drawing while outside the network
Definition: GUIVehicle.cpp:847
int getRightSublaneOnEdge() const
return the righmost sublane on the edge occupied by the vehicle
Definition: GUIVehicle.cpp:869
void drawRouteHelper(const GUIVisualizationSettings &s, ConstMSRoutePtr r, bool future, bool noLoop, const RGBColor &col) const
Draws the route.
Definition: GUIVehicle.cpp:662
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:732
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:99
std::string getBackLaneIDs() const
Definition: GUIVehicle.cpp:914
double getLeftSideOnEdge() const
return left vehicle side on current edge
Definition: GUIVehicle.h:144
void drawAction_drawCarriageClass(const GUIVisualizationSettings &s, bool asImage) const
draws the given guiShape with distinct carriages/modules
Definition: GUIVehicle.cpp:318
std::string getShadowLaneID() const
Definition: GUIVehicle.cpp:919
double getManeuverDist() const
return the lane-change maneuver distance
Definition: GUIVehicle.cpp:929
double getRightSideOnEdge2() const
return right vehicle side on current edge (without argument)
Definition: GUIVehicle.h:140
std::string getSpeedMode() const
return the speed mode as bit string
Definition: GUIVehicle.cpp:934
GUIVehicle(SUMOVehicleParameter *pars, ConstMSRoutePtr route, MSVehicleType *type, const double speedFactor)
Constructor.
Definition: GUIVehicle.cpp:87
void drawAction_drawVehicleBlinker(double length) const
Definition: GUIVehicle.cpp:484
void rerouteDRTStop(MSStoppingPlace *busStop)
handle route to accomodate to given stop
Definition: GUIVehicle.cpp:944
std::string getLCStateRight() const
return the lanechange state
Definition: GUIVehicle.cpp:894
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:524
double getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:726
std::string getLaneID() const
return vehicle lane id
Definition: GUIVehicle.cpp:909
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:288
std::string getTargetLaneID() const
Definition: GUIVehicle.cpp:924
std::string getLCStateLeft() const
Definition: GUIVehicle.cpp:899
Position getVisualPosition(bool s2, const double offset=0) const
Return current position taking into account secondary shape.
void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=false) const
Definition: GUIVehicle.cpp:503
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:94
std::string getLCStateCenter() const
Definition: GUIVehicle.cpp:904
std::string getLaneChangeMode() const
return the lane change mode as bit string
Definition: GUIVehicle.cpp:939
Stores the information about how to visualize structures.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
A lane area vehicles can halt at.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
double getRightSideOnEdge(const MSLane *lane=0) const
Get the vehicle's lateral position on the edge of the given lane (or its current edge if lane == 0)
Definition: MSVehicle.cpp:6681
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:1242
double getAngle() const
Returns the vehicle's direction in radians.
Definition: MSVehicle.h:734
The car-following model and parameter.
Definition: MSVehicleType.h:63
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
Structure representing possible vehicle parameter.