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