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 GUIParkingArea.h 15 : /// @author Mirco Sturari 16 : /// @date Tue, 19.01.2016 17 : /// 18 : // A area where vehicles can park next to the road (gui version) 19 : /****************************************************************************/ 20 : #pragma once 21 : #include <config.h> 22 : 23 : #include <vector> 24 : #include <string> 25 : #include <utils/common/Command.h> 26 : #include <utils/common/VectorHelper.h> 27 : #include <microsim/MSStoppingPlace.h> 28 : #include <microsim/MSParkingArea.h> 29 : #include <utils/gui/globjects/GUIGlObject.h> 30 : #include <utils/gui/globjects/GUIGlObject_AbstractAdd.h> 31 : #include <utils/gui/globjects/GUIGLObjectPopupMenu.h> 32 : #include <utils/geom/Position.h> 33 : #include <gui/GUIManipulator.h> 34 : 35 : 36 : // =========================================================================== 37 : // class declarations 38 : // =========================================================================== 39 : class MSNet; 40 : class MSLane; 41 : class GUIManipulator; 42 : 43 : 44 : // =========================================================================== 45 : // class definitions 46 : // =========================================================================== 47 : /** 48 : * @class GUIParkingArea 49 : * @brief A lane area vehicles can halt at (gui-version) 50 : * 51 : * This gui-version of a parking-area extends MSStoppingPlace by methods for displaying 52 : * and interaction. 53 : * 54 : * @see MSStoppingPlace 55 : * @see GUIGlObject_AbstractAdd 56 : * @see GUIGlObject 57 : */ 58 : class GUIParkingArea : public MSParkingArea, public GUIGlObject_AbstractAdd { 59 : public: 60 : 61 : /** @brief Constructor 62 : * @param[in] idStorage The gl-id storage for giving this object an gl-id 63 : * @param[in] id The id of the parking area 64 : * @param[in] lines Names of the parking lines that halt on this parking area 65 : * @param[in] lane The lane the parking area is placed on 66 : * @param[in] begPos Begin position of the parking area on the lane 67 : * @param[in] endPos End position of the parking area on the lane 68 : * @param[in] capacity Capacity of the parking area (if > 0 lots are generated, otherwise expected addLotEntry()) 69 : * @param[in] width Default width of the lot rectangle (if = 0 is computed from line.getWidth()) 70 : * @param[in] length Default length of the lot rectangle (if = 0 is computed from endPos-begPos) 71 : * @param[in] angle Default angle of the lot rectangle relative to lane direction (if = 0 is computed ... TODO) 72 : */ 73 : GUIParkingArea(const std::string& id, 74 : const std::vector<std::string>& lines, MSLane& lane, 75 : double frompos, double topos, unsigned int capacity, 76 : double width, double length, double angle, const std::string& name, 77 : bool onRoad, 78 : const std::string& departPos, 79 : bool lefthand); 80 : 81 : 82 : /// @brief Destructor 83 : ~GUIParkingArea(); 84 : 85 : 86 : 87 : /// @name inherited from GUIGlObject 88 : //@{ 89 : 90 : /** @brief Returns an own popup-menu 91 : * 92 : * @param[in] app The application needed to build the popup-menu 93 : * @param[in] parent The parent window needed to build the popup-menu 94 : * @return The built popup-menu 95 : * @see GUIGlObject::getPopUpMenu 96 : */ 97 : GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, 98 : GUISUMOAbstractView& parent); 99 : 100 : /** @brief Returns an own parameter window 101 : * 102 : * Container stops have no parameter windows (yet). 103 : * 104 : * @param[in] app The application needed to build the parameter window 105 : * @param[in] parent The parent window needed to build the parameter window 106 : * @return The built parameter window (always 0 in this case) 107 : * @see GUIGlObject::getParameterWindow 108 : */ 109 : GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app, 110 : GUISUMOAbstractView& parent); 111 : 112 : /// @brief return exaggeration associated with this GLObject 113 : double getExaggeration(const GUIVisualizationSettings& s) const; 114 : 115 : /** @brief Returns the boundary to which the view shall be centered in order to show the object 116 : * 117 : * @return The boundary the object is within 118 : * @see GUIGlObject::getCenteringBoundary 119 : */ 120 : Boundary getCenteringBoundary() const; 121 : 122 : /// @brief Returns the stopping place name 123 : const std::string getOptionalName() const; 124 : 125 : /// @brief extend boundary 126 : void addLotEntry(double x, double y, double z, 127 : double width, double length, 128 : double angle, double slope); 129 : 130 : /** @brief Draws the object 131 : * @param[in] s The settings for the current view (may influence drawing) 132 : * @see GUIGlObject::drawGL 133 : */ 134 : void drawGL(const GUIVisualizationSettings& s) const; 135 : //@} 136 : 137 : const Position& getSignPos() const { 138 0 : return mySignPos; 139 : } 140 : 141 : private: 142 : /// @brief The rotations of the shape parts 143 : std::vector<double> myShapeRotations; 144 : 145 : /// @brief The lengths of the shape parts 146 : std::vector<double> myShapeLengths; 147 : 148 : /// @brief The position of the sign 149 : Position mySignPos; 150 : 151 : /// @brief The rotation of the sign 152 : double mySignRot; 153 : 154 : /// @brief the centering boundary 155 : Boundary myBoundary; 156 : 157 : };