Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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>
25
29
30// ===========================================================================
31// class declaration
32// ===========================================================================
33
35class MFXComboBoxIcon;
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
40
41class GNESelectorFrame : public GNEFrame {
42
43public:
44 // ===========================================================================
45 // class SelectionInformation
46 // ===========================================================================
47
49
50 public:
52 SelectionInformation(GNESelectorFrame* selectorFrameParent);
53
56
59
60 protected:
62 void updateInformationLabel(const std::string& element, int number);
63
64 private:
66 std::string myInformation;
67
70
73
76
79 };
80
81 // ===========================================================================
82 // class ModificationMode
83 // ===========================================================================
84
88
89 public:
91 enum class Operation {
92 ADD,
93 SUB,
95 REPLACE,
97 };
98
100 ModificationMode(GNESelectorFrame* selectorFrameParent);
101
104
107
111 long onCmdSelectModificationMode(FXObject*, FXSelector, void*);
112
114
115 protected:
117 FOX_CONSTRUCTOR(ModificationMode)
118
119 private:
121 FXRadioButton* myAddRadioButton;
122
124 FXRadioButton* myRemoveRadioButton;
125
127 FXRadioButton* myKeepRadioButton;
128
130 FXRadioButton* myReplaceRadioButton;
131
134
137
140 };
141
142 // ===========================================================================
143 // class VisualScaling
144 // ===========================================================================
145
149
150 public:
152 VisualScaling(GNESelectorFrame* selectorFrameParent);
153
156
159
161 long onCmdScaleSelection(FXObject*, FXSelector, void*);
162
164
165 protected:
167 FOX_CONSTRUCTOR(VisualScaling)
168
169 private:
172
174 FXRealSpinner* mySelectionScaling;
175
177 VisualScaling(const VisualScaling&) = delete;
178
181 };
182
183 // ===========================================================================
184 // class SelectionOperation
185 // ===========================================================================
186
190
191 public:
193 SelectionOperation(GNESelectorFrame* selectorFrameParent);
194
197
199 void loadFromFile(const std::string& file) const;
200
203
208 long onCmdLoad(FXObject*, FXSelector, void*);
209
214 long onCmdSave(FXObject*, FXSelector, void*);
215
219 long onCmdClear(FXObject*, FXSelector, void*);
220
223 long onCmdDelete(FXObject*, FXSelector, void*);
224
228 long onCmdInvert(FXObject*, FXSelector, void*);
229
233 long onCmdReduce(FXObject*, FXSelector, void*);
234
236
237 protected:
239 FOX_CONSTRUCTOR(SelectionOperation)
240
241
243
245 MassiveSelection(const int bucketSize);
246
249
251 bool isElementToProcess() const;
252
254 std::unordered_map<GNEAttributeCarrier*, bool> ACsToSelect;
255
257 std::unordered_map<GNEAttributeCarrier*, bool> ACsToUnselect;
258
260 std::map<GUIGlObjectType, bool> lockedTypes;
261
262 private:
265 };
266
268 MassiveSelection processMassiveNetworkElementSelection(const bool filterLanes) const;
269
272
275
277 bool askContinueIfLock() const;
278
279 private:
282
285
288 };
289
290 // ===========================================================================
291 // class SelectionHierarchy
292 // ===========================================================================
293
297
298 public:
300 SelectionHierarchy(GNESelectorFrame* selectorFrameParent);
301
304
307
309 long onCmdSelectItem(FXObject* obj, FXSelector, void*);
310
312 long onCmdParents(FXObject* obj, FXSelector, void*);
313
315 long onCmdChildren(FXObject* obj, FXSelector, void*);
316
318
319 protected:
321 FOX_CONSTRUCTOR(SelectionHierarchy)
322
323 private:
325 enum class Selection {
326 ALL,
327 JUNCTION,
328 EDGE,
329 LANE,
331 CROSSING,
333 WIRE,
334 SHAPE,
335 DEMAND,
336 DATA,
337 NOTHING,
338 };
339
342
345
348
350 FXButton* mySelectParentsButton = nullptr;
351
353 FXButton* myUnselectParentsButton = nullptr;
354
356 FXButton* mySelectChildrenButton = nullptr;
357
359 FXButton* myUnselectChildrenButton = nullptr;
360
361 // @brief items
362 const std::vector<std::pair<Selection, std::string> > myItems = {
363 std::make_pair(Selection::ALL, "all"),
364 std::make_pair(Selection::JUNCTION, "junction"),
365 std::make_pair(Selection::EDGE, "edge"),
366 std::make_pair(Selection::LANE, "lane"),
367 std::make_pair(Selection::CONNECTION, "connection"),
368 std::make_pair(Selection::CROSSING, "crossing"),
369 std::make_pair(Selection::ADDITIONAL, "additionalElements"),
370 std::make_pair(Selection::WIRE, "wireElements"),
371 std::make_pair(Selection::SHAPE, "shapeElements"),
372 std::make_pair(Selection::DEMAND, "demandElements"),
373 std::make_pair(Selection::DATA, "dataElements")
374 };
375
378
381
384
387 };
388
389 // ===========================================================================
390 // class Legend
391 // ===========================================================================
392
394
395 public:
397 Information(GNESelectorFrame* selectorFrameParent);
398
400 ~Information();
401 };
402
407 GNESelectorFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);
408
411
413 void show();
414
416 void hide();
417
420
422 void clearCurrentSelection() const;
423
428
432 void handleIDs(const std::vector<GNEAttributeCarrier*>& ACs, const ModificationMode::Operation setop = ModificationMode::Operation::DEFAULT);
433
435 FXVerticalFrame* getContentFrame() const;
436
439
442
445
446private:
449
452
455
458
461
464
467
470
473};
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)