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 /****************************************************************************/
18 // A MSVehicle extended by some values for usage within the gui
19 /****************************************************************************/
20 #ifndef GUIVehicle_h
21 #define GUIVehicle_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <vector>
30 #include <string>
32 #include <microsim/MSVehicle.h>
33 #include "GUIBaseVehicle.h"
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
54 class GUIVehicle : public MSVehicle, public GUIBaseVehicle {
55 public:
63  GUIVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
64  MSVehicleType* type, const double speedFactor);
65 
66 
68  ~GUIVehicle();
69 
74  Position getPosition(const double offset = 0) const {
75  return MSVehicle::getPosition(offset);
76  }
77 
82  double getAngle() const {
83  return MSVehicle::getAngle();
84  }
85 
89  void drawRouteHelper(const GUIVisualizationSettings& s, const MSRoute& r, bool future) const;
90 
91  void drawAction_drawVehicleBlinker(double length) const;
92  void drawAction_drawVehicleBrakeLight(double length, bool onlyOne = false) const;
95 
100  double getLastLaneChangeOffset() const;
101 
102 
105  void drawBestLanes() const;
107 
109  void selectBlockingFoes() const;
110 
112  double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
113 
122 
130 
132  bool isSelected() const;
133 
135  double getRightSideOnEdge2() const {
136  return getRightSideOnEdge();
137  }
139  double getLeftSideOnEdge() const {
141  }
142 
144  int getRightSublaneOnEdge() const;
145  int getLeftSublaneOnEdge() const;
146 
148  std::string getLCStateRight() const;
149  std::string getLCStateLeft() const;
150 
152  std::string getLaneID() const;
153  std::string getShadowLaneID() const;
154  std::string getTargetLaneID() const;
155 
157  double getManeuverDist() const;
158 
160  void rerouteDRTStop(MSStoppingPlace* busStop);
161 
162 protected:
164  void drawOutsideNetwork(bool add);
165 
166 private:
167 
168  /* @brief draw train with individual carriages. The number of carriages is
169  * determined from defaultLength of carriages and vehicle length
170  * passengerSeats are computed beginning at firstPassengerCarriage */
171  void drawAction_drawCarriageClass(const GUIVisualizationSettings& s, bool asImage) const;
172 
173  /* @brief return the previous lane in this vehicles route including internal lanes
174  * @param[in] current The lane of which the predecessor should be returned
175  * @param[in,out] routeIndex The index of the current or previous non-internal edge in the route
176  */
177  MSLane* getPreviousLane(MSLane* current, int& routeIndex) const;
178 
180  std::string getStopInfo() const;
181 
182 };
183 
184 
185 #endif
186 
187 /****************************************************************************/
188 
void drawAction_drawVehicleBlinker(double length) const
Definition: GUIVehicle.cpp:434
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:96
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
double getAngle() const
Returns the vehicle&#39;s direction in radians.
Definition: MSVehicle.h:681
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: GUIVehicle.h:74
A lane area vehicles can halt at.
double getRightSideOnEdge2() const
return right vehicle side on current edge (without argument)
Definition: GUIVehicle.h:135
std::string getLCStateRight() const
return the lanechange state
Definition: GUIVehicle.cpp:828
Stores the information about how to visualize structures.
std::string getShadowLaneID() const
Definition: GUIVehicle.cpp:843
double getLeftSideOnEdge() const
return left vehicle side on current edge
Definition: GUIVehicle.h:139
void drawOutsideNetwork(bool add)
register vehicle for drawing while outside the network
Definition: GUIVehicle.cpp:781
std::string getTargetLaneID() const
Definition: GUIVehicle.cpp:848
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:1280
void drawBestLanes() const
Draws the vehicle&#39;s best lanes.
Definition: GUIVehicle.cpp:551
void rerouteDRTStop(MSStoppingPlace *busStop)
handle route to accomodate to given stop
Definition: GUIVehicle.cpp:858
int getLeftSublaneOnEdge() const
Definition: GUIVehicle.cpp:815
void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=false) const
Definition: GUIVehicle.cpp:453
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:669
The car-following model and parameter.
Definition: MSVehicleType.h:66
bool isSelected() const
whether this vehicle is selected in the GUI
Definition: GUIVehicle.cpp:798
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
Definition: GUIVehicle.cpp:81
double getColorValue(const GUIVisualizationSettings &s, int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:486
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:91
A MSVehicle extended by some values for usage within the gui.
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:239
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:696
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:187
MSLane * getPreviousLane(MSLane *current, int &routeIndex) const
Definition: GUIVehicle.cpp:639
void drawAction_drawCarriageClass(const GUIVisualizationSettings &s, bool asImage) const
draws the given guiShape with distinct carriages/modules
Definition: GUIVehicle.cpp:269
std::string getLaneID() const
return vehicle lane id
Definition: GUIVehicle.cpp:838
double getManeuverDist() const
return the lane-change maneuver distance
Definition: GUIVehicle.cpp:853
int getRightSublaneOnEdge() const
return the righmost sublane on the edge occupied by the vehicle
Definition: GUIVehicle.cpp:803
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
Structure representing possible vehicle parameter.
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
std::string getLCStateLeft() const
Definition: GUIVehicle.cpp:833
double getRightSideOnEdge(const MSLane *lane=0) const
Get the vehicle&#39;s lateral position on the edge of the given lane (or its current edge if lane == 0) ...
Definition: MSVehicle.cpp:5256
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:474
void drawRouteHelper(const GUIVisualizationSettings &s, const MSRoute &r, bool future) const
Draws the route.
Definition: GUIVehicle.cpp:586
Representation of a lane in the micro simulation.
Definition: MSLane.h:83
A window containing a gl-object&#39;s parameter.
double getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:663
double getAngle() const
Return current angle.
Definition: GUIVehicle.h:82
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:54