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.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 /****************************************************************************/
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:
60  GUIVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
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 
79  double getAngle() const {
80  return MSVehicle::getAngle();
81  }
82 
86  void drawRouteHelper(const GUIVisualizationSettings& s, const MSRoute& r, bool future, bool noLoop, const RGBColor& col) const;
87 
88  void drawAction_drawVehicleBlinker(double length) const;
89  void drawAction_drawVehicleBrakeLight(double length, bool onlyOne = false) const;
92 
97  double getLastLaneChangeOffset() const;
98 
99 
102  void drawBestLanes() const;
104 
106  void selectBlockingFoes() const;
107 
109  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
110 
119 
127 
129  bool isSelected() const;
130 
132  double getRightSideOnEdge2() const {
133  return getRightSideOnEdge();
134  }
136  double getLeftSideOnEdge() const {
138  }
139 
141  int getRightSublaneOnEdge() const;
142  int getLeftSublaneOnEdge() const;
143 
145  std::string getLCStateRight() const;
146  std::string getLCStateLeft() const;
147  std::string getLCStateCenter() const;
148 
150  std::string getLaneID() const;
151  std::string getBackLaneID() const;
152  std::string getShadowLaneID() const;
153  std::string getTargetLaneID() const;
154 
156  double getManeuverDist() const;
158  std::string getSpeedMode() const;
160  std::string getLaneChangeMode() const;
161 
163  void rerouteDRTStop(MSStoppingPlace* busStop);
164 
165 protected:
167  void drawOutsideNetwork(bool add);
168 
169 private:
170 
171  /* @brief draw train with individual carriages. The number of carriages is
172  * determined from defaultLength of carriages and vehicle length
173  * passengerSeats are computed beginning at firstPassengerCarriage */
174  void drawAction_drawCarriageClass(const GUIVisualizationSettings& s, bool asImage) const;
175 
176  /* @brief return the previous lane in this vehicles route including internal lanes
177  * @param[in] current The lane of which the predecessor should be returned
178  * @param[in,out] routeIndex The index of the current or previous non-internal edge in the route
179  */
180  MSLane* getPreviousLane(MSLane* current, int& furtherIndex) const;
181 
183  std::string getStopInfo() const;
184 
185 };
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:947
int getLeftSublaneOnEdge() const
Definition: GUIVehicle.cpp:964
double getAngle() const
Return current angle.
Definition: GUIVehicle.h:79
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:526
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:845
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:209
void drawBestLanes() const
Draws the vehicle's best lanes.
Definition: GUIVehicle.cpp:609
void drawOutsideNetwork(bool add)
register vehicle for drawing while outside the network
Definition: GUIVehicle.cpp:930
int getRightSublaneOnEdge() const
return the righmost sublane on the edge occupied by the vehicle
Definition: GUIVehicle.cpp:952
MSLane * getPreviousLane(MSLane *current, int &furtherIndex) const
Definition: GUIVehicle.cpp:758
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:818
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:100
double getLeftSideOnEdge() const
return left vehicle side on current edge
Definition: GUIVehicle.h:136
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
Definition: GUIVehicle.cpp:85
void drawAction_drawCarriageClass(const GUIVisualizationSettings &s, bool asImage) const
draws the given guiShape with distinct carriages/modules
Definition: GUIVehicle.cpp:293
std::string getShadowLaneID() const
double getManeuverDist() const
return the lane-change maneuver distance
double getRightSideOnEdge2() const
return right vehicle side on current edge (without argument)
Definition: GUIVehicle.h:132
std::string getSpeedMode() const
return the speed mode as bit string
std::string getBackLaneID() const
Definition: GUIVehicle.cpp:997
void drawAction_drawVehicleBlinker(double length) const
Definition: GUIVehicle.cpp:474
void rerouteDRTStop(MSStoppingPlace *busStop)
handle route to accomodate to given stop
std::string getLCStateRight() const
return the lanechange state
Definition: GUIVehicle.cpp:977
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:514
double getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:812
std::string getLaneID() const
return vehicle lane id
Definition: GUIVehicle.cpp:992
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:263
std::string getTargetLaneID() const
std::string getLCStateLeft() const
Definition: GUIVehicle.cpp:982
void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=false) const
Definition: GUIVehicle.cpp:493
void drawRouteHelper(const GUIVisualizationSettings &s, const MSRoute &r, bool future, bool noLoop, const RGBColor &col) const
Draws the route.
Definition: GUIVehicle.cpp:644
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:95
std::string getLCStateCenter() const
Definition: GUIVehicle.cpp:987
std::string getLaneChangeMode() const
return the lane change mode as bit string
Stores the information about how to visualize structures.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
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:5479
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:1122
double getAngle() const
Returns the vehicle's direction in radians.
Definition: MSVehicle.h:700
The car-following model and parameter.
Definition: MSVehicleType.h:62
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:36
Structure representing possible vehicle parameter.