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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // The Widget for modifying selections of network-elements
16 // (some elements adapted from GUIDialog_GLChosenEditor)
17 /****************************************************************************/
18 #ifndef GNESelectorFrame_h
19 #define GNESelectorFrame_h
20 
21 // ===========================================================================
22 // included modules
23 // ===========================================================================
24 #include "GNEFrame.h"
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 std::string& label);
52 
54  void showObjectTypeEntry();
55 
57  void hideObjectTypeEntry();
58 
60  void counterUp();
61 
63  void counterDown();
64 
66  bool isGLTypeLocked() const;
67 
71  long onCmdSetCheckBox(FXObject*, FXSelector, void*);
72 
74 
75  protected:
78 
79  private:
81  FXLabel* myLabelCounter;
82 
84  FXLabel* myLabelTypeName;
85 
87  FXCheckButton* myCheckBoxLocked;
88 
90  int myCounter;
91  };
92 
94  LockGLObjectTypes(GNESelectorFrame* selectorFrameParent);
95 
98 
100  void addedLockedObject(const GUIGlObjectType type);
101 
103  void removeLockedObject(const GUIGlObjectType type);
104 
106  bool IsObjectTypeLocked(const GUIGlObjectType type) const;
107 
109  void showTypeEntries();
110 
111  private:
114 
116  std::map<GUIGlObjectType, std::pair<Supermode, ObjectTypeEntry* > > myTypeEntries;
117  };
118 
119  // ===========================================================================
120  // class ModificationMode
121  // ===========================================================================
122 
123  class ModificationMode : protected FXGroupBox {
126 
127  public:
130  SET_ADD = 1,
131  SET_SUB = 2,
132  SET_RESTRICT = 3,
133  SET_REPLACE = 4,
134  SET_DEFAULT = 5 // use mySetOperation instead of override
135  };
136 
138  ModificationMode(GNESelectorFrame* selectorFrameParent);
139 
141  ~ModificationMode();
142 
144  SetOperation getModificationMode() const;
145 
149  long onCmdSelectModificationMode(FXObject*, FXSelector, void*);
150 
152 
153  protected:
156 
157  private:
159  FXRadioButton* myAddRadioButton;
160 
162  FXRadioButton* myRemoveRadioButton;
163 
165  FXRadioButton* myKeepRadioButton;
166 
168  FXRadioButton* myReplaceRadioButton;
169 
172  };
173 
174  // ===========================================================================
175  // class ElementSet
176  // ===========================================================================
177 
178  class ElementSet : protected FXGroupBox {
181 
182  public:
185  ELEMENTSET_NETELEMENT = 1,
186  ELEMENTSET_ADDITIONAL = 2,
187  ELEMENTSET_SHAPE = 3,
188  ELEMENTSET_DEMANDELEMENT = 4,
189  ELEMENTSET_INVALID = 5,
190  };
191 
193  ElementSet(GNESelectorFrame* selectorFrameParent);
194 
196  ~ElementSet();
197 
199  ElementSetType getElementSet() const;
200 
202  void refreshElementSet();
203 
205 
208 
210  long onCmdSelectElementSet(FXObject*, FXSelector, void*);
211 
213 
214  protected:
217 
218  private:
221 
223  FXComboBox* mySetComboBox;
224 
227  };
228 
229  // ===========================================================================
230  // class MatchAttribute
231  // ===========================================================================
232 
233  class MatchAttribute : protected FXGroupBox {
236 
237  public:
239  MatchAttribute(GNESelectorFrame* selectorFrameParent);
240 
242  ~MatchAttribute();
243 
245  void enableMatchAttribute();
246 
248  void disableMatchAttribute();
249 
252 
256  long onCmdSelMBTag(FXObject*, FXSelector, void*);
257 
261  long onCmdSelMBAttribute(FXObject*, FXSelector, void*);
262 
266  long onCmdSelMBString(FXObject*, FXSelector, void*);
267 
271  long onCmdHelp(FXObject*, FXSelector, void*);
272 
274 
275  protected:
278 
279  private:
282 
284  FXComboBox* myMatchTagComboBox;
285 
287  FXComboBox* myMatchAttrComboBox;
288 
291 
294 
296  FXTextField* myMatchString;
297  };
298 
299  // ===========================================================================
300  // class VisualScaling
301  // ===========================================================================
302 
303  class VisualScaling : protected FXGroupBox {
306 
307  public:
309  VisualScaling(GNESelectorFrame* selectorFrameParent);
310 
312  ~VisualScaling();
313 
316 
318  long onCmdScaleSelection(FXObject*, FXSelector, void*);
319 
321 
322  protected:
325 
326  private:
329 
331  FXRealSpinner* mySelectionScaling;
332  };
333 
334  // ===========================================================================
335  // class SelectionOperation
336  // ===========================================================================
337 
338  class SelectionOperation : protected FXGroupBox {
341 
342  public:
344  SelectionOperation(GNESelectorFrame* selectorFrameParent);
345 
348 
351 
356  long onCmdLoad(FXObject*, FXSelector, void*);
357 
362  long onCmdSave(FXObject*, FXSelector, void*);
363 
367  long onCmdClear(FXObject*, FXSelector, void*);
368 
372  long onCmdInvert(FXObject*, FXSelector, void*);
373 
375 
376  protected:
379 
380  private:
383  };
384 
389  GNESelectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
390 
393 
395  void show();
396 
398  void hide();
399 
401  void clearCurrentSelection() const;
402 
406  void handleIDs(const std::vector<GNEAttributeCarrier*>& ACs, ModificationMode::SetOperation setop = ModificationMode::SET_DEFAULT);
407 
410 
413 
414 private:
417 
420 
423 
426 
429 
432 
434  bool ACsToSelected() const;
435 
436 private:
442  std::vector<GNEAttributeCarrier*> getMatches(SumoXMLTag ACTag, SumoXMLAttr ACAttr, char compOp, double val, const std::string& expr);
443 };
444 
445 
446 #endif
447 
448 /****************************************************************************/
449 
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
SumoXMLTag
Numbers representing SUMO-XML - element names.
long onCmdSetCheckBox(FXObject *, FXSelector, void *)
void addedLockedObject(const GUIGlObjectType type)
set object selected
FXRadioButton * myReplaceRadioButton
replace radio button
GUIGlObjectType
FXComboBox * mySetComboBox
Combo Box with the element sets.
void handleIDs(const std::vector< GNEAttributeCarrier *> &ACs, ModificationMode::SetOperation setop=ModificationMode::SET_DEFAULT)
apply list of ids to the current selection according to SetOperation,
FXLabel * myLabelCounter
label counter
void hideObjectTypeEntry()
hide ObjectTypeEntry
void show()
show Frame
FXRadioButton * myAddRadioButton
add radio button
FXLabel * myLabelTypeName
label type nane
GNESelectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
void counterUp()
up count
VisualScaling * myVisualScaling
modul for visual scaling
ElementSetType myCurrentElementSet
current element set selected
FXCheckButton * myCheckBoxLocked
check box to check if GLObject type is blocked
FXRealSpinner * mySelectionScaling
Spinner for selection scaling.
~GNESelectorFrame()
Destructor.
FXComboBox * myMatchTagComboBox
tag of the match box
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
FXComboBox * myMatchAttrComboBox
attributes of the match box
void showTypeEntries()
show type Entries (depending if we&#39;re in Network or demand supermode)
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
void showObjectTypeEntry()
show ObjectTypeEntry
LockGLObjectTypes(GNESelectorFrame *selectorFrameParent)
constructor
void removeLockedObject(const GUIGlObjectType type)
set object unselected
FXTextField * myMatchString
string of the match
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
bool ACsToSelected() const
check if there is ACs to select/unselect
ObjectTypeEntry()
FOX needs this.
FXRadioButton * myKeepRadioButton
keep button
SumoXMLAttr myCurrentAttribute
current SumoXMLTag Attribute
SumoXMLTag myCurrentTag
current SumoXMLTag tag
class for object types entries
ModificationMode * getModificationModeModul() const
get modification mode modul
LockGLObjectTypes * myLockGLObjectTypes
modul for lock selected items
MatchAttribute * myMatchAttribute
modul for matchA ttribute
void clearCurrentSelection() const
clear current selection with possibility of undo/redo
int myCounter
counter
bool IsObjectTypeLocked(const GUIGlObjectType type) const
check if an object is locked
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
SelectionOperation * mySelectionOperation
modul for selection operations
std::map< GUIGlObjectType, std::pair< Supermode, ObjectTypeEntry *> > myTypeEntries
check boxes for type-based selection locking and selected object counts
ModificationMode * myModificationMode
modul for change modification mode
FXRadioButton * myRemoveRadioButton
remove radio button
void counterDown()
down count
void hide()
hide Frame
std::vector< GNEAttributeCarrier * > getMatches(SumoXMLTag ACTag, SumoXMLAttr ACAttr, char compOp, double val, const std::string &expr)
return ACs of the given type with matching attrs
ElementSet * myElementSet
modul for select element set
bool isGLTypeLocked() const
check if current GLType is blocked
SetOperation myModificationModeType
how to modify selection