SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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, bool onlyOne = 1) const;
102  void drawAction_drawVehicleBlueLight() const;
103 
109 
110 
113  void drawBestLanes() const;
115 
117  void selectBlockingFoes() const;
118 
120  SUMOReal getColorValue(int activeScheme) const;
121 
130 
138 
139 protected:
141  void drawOutsideNetwork(bool add);
142 
143 private:
144 
145  /* @brief draw train with individual carriages. The number of carriages is
146  * determined from defaultLength of carriages and vehicle length
147  * passengerSeats are computed beginning at firstPassengerCarriage */
148  void drawAction_drawRailCarriages(const GUIVisualizationSettings& s, SUMOReal defaultLength, SUMOReal carriageGap,
149  int firstPassengerCarriage, bool asImage) const;
151 
153  bool drawAction_drawCarriageClass(const GUIVisualizationSettings& s, SUMOVehicleShape guiShape, bool asImage) const;
154 
155  /* @brief return the previous lane in this vehicles route including internal lanes
156  * @param[in] current The lane of which the predecessor should be returned
157  * @param[in,out] routeIndex The index of the current or previous non-internal edge in the route
158  */
159  MSLane* getPreviousLane(MSLane* current, int& furtherIndex) const;
160 
162  int getNumPassengers() const;
163 
165  void computeSeats(const Position& front, const Position& back, int& requiredSeats) const;
166 
168  std::string getStopInfo() const;
169 
170 };
171 
172 
173 #endif
174 
175 /****************************************************************************/
176 
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:103
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:645
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:284
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:82
SUMOReal getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:377
void drawBestLanes() const
Draws the vehicle's best lanes.
Definition: GUIVehicle.cpp:426
Stores the information about how to visualize structures.
Position getPosition(const SUMOReal offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:776
void drawAction_drawPersonsAndContainers(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:216
SUMOReal getLastLaneChangeOffset() const
Returns the time since the last lane change in seconds.
Definition: GUIVehicle.cpp:618
void drawOutsideNetwork(bool add)
register vehicle for drawing while outside the network
Definition: GUIVehicle.cpp:696
void drawAction_drawVehicleBlinker(SUMOReal length) const
Definition: GUIVehicle.cpp:325
The car-following model and parameter.
Definition: MSVehicleType.h:74
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:624
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, const MSVehicleType *type, const SUMOReal speedFactor)
Constructor.
Definition: GUIVehicle.cpp:88
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:481
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:98
A MSVehicle extended by some values for usage within the gui.
int getNumPassengers() const
return the number of passengers
Definition: GUIVehicle.cpp:590
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:186
void computeSeats(const Position &front, const Position &back, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
Definition: GUIVehicle.cpp:599
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:256
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:491
#define SUMOReal
Definition: config.h:214
void drawRouteHelper(const MSRoute &r, SUMOReal exaggeration) const
Draws the route.
Definition: GUIVehicle.cpp:461
Representation of a lane in the micro simulation.
Definition: MSLane.h:79
A window containing a gl-object's parameter.
SUMOReal getAngle() const
Return current angle.
Definition: GUIVehicle.h:89
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:365
SUMOReal getAngle() const
Returns the vehicle's direction in radians.
Definition: MSVehicle.h:574
void drawAction_drawVehicleBrakeLight(SUMOReal length, bool onlyOne=1) const
Definition: GUIVehicle.cpp:344
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:61