Line data Source code
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 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] badges Names which grant access to this parking area
66 : * @param[in] lane The lane the parking area is placed on
67 : * @param[in] begPos Begin position of the parking area on the lane
68 : * @param[in] endPos End position of the parking area on the lane
69 : * @param[in] capacity Capacity of the parking area (if > 0 lots are generated, otherwise expected addLotEntry())
70 : * @param[in] width Default width of the lot rectangle (if = 0 is computed from line.getWidth())
71 : * @param[in] length Default length of the lot rectangle (if = 0 is computed from endPos-begPos)
72 : * @param[in] angle Default angle of the lot rectangle relative to lane direction (if = 0 is computed ... TODO)
73 : */
74 : GUIParkingArea(const std::string& id,
75 : const std::vector<std::string>& lines, const std::vector<std::string>& badges, MSLane& lane,
76 : double frompos, double topos, unsigned int capacity,
77 : double width, double length, double angle, const std::string& name,
78 : bool onRoad,
79 : const std::string& departPos,
80 : bool lefthand);
81 :
82 :
83 : /// @brief Destructor
84 : ~GUIParkingArea();
85 :
86 :
87 :
88 : /// @name inherited from GUIGlObject
89 : //@{
90 :
91 : /** @brief Returns an own popup-menu
92 : *
93 : * @param[in] app The application needed to build the popup-menu
94 : * @param[in] parent The parent window needed to build the popup-menu
95 : * @return The built popup-menu
96 : * @see GUIGlObject::getPopUpMenu
97 : */
98 : GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;
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, GUISUMOAbstractView& parent) override;
110 :
111 : /// @brief return exaggeration associated with this GLObject
112 : double getExaggeration(const GUIVisualizationSettings& s) const override;
113 :
114 : /** @brief Returns the boundary to which the view shall be centered in order to show the object
115 : *
116 : * @return The boundary the object is within
117 : * @see GUIGlObject::getCenteringBoundary
118 : */
119 : Boundary getCenteringBoundary() const override;
120 :
121 : /// @brief Returns the stopping place name
122 : const std::string getOptionalName() const override;
123 :
124 : /// @brief extend boundary
125 : void addLotEntry(double x, double y, double z,
126 : double width, double length,
127 : double angle, double slope) override;
128 :
129 : /** @brief Draws the object
130 : * @param[in] s The settings for the current view (may influence drawing)
131 : * @see GUIGlObject::drawGL
132 : */
133 : void drawGL(const GUIVisualizationSettings& s) const override;
134 : //@}
135 :
136 : const Position& getSignPos() const {
137 0 : return mySignPos;
138 : }
139 :
140 : private:
141 : /// @brief The rotations of the shape parts
142 : std::vector<double> myShapeRotations;
143 :
144 : /// @brief The lengths of the shape parts
145 : std::vector<double> myShapeLengths;
146 :
147 : /// @brief The position of the sign
148 : Position mySignPos;
149 :
150 : /// @brief The rotation of the sign
151 : double mySignRot;
152 :
153 : /// @brief the centering boundary
154 : Boundary myBoundary;
155 :
156 : };
|