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-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 /****************************************************************************/
17 // A MSVehicle extended by some values for usage within the gui
18 /****************************************************************************/
19 #ifndef GUIVehicle_h
20 #define GUIVehicle_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <vector>
29 #include <string>
31 #include <microsim/MSVehicle.h>
32 #include "GUIBaseVehicle.h"
33 
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
39 
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
53 class GUIVehicle : public MSVehicle, public GUIBaseVehicle {
54 public:
62  GUIVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
63  MSVehicleType* type, const double speedFactor);
64 
65 
67  ~GUIVehicle();
68 
73  Position getPosition(const double offset = 0) const {
74  return MSVehicle::getPosition(offset);
75  }
76 
81  double getAngle() const {
82  return MSVehicle::getAngle();
83  }
84 
88  void drawRouteHelper(const GUIVisualizationSettings& s, const MSRoute& r, bool future, const RGBColor& col) const;
89 
90  void drawAction_drawVehicleBlinker(double length) const;
91  void drawAction_drawVehicleBrakeLight(double length, bool onlyOne = false) const;
94 
99  double getLastLaneChangeOffset() const;
100 
101 
104  void drawBestLanes() const;
106 
108  void selectBlockingFoes() const;
109 
111  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
112 
121 
129 
131  bool isSelected() const;
132 
134  double getRightSideOnEdge2() const {
135  return getRightSideOnEdge();
136  }
138  double getLeftSideOnEdge() const {
140  }
141 
143  int getRightSublaneOnEdge() const;
144  int getLeftSublaneOnEdge() const;
145 
147  std::string getLCStateRight() const;
148  std::string getLCStateLeft() const;
149 
151  std::string getLaneID() const;
152  std::string getShadowLaneID() const;
153  std::string getTargetLaneID() const;
154 
156  double getManeuverDist() const;
157 
159  void rerouteDRTStop(MSStoppingPlace* busStop);
160 
161 protected:
163  void drawOutsideNetwork(bool add);
164 
165 private:
166 
167  /* @brief draw train with individual carriages. The number of carriages is
168  * determined from defaultLength of carriages and vehicle length
169  * passengerSeats are computed beginning at firstPassengerCarriage */
170  void drawAction_drawCarriageClass(const GUIVisualizationSettings& s, bool asImage) const;
171 
172  /* @brief return the previous lane in this vehicles route including internal lanes
173  * @param[in] current The lane of which the predecessor should be returned
174  * @param[in,out] routeIndex The index of the current or previous non-internal edge in the route
175  */
176  MSLane* getPreviousLane(MSLane* current, int& furtherIndex) const;
177 
179  std::string getStopInfo() const;
180 
181 };
182 
183 
184 #endif
185 
186 /****************************************************************************/
187 
MSVehicleType
The car-following model and parameter.
Definition: MSVehicleType.h:65
GUIVehicle::isSelected
bool isSelected() const
whether this vehicle is selected in the GUI
Definition: GUIVehicle.cpp:859
GUIVehicle::getLeftSideOnEdge
double getLeftSideOnEdge() const
return left vehicle side on current edge
Definition: GUIVehicle.h:138
MSStoppingPlace
A lane area vehicles can halt at.
Definition: MSStoppingPlace.h:59
GUIParameterTableWindow
A window containing a gl-object's parameter.
Definition: GUIParameterTableWindow.h:62
GUIBaseVehicle
A MSVehicle extended by some values for usage within the gui.
Definition: GUIBaseVehicle.h:61
GUIVehicle::drawAction_drawVehicleBlueLight
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:478
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
MSLane
Representation of a lane in the micro simulation.
Definition: MSLane.h:82
GUIVehicle::~GUIVehicle
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:90
GUIVehicle::getStopInfo
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:730
GUIVehicle::drawRouteHelper
void drawRouteHelper(const GUIVisualizationSettings &s, const MSRoute &r, bool future, const RGBColor &col) const
Draws the route.
Definition: GUIVehicle.cpp:601
GUIVehicle::getRightSideOnEdge2
double getRightSideOnEdge2() const
return right vehicle side on current edge (without argument)
Definition: GUIVehicle.h:134
GUIVehicle::rerouteDRTStop
void rerouteDRTStop(MSStoppingPlace *busStop)
handle route to accomodate to given stop
Definition: GUIVehicle.cpp:919
SUMOVehicleParameter
Structure representing possible vehicle parameter.
Definition: SUMOVehicleParameter.h:297
GUIVehicle::getTypeParameterWindow
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:185
MSRoute
Definition: MSRoute.h:66
GUIVehicle::getManeuverDist
double getManeuverDist() const
return the lane-change maneuver distance
Definition: GUIVehicle.cpp:914
GUIVehicle::getTargetLaneID
std::string getTargetLaneID() const
Definition: GUIVehicle.cpp:909
MSVehicle.h
GUIVehicle::drawAction_drawVehicleBlinker
void drawAction_drawVehicleBlinker(double length) const
Definition: GUIVehicle.cpp:438
MSVehicle::getPosition
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:1269
RGBColor
Definition: RGBColor.h:39
GUIVehicle::drawAction_drawCarriageClass
void drawAction_drawCarriageClass(const GUIVisualizationSettings &s, bool asImage) const
draws the given guiShape with distinct carriages/modules
Definition: GUIVehicle.cpp:273
GUIVehicle::drawOutsideNetwork
void drawOutsideNetwork(bool add)
register vehicle for drawing while outside the network
Definition: GUIVehicle.cpp:842
GUIVehicle::getAngle
double getAngle() const
Return current angle.
Definition: GUIVehicle.h:81
MSVehicleType::getWidth
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
Definition: MSVehicleType.h:246
GUIVehicle
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:53
GUIVehicle::getLastLaneChangeOffset
double getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:724
GUIVehicle::getColorValue
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:490
MSVehicle::getAngle
double getAngle() const
Returns the vehicle's direction in radians.
Definition: MSVehicle.h:680
Position
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:38
GUIVehicle::getLaneID
std::string getLaneID() const
return vehicle lane id
Definition: GUIVehicle.cpp:899
GUIVehicle::selectBlockingFoes
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:757
GUIVehicle::getParameterWindow
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:95
MSBaseVehicle::getVehicleType
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
Definition: MSBaseVehicle.h:123
GUIVehicle::getRightSublaneOnEdge
int getRightSublaneOnEdge() const
return the righmost sublane on the edge occupied by the vehicle
Definition: GUIVehicle.cpp:864
GUIVehicle::drawBestLanes
void drawBestLanes() const
Draws the vehicle's best lanes.
Definition: GUIVehicle.cpp:566
GUIMainWindow
Definition: GUIMainWindow.h:46
GUIVehicle::getPreviousLane
MSLane * getPreviousLane(MSLane *current, int &furtherIndex) const
Definition: GUIVehicle.cpp:670
GUIVehicle::GUIVehicle
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
Definition: GUIVehicle.cpp:80
MSVehicle::getRightSideOnEdge
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:5327
GUIBaseVehicle.h
GUIVehicle::getLCStateRight
std::string getLCStateRight() const
return the lanechange state
Definition: GUIVehicle.cpp:889
config.h
GUIVehicle::getLeftSublaneOnEdge
int getLeftSublaneOnEdge() const
Definition: GUIVehicle.cpp:876
GUIVehicle::getShadowLaneID
std::string getShadowLaneID() const
Definition: GUIVehicle.cpp:904
GUIVehicle::drawAction_drawVehicleBrakeLight
void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=false) const
Definition: GUIVehicle.cpp:457
GUIVisualizationSettings
Stores the information about how to visualize structures.
Definition: GUIVisualizationSettings.h:345
GUIVehicle::getPosition
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: GUIVehicle.h:73
PositionVector.h
GUIVehicle::drawAction_drawLinkItems
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:243
GUIVehicle::getLCStateLeft
std::string getLCStateLeft() const
Definition: GUIVehicle.cpp:894
MSVehicle
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79