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-2024 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
33class GNEElementSet;
36
37// ===========================================================================
38// class definitions
39// ===========================================================================
44class GNESelectorFrame : public GNEFrame {
45
46public:
47 // ===========================================================================
48 // class SelectionInformation
49 // ===========================================================================
50
52
53 public:
55 SelectionInformation(GNESelectorFrame* selectorFrameParent);
56
59
62
63 protected:
65 void updateInformationLabel(const std::string& element, int number);
66
67 private:
69 std::string myInformation;
70
73
76
79
82 };
83
84 // ===========================================================================
85 // class ModificationMode
86 // ===========================================================================
87
91
92 public:
94 enum class Operation {
95 ADD,
96 SUB,
98 REPLACE,
100 };
101
103 ModificationMode(GNESelectorFrame* selectorFrameParent);
104
107
110
114 long onCmdSelectModificationMode(FXObject*, FXSelector, void*);
115
117
118 protected:
120 FOX_CONSTRUCTOR(ModificationMode)
121
122 private:
124 FXRadioButton* myAddRadioButton;
125
127 FXRadioButton* myRemoveRadioButton;
128
130 FXRadioButton* myKeepRadioButton;
131
133 FXRadioButton* myReplaceRadioButton;
134
137
140
143 };
144
145 // ===========================================================================
146 // class VisualScaling
147 // ===========================================================================
148
152
153 public:
155 VisualScaling(GNESelectorFrame* selectorFrameParent);
156
159
162
164 long onCmdScaleSelection(FXObject*, FXSelector, void*);
165
167
168 protected:
170 FOX_CONSTRUCTOR(VisualScaling)
171
172 private:
175
177 FXRealSpinner* mySelectionScaling;
178
180 VisualScaling(const VisualScaling&) = delete;
181
184 };
185
186 // ===========================================================================
187 // class SelectionOperation
188 // ===========================================================================
189
193
194 public:
196 SelectionOperation(GNESelectorFrame* selectorFrameParent);
197
200
202 void loadFromFile(const std::string& file) const;
203
206
211 long onCmdLoad(FXObject*, FXSelector, void*);
212
217 long onCmdSave(FXObject*, FXSelector, void*);
218
222 long onCmdClear(FXObject*, FXSelector, void*);
223
226 long onCmdDelete(FXObject*, FXSelector, void*);
227
231 long onCmdInvert(FXObject*, FXSelector, void*);
232
236 long onCmdReduce(FXObject*, FXSelector, void*);
237
239
240 protected:
242 FOX_CONSTRUCTOR(SelectionOperation)
243
244
246
248 MassiveSelection(const int bucketSize);
249
252
254 bool isElementToProcess() const;
255
257 std::unordered_map<GNEAttributeCarrier*, bool> ACsToSelect;
258
260 std::unordered_map<GNEAttributeCarrier*, bool> ACsToUnselect;
261
263 std::map<GUIGlObjectType, bool> lockedTypes;
264
265 private:
268 };
269
271 MassiveSelection processMassiveNetworkElementSelection(const bool filterLanes) const;
272
275
278
280 bool askContinueIfLock() const;
281
282 private:
285
288
291 };
292
293 // ===========================================================================
294 // class SelectionHierarchy
295 // ===========================================================================
296
300
301 public:
303 SelectionHierarchy(GNESelectorFrame* selectorFrameParent);
304
307
310
312 long onCmdSelectItem(FXObject* obj, FXSelector, void*);
313
315 long onCmdParents(FXObject* obj, FXSelector, void*);
316
318 long onCmdChildren(FXObject* obj, FXSelector, void*);
319
321
322 protected:
324 FOX_CONSTRUCTOR(SelectionHierarchy)
325
326 private:
328 enum class Selection {
329 ALL,
330 JUNCTION,
331 EDGE,
332 LANE,
334 CROSSING,
336 WIRE,
337 SHAPE,
338 DEMAND,
339 DATA,
340 NOTHING,
341 };
342
345
348
351
353 FXButton* mySelectParentsButton = nullptr;
354
356 FXButton* myUnselectParentsButton = nullptr;
357
359 FXButton* mySelectChildrenButton = nullptr;
360
362 FXButton* myUnselectChildrenButton = nullptr;
363
364 // @brief items
365 const std::vector<std::pair<Selection, std::string> > myItems = {
366 std::make_pair(Selection::ALL, "all"),
367 std::make_pair(Selection::JUNCTION, "junction"),
368 std::make_pair(Selection::EDGE, "edge"),
369 std::make_pair(Selection::LANE, "lane"),
370 std::make_pair(Selection::CONNECTION, "connection"),
371 std::make_pair(Selection::CROSSING, "crossing"),
372 std::make_pair(Selection::ADDITIONAL, "additionalElements"),
373 std::make_pair(Selection::WIRE, "wireElements"),
374 std::make_pair(Selection::SHAPE, "shapeElements"),
375 std::make_pair(Selection::DEMAND, "demandElements"),
376 std::make_pair(Selection::DATA, "dataElements")
377 };
378
381
384
387
390 };
391
392 // ===========================================================================
393 // class Legend
394 // ===========================================================================
395
397
398 public:
400 Information(GNESelectorFrame* selectorFrameParent);
401
403 ~Information();
404 };
405
410 GNESelectorFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);
411
414
416 void show();
417
419 void hide();
420
423
425 void clearCurrentSelection() const;
426
431
435 void handleIDs(const std::vector<GNEAttributeCarrier*>& ACs, const ModificationMode::Operation setop = ModificationMode::Operation::DEFAULT);
436
442 std::vector<GNEAttributeCarrier*> getMatches(const SumoXMLTag ACTag, const SumoXMLAttr ACAttr, const char compOp, const double val, const std::string& expr);
443
449 std::vector<GNEAttributeCarrier*> getGenericMatches(const std::vector<GNEGenericData*>& genericDatas, const std::string& attr, const char compOp, const double val, const std::string& expr);
450
452 FXVerticalFrame* getContentFrame() const;
453
456
459
462
463private:
466
469
472
475
478
481
484
487
490
493
496};
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
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.
std::vector< GNEAttributeCarrier * > getMatches(const SumoXMLTag ACTag, const SumoXMLAttr ACAttr, const char compOp, const double val, const std::string &expr)
return ACs of the given type with matching attrs
void updateFrameAfterUndoRedo()
function called after undo/redo in the current frame
ModificationMode * getModificationModeModul() const
get modification mode modul
std::vector< GNEAttributeCarrier * > getGenericMatches(const std::vector< GNEGenericData * > &genericDatas, const std::string &attr, const char compOp, const double val, const std::string &expr)
return GenericDatas of the given type with matching attrs
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
GNEElementSet * myDemandElementSet
moduls for select demand element set
GNESelectorFrame::Information * myInformation
information modul
GNESelectorFrame::SelectionHierarchy * mySelectionHierarchy
modul for selection hierarchy
GNEElementSet * myNetworkElementSet
moduls for select network element set
GNEElementSet * myDataElementSet
moduls for select data element set
GNESelectorFrame::ModificationMode * myModificationMode
modul for change modification mode
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.
ComboBox with icon.
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)