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