Eclipse SUMO - Simulation of Urban MObility
GNESelectorFrame.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 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 
25 
26 // ===========================================================================
27 // class definitions
28 // ===========================================================================
33 class GNESelectorFrame : public GNEFrame {
34 
35 public:
36 
37  // ===========================================================================
38  // class LockGLObjectTypes
39  // ===========================================================================
40 
41  class LockGLObjectTypes : protected FXGroupBox {
42 
43  public:
45  class ObjectTypeEntry : protected FXObject {
48 
49  public:
51  ObjectTypeEntry(FXMatrix* matrixParent, const Supermode supermode, const std::string& label);
52 
54  Supermode getSupermode() const;
55 
57  void showObjectTypeEntry();
58 
60  void hideObjectTypeEntry();
61 
63  void counterUp();
64 
66  void counterDown();
67 
69  bool isGLTypeLocked() const;
70 
73 
75  long onCmdSetCheckBox(FXObject*, FXSelector, void*);
76 
78 
79  protected:
81 
82  private:
85 
87  FXLabel* myLabelCounter;
88 
90  FXLabel* myLabelTypeName;
91 
93  FXCheckButton* myCheckBoxLocked;
94 
96  int myCounter;
97 
98  private:
101 
102  };
103 
105  LockGLObjectTypes(GNESelectorFrame* selectorFrameParent);
106 
109 
111  void addedLockedObject(const GUIGlObjectType type);
112 
114  void removeLockedObject(const GUIGlObjectType type);
115 
117  bool IsObjectTypeLocked(const GUIGlObjectType type) const;
118 
120  void showTypeEntries();
121 
122  private:
125 
127  std::map<GUIGlObjectType, ObjectTypeEntry*> myTypeEntries;
128  };
129 
130  // ===========================================================================
131  // class ModificationMode
132  // ===========================================================================
133 
134  class ModificationMode : protected FXGroupBox {
137 
138  public:
140  enum class Operation {
141  ADD,
142  SUB,
143  RESTRICT,
144  REPLACE,
145  DEFAULT
146  };
147 
149  ModificationMode(GNESelectorFrame* selectorFrameParent);
150 
153 
156 
160  long onCmdSelectModificationMode(FXObject*, FXSelector, void*);
161 
163 
164  protected:
165  FOX_CONSTRUCTOR(ModificationMode)
166 
167  private:
169  FXRadioButton* myAddRadioButton;
170 
172  FXRadioButton* myRemoveRadioButton;
173 
175  FXRadioButton* myKeepRadioButton;
176 
178  FXRadioButton* myReplaceRadioButton;
179 
182  };
183 
184  // ===========================================================================
185  // class ElementSet
186  // ===========================================================================
187 
188  class ElementSet : protected FXGroupBox {
191 
192  public:
194  enum class Type {
197  SHAPE,
198  TAZELEMENT,
200  DATA,
201  INVALID,
202  };
203 
205  ElementSet(GNESelectorFrame* selectorFrameParent);
206 
208  ~ElementSet();
209 
211  Type getElementSet() const;
212 
214  void refreshElementSet();
215 
217 
220 
222  long onCmdSelectElementSet(FXObject*, FXSelector, void*);
223 
225 
226  protected:
227  FOX_CONSTRUCTOR(ElementSet)
228 
229  private:
232 
234  FXComboBox* mySetComboBox;
235 
238  };
239 
240  // ===========================================================================
241  // class MatchAttribute
242  // ===========================================================================
243 
244  class MatchAttribute : protected FXGroupBox {
247 
248  public:
250  MatchAttribute(GNESelectorFrame* selectorFrameParent);
251 
253  ~MatchAttribute();
254 
256  void enableMatchAttribute();
257 
259  void disableMatchAttribute();
260 
262  void showMatchAttribute();
263 
265  void hideMatchAttribute();
266 
269 
273  long onCmdSelMBTag(FXObject*, FXSelector, void*);
274 
278  long onCmdSelMBAttribute(FXObject*, FXSelector, void*);
279 
283  long onCmdSelMBString(FXObject*, FXSelector, void*);
284 
288  long onCmdHelp(FXObject*, FXSelector, void*);
289 
291 
292  protected:
293  FOX_CONSTRUCTOR(MatchAttribute)
294 
295  private:
298 
300  FXComboBox* myMatchTagComboBox;
301 
303  FXComboBox* myMatchAttrComboBox;
304 
307 
310 
312  FXTextField* myMatchString;
313 
316  };
317 
318  // ===========================================================================
319  // class MatchGenericDataAttribute
320  // ===========================================================================
321 
322  class MatchGenericDataAttribute : protected FXGroupBox {
325 
326  public:
328  MatchGenericDataAttribute(GNESelectorFrame* selectorFrameParent);
329 
332 
335 
338 
341 
344 
347 
349  long onCmdSetInterval(FXObject*, FXSelector, void*);
350 
352  long onCmdSetBegin(FXObject*, FXSelector, void*);
353 
355  long onCmdSetEnd(FXObject*, FXSelector, void*);
356 
358  long onCmdSelectTag(FXObject*, FXSelector, void*);
359 
361  long onCmdSelectAttribute(FXObject*, FXSelector, void*);
362 
364  long onCmdProcessString(FXObject*, FXSelector, void*);
365 
367  long onCmdHelp(FXObject*, FXSelector, void*);
368 
370 
371  protected:
372  FOX_CONSTRUCTOR(MatchGenericDataAttribute)
373 
374  private:
377 
379  FXComboBox* myIntervalSelector;
380 
382  FXTextField* myBegin;
383 
385  FXTextField* myEnd;
386 
389 
392 
395 
397  std::string myCurrentAttribute;
398 
401 
402  // declare a set and fill it with all intervals
403  std::map<std::pair<double, double>, int> myIntervals;
404  };
405 
406  // ===========================================================================
407  // class VisualScaling
408  // ===========================================================================
409 
410  class VisualScaling : protected FXGroupBox {
413 
414  public:
416  VisualScaling(GNESelectorFrame* selectorFrameParent);
417 
419  ~VisualScaling();
420 
423 
425  long onCmdScaleSelection(FXObject*, FXSelector, void*);
426 
428 
429  protected:
430  FOX_CONSTRUCTOR(VisualScaling)
431 
432  private:
435 
437  FXRealSpinner* mySelectionScaling;
438  };
439 
440  // ===========================================================================
441  // class SelectionOperation
442  // ===========================================================================
443 
444  class SelectionOperation : protected FXGroupBox {
447 
448  public:
450  SelectionOperation(GNESelectorFrame* selectorFrameParent);
451 
454 
457 
462  long onCmdLoad(FXObject*, FXSelector, void*);
463 
468  long onCmdSave(FXObject*, FXSelector, void*);
469 
473  long onCmdClear(FXObject*, FXSelector, void*);
474 
478  long onCmdInvert(FXObject*, FXSelector, void*);
479 
481 
482  protected:
483  FOX_CONSTRUCTOR(SelectionOperation)
484 
485  private:
488  };
489 
494  GNESelectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
495 
498 
500  void show();
501 
503  void hide();
504 
506  void clearCurrentSelection() const;
507 
511  void handleIDs(const std::vector<GNEAttributeCarrier*>& ACs, const ModificationMode::Operation setop = ModificationMode::Operation::DEFAULT);
512 
515 
518 
519 private:
522 
525 
528 
531 
534 
537 
540 
542  bool ACsToSelected() const;
543 
549  std::vector<GNEAttributeCarrier*> getMatches(const SumoXMLTag ACTag, const SumoXMLAttr ACAttr, const char compOp, const double val, const std::string& expr);
550 
556  std::vector<GNEAttributeCarrier*> getGenericMatches(const std::vector<GNEGenericData*>& genericDatas, const std::string& attr, const char compOp, const double val, const std::string& expr);
557 };
Supermode
@brie enum for supermodes
GUIGlObjectType
SumoXMLTag
Numbers representing SUMO-XML - element names.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Type getElementSet() const
get current selected element set
Type myCurrentElementSet
current element set selected
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
void refreshElementSet()
refresh element set
ElementSet(GNESelectorFrame *selectorFrameParent)
constructor
FXComboBox * mySetComboBox
Combo Box with the element sets.
long onCmdSelectElementSet(FXObject *, FXSelector, void *)
Called when the user change the set of element to search (networkElement, Additional or shape)
class for object types entries
Supermode getSupermode() const
get supermode associated to this ObjectTypeEntry
void showObjectTypeEntry()
show ObjectTypeEntry
void counterDown()
down count
bool isGLTypeLocked() const
check if current GLType is blocked
FXCheckButton * myCheckBoxLocked
check box to check if GLObject type is blocked
FXLabel * myLabelTypeName
label type nane
ObjectTypeEntry & operator=(const ObjectTypeEntry &)=delete
Invalidated assignment operator.
const Supermode mySupermode
supermode associated to this ObjectTypeEntry
void counterUp()
up count
FXLabel * myLabelCounter
label counter
int myCounter
counter
long onCmdSetCheckBox(FXObject *, FXSelector, void *)
called when user change the CheckBox
ObjectTypeEntry()
void hideObjectTypeEntry()
hide ObjectTypeEntry
void addedLockedObject(const GUIGlObjectType type)
set object selected
std::map< GUIGlObjectType, ObjectTypeEntry * > myTypeEntries
check boxes for type-based selection locking and selected object counts
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
void showTypeEntries()
show type Entries (depending if we're in Network or demand supermode)
bool IsObjectTypeLocked(const GUIGlObjectType type) const
check if an object is locked
void removeLockedObject(const GUIGlObjectType type)
set object unselected
LockGLObjectTypes(GNESelectorFrame *selectorFrameParent)
constructor
void disableMatchAttribute()
disable match attributes
void hideMatchAttribute()
hide match attributes
FXTextField * myMatchString
string of the match
MatchAttribute(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
FXButton * myMatchStringButton
match string button
FXComboBox * myMatchAttrComboBox
attributes of the match box
void showMatchAttribute()
show match attributes
long onCmdSelMBString(FXObject *, FXSelector, void *)
Called when the user enters a new selection expression.
SumoXMLTag myCurrentTag
current SumoXMLTag tag
long onCmdHelp(FXObject *, FXSelector, void *)
Called when the user clicks the help button.
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
long onCmdSelMBAttribute(FXObject *, FXSelector, void *)
Called when the user selectes a tag in the match box.
void enableMatchAttribute()
enable match attributes
long onCmdSelMBTag(FXObject *, FXSelector, void *)
Called when the user selectes a tag in the match box.
FXComboBox * myMatchTagComboBox
tag of the match box
SumoXMLAttr myCurrentAttribute
current SumoXMLTag Attribute
long onCmdProcessString(FXObject *, FXSelector, void *)
Called when the user enters a new selection expression.
std::map< std::pair< double, double >, int > myIntervals
MatchGenericDataAttribute(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
long onCmdSelectTag(FXObject *, FXSelector, void *)
Called when the user selects a tag in the match box.
void enableMatchGenericDataAttribute()
enable match attributes
void showMatchGenericDataAttribute()
show match attributes
FXTextField * myEnd
TextField for end.
long onCmdHelp(FXObject *, FXSelector, void *)
Called when the user clicks the help button.
FXComboBox * myIntervalSelector
tag of the match box
long onCmdSetBegin(FXObject *, FXSelector, void *)
Called when the user change begin text field.
long onCmdSetInterval(FXObject *, FXSelector, void *)
Called when the user selects an interval.
long onCmdSelectAttribute(FXObject *, FXSelector, void *)
Called when the user selects an attribute in the match box.
FXComboBox * myMatchGenericDataTagComboBox
tag of the match box
void disableMatchGenericDataAttribute()
disable match attributes
SumoXMLTag myCurrentTag
current SumoXMLTag tag
long onCmdSetEnd(FXObject *, FXSelector, void *)
Called when the user change end text field.
FXTextField * myBegin
TextField for begin.
FXComboBox * myMatchGenericDataAttrComboBox
attributes of the match box
FXTextField * myMatchGenericDataString
string of the match
std::string myCurrentAttribute
current string Attribute
void hideMatchGenericDataAttribute()
hide match attributes
FXRadioButton * myReplaceRadioButton
replace radio button
ModificationMode(GNESelectorFrame *selectorFrameParent)
constructor
Operation myModificationModeType
how to modify selection
long onCmdSelectModificationMode(FXObject *, FXSelector, void *)
FXRadioButton * myAddRadioButton
add radio button
Operation getModificationMode() const
get current modification mode
FXRadioButton * myRemoveRadioButton
remove radio button
FXRadioButton * myKeepRadioButton
keep button
SelectionOperation(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user presses the Save-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.
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
long onCmdScaleSelection(FXObject *, FXSelector, void *)
Called when the user changes visual scaling.
VisualScaling(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
FXRealSpinner * mySelectionScaling
Spinner for selection scaling.
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
MatchGenericDataAttribute * myMatchGenericDataAttribute
modul for match generic data attribute
ModificationMode * getModificationModeModul() const
get modification mode modul
MatchAttribute * myMatchAttribute
modul for match attribute
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
SelectionOperation * mySelectionOperation
modul for selection operations
GNESelectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
bool ACsToSelected() const
check if there is ACs to select/unselect
void show()
show Frame
~GNESelectorFrame()
Destructor.
ModificationMode * myModificationMode
modul for change modification mode
VisualScaling * myVisualScaling
modul for visual scaling
void clearCurrentSelection() const
clear current selection with possibility of undo/redo
void hide()
hide Frame
LockGLObjectTypes * myLockGLObjectTypes
modul for lock selected items
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,
ElementSet * myElementSet
modul for select element set