Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/guisim/GUIParkingArea.h
169667 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 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,
99
GUISUMOAbstractView& parent);
100
101
/** @brief Returns an own parameter window
102
*
103
* Container stops have no parameter windows (yet).
104
*
105
* @param[in] app The application needed to build the parameter window
106
* @param[in] parent The parent window needed to build the parameter window
107
* @return The built parameter window (always 0 in this case)
108
* @see GUIGlObject::getParameterWindow
109
*/
110
GUIParameterTableWindow* getParameterWindow(GUIMainWindow& app,
111
GUISUMOAbstractView& parent);
112
113
/// @brief return exaggeration associated with this GLObject
114
double getExaggeration(const GUIVisualizationSettings& s) const;
115
116
/** @brief Returns the boundary to which the view shall be centered in order to show the object
117
*
118
* @return The boundary the object is within
119
* @see GUIGlObject::getCenteringBoundary
120
*/
121
Boundary getCenteringBoundary() const;
122
123
/// @brief Returns the stopping place name
124
const std::string getOptionalName() const;
125
126
/// @brief extend boundary
127
void addLotEntry(double x, double y, double z,
128
double width, double length,
129
double angle, double slope);
130
131
/** @brief Draws the object
132
* @param[in] s The settings for the current view (may influence drawing)
133
* @see GUIGlObject::drawGL
134
*/
135
void drawGL(const GUIVisualizationSettings& s) const;
136
//@}
137
138
const Position& getSignPos() const {
139
return mySignPos;
140
}
141
142
private:
143
/// @brief The rotations of the shape parts
144
std::vector<double> myShapeRotations;
145
146
/// @brief The lengths of the shape parts
147
std::vector<double> myShapeLengths;
148
149
/// @brief The position of the sign
150
Position mySignPos;
151
152
/// @brief The rotation of the sign
153
double mySignRot;
154
155
/// @brief the centering boundary
156
Boundary myBoundary;
157
158
};
159
160