Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/additional/GNEParkingSpace.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 GNEParkingSpace.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Feb 2018
17
///
18
// A class for visualizing ParkingSpace geometry (adapted from GUILaneWrapper)
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include "GNEAdditional.h"
24
25
// ===========================================================================
26
// class declarations
27
// ===========================================================================
28
29
class GNEParkingArea;
30
31
// ===========================================================================
32
// class definitions
33
// ===========================================================================
34
35
class GNEParkingSpace : public GNEAdditional, public Parameterised {
36
37
public:
38
/// @brief Constructor
39
GNEParkingSpace(GNENet* net);
40
41
/**@brief Constructor
42
* @param[in] parkingAreaParent pointer to Parking Area parent
43
* @param[in] pos position X-Y-Z
44
* @param[in] width ParkingArea's width
45
* @param[in] length ParkingArea's length
46
* @param[in] angle ParkingArea's angle
47
* @param[in] slope ParkingArea's slope (of this space)
48
* @param[in] name ParkingArea's name
49
* @param[in] parameters generic parameters
50
*/
51
GNEParkingSpace(GNEAdditional* parkingAreaParent, const Position& pos, const std::string& width,
52
const std::string& length, const std::string& angle, double slope, const std::string& name,
53
const Parameterised::Map& parameters);
54
55
/// @brief Destructor
56
~GNEParkingSpace();
57
58
/**@brief get move operation
59
* @note returned GNEMoveOperation can be nullptr
60
*/
61
GNEMoveOperation* getMoveOperation();
62
63
/// @name members and functions relative to write additionals into XML
64
/// @{
65
66
/**@brief write additional element into a xml file
67
* @param[in] device device in which write parameters of additional element
68
*/
69
void writeAdditional(OutputDevice& device) const;
70
71
/// @brief check if current additional is valid to be written into XML (must be reimplemented in all detector children)
72
bool isAdditionalValid() const;
73
74
/// @brief return a string with the current additional problem (must be reimplemented in all detector children)
75
std::string getAdditionalProblem() const;
76
77
/// @brief fix additional problem (must be reimplemented in all detector children)
78
void fixAdditionalProblem();
79
80
/// @}
81
82
/// @name Function related with contour drawing
83
/// @{
84
85
/// @brief check if draw move contour (red)
86
bool checkDrawMoveContour() const;
87
88
/// @}
89
90
/// @name Functions related with geometry of element
91
/// @{
92
93
/// @brief update pre-computed geometry information
94
void updateGeometry();
95
96
/// @brief Returns position of additional in view
97
Position getPositionInView() const;
98
99
/// @brief update centering boundary (implies change in RTREE)
100
void updateCenteringBoundary(const bool updateGrid);
101
102
/// @brief split geometry
103
void splitEdgeGeometry(const double splitPosition, const GNENetworkElement* originalElement, const GNENetworkElement* newElement, GNEUndoList* undoList);
104
105
/// @}
106
107
/// @name inherited from GUIGlObject
108
/// @{
109
110
/// @brief Returns the name of the parent object
111
/// @return This object's parent id
112
std::string getParentName() const;
113
114
/**@brief Draws the object
115
* @param[in] s The settings for the current view (may influence drawing)
116
* @see GUIGlObject::drawGL
117
*/
118
void drawGL(const GUIVisualizationSettings& s) const;
119
120
/// @}
121
122
/// @name inherited from GNEAttributeCarrier
123
/// @{
124
125
/* @brief method for getting the Attribute of an XML key
126
* @param[in] key The attribute key
127
* @return string with the value associated to key
128
*/
129
std::string getAttribute(SumoXMLAttr key) const;
130
131
/* @brief method for getting the Attribute of an XML key in double format (to avoid unnecessary parse<double>(...) for certain attributes)
132
* @param[in] key The attribute key
133
* @return double with the value associated to key
134
*/
135
double getAttributeDouble(SumoXMLAttr key) const;
136
137
/// @brief get parameters map
138
const Parameterised::Map& getACParametersMap() const;
139
140
/* @brief method for setting the attribute and letting the object perform additional changes
141
* @param[in] key The attribute key
142
* @param[in] value The new value
143
* @param[in] undoList The undoList on which to register changes
144
*/
145
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList);
146
147
/* @brief method for checking if the key and their correspond attribute are valids
148
* @param[in] key The attribute key
149
* @param[in] value The value associated to key key
150
* @return true if the value is valid, false in other case
151
*/
152
bool isValid(SumoXMLAttr key, const std::string& value);
153
154
/// @brief get PopPup ID (Used in AC Hierarchy)
155
std::string getPopUpID() const;
156
157
/// @brief get Hierarchy Name (Used in AC Hierarchy)
158
std::string getHierarchyName() const;
159
160
/// @}
161
162
protected:
163
/// @brief position of Parking Space in view
164
Position myPosition;
165
166
/// @brief width of Parking Space
167
std::string myWidth;
168
169
/// @brief Length of Parking Space
170
std::string myLength;
171
172
/// @brief shape width of Parking Space
173
PositionVector myShapeWidth;
174
175
/// @brief shape length of Parking Space
176
PositionVector myShapeLength;
177
178
/// @brief Angle of Parking Space
179
std::string myAngle;
180
181
/// @brief Slope of Parking Space
182
double mySlope;
183
184
/// @brief variable used for moving contour up
185
GNEContour myMovingContourUp;
186
187
/// @brief variable used for moving contour down
188
GNEContour myMovingContourDown;
189
190
/// @brief variable used for moving contour left
191
GNEContour myMovingContourLeft;
192
193
/// @brief variable used for moving contour right
194
GNEContour myMovingContourRight;
195
196
private:
197
/// @brief draw space
198
void drawSpace(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
199
const double width, const bool movingGeometryPoints) const;
200
201
/// @brief calculate space contour
202
void calculateSpaceContour(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
203
const double width, const double exaggeration, const bool movingGeometryPoints) const;
204
205
/// @brief set attribute after validation
206
void setAttribute(SumoXMLAttr key, const std::string& value);
207
208
/// @brief set move shape
209
void setMoveShape(const GNEMoveResult& moveResult);
210
211
/// @brief commit move shape
212
void commitMoveShape(const GNEMoveResult& moveResult, GNEUndoList* undoList);
213
214
/// @brief Invalidated copy constructor.
215
GNEParkingSpace(const GNEParkingSpace&) = delete;
216
217
/// @brief Invalidated assignment operator.
218
GNEParkingSpace& operator=(const GNEParkingSpace&) = delete;
219
};
220
221