Line data Source code
1 : /****************************************************************************/ 2 : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo 3 : // Copyright (C) 2001-2024 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 127058 : Position getPosition(const double offset = 0) const { 74 127058 : return MEVehicle::getPosition(offset); 75 : } 76 : 77 105 : Position getVisualPosition(bool /*s2*/, const double offset = 0) const { 78 105 : return MEVehicle::getPosition(offset); 79 : } 80 : 81 : /// @brief return exaggeration associated with this GLObject 82 : double getExaggeration(const GUIVisualizationSettings& s) const; 83 : 84 : /** @brief Returns the boundary to which the view shall be centered in order to show the object 85 : * 86 : * @return The boundary the object is within 87 : * @see GUIGlObject::getCenteringBoundary 88 : */ 89 : virtual Boundary getCenteringBoundary() const; 90 : 91 : /** @brief Return current angle 92 : * 93 : * @note implementation of abstract method does not work otherwise 94 : */ 95 24756 : double getAngle() const { 96 24756 : return MEVehicle::getAngle(); 97 : } 98 : 99 105 : double getVisualAngle(bool /*s2*/) const { 100 105 : return MEVehicle::getAngle(); 101 : } 102 : 103 : /// @brief gets the color value according to the current scheme index 104 : double getColorValue(const GUIVisualizationSettings& s, int activeScheme) const; 105 : 106 : /// @brief draws the given guiShape with distinct carriages/modules 107 : void drawAction_drawCarriageClass(const GUIVisualizationSettings& s, bool asImage) const; 108 : 109 : /** @brief Returns the time since the last lane change in seconds 110 : * @see MSVehicle::myLastLaneChangeOffset 111 : * @return The time since the last lane change in seconds 112 : */ 113 : double getLastLaneChangeOffset() const; 114 : 115 : /** @brief Draws the route 116 : * @param[in] r The route to draw 117 : */ 118 : void drawRouteHelper(const GUIVisualizationSettings& s, ConstMSRoutePtr r, bool future, bool noLoop, const RGBColor& col) const; 119 : 120 : /// @brief retrieve information about the current stop state 121 : std::string getStopInfo() const; 122 : 123 : std::string getEdgeID() const; 124 : 125 : int getSegmentIndex() const; 126 : 127 : /// @brief adds the blocking foes to the current selection 128 : void selectBlockingFoes() const; 129 : 130 : /** @brief Returns an own parameter window 131 : * 132 : * @param[in] app The application needed to build the parameter window 133 : * @param[in] parent The parent window needed to build the parameter window 134 : * @return The built parameter window 135 : * @see GUIGlObject::getParameterWindow 136 : */ 137 : GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent); 138 : 139 : /** @brief Returns an own type parameter window 140 : * 141 : * @param[in] app The application needed to build the parameter window 142 : * @param[in] parent The parent window needed to build the parameter window 143 : * @return The built parameter window 144 : */ 145 : GUIParameterTableWindow* getTypeParameterWindow(GUIMainWindow& app, GUISUMOAbstractView& parent); 146 : 147 : };