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-2017 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 double speedFactor);
72 
73 
75  ~GUIVehicle();
76 
81  Position getPosition(const double offset = 0) const {
82  return MSVehicle::getPosition(offset);
83  }
84 
89  double getAngle() const {
90  return MSVehicle::getAngle();
91  }
92 
96  void drawRouteHelper(const MSRoute& r, double exaggeration) const;
97 
98  void drawAction_drawVehicleBlinker(double length) const;
99  void drawAction_drawVehicleBrakeLight(double length, bool onlyOne = 1) const;
102  void drawAction_drawVehicleBlueLight() const;
103 
108  double getLastLaneChangeOffset() const;
109 
110 
113  void drawBestLanes() const;
115 
117  void selectBlockingFoes() const;
118 
120  double getColorValue(int activeScheme) const;
121 
130 
138 
140  bool isSelected() const;
141 
142 protected:
144  void drawOutsideNetwork(bool add);
145 
146 private:
147 
148  /* @brief draw train with individual carriages. The number of carriages is
149  * determined from defaultLength of carriages and vehicle length
150  * passengerSeats are computed beginning at firstPassengerCarriage */
151  void drawAction_drawRailCarriages(const GUIVisualizationSettings& s, double defaultLength, double carriageGap,
152  int firstPassengerCarriage, bool asImage) const;
154 
156  bool drawAction_drawCarriageClass(const GUIVisualizationSettings& s, SUMOVehicleShape guiShape, bool asImage) const;
157 
158  /* @brief return the previous lane in this vehicles route including internal lanes
159  * @param[in] current The lane of which the predecessor should be returned
160  * @param[in,out] routeIndex The index of the current or previous non-internal edge in the route
161  */
162  MSLane* getPreviousLane(MSLane* current, int& furtherIndex) const;
163 
165  int getNumPassengers() const;
166 
168  void computeSeats(const Position& front, const Position& back, int& requiredSeats) const;
169 
171  std::string getStopInfo() const;
172 
173 };
174 
175 
176 #endif
177 
178 /****************************************************************************/
179 
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:295
void drawAction_drawVehicleBlinker(double length) const
Definition: GUIVehicle.cpp:336
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:101
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, const MSVehicleType *type, const double speedFactor)
Constructor.
Definition: GUIVehicle.cpp:86
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:83
double getAngle() const
Returns the vehicle&#39;s direction in radians.
Definition: MSVehicle.h:594
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: GUIVehicle.h:81
int getNumPassengers() const
return the number of passengers
Definition: GUIVehicle.cpp:608
Stores the information about how to visualize structures.
MSLane * getPreviousLane(MSLane *current, int &furtherIndex) const
Definition: GUIVehicle.cpp:499
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:388
void drawOutsideNetwork(bool add)
register vehicle for drawing while outside the network
Definition: GUIVehicle.cpp:737
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:777
void drawBestLanes() const
Draws the vehicle&#39;s best lanes.
Definition: GUIVehicle.cpp:439
void drawRouteHelper(const MSRoute &r, double exaggeration) const
Draws the route.
Definition: GUIVehicle.cpp:474
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:642
The car-following model and parameter.
Definition: MSVehicleType.h:74
bool isSelected() const
whether this vehicle is selected in the GUI
Definition: GUIVehicle.cpp:754
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:96
A MSVehicle extended by some values for usage within the gui.
void drawAction_drawRailCarriages(const GUIVisualizationSettings &s, double defaultLength, double carriageGap, int firstPassengerCarriage, bool asImage) const
Definition: GUIVehicle.cpp:509
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:267
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:663
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:188
Structure representing possible vehicle parameter.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
void computeSeats(const Position &front, const Position &back, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
Definition: GUIVehicle.cpp:617
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:376
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:227
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:636
double getAngle() const
Return current angle.
Definition: GUIVehicle.h:89
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:61
void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=1) const
Definition: GUIVehicle.cpp:355