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  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 
143  double getRightSideOnEdge2() const {
144  return getRightSideOnEdge();
145  }
147  double getLeftSideOnEdge() const {
149  }
150 
152  int getRightSublaneOnEdge() const;
153  int getLeftSublaneOnEdge() const;
154 
155 protected:
157  void drawOutsideNetwork(bool add);
158 
159 private:
160 
161  /* @brief draw train with individual carriages. The number of carriages is
162  * determined from defaultLength of carriages and vehicle length
163  * passengerSeats are computed beginning at firstPassengerCarriage */
164  void drawAction_drawRailCarriages(const GUIVisualizationSettings& s, double defaultLength, double carriageGap,
165  int firstPassengerCarriage, bool asImage) const;
167 
169  bool drawAction_drawCarriageClass(const GUIVisualizationSettings& s, SUMOVehicleShape guiShape, bool asImage) const;
170 
171  /* @brief return the previous lane in this vehicles route including internal lanes
172  * @param[in] current The lane of which the predecessor should be returned
173  * @param[in,out] routeIndex The index of the current or previous non-internal edge in the route
174  */
175  MSLane* getPreviousLane(MSLane* current, int& furtherIndex) const;
176 
178  int getNumPassengers() const;
179 
181  void computeSeats(const Position& front, const Position& back, int& requiredSeats) const;
182 
184  std::string getStopInfo() const;
185 
186 };
187 
188 
189 #endif
190 
191 /****************************************************************************/
192 
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:669
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:301
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:765
void drawBestLanes() const
Draws the vehicle&#39;s best lanes.
Definition: GUIVehicle.cpp:445
Stores the information about how to visualize structures.
void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:233
double getRightSideOnEdge2() const
return right vehicle side on current edge (without argument)
Definition: GUIVehicle.h:143
void drawOutsideNetwork(bool add)
register vehicle for drawing while outside the network
Definition: GUIVehicle.cpp:743
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:806
bool isSelected() const
whether this vehicle is selected in the GUI
Definition: GUIVehicle.cpp:760
double getAngle() const
Returns the vehicle&#39;s direction in radians.
Definition: MSVehicle.h:605
The car-following model and parameter.
Definition: MSVehicleType.h:73
void drawRouteHelper(const MSRoute &r, double exaggeration) const
Draws the route.
Definition: GUIVehicle.cpp:480
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:648
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:394
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:46
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
Definition: GUIVehicle.cpp:86
MSLane * getPreviousLane(MSLane *current, int &furtherIndex) const
Definition: GUIVehicle.cpp:505
void drawAction_drawRailCarriages(const GUIVisualizationSettings &s, double defaultLength, double carriageGap, int firstPassengerCarriage, bool asImage) const
Definition: GUIVehicle.cpp:515
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:96
double getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:642
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:81
int getNumPassengers() const
return the number of passengers
Definition: GUIVehicle.cpp:614
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:342
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:193
void computeSeats(const Position &front, const Position &back, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
Definition: GUIVehicle.cpp:623
Structure representing possible vehicle parameter.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
int getLeftSublaneOnEdge() const
Definition: GUIVehicle.cpp:777
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:273
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
double getLeftSideOnEdge() const
return left vehicle side on current edge
Definition: GUIVehicle.h:147
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:3824
void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=1) const
Definition: GUIVehicle.cpp:361
double getAngle() const
Return current angle.
Definition: GUIVehicle.h:89
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
A window containing a gl-object&#39;s parameter.
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:382
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:61