Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/mesogui/GUIMEVehicle.h
169668 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
14
/// @file GUIMEVehicle.h
15
/// @author Daniel Krajzewicz
16
/// @author Jakob Erdmann
17
/// @author Sascha Krieg
18
/// @author Michael Behrisch
19
/// @date Sept 2002
20
///
21
// A MSVehicle extended by some values for usage within the gui
22
/****************************************************************************/
23
#pragma once
24
#include <config.h>
25
26
#include <vector>
27
#include <set>
28
#include <string>
29
#include <guisim/GUIBaseVehicle.h>
30
#include <mesosim/MEVehicle.h>
31
32
33
// ===========================================================================
34
// class declarations
35
// ===========================================================================
36
class GUISUMOAbstractView;
37
class GUIVisualizationSettings;
38
39
40
// ===========================================================================
41
// class definitions
42
// ===========================================================================
43
/**
44
* @class GUIMEVehicle
45
* @brief A MSVehicle extended by some values for usage within the gui
46
*
47
* A visualisable MSVehicle. Extended by the possibility to retrieve names
48
* of all available vehicles (static) and the possibility to retrieve the
49
* color of the vehicle which is available in different forms allowing an
50
* easier recognition of done actions such as lane changing.
51
*/
52
class GUIMEVehicle : public MEVehicle, public GUIBaseVehicle {
53
public:
54
/** @brief Constructor
55
* @param[in] pars The vehicle description
56
* @param[in] route The vehicle's route
57
* @param[in] type The vehicle's type
58
* @param[in] speedFactor The factor for driven lane's speed limits
59
* @exception ProcessError If a value is wrong
60
*/
61
GUIMEVehicle(SUMOVehicleParameter* pars, ConstMSRoutePtr route,
62
MSVehicleType* type, const double speedFactor);
63
64
65
/// @brief destructor
66
~GUIMEVehicle();
67
68
69
/** @brief Return current position (x/y, cartesian)
70
*
71
* @note implementation of abstract method does not work otherwise
72
*/
73
Position getPosition(const double offset = 0) const {
74
return MEVehicle::getPosition(offset);
75
}
76
77
Position getVisualPosition(bool s2, const double offset = 0) const;
78
79
/// @brief return exaggeration associated with this GLObject
80
double getExaggeration(const GUIVisualizationSettings& s) const;
81
82
/** @brief Returns the boundary to which the view shall be centered in order to show the object
83
*
84
* @return The boundary the object is within
85
* @see GUIGlObject::getCenteringBoundary
86
*/
87
virtual Boundary getCenteringBoundary() const;
88
89
/** @brief Return current angle
90
*
91
* @note implementation of abstract method does not work otherwise
92
*/
93
double getAngle() const {
94
return MEVehicle::getAngle();
95
}
96
97
double getVisualAngle(bool /*s2*/) const {
98
return MEVehicle::getAngle();
99
}
100
101
/// @brief gets the color value according to the current scheme index
102
double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const;
103
104
/// @brief draws the given guiShape with distinct carriages/modules
105
void drawAction_drawCarriageClass(const GUIVisualizationSettings& s, double scaledLength, bool asImage) const;
106
107
/** @brief Returns the time since the last lane change in seconds
108
* @see MSVehicle::myLastLaneChangeOffset
109
* @return The time since the last lane change in seconds
110
*/
111
double getLastLaneChangeOffset() const;
112
113
/** @brief Draws the route
114
* @param[in] r The route to draw
115
*/
116
void drawRouteHelper(const GUIVisualizationSettings& s, ConstMSRoutePtr r, bool future, bool noLoop, const RGBColor& col) const;
117
118
/// @brief retrieve information about the current stop state
119
std::string getStopInfo() const;
120
121
std::string getEdgeID() const;
122
123
/// @brief adds the blocking foes to the current selection
124
void selectBlockingFoes() const;
125
126
/** @brief Returns an own parameter window
127
*
128
* @param[in] app The application needed to build the parameter window
129
* @param[in] parent The parent window needed to build the parameter window
130
* @return The built parameter window
131
* @see GUIGlObject::getParameterWindow
132
*/
133
GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent);
134
135
/** @brief Returns an own type parameter window
136
*
137
* @param[in] app The application needed to build the parameter window
138
* @param[in] parent The parent window needed to build the parameter window
139
* @return The built parameter window
140
*/
141
GUIParameterTableWindow* getTypeParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent);
142
143
/// @brief whether this vehicle is selected in the GUI
144
bool isSelected() const;
145
};
146
147