Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
GNESelectorFrame.h
Go to the documentation of this file.
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/****************************************************************************/
18// The Widget for modifying selections of network-elements
19// (some elements adapted from GUIDialog_GLChosenEditor)
20/****************************************************************************/
21#pragma once
22#include <config.h>
23
24#include <unordered_map>
28
29// ===========================================================================
30// class declaration
31// ===========================================================================
32
35class GNEMatchGenericDataAttribute;
37
38// ===========================================================================
39// class definitions
40// ===========================================================================
45class GNESelectorFrame : public GNEFrame {
46
47public:
48 // ===========================================================================
49 // class SelectionInformation
50 // ===========================================================================
51
53
54 public:
56 SelectionInformation(GNESelectorFrame* selectorFrameParent);
57
60
63
64 protected:
66 void updateInformationLabel(const std::string& element, int number);
67
68 private:
70 std::string myInformation;
71
74
77
80
83 };
84
85 // ===========================================================================
86 // class ModificationMode
87 // ===========================================================================
88
92
93 public:
95 enum class Operation {
96 ADD,
97 SUB,
99 REPLACE,
100 DEFAULT
101 };
102
104 ModificationMode(GNESelectorFrame* selectorFrameParent);
105
108
111
115 long onCmdSelectModificationMode(FXObject*, FXSelector, void*);
116
118
119 protected:
121 FOX_CONSTRUCTOR(ModificationMode)
122
123 private:
125 FXRadioButton* myAddRadioButton;
126
128 FXRadioButton* myRemoveRadioButton;
129
131 FXRadioButton* myKeepRadioButton;
132
134 FXRadioButton* myReplaceRadioButton;
135
138
141
144 };
145
146 // ===========================================================================
147 // class VisualScaling
148 // ===========================================================================
149
153
154 public:
156 VisualScaling(GNESelectorFrame* selectorFrameParent);
157
160
163
165 long onCmdScaleSelection(FXObject*, FXSelector, void*);
166
168
169 protected:
171 FOX_CONSTRUCTOR(VisualScaling)
172
173 private:
176
178 FXRealSpinner* mySelectionScaling;
179
181 VisualScaling(const VisualScaling&) = delete;
182
185 };
186
187 // ===========================================================================
188 // class SelectionOperation
189 // ===========================================================================
190
194
195 public:
197 SelectionOperation(GNESelectorFrame* selectorFrameParent);
198
201
203 void loadFromFile(const std::string& file) const;
204
207
212 long onCmdLoad(FXObject*, FXSelector, void*);
213
218 long onCmdSave(FXObject*, FXSelector, void*);
219
223 long onCmdClear(FXObject*, FXSelector, void*);
224
227 long onCmdDelete(FXObject*, FXSelector, void*);
228
232 long onCmdInvert(FXObject*, FXSelector, void*);
233
237 long onCmdReduce(FXObject*, FXSelector, void*);
238
240
241 protected:
243 FOX_CONSTRUCTOR(SelectionOperation)
244
245
247
249 MassiveSelection(const int bucketSize);
250
253
255 bool isElementToProcess() const;
256
258 std::unordered_map<GNEAttributeCarrier*, bool> ACsToSelect;
259
261 std::unordered_map<GNEAttributeCarrier*, bool> ACsToUnselect;
262
264 std::map<GUIGlObjectType, bool> lockedTypes;
265
266 private:
269 };
270
272 MassiveSelection processMassiveNetworkElementSelection(const bool filterLanes) const;
273
276
279
281 bool askContinueIfLock() const;
282
283 private:
286
289
292 };
293
294 // ===========================================================================
295 // class SelectionHierarchy
296 // ===========================================================================
297
301
302 public:
304 SelectionHierarchy(GNESelectorFrame* selectorFrameParent);
305
308
311
313 long onCmdSelectItem(FXObject* obj, FXSelector, void*);
314
316 long onCmdParents(FXObject* obj, FXSelector, void*);
317
319 long onCmdChildren(FXObject* obj, FXSelector, void*);
320
322
323 protected:
325 FOX_CONSTRUCTOR(SelectionHierarchy)
326
327 private:
329 enum class Selection {
330 ALL,
331 JUNCTION,
332 EDGE,
333 LANE,
335 CROSSING,
337 WIRE,
338 SHAPE,
339 DEMAND,
340 DATA,
341 NOTHING,
342 };
343
346
349
352
354 FXButton* mySelectParentsButton = nullptr;
355
357 FXButton* myUnselectParentsButton = nullptr;
358
360 FXButton* mySelectChildrenButton = nullptr;
361
363 FXButton* myUnselectChildrenButton = nullptr;
364
365 // @brief items
366 const std::vector<std::pair<Selection, std::string> > myItems = {
367 std::make_pair(Selection::ALL, "all"),
368 std::make_pair(Selection::JUNCTION, "junction"),
369 std::make_pair(Selection::EDGE, "edge"),
370 std::make_pair(Selection::LANE, "lane"),
371 std::make_pair(Selection::CONNECTION, "connection"),
372 std::make_pair(Selection::CROSSING, "crossing"),
373 std::make_pair(Selection::ADDITIONAL, "additionalElements"),
374 std::make_pair(Selection::WIRE, "wireElements"),
375 std::make_pair(Selection::SHAPE, "shapeElements"),
376 std::make_pair(Selection::DEMAND, "demandElements"),
377 std::make_pair(Selection::DATA, "dataElements")
378 };
379
382
385
388
391 };
392
393 // ===========================================================================
394 // class Legend
395 // ===========================================================================
396
398
399 public:
401 Information(GNESelectorFrame* selectorFrameParent);
402
404 ~Information();
405 };
406
411 GNESelectorFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);
412
415
417 void show();
418
420 void hide();
421
424
426 void clearCurrentSelection() const;
427
432
436 void handleIDs(const std::vector<GNEAttributeCarrier*>& ACs, const ModificationMode::Operation setop = ModificationMode::Operation::DEFAULT);
437
439 FXVerticalFrame* getContentFrame() const;
440
443
446
449
450private:
453
456
459
462
465
468
471
474
477};
FXRadioButton * myReplaceRadioButton
replace radio button
Operation myModificationModeType
how to modify selection
long onCmdSelectModificationMode(FXObject *, FXSelector, void *)
FXRadioButton * myAddRadioButton
FOX need this.
ModificationMode & operator=(const ModificationMode &)=delete
Invalidated assignment operator.
ModificationMode(const ModificationMode &)=delete
Invalidated copy constructor.
Operation getModificationMode() const
get current modification mode
FXRadioButton * myRemoveRadioButton
remove radio button
FXRadioButton * myKeepRadioButton
keep button
MFXComboBoxIcon * myChildrenComboBox
comboBox for children
SelectionHierarchy & operator=(const SelectionHierarchy &)=delete
Invalidated assignment operator.
FXButton * myUnselectParentsButton
unselect parents button
Selection myCurrentSelectedChild
current selected child
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
SelectionHierarchy(const SelectionHierarchy &)=delete
Invalidated copy constructor.
FXButton * mySelectParentsButton
select parents button
FXButton * myUnselectChildrenButton
unselect parents button
long onCmdParents(FXObject *obj, FXSelector, void *)
called when user press select/unselect parents button
long onCmdChildren(FXObject *obj, FXSelector, void *)
called when user press select/unselect children button
long onCmdSelectItem(FXObject *obj, FXSelector, void *)
called when user select an item in comboBox
MFXComboBoxIcon * myParentsComboBox
comboBox for parents
const std::vector< std::pair< Selection, std::string > > myItems
FXButton * mySelectChildrenButton
select children button
Selection myCurrentSelectedParent
current selected parent
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
SelectionInformation & operator=(const SelectionInformation &)=delete
Invalidated assignment operator.
void updateInformationLabel()
update information label
std::string myInformation
string for keep information
SelectionInformation(const SelectionInformation &)=delete
Invalidated copy constructor.
FXLabel * myInformationLabel
information label
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user presses the Save-button.
MassiveSelection processMassiveNetworkElementSelection(const bool filterLanes) const
process massive network element selection
bool askContinueIfLock() const
ask if continue due locking
long onCmdDelete(FXObject *, FXSelector, void *)
Called when the user presses the delete-button.
long onCmdReduce(FXObject *, FXSelector, void *)
Called when the user presses the Reduce-button.
long onCmdInvert(FXObject *, FXSelector, void *)
Called when the user presses the Invert-button.
long onCmdClear(FXObject *, FXSelector, void *)
Called when the user presses the Clear-button.
long onCmdLoad(FXObject *, FXSelector, void *)
Called when the user presses the Load-button.
void loadFromFile(const std::string &file) const
load from file
MassiveSelection processMassiveDataElementSelection() const
process massive dataelement selection
SelectionOperation(const SelectionOperation &)=delete
Invalidated copy constructor.
SelectionOperation & operator=(const SelectionOperation &)=delete
Invalidated assignment operator.
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
MassiveSelection processMassiveDemandElementSelection() const
process massive demand element selection
GNESelectorFrame * mySelectorFrameParent
FOX need this.
long onCmdScaleSelection(FXObject *, FXSelector, void *)
Called when the user changes visual scaling.
VisualScaling & operator=(const VisualScaling &)=delete
Invalidated assignment operator.
FXRealSpinner * mySelectionScaling
Spinner for selection scaling.
VisualScaling(const VisualScaling &)=delete
Invalidated copy constructor.
FXVerticalFrame * getContentFrame() const
get vertical frame that holds all widgets of frame
GNESelectorFrame(const GNESelectorFrame &)=delete
Invalidated copy constructor.
void updateFrameAfterUndoRedo()
function called after undo/redo in the current frame
ModificationMode * getModificationModeModul() const
get modification mode modul
void show()
show Frame
GNESelectorFrame::SelectionOperation * mySelectionOperation
modul for selection operations
~GNESelectorFrame()
Destructor.
GNESelectorFrame::SelectionInformation * mySelectionInformation
modul for selection information
GNESelectorFrame::VisualScaling * myVisualScaling
modul for visual scaling
GNESelectorFrame::Information * myInformation
information modul
GNESelectorFrame::SelectionHierarchy * mySelectionHierarchy
modul for selection hierarchy
GNESelectorFrame::ModificationMode * myModificationMode
modul for change modification mode
GNEMatchAttribute * myMatchAttribute
modul for match attribute
void clearCurrentSelection() const
clear current selection with possibility of undo/redo
void hide()
hide Frame
GNESelectorFrame & operator=(const GNESelectorFrame &)=delete
Invalidated assignment operator.
GNESelectorFrame::SelectionOperation * getSelectionOperationModul() const
get selection operation modul
void handleIDs(const std::vector< GNEAttributeCarrier * > &ACs, const ModificationMode::Operation setop=ModificationMode::Operation::DEFAULT)
apply list of ids to the current selection according to Operation,
SelectionInformation * getSelectionInformation() const
get modul for selection information
bool selectAttributeCarrier(const GNEViewNetHelper::ViewObjectsSelector &viewObjects)
select attribute carrier (element)
class used to group all variables related with objects under cursor after a click over view
A single child window which contains a view of the simulation area.
MFXGroupBoxModule (based on FXGroupBox)
std::unordered_map< GNEAttributeCarrier *, bool > ACsToSelect
ACs to select (the bool flag shows if element is locked)
std::map< GUIGlObjectType, bool > lockedTypes
locked types
std::unordered_map< GNEAttributeCarrier *, bool > ACsToUnselect
ACs to select (the bool flag shows if element is locked)