Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/frames/common/GNEDeleteFrame.h
194318 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 GNEDeleteFrame.h
15
/// @author Pablo Alvarez Lopez
16
/// @date Dec 2016
17
///
18
// The Widget for remove network-elements
19
/****************************************************************************/
20
#pragma once
21
#include <config.h>
22
23
#include <netedit/GNEViewNetHelper.h>
24
#include <netedit/frames/GNEFrame.h>
25
#include <netedit/frames/common/GNEGroupBoxModule.h>
26
27
// ===========================================================================
28
// class declaration
29
// ===========================================================================
30
31
class GNEHierarchicalElement;
32
33
// ===========================================================================
34
// class definitions
35
// ===========================================================================
36
37
class GNEDeleteFrame : public GNEFrame {
38
39
public:
40
41
// ===========================================================================
42
// class DeleteOptions
43
// ===========================================================================
44
45
class DeleteOptions : public GNEGroupBoxModule {
46
/// @brief FOX-declaration
47
FXDECLARE(GNEDeleteFrame::DeleteOptions)
48
49
public:
50
/// @brief constructor
51
DeleteOptions(GNEDeleteFrame* deleteFrameParent);
52
53
/// @brief destructor
54
~DeleteOptions();
55
56
/// @brief check if only delete geometry points checkbox is enabled
57
bool deleteOnlyGeometryPoints() const;
58
59
/// @name FOX-callbacks
60
/// @{
61
/// @brief Called when user change an option
62
long onCmdSetOption(FXObject*, FXSelector, void*);
63
64
/// @}
65
66
protected:
67
/// @brief FOX need this
68
FOX_CONSTRUCTOR(DeleteOptions)
69
70
private:
71
/// @brief delete frame parent
72
GNEDeleteFrame* myDeleteFrameParent;
73
74
/// @brief checkbox for enable/disable delete only geometry points
75
FXCheckButton* myDeleteOnlyGeometryPoints;
76
};
77
78
// ===========================================================================
79
// class ProtectElements
80
// ===========================================================================
81
82
class ProtectElements : public GNEGroupBoxModule {
83
/// @brief FOX-declaration
84
FXDECLARE(GNEDeleteFrame::ProtectElements)
85
86
public:
87
/// @brief constructor
88
ProtectElements(GNEDeleteFrame* deleteFrameParent);
89
90
/// @brief destructor
91
~ProtectElements();
92
93
/// @brief get delete frame parent
94
GNEDeleteFrame* getDeleteFrameParent() const;
95
96
/// @brief check if protect additional elements checkbox is enabled
97
bool protectAdditionals() const;
98
99
/// @brief check if protect TAZ elements checkbox is enabled
100
bool protectTAZs() const;
101
102
/// @brief check if protect demand elements checkbox is enabled
103
bool protectDemandElements() const;
104
105
/// @brief check if protect generic datas checkbox is enabled
106
bool protectGenericDatas() const;
107
108
/// @name FOX-callbacks
109
/// @{
110
/// @brief protect all elements
111
long onCmdProtectAll(FXObject*, FXSelector, void*);
112
113
/// @brief unprotect all elements
114
long onCmdUnprotectAll(FXObject*, FXSelector, void*);
115
116
/// @brief update protect all elements
117
long onUpdProtectAll(FXObject*, FXSelector, void*);
118
119
/// @brief update unprotect all elements
120
long onUpdUnprotectAll(FXObject*, FXSelector, void*);
121
122
/// @}
123
124
protected:
125
/// @brief FOX need this
126
FOX_CONSTRUCTOR(ProtectElements)
127
128
private:
129
/// @brief pointer to delete frame parent
130
GNEDeleteFrame* myDeleteFrameParent = nullptr;
131
132
/// @brief protect all button
133
FXButton* myProtectAllButton = nullptr;
134
135
/// @brief unprotect all button
136
FXButton* myUnprotectAllButton = nullptr;
137
138
/// @brief checkbox for enable/disable protect additionals
139
FXCheckButton* myProtectAdditionals = nullptr;
140
141
/// @brief checkbox for enable/disable protect TAZs
142
FXCheckButton* myProtectTAZs = nullptr;
143
144
/// @brief checkbox for enable/disable protect demand elements
145
FXCheckButton* myProtectDemandElements = nullptr;
146
147
/// @brief checkbox for enable/disable protect generic datas
148
FXCheckButton* myProtectGenericDatas = nullptr;
149
150
/// @brief Invalidated copy constructor.
151
ProtectElements(const ProtectElements&) = delete;
152
153
/// @brief Invalidated assignment operator.
154
ProtectElements& operator=(const ProtectElements&) = delete;
155
};
156
157
/// @brief struct for saving subordinated elements (Junction->Edge->Lane->(Additional | DemandElement)
158
class SubordinatedElements {
159
160
public:
161
/// @brief constructor (for junctions)
162
SubordinatedElements(const GNEJunction* junction);
163
164
/// @brief constructor (for edges)
165
SubordinatedElements(const GNEEdge* edge);
166
167
/// @brief constructor (for lanes)
168
SubordinatedElements(const GNELane* lane);
169
170
/// @brief constructor (for additionals)
171
SubordinatedElements(const GNEAdditional* additional);
172
173
/// @brief constructor (for demandElements)
174
SubordinatedElements(const GNEDemandElement* demandElement);
175
176
/// @brief constructor (for shapes)
177
SubordinatedElements(const GNEGenericData* genericData);
178
179
/// @brief destructor
180
~SubordinatedElements();
181
182
/// @brief if element can be removed
183
bool checkElements(const ProtectElements* protectElements);
184
185
protected:
186
/// @brief parent of SubordinatedElements
187
const GNEAttributeCarrier* myAttributeCarrier;
188
189
/// @brief pointer to view net
190
GNEViewNet* myViewNet;
191
192
/// @brief parent additionals (except TAZs)
193
size_t myAdditionalParents;
194
195
/// @brief child additional (except TAZs)
196
size_t myAdditionalChilds;
197
198
/// @brief parent demand elements
199
size_t myDemandElementParents;
200
201
/// @brief child demand elements
202
size_t myDemandElementChilds;
203
204
/// @brief parent demand elements
205
size_t myGenericDataParents;
206
207
/// @brief child demand elements
208
size_t myGenericDataChilds;
209
210
private:
211
// default constructor for non-net elements
212
SubordinatedElements(const GNEAttributeCarrier* attributeCarrier, GNEViewNet* viewNet);
213
214
// default constructor for Net Elements
215
SubordinatedElements(const GNEAttributeCarrier* attributeCarrier, GNEViewNet* viewNet, const GNEHierarchicalElement* hierarchicalElement);
216
217
/// @brief add in originalSE the values of newSE
218
void addValuesFromSubordinatedElements(SubordinatedElements* originalSE, const SubordinatedElements& newSE);
219
220
// @brief open warning dialog
221
void openWarningDialog(const std::string& elementType, const size_t number, const bool isChild, const bool runningInternalTests);
222
223
/// @brief Invalidated copy constructor.
224
SubordinatedElements(const SubordinatedElements&) = delete;
225
226
/// @brief Invalidated assignment operator.
227
SubordinatedElements& operator=(const SubordinatedElements&) = delete;
228
};
229
230
/**@brief Constructor
231
* @brief viewParent GNEViewParent in which this GNEFrame is placed
232
* @brief viewNet viewNet that uses this GNEFrame
233
*/
234
GNEDeleteFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);
235
236
/// @brief Destructor
237
~GNEDeleteFrame();
238
239
/// @brief show delete frame
240
void show();
241
242
/// @brief hide delete frame
243
void hide();
244
245
/// @brief remove selected attribute carriers (element)
246
void removeSelectedAttributeCarriers();
247
248
/**@brief remove attribute carrier (element)
249
* @param viewObjects objects under cursors
250
*/
251
void removeAttributeCarrier(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);
252
253
/**@brief remove geometry point
254
* @param viewObjects objects under cursors
255
*/
256
bool removeGeometryPoint(const GNEViewNetHelper::ViewObjectsSelector& viewObjects);
257
258
/// @brief get delete options modul
259
DeleteOptions* getDeleteOptions() const;
260
261
/// @brief get protect elements modul
262
ProtectElements* getProtectElements() const;
263
264
protected:
265
/// @brief check if there is selected ACs to delete
266
bool selectedACsToDelete() const;
267
268
private:
269
/// @brief modul for delete options
270
DeleteOptions* myDeleteOptions = nullptr;
271
272
/// @brief modul for protect elements
273
ProtectElements* myProtectElements = nullptr;
274
};
275
276