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-2018 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 <config.h>
25 
26 #include "GNEFrame.h"
27 
28 // ===========================================================================
29 // class declarations
30 // ===========================================================================
32 
33 // ===========================================================================
34 // class definitions
35 // ===========================================================================
40 class GNESelectorFrame : public GNEFrame {
41 
42 public:
43 
44  // ===========================================================================
45  // class LockGLObjectTypes
46  // ===========================================================================
47 
48  class LockGLObjectTypes : public FXGroupBox {
49 
50  public:
52  LockGLObjectTypes(GNESelectorFrame* selectorFrameParent);
53 
56 
59 
61  bool IsObjectTypeLocked(GUIGlObjectType type) const;
62 
63  private:
64  struct ObjectTypeEntry {
65  ObjectTypeEntry(FXMatrix* parent, const std::string& label, const std::string& label2);
67  FXLabel* count;
68  FXLabel* typeName;
69  FXMenuCheck* locked;
70  };
71 
74 
76  std::map<GUIGlObjectType, ObjectTypeEntry> myTypeEntries;
77  };
78 
79  // ===========================================================================
80  // class ModificationMode
81  // ===========================================================================
82 
83  class ModificationMode : public FXGroupBox {
86 
87  public:
89  enum SetOperation {
90  SET_ADD = 1,
91  SET_SUB = 2,
92  SET_RESTRICT = 3,
93  SET_REPLACE = 4,
94  SET_DEFAULT = 5 // use mySetOperation instead of override
95  };
96 
98  ModificationMode(GNESelectorFrame* selectorFrameParent);
99 
101  ~ModificationMode();
102 
104  SetOperation getModificationMode() const;
105 
109  long onCmdSelectModificationMode(FXObject*, FXSelector, void*);
110 
112 
113  protected:
116 
117  private:
120 
122  FXRadioButton* myAddRadioButton;
123 
125  FXRadioButton* myRemoveRadioButton;
126 
128  FXRadioButton* myKeepRadioButton;
129 
131  FXRadioButton* myReplaceRadioButton;
132 
135  };
136 
137  // ===========================================================================
138  // class ElementSet
139  // ===========================================================================
140 
141  class ElementSet : public FXGroupBox {
144 
145  public:
148  ELEMENTSET_NETELEMENT = 1,
149  ELEMENTSET_ADDITIONAL = 2,
150  ELEMENTSET_SHAPE = 3,
151  ELEMENTSET_INVALID = 4,
152  };
153 
155  ElementSet(GNESelectorFrame* selectorFrameParent);
156 
158  ~ElementSet();
159 
161  ElementSetType getElementSet() const;
162 
165 
167  long onCmdSelectElementSet(FXObject*, FXSelector, void*);
168 
170 
171  protected:
174 
175  private:
178 
180  FXComboBox* mySetComboBox;
181 
184  };
185 
186  // ===========================================================================
187  // class MatchAttribute
188  // ===========================================================================
189 
190  class MatchAttribute : public FXGroupBox {
193 
194  public:
196  MatchAttribute(GNESelectorFrame* selectorFrameParent);
197 
199  ~MatchAttribute();
200 
202  void enableMatchAttribute();
203 
205  void disableMatchAttribute();
206 
209 
213  long onCmdSelMBTag(FXObject*, FXSelector, void*);
214 
218  long onCmdSelMBAttribute(FXObject*, FXSelector, void*);
219 
223  long onCmdSelMBString(FXObject*, FXSelector, void*);
224 
228  long onCmdHelp(FXObject*, FXSelector, void*);
229 
231 
232  protected:
235 
236  private:
239 
241  FXComboBox* myMatchTagComboBox;
242 
244  FXComboBox* myMatchAttrComboBox;
245 
248 
251 
253  FXTextField* myMatchString;
254  };
255 
256  // ===========================================================================
257  // class VisualScaling
258  // ===========================================================================
259 
260  class VisualScaling : public FXGroupBox {
263 
264  public:
266  VisualScaling(GNESelectorFrame* selectorFrameParent);
267 
269  ~VisualScaling();
270 
273 
275  long onCmdScaleSelection(FXObject*, FXSelector, void*);
276 
278 
279  protected:
282 
283  private:
286 
288  FXRealSpinner* mySelectionScaling;
289  };
290 
291  // ===========================================================================
292  // class SelectionOperation
293  // ===========================================================================
294 
295  class SelectionOperation : public FXGroupBox {
298 
299  public:
301  SelectionOperation(GNESelectorFrame* selectorFrameParent);
302 
305 
308 
313  long onCmdLoad(FXObject*, FXSelector, void*);
314 
319  long onCmdSave(FXObject*, FXSelector, void*);
320 
324  long onCmdClear(FXObject*, FXSelector, void*);
325 
329  long onCmdInvert(FXObject*, FXSelector, void*);
330 
332 
333  protected:
336 
337  private:
340  };
341 
346  GNESelectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
347 
350 
352  void show();
353 
355  void hide();
356 
359 
361  void clearCurrentSelection() const;
362 
366  void handleIDs(const std::vector<GNEAttributeCarrier*>& ACs, ModificationMode::SetOperation setop = ModificationMode::SET_DEFAULT);
367 
370 
371 private:
374 
377 
380 
383 
386 
389 
390 private:
396  std::vector<GNEAttributeCarrier*> getMatches(SumoXMLTag ACTag, SumoXMLAttr ACAttr, char compOp, double val, const std::string& expr);
397 };
398 
399 
400 #endif
401 
402 /****************************************************************************/
403 
FXLabel * count
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
SumoXMLTag
Numbers representing SUMO-XML - element names.
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,
ObjectTypeEntry()
void show()
show Frame
FXRadioButton * myAddRadioButton
add radio button
GNESelectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
VisualScaling * myVisualScaling
modul for visual scaling
ElementSetType myCurrentElementSet
current element set selected
FXRealSpinner * mySelectionScaling
Spinner for selection scaling.
bool IsObjectTypeLocked(GUIGlObjectType type) const
check if an object is locked
~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
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items
LockGLObjectTypes(GNESelectorFrame *selectorFrameParent)
constructor
FXTextField * myMatchString
string of the match
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
std::map< GUIGlObjectType, ObjectTypeEntry > myTypeEntries
check boxes for type-based selection locking and selected object counts
void updateLockGLObjectTypes()
update selected items
FXRadioButton * myKeepRadioButton
keep button
SumoXMLAttr myCurrentAttribute
current SumoXMLTag Attribute
SumoXMLTag myCurrentTag
current SumoXMLTag tag
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
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
SelectionOperation * mySelectionOperation
modul for selection operations
FXMenuCheck * locked
ModificationMode * myModificationMode
modul for change modification mode
FXRadioButton * myRemoveRadioButton
remove radio button
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
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
FXLabel * typeName
ElementSet * myElementSet
modul for select element set
SetOperation myModificationModeType
how to modify selection