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
27
28// ===========================================================================
29// class declaration
30// ===========================================================================
31
32class GNEElementSet;
35
36// ===========================================================================
37// class definitions
38// ===========================================================================
43class GNESelectorFrame : public GNEFrame {
44
45public:
46 // ===========================================================================
47 // class SelectionInformation
48 // ===========================================================================
49
51
52 public:
54 SelectionInformation(GNESelectorFrame* selectorFrameParent);
55
58
61
62 protected:
64 void updateInformationLabel(const std::string& element, int number);
65
66 private:
68 std::string myInformation;
69
72
75
78
81 };
82
83 // ===========================================================================
84 // class ModificationMode
85 // ===========================================================================
86
90
91 public:
93 enum class Operation {
94 ADD,
95 SUB,
97 REPLACE,
99 };
100
102 ModificationMode(GNESelectorFrame* selectorFrameParent);
103
106
109
113 long onCmdSelectModificationMode(FXObject*, FXSelector, void*);
114
116
117 protected:
119 FOX_CONSTRUCTOR(ModificationMode)
120
121 private:
123 FXRadioButton* myAddRadioButton;
124
126 FXRadioButton* myRemoveRadioButton;
127
129 FXRadioButton* myKeepRadioButton;
130
132 FXRadioButton* myReplaceRadioButton;
133
136
139
142 };
143
144 // ===========================================================================
145 // class VisualScaling
146 // ===========================================================================
147
151
152 public:
154 VisualScaling(GNESelectorFrame* selectorFrameParent);
155
158
161
163 long onCmdScaleSelection(FXObject*, FXSelector, void*);
164
166
167 protected:
169 FOX_CONSTRUCTOR(VisualScaling)
170
171 private:
174
176 FXRealSpinner* mySelectionScaling;
177
179 VisualScaling(const VisualScaling&) = delete;
180
183 };
184
185 // ===========================================================================
186 // class SelectionOperation
187 // ===========================================================================
188
192
193 public:
195 SelectionOperation(GNESelectorFrame* selectorFrameParent);
196
199
201 void loadFromFile(const std::string& file) const;
202
205
210 long onCmdLoad(FXObject*, FXSelector, void*);
211
216 long onCmdSave(FXObject*, FXSelector, void*);
217
221 long onCmdClear(FXObject*, FXSelector, void*);
222
225 long onCmdDelete(FXObject*, FXSelector, void*);
226
230 long onCmdInvert(FXObject*, FXSelector, void*);
231
235 long onCmdReduce(FXObject*, FXSelector, void*);
236
238
239 protected:
241 FOX_CONSTRUCTOR(SelectionOperation)
242
243
244 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > > processMassiveNetworkElementSelection(const bool filterLanes);
245
247 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > > processMassiveDemandElementSelection();
248
250 std::pair<std::vector<std::pair<bool, GNEAttributeCarrier*> >, std::vector<std::pair<bool, GNEAttributeCarrier*> > > processMassiveDataElementSelection();
251
253 bool askContinueIfLock() const;
254
255 private:
258
261
264 };
265
266 // ===========================================================================
267 // class SelectionHierarchy
268 // ===========================================================================
269
273
274 public:
276 SelectionHierarchy(GNESelectorFrame* selectorFrameParent);
277
280
283
285 long onCmdSelectItem(FXObject* obj, FXSelector, void*);
286
288 long onCmdParents(FXObject* obj, FXSelector, void*);
289
291 long onCmdChildren(FXObject* obj, FXSelector, void*);
292
294
295 protected:
297 FOX_CONSTRUCTOR(SelectionHierarchy)
298
299 private:
301 enum class Selection {
302 ALL,
303 JUNCTION,
304 EDGE,
305 LANE,
307 CROSSING,
309 WIRE,
310 SHAPE,
311 DEMAND,
312 DATA,
313 NOTHING,
314 };
315
318
321
324
326 FXButton* mySelectParentsButton = nullptr;
327
329 FXButton* myUnselectParentsButton = nullptr;
330
332 FXButton* mySelectChildrenButton = nullptr;
333
335 FXButton* myUnselectChildrenButton = nullptr;
336
337 // @brief items
338 const std::vector<std::pair<Selection, std::string> > myItems = {
339 std::make_pair(Selection::ALL, "all"),
340 std::make_pair(Selection::JUNCTION, "junction"),
341 std::make_pair(Selection::EDGE, "edge"),
342 std::make_pair(Selection::LANE, "lane"),
343 std::make_pair(Selection::CONNECTION, "connection"),
344 std::make_pair(Selection::CROSSING, "crossing"),
345 std::make_pair(Selection::ADDITIONAL, "additionalElements"),
346 std::make_pair(Selection::WIRE, "wireElements"),
347 std::make_pair(Selection::SHAPE, "shapeElements"),
348 std::make_pair(Selection::DEMAND, "demandElements"),
349 std::make_pair(Selection::DATA, "dataElements")
350 };
351
354
357
360
363 };
364
365 // ===========================================================================
366 // class Legend
367 // ===========================================================================
368
370
371 public:
373 Information(GNESelectorFrame* selectorFrameParent);
374
376 ~Information();
377 };
378
383 GNESelectorFrame(GNEViewParent* viewParent, GNEViewNet* viewNet);
384
387
389 void show();
390
392 void hide();
393
396
398 void clearCurrentSelection() const;
399
404
408 void handleIDs(const std::vector<GNEAttributeCarrier*>& ACs, const ModificationMode::Operation setop = ModificationMode::Operation::DEFAULT);
409
415 std::vector<GNEAttributeCarrier*> getMatches(const SumoXMLTag ACTag, const SumoXMLAttr ACAttr, const char compOp, const double val, const std::string& expr);
416
422 std::vector<GNEAttributeCarrier*> getGenericMatches(const std::vector<GNEGenericData*>& genericDatas, const std::string& attr, const char compOp, const double val, const std::string& expr);
423
425 FXVerticalFrame* getContentFrame() const;
426
429
432
435
436private:
439
442
445
448
451
454
457
460
463
466
469};
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.
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.
std::pair< std::vector< std::pair< bool, GNEAttributeCarrier * > >, std::vector< std::pair< bool, GNEAttributeCarrier * > > > processMassiveNetworkElementSelection(const bool filterLanes)
FOX need this.
std::pair< std::vector< std::pair< bool, GNEAttributeCarrier * > >, std::vector< std::pair< bool, GNEAttributeCarrier * > > > processMassiveDataElementSelection()
process massive dataelement selection
std::pair< std::vector< std::pair< bool, GNEAttributeCarrier * > >, std::vector< std::pair< bool, GNEAttributeCarrier * > > > processMassiveDemandElementSelection()
process massive demand element selection
void loadFromFile(const std::string &file) const
load from file
SelectionOperation(const SelectionOperation &)=delete
Invalidated copy constructor.
SelectionOperation & operator=(const SelectionOperation &)=delete
Invalidated assignment operator.
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
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)