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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 // A MSVehicle extended by some values for usage within the gui
21 /****************************************************************************/
22 #ifndef GUIVehicle_h
23 #define GUIVehicle_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
35 #include <vector>
36 #include <string>
38 #include <microsim/MSVehicle.h>
39 #include "GUIBaseVehicle.h"
40 
41 
42 // ===========================================================================
43 // class declarations
44 // ===========================================================================
46 
47 
48 // ===========================================================================
49 // class definitions
50 // ===========================================================================
60 class GUIVehicle : public MSVehicle, public GUIBaseVehicle {
61 public:
69  GUIVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
70  MSVehicleType* type, const double speedFactor);
71 
72 
74  ~GUIVehicle();
75 
80  Position getPosition(const double offset = 0) const {
81  return MSVehicle::getPosition(offset);
82  }
83 
88  double getAngle() const {
89  return MSVehicle::getAngle();
90  }
91 
95  void drawRouteHelper(const GUIVisualizationSettings& s, const MSRoute& r) const;
96 
97  void drawAction_drawVehicleBlinker(double length) const;
98  void drawAction_drawVehicleBrakeLight(double length, bool onlyOne = false) const;
101  void drawAction_drawVehicleBlueLight() const;
102 
107  double getLastLaneChangeOffset() const;
108 
109 
112  void drawBestLanes() const;
114 
116  void selectBlockingFoes() const;
117 
119  double getColorValue(int activeScheme) const;
120 
129 
137 
139  bool isSelected() const;
140 
142  double getRightSideOnEdge2() const {
143  return getRightSideOnEdge();
144  }
146  double getLeftSideOnEdge() const {
148  }
149 
151  int getRightSublaneOnEdge() const;
152  int getLeftSublaneOnEdge() const;
153 
154 
156  double getManeuverDist() const;
157 
158 
159 protected:
161  void drawOutsideNetwork(bool add);
162 
163 private:
164 
165  /* @brief draw train with individual carriages. The number of carriages is
166  * determined from defaultLength of carriages and vehicle length
167  * passengerSeats are computed beginning at firstPassengerCarriage */
168  void drawAction_drawRailCarriages(const GUIVisualizationSettings& s, double defaultLength, double carriageGap,
169  int firstPassengerCarriage, bool asImage) const;
171 
173  bool drawAction_drawCarriageClass(const GUIVisualizationSettings& s, SUMOVehicleShape guiShape, bool asImage) const;
174 
175  /* @brief return the previous lane in this vehicles route including internal lanes
176  * @param[in] current The lane of which the predecessor should be returned
177  * @param[in,out] routeIndex The index of the current or previous non-internal edge in the route
178  */
179  MSLane* getPreviousLane(MSLane* current, int& furtherIndex) const;
180 
182  int getNumPassengers() const;
183 
185  void computeSeats(const Position& front, const Position& back, int& requiredSeats) const;
186 
188  std::string getStopInfo() const;
189 
190 };
191 
192 
193 #endif
194 
195 /****************************************************************************/
196 
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:99
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:716
bool drawAction_drawCarriageClass(const GUIVisualizationSettings &s, SUMOVehicleShape guiShape, bool asImage) const
draws the given guiShape if it has distinct carriages/modules and returns true if so ...
Definition: GUIVehicle.cpp:306
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
int getRightSublaneOnEdge() const
return the righmost sublane on the edge occupied by the vehicle
Definition: GUIVehicle.cpp:812
double getManeuverDist() const
return the lane-change maneuver distance
Definition: GUIVehicle.cpp:836
void drawBestLanes() const
Draws the vehicle&#39;s best lanes.
Definition: GUIVehicle.cpp:462
Stores the information about how to visualize structures.
void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:236
void drawRouteHelper(const GUIVisualizationSettings &s, const MSRoute &r) const
Draws the route.
Definition: GUIVehicle.cpp:497
double getRightSideOnEdge2() const
return right vehicle side on current edge (without argument)
Definition: GUIVehicle.h:142
void drawOutsideNetwork(bool add)
register vehicle for drawing while outside the network
Definition: GUIVehicle.cpp:790
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:901
bool isSelected() const
whether this vehicle is selected in the GUI
Definition: GUIVehicle.cpp:807
double getAngle() const
Returns the vehicle&#39;s direction in radians.
Definition: MSVehicle.h:684
The car-following model and parameter.
Definition: MSVehicleType.h:72
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:691
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:399
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:45
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
Definition: GUIVehicle.cpp:84
MSLane * getPreviousLane(MSLane *current, int &furtherIndex) const
Definition: GUIVehicle.cpp:537
void drawAction_drawRailCarriages(const GUIVisualizationSettings &s, double defaultLength, double carriageGap, int firstPassengerCarriage, bool asImage) const
Definition: GUIVehicle.cpp:547
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:94
double getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:685
A MSVehicle extended by some values for usage within the gui.
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: GUIVehicle.h:80
int getNumPassengers() const
return the number of passengers
Definition: GUIVehicle.cpp:657
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
void drawAction_drawVehicleBlinker(double length) const
Definition: GUIVehicle.cpp:347
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:196
void computeSeats(const Position &front, const Position &back, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
Definition: GUIVehicle.cpp:666
Structure representing possible vehicle parameter.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
int getLeftSublaneOnEdge() const
Definition: GUIVehicle.cpp:824
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:276
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
double getLeftSideOnEdge() const
return left vehicle side on current edge
Definition: GUIVehicle.h:146
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:4337
double getAngle() const
Return current angle.
Definition: GUIVehicle.h:88
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=false) const
Definition: GUIVehicle.cpp:366
A window containing a gl-object&#39;s parameter.
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:387
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:60