Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/elements/network/GNEWalkingArea.h
185849 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 GNEWalkingArea.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Jun 2022
17
///
18
// A class for visualizing and editing WalkingAreas
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
#include "GNENetworkElement.h"
23
#include <utils/gui/globjects/GUIPolygon.h>
24
#include <netbuild/NBNode.h>
25
26
// ===========================================================================
27
// class declarations
28
// ===========================================================================
29
30
class GUIGLObjectPopupMenu;
31
class PositionVector;
32
class GNEJunction;
33
class GNEEdge;
34
35
// ===========================================================================
36
// class definitions
37
// ===========================================================================
38
39
class GNEWalkingArea : public GNENetworkElement {
40
41
public:
42
/**@brief Constructor
43
* @param[in] junction GNEJunction in which this crossing is placed
44
* @param[in] ID walkingArea ID
45
*/
46
GNEWalkingArea(GNEJunction* junction, const std::string& ID);
47
48
/// @brief Destructor
49
~GNEWalkingArea();
50
51
/// @brief methods to retrieve the elements linked to this walkingArea
52
/// @{
53
54
/// @brief get GNEMoveElement associated with this walkingArea
55
GNEMoveElement* getMoveElement() const override;
56
57
/// @brief get parameters associated with this walkingArea
58
Parameterised* getParameters() override;
59
60
/// @brief get parameters associated with this walkingArea (constant)
61
const Parameterised* getParameters() const override;
62
63
/// @}
64
65
/// @name Functions related with geometry of element
66
/// @{
67
68
/// @brief update pre-computed geometry information
69
void updateGeometry() override;
70
71
/// @brief Returns position of hierarchical element in view
72
Position getPositionInView() const;
73
74
/// @}
75
76
/// @name Function related with contour drawing
77
/// @{
78
79
/// @brief check if draw from contour (green)
80
bool checkDrawFromContour() const override;
81
82
/// @brief check if draw from contour (magenta)
83
bool checkDrawToContour() const override;
84
85
/// @brief check if draw related contour (cyan)
86
bool checkDrawRelatedContour() const override;
87
88
/// @brief check if draw over contour (orange)
89
bool checkDrawOverContour() const override;
90
91
/// @brief check if draw delete contour (pink/white)
92
bool checkDrawDeleteContour() const override;
93
94
/// @brief check if draw delete contour small (pink/white)
95
bool checkDrawDeleteContourSmall() const override;
96
97
/// @brief check if draw select contour (blue)
98
bool checkDrawSelectContour() const override;
99
100
/// @brief check if draw move contour (red)
101
bool checkDrawMoveContour() const override;
102
103
/// @}
104
105
/// @brief get referente to NBode::WalkingArea
106
NBNode::WalkingArea& getNBWalkingArea() const;
107
108
/// @name inherited from GUIGlObject
109
/// @{
110
/**@brief Returns an own popup-menu
111
*
112
* @param[in] app The application needed to build the popup-menu
113
* @param[in] parent The parent window needed to build the popup-menu
114
* @return The built popup-menu
115
* @see GUIGlObject::getPopUpMenu
116
*/
117
GUIGLObjectPopupMenu* getPopUpMenu(GUIMainWindow& app, GUISUMOAbstractView& parent) override;
118
119
/// @brief Returns the boundary to which the view shall be centered in order to show the object
120
Boundary getCenteringBoundary() const override;
121
122
/// @brief update centering boundary (implies change in RTREE)
123
void updateCenteringBoundary(const bool updateGrid);
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
/// @brief delete element
132
void deleteGLObject() override;
133
134
/// @brief update GLObject (geometry, ID, etc.)
135
void updateGLObject() override;
136
/// @}
137
138
/// @name inherited from GNEAttributeCarrier
139
/// @{
140
/* @brief method for getting the Attribute of an XML key
141
* @param[in] key The attribute key
142
* @return string with the value associated to key
143
*/
144
std::string getAttribute(SumoXMLAttr key) const override;
145
146
/* @brief method for getting the Attribute of an XML key in double format
147
* @param[in] key The attribute key
148
* @return double with the value associated to key
149
*/
150
double getAttributeDouble(SumoXMLAttr key) const override;
151
152
/* @brief method for getting the Attribute of an XML key in position format
153
* @param[in] key The attribute key
154
* @return position with the value associated to key
155
*/
156
Position getAttributePosition(SumoXMLAttr key) const override;
157
158
/* @brief method for getting the Attribute of an XML key in Position format
159
* @param[in] key The attribute key
160
* @return position with the value associated to key
161
*/
162
PositionVector getAttributePositionVector(SumoXMLAttr key) const override;
163
164
/* @brief method for setting the attribute and letting the object perform additional changes
165
* @param[in] key The attribute key
166
* @param[in] value The new value
167
* @param[in] undoList The undoList on which to register changes
168
*/
169
void setAttribute(SumoXMLAttr key, const std::string& value, GNEUndoList* undoList) override;
170
171
/* @brief method for checking if the key and their correspond attribute are valids
172
* @param[in] key The attribute key
173
* @param[in] value The value associated to key key
174
* @return true if the value is valid, false in other case
175
*/
176
bool isValid(SumoXMLAttr key, const std::string& value) override;
177
178
/* @brief method for check if the value for certain attribute is set
179
* @param[in] key The attribute key
180
*/
181
bool isAttributeEnabled(SumoXMLAttr key) const override;
182
183
/// @}
184
185
protected:
186
/// @brief An object that stores the shape and its tesselation
187
mutable TesselatedPolygon myTesselation;
188
189
/// @brief exaggeration used in tesselation
190
mutable double myExaggeration;
191
192
/// @brief variable used for draw innen contour
193
GNEContour myInnenContour;
194
195
private:
196
/// @brief draw walking area
197
void drawWalkingArea(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d,
198
const PositionVector& shape, const double exaggeration) const;
199
200
/// @brief check if draw walking area in contour mode
201
bool drawInContourMode() const;
202
203
/// @brief draw tesselated walking area
204
void drawTesselatedWalkingArea(const GUIVisualizationSettings& s, const GUIVisualizationSettings::Detail d) const;
205
206
/// @brief method for setting the attribute and nothing else (used in GNEChange_Attribute)
207
void setAttribute(SumoXMLAttr key, const std::string& value) override;
208
209
/// @brief Invalidated copy constructor.
210
GNEWalkingArea(const GNEWalkingArea&) = delete;
211
212
/// @brief Invalidated assignment operator.
213
GNEWalkingArea& operator=(const GNEWalkingArea&) = delete;
214
};
215
216