Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/additional/GNEParkingArea.h
169684 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 GNEParkingArea.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Feb 2018
17
///
18
// A class for visualizing ParkingArea geometry (adapted from GUILaneWrapper)
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEStoppingPlace.h"
24
25
// ===========================================================================
26
// class definitions
27
// ===========================================================================
28
29
class GNEParkingArea : public GNEStoppingPlace {
30
31
public:
32
/// @brief default constructor
33
GNEParkingArea(GNENet* net);
34
35
/**@brief Constructor
36
* @param[in] id parking area ID
37
* @param[in] net pointer to GNENet of this additional element belongs
38
* @param[in] filename file in which this element is stored
39
* @param[in] lane Lane of this StoppingPlace belongs
40
* @param[in] startPos Start position of the StoppingPlace
41
* @param[in] endPos End position of the StoppingPlace
42
* @param[in] departPos lane position in that vehicle must depart when leaves parkingArea
43
* @param[in] name Name of ParkingArea
44
* @param[in] badges names which grant access to the parkingArea
45
* @param[in] friendlyPos enable or disable friendly position
46
* @param[in] roadSideCapacity road side capacity of ParkingArea
47
* @param[in] width ParkingArea's length
48
* @param[in] length ParkingArea's length
49
* @param[in] angle ParkingArea's angle
50
* @param[in] lefthand enable or disable lefthand
51
* @param[in] parameters generic parameters
52
*/
53
GNEParkingArea(const std::string& id, GNENet* net, const std::string& filename, GNELane* lane, const double startPos, const double endPos,
54
const std::string& departPos, const std::string& name, const std::vector<std::string>& badges, const bool friendlyPosition,
55
const int roadSideCapacity, const bool onRoad, const double width, const double length, const double angle, const bool lefthand,
56
const Parameterised::Map& parameters);
57
58
/// @brief Destructor
59
~GNEParkingArea();
60
61
/**@brief write additional element into a xml file
62
* @param[in] device device in which write parameters of additional element
63
*/
64
void writeAdditional(OutputDevice& device) const;
65
66
/// @name Functions related with geometry of element
67
/// @{
68
69
/// @brief update pre-computed geometry information
70
void updateGeometry();
71
72
/// @}
73
74
/// @name inherited from GUIGlObject
75
/// @{
76
77
/**@brief Draws the object
78
* @param[in] s The settings for the current view (may influence drawing)
79
* @see GUIGlObject::drawGL
80
*/
81
void drawGL(const GUIVisualizationSettings& s) const;
82
83
/// @}
84
85
/// @name inherited from GNEAttributeCarrier
86
/// @{
87
88
/* @brief method for getting the Attribute of an XML key
89
* @param[in] key The attribute key
90
* @return string with the value associated to key
91
*/
92
std::string getAttribute(SumoXMLAttr key) const;
93
94
/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
95
* @param[in] key The attribute key
96
* @return double with the value associated to key
97
*/
98
double getAttributeDouble(SumoXMLAttr key) const;
99
100
/* @brief method for setting the attribute and letting the object perform additional changes
101
* @param[in] key The attribute key
102
* @param[in] value The new value
103
* @param[in] undoList The undoList on which to register changes
104
*/
105
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
106
107
/* @brief method for checking if the key and their correspond attribute are valids
108
* @param[in] key The attribute key
109
* @param[in] value The value associated to key key
110
* @return true if the value is valid, false in other case
111
*/
112
bool isValid(SumoXMLAttr key, const std::string& value);
113
114
/// @}
115
116
protected:
117
/** @struct GNELotSpaceDefinition
118
* @brief Representation of a single lot space in Netedit
119
*/
120
struct GNELotSpaceDefinition {
121
/// @brief default constructor
122
GNELotSpaceDefinition();
123
124
/// @brief parameter constructor
125
GNELotSpaceDefinition(double x, double y, double z, double rotation, double width, double length);
126
127
/// @brief The position of the vehicle when parking in this space
128
const Position position;
129
130
/// @brief The rotation
131
const double rotation;
132
133
/// @brief The width
134
const double width;
135
136
/// @brief The length
137
const double length;
138
};
139
140
/// @brief departPos
141
std::string myDepartPos;
142
143
/// @brief roadside capacity of Parking Area
144
int myRoadSideCapacity;
145
146
/// @brief Whether vehicles stay on the road
147
bool myOnRoad;
148
149
/// @brief width of Parking Area
150
double myWidth;
151
152
/// @brief Length of Parking Area (by default (endPos - startPos) / roadsideCapacity
153
double myLength;
154
155
/// @brief lefthand
156
bool myLefthand;
157
158
/// @brief The list of badges that allow accessing the parkingArea
159
std::vector<std::string> myAcceptedBadges;
160
161
/// @brief vector with GNELotSpaceDefinition
162
std::vector<GNELotSpaceDefinition> myLotSpaceDefinitions;
163
164
private:
165
/// @brief set attribute after validation
166
void setAttribute(SumoXMLAttr key, const std::string& value);
167
168
/// @brief Invalidated copy constructor.
169
GNEParkingArea(const GNEParkingArea&) = delete;
170
171
/// @brief Invalidated assignment operator.
172
GNEParkingArea& operator=(const GNEParkingArea&) = delete;
173
};
174
175