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-2015 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 
131 private:
132 
133  /* @brief draw train with individual carriages. The number of carriages is
134  * determined from defaultLength of carriages and vehicle length
135  * passengerSeats are computed beginning at firstPassengerCarriage */
136  void drawAction_drawRailCarriages(const GUIVisualizationSettings& s, SUMOReal defaultLength, SUMOReal carriageGap,
137  int firstPassengerCarriage, bool asImage) const;
139 
141  bool drawAction_drawCarriageClass(const GUIVisualizationSettings& s, SUMOVehicleShape guiShape, bool asImage) const;
142 
143  /* @brief return the previous lane in this vehicles route including internal lanes
144  * @param[in] current The lane of which the predecessor should be returned
145  * @param[in,out] routeIndex The index of the current or previous non-internal edge in the route
146  */
147  MSLane* getPreviousLane(MSLane* current, int& furtherIndex) const;
148 
150  SUMOReal getNaviDegree() const;
151 
153  int getNumPassengers() const;
154 
156  void computeSeats(const Position& front, const Position& back, int& requiredSeats) const;
157 
159  std::string getStopInfo() const;
160 
161 };
162 
163 
164 #endif
165 
166 /****************************************************************************/
167 
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:102
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:602
SUMOReal getColorValue(size_t activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:330
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:242
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:375
void drawAction_drawVehicleBrakeLight(SUMOReal length) const
Definition: GUIVehicle.cpp:302
Stores the information about how to visualize structures.
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:617
void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:189
SUMOReal getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:575
SUMOReal getNaviDegree() const
return the current angle in navigational degrees
Definition: GUIVehicle.cpp:541
void drawAction_drawVehicleBlinker(SUMOReal length) const
Definition: GUIVehicle.cpp:283
The car-following model and parameter.
Definition: MSVehicleType.h:74
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:581
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, const MSVehicleType *type, const SUMOReal speedFactor)
Constructor.
Definition: GUIVehicle.cpp:87
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:432
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:97
A MSVehicle extended by some values for usage within the gui.
int getNumPassengers() const
return the number of passengers
Definition: GUIVehicle.cpp:547
void computeSeats(const Position &front, const Position &back, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
Definition: GUIVehicle.cpp:556
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:214
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:442
#define SUMOReal
Definition: config.h:214
void drawRouteHelper(const MSRoute &r, SUMOReal exaggeration) const
Draws the route.
Definition: GUIVehicle.cpp:412
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:318
SUMOReal getAngle() const
Returns the vehicle&#39;s direction in degrees.
Definition: MSVehicle.cpp:663
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:61