SUMO - Simulation of Urban MObility
GUIVehicle.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // A MSVehicle extended by some values for usage within the gui
19 /****************************************************************************/
20 #ifndef GUIVehicle_h
21 #define GUIVehicle_h
22 
23 
24 // ===========================================================================
25 // included modules
26 // ===========================================================================
27 #include <config.h>
28 
29 #include <vector>
30 #include <string>
32 #include <microsim/MSVehicle.h>
33 #include "GUIBaseVehicle.h"
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
40 
41 
42 // ===========================================================================
43 // class definitions
44 // ===========================================================================
54 class GUIVehicle : public MSVehicle, public GUIBaseVehicle {
55 public:
63  GUIVehicle(SUMOVehicleParameter* pars, const MSRoute* route,
64  MSVehicleType* type, const double speedFactor);
65 
66 
68  ~GUIVehicle();
69 
74  Position getPosition(const double offset = 0) const {
75  return MSVehicle::getPosition(offset);
76  }
77 
82  double getAngle() const {
83  return MSVehicle::getAngle();
84  }
85 
89  void drawRouteHelper(const GUIVisualizationSettings& s, const MSRoute& r) const;
90 
91  void drawAction_drawVehicleBlinker(double length) const;
92  void drawAction_drawVehicleBrakeLight(double length, bool onlyOne = false) const;
95 
100  double getLastLaneChangeOffset() const;
101 
102 
105  void drawBestLanes() const;
107 
109  void selectBlockingFoes() const;
110 
112  double getColorValue(int activeScheme) const;
113 
122 
130 
132  bool isSelected() const;
133 
135  double getRightSideOnEdge2() const {
136  return getRightSideOnEdge();
137  }
139  double getLeftSideOnEdge() const {
141  }
142 
144  int getRightSublaneOnEdge() const;
145  int getLeftSublaneOnEdge() const;
146 
147 
149  double getManeuverDist() const;
150 
151 
152 protected:
154  void drawOutsideNetwork(bool add);
155 
156 private:
157 
158  /* @brief draw train with individual carriages. The number of carriages is
159  * determined from defaultLength of carriages and vehicle length
160  * passengerSeats are computed beginning at firstPassengerCarriage */
161  void drawAction_drawRailCarriages(const GUIVisualizationSettings& s, double defaultLength, double carriageGap,
162  int firstPassengerCarriage, bool asImage) const;
164 
166  bool drawAction_drawCarriageClass(const GUIVisualizationSettings& s, SUMOVehicleShape guiShape, bool asImage) const;
167 
168  /* @brief return the previous lane in this vehicles route including internal lanes
169  * @param[in] current The lane of which the predecessor should be returned
170  * @param[in,out] routeIndex The index of the current or previous non-internal edge in the route
171  */
172  MSLane* getPreviousLane(MSLane* current, int& furtherIndex) const;
173 
175  int getNumPassengers() const;
176 
178  void computeSeats(const Position& front, const Position& back, int& requiredSeats) const;
179 
181  std::string getStopInfo() const;
182 
183 };
184 
185 
186 #endif
187 
188 /****************************************************************************/
189 
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:263
void drawAction_drawVehicleBlinker(double length) const
Definition: GUIVehicle.cpp:304
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own parameter window.
Definition: GUIVehicle.cpp:92
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:79
double getAngle() const
Returns the vehicle&#39;s direction in radians.
Definition: MSVehicle.h:685
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: GUIVehicle.h:74
double getRightSideOnEdge2() const
return right vehicle side on current edge (without argument)
Definition: GUIVehicle.h:135
int getNumPassengers() const
return the number of passengers
Definition: GUIVehicle.cpp:633
Stores the information about how to visualize structures.
MSLane * getPreviousLane(MSLane *current, int &furtherIndex) const
Definition: GUIVehicle.cpp:494
double getColorValue(int activeScheme) const
gets the color value according to the current scheme index
Definition: GUIVehicle.cpp:356
double getLeftSideOnEdge() const
return left vehicle side on current edge
Definition: GUIVehicle.h:139
void drawOutsideNetwork(bool add)
register vehicle for drawing while outside the network
Definition: GUIVehicle.cpp:779
Position getPosition(const double offset=0) const
Return current position (x/y, cartesian)
Definition: MSVehicle.cpp:1126
void drawBestLanes() const
Draws the vehicle&#39;s best lanes.
Definition: GUIVehicle.cpp:419
int getLeftSublaneOnEdge() const
Definition: GUIVehicle.cpp:813
void drawAction_drawVehicleBrakeLight(double length, bool onlyOne=false) const
Definition: GUIVehicle.cpp:323
std::string getStopInfo() const
retrieve information about the current stop state
Definition: GUIVehicle.cpp:667
void drawRouteHelper(const GUIVisualizationSettings &s, const MSRoute &r) const
Draws the route.
Definition: GUIVehicle.cpp:454
The car-following model and parameter.
Definition: MSVehicleType.h:66
bool isSelected() const
whether this vehicle is selected in the GUI
Definition: GUIVehicle.cpp:796
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
GUIVehicle(SUMOVehicleParameter *pars, const MSRoute *route, MSVehicleType *type, const double speedFactor)
Constructor.
Definition: GUIVehicle.cpp:77
~GUIVehicle()
destructor
Definition: GUIVehicle.cpp:87
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:517
void drawAction_drawLinkItems(const GUIVisualizationSettings &s) const
Definition: GUIVehicle.cpp:233
void selectBlockingFoes() const
adds the blocking foes to the current selection
Definition: GUIVehicle.cpp:694
GUIParameterTableWindow * getTypeParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent)
Returns an own type parameter window.
Definition: GUIVehicle.cpp:182
double getManeuverDist() const
return the lane-change maneuver distance
Definition: GUIVehicle.cpp:825
int getRightSublaneOnEdge() const
return the righmost sublane on the edge occupied by the vehicle
Definition: GUIVehicle.cpp:801
double getWidth() const
Get the width which vehicles of this class shall have when being drawn.
Structure representing possible vehicle parameter.
SUMOVehicleShape
Definition of vehicle classes to differ between different appearences.
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
void computeSeats(const Position &front, const Position &back, int &requiredSeats) const
add seats to mySeatPositions and update requiredSeats
Definition: GUIVehicle.cpp:642
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:4937
void drawAction_drawVehicleBlueLight() const
Definition: GUIVehicle.cpp:344
Representation of a lane in the micro simulation.
Definition: MSLane.h:78
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:661
double getAngle() const
Return current angle.
Definition: GUIVehicle.h:82
A MSVehicle extended by some values for usage within the gui.
Definition: GUIVehicle.h:54