SUMO - Simulation of Urban MObility
GUIVehicle.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // A MSVehicle extended by some values for usage within the gui
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef GUIVehicle_h
24 #define GUIVehicle_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <vector>
37 #include <string>
39 #include <microsim/MSVehicle.h>
40 #include "GUIBaseVehicle.h"
41 
42 
43 // ===========================================================================
44 // class declarations
45 // ===========================================================================
47 
48 
49 // ===========================================================================
50 // class definitions
51 // ===========================================================================
61 class GUIVehicle : public MSVehicle, public GUIBaseVehicle {
62 public:
70  GUIVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
71  const MSVehicleType* type, const SUMOReal speedFactor);
72 
73 
75  ~GUIVehicle();
76 
81  Position getPosition(const SUMOReal offset = 0) const {
82  return MSVehicle::getPosition(offset);
83  }
84 
89  SUMOReal getAngle() const {
90  return MSVehicle::getAngle();
91  }
92 
96  void drawRouteHelper(const MSRoute& r, SUMOReal exaggeration) const;
97 
98  void drawAction_drawVehicleBlinker(SUMOReal length) const;
99  void drawAction_drawVehicleBrakeLight(SUMOReal length) const;
102  void drawAction_drawVehicleBlueLight() const;
103 
109 
110 
113  void drawBestLanes() const;
115 
117  void selectBlockingFoes() const;
118 
120  SUMOReal getColorValue(size_t activeScheme) const;
121 
130 
138 
139 private:
140 
141  /* @brief draw train with individual carriages. The number of carriages is
142  * determined from defaultLength of carriages and vehicle length
143  * passengerSeats are computed beginning at firstPassengerCarriage */
144  void drawAction_drawRailCarriages(const GUIVisualizationSettings& s, SUMOReal defaultLength, SUMOReal carriageGap,
145  int firstPassengerCarriage, bool asImage) const;
147 
149  bool drawAction_drawCarriageClass(const GUIVisualizationSettings& s, SUMOVehicleShape guiShape, bool asImage) const;
150 
151  /* @brief return the previous lane in this vehicles route including internal lanes
152  * @param[in] current The lane of which the predecessor should be returned
153  * @param[in,out] routeIndex The index of the current or previous non-internal edge in the route
154  */
155  MSLane* getPreviousLane(MSLane* current, int& furtherIndex) const;
156 
158  SUMOReal getNaviDegree() const;
159 
161  int getNumPassengers() const;
162 
164  void computeSeats(const Position& front, const Position& back, int& requiredSeats) const;
165 
167  std::string getStopInfo() const;
168 
169 };
170 
171 
172 #endif
173 
174 /****************************************************************************/
175 
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:101
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:622
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:348
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:260
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
void drawBestLanes() const
Draws the vehicle&#39;s best lanes.
Definition: GUIVehicle.cpp:397
void drawAction_drawVehicleBrakeLight(SUMOReal length) const
Definition: GUIVehicle.cpp:320
Stores the information about how to visualize structures.
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:718
void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:207
SUMOReal getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:595
SUMOReal getNaviDegree() const
return the current angle in navigational degrees
Definition: GUIVehicle.cpp:561
void drawAction_drawVehicleBlinker(SUMOReal length) const
Definition: GUIVehicle.cpp:301
The car-following model and parameter.
Definition: MSVehicleType.h:74
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:601
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, const MSVehicleType *type, const SUMOReal speedFactor)
Constructor.
Definition: GUIVehicle.cpp:86
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
MSLane * getPreviousLane(MSLane *current, int &furtherIndex) const
Definition: GUIVehicle.cpp:452
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:96
A MSVehicle extended by some values for usage within the gui.
int getNumPassengers() const
return the number of passengers
Definition: GUIVehicle.cpp:567
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:178
void computeSeats(const Position &front, const Position &back, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
Definition: GUIVehicle.cpp:576
Structure representing possible vehicle parameter.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:232
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
Definition: GUIVehicle.h:81
void drawAction_drawRailCarriages(const GUIVisualizationSettings &s, SUMOReal defaultLength, SUMOReal carriageGap, int firstPassengerCarriage, bool asImage) const
Definition: GUIVehicle.cpp:462
#define SUMOReal
Definition: config.h:213
void drawRouteHelper(const MSRoute &r, SUMOReal exaggeration) const
Draws the route.
Definition: GUIVehicle.cpp:432
Representation of a lane in the micro simulation.
Definition: MSLane.h:77
A window containing a gl-object&#39;s parameter.
SUMOReal getAngle() const
Return current angle.
Definition: GUIVehicle.h:89
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:336
SUMOReal getAngle() const
Returns the vehicle&#39;s direction in degrees.
Definition: MSVehicle.h:452
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:61