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 "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 counterUp();
55 
57  void counterDown();
58 
60  bool isGLTypeLocked() const;
61 
65  long onCmdSetCheckBox(FXObject*, FXSelector, void*);
66 
68 
69  protected:
72 
73  private:
75  FXLabel* myLabelCounter;
76 
78  FXLabel* myLabelTypeName;
79 
81  FXMenuCheck* myCheckBoxLocked;
82 
84  int myCounter;
85  };
86 
88  LockGLObjectTypes(GNESelectorFrame* selectorFrameParent);
89 
92 
94  void addedLockedObject(const GUIGlObjectType type);
95 
97  void removeLockedObject(const GUIGlObjectType type);
98 
100  bool IsObjectTypeLocked(const GUIGlObjectType type) const;
101 
102  private:
105 
107  std::map<GUIGlObjectType, ObjectTypeEntry*> myTypeEntries;
108  };
109 
110  // ===========================================================================
111  // class ModificationMode
112  // ===========================================================================
113 
114  class ModificationMode : protected FXGroupBox {
117 
118  public:
121  SET_ADD = 1,
122  SET_SUB = 2,
123  SET_RESTRICT = 3,
124  SET_REPLACE = 4,
125  SET_DEFAULT = 5 // use mySetOperation instead of override
126  };
127 
129  ModificationMode(GNESelectorFrame* selectorFrameParent);
130 
132  ~ModificationMode();
133 
135  SetOperation getModificationMode() const;
136 
140  long onCmdSelectModificationMode(FXObject*, FXSelector, void*);
141 
143 
144  protected:
147 
148  private:
151 
153  FXRadioButton* myAddRadioButton;
154 
156  FXRadioButton* myRemoveRadioButton;
157 
159  FXRadioButton* myKeepRadioButton;
160 
162  FXRadioButton* myReplaceRadioButton;
163 
166  };
167 
168  // ===========================================================================
169  // class ElementSet
170  // ===========================================================================
171 
172  class ElementSet : protected FXGroupBox {
175 
176  public:
179  ELEMENTSET_NETELEMENT = 1,
180  ELEMENTSET_ADDITIONAL = 2,
181  ELEMENTSET_SHAPE = 3,
182  ELEMENTSET_INVALID = 4,
183  };
184 
186  ElementSet(GNESelectorFrame* selectorFrameParent);
187 
189  ~ElementSet();
190 
192  ElementSetType getElementSet() const;
193 
196 
198  long onCmdSelectElementSet(FXObject*, FXSelector, void*);
199 
201 
202  protected:
205 
206  private:
209 
211  FXComboBox* mySetComboBox;
212 
215  };
216 
217  // ===========================================================================
218  // class MatchAttribute
219  // ===========================================================================
220 
221  class MatchAttribute : protected FXGroupBox {
224 
225  public:
227  MatchAttribute(GNESelectorFrame* selectorFrameParent);
228 
230  ~MatchAttribute();
231 
233  void enableMatchAttribute();
234 
236  void disableMatchAttribute();
237 
240 
244  long onCmdSelMBTag(FXObject*, FXSelector, void*);
245 
249  long onCmdSelMBAttribute(FXObject*, FXSelector, void*);
250 
254  long onCmdSelMBString(FXObject*, FXSelector, void*);
255 
259  long onCmdHelp(FXObject*, FXSelector, void*);
260 
262 
263  protected:
266 
267  private:
270 
272  FXComboBox* myMatchTagComboBox;
273 
275  FXComboBox* myMatchAttrComboBox;
276 
279 
282 
284  FXTextField* myMatchString;
285  };
286 
287  // ===========================================================================
288  // class VisualScaling
289  // ===========================================================================
290 
291  class VisualScaling : protected FXGroupBox {
294 
295  public:
297  VisualScaling(GNESelectorFrame* selectorFrameParent);
298 
300  ~VisualScaling();
301 
304 
306  long onCmdScaleSelection(FXObject*, FXSelector, void*);
307 
309 
310  protected:
313 
314  private:
317 
319  FXRealSpinner* mySelectionScaling;
320  };
321 
322  // ===========================================================================
323  // class SelectionOperation
324  // ===========================================================================
325 
326  class SelectionOperation : protected FXGroupBox {
329 
330  public:
332  SelectionOperation(GNESelectorFrame* selectorFrameParent);
333 
336 
339 
344  long onCmdLoad(FXObject*, FXSelector, void*);
345 
350  long onCmdSave(FXObject*, FXSelector, void*);
351 
355  long onCmdClear(FXObject*, FXSelector, void*);
356 
360  long onCmdInvert(FXObject*, FXSelector, void*);
361 
363 
364  protected:
367 
368  private:
371  };
372 
377  GNESelectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet);
378 
381 
383  void show();
384 
386  void hide();
387 
390 
392  void clearCurrentSelection() const;
393 
397  void handleIDs(const std::vector<GNEAttributeCarrier*>& ACs, ModificationMode::SetOperation setop = ModificationMode::SET_DEFAULT);
398 
401 
402 private:
405 
408 
411 
414 
417 
420 
421 private:
427  std::vector<GNEAttributeCarrier*> getMatches(SumoXMLTag ACTag, SumoXMLAttr ACAttr, char compOp, double val, const std::string& expr);
428 };
429 
430 
431 #endif
432 
433 /****************************************************************************/
434 
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
std::map< GUIGlObjectType, ObjectTypeEntry * > myTypeEntries
check boxes for type-based selection locking and selected object counts
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 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
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
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items
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
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
FXMenuCheck * myCheckBoxLocked
check box to check if GLObject type is blocked
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
GNESelectorFrame * mySelectorFrameParent
pointer to Selector Frame Parent
ElementSet * myElementSet
modul for select element set
bool isGLTypeLocked() const
check if current GLType is blocked
SetOperation myModificationModeType
how to modify selection