SUMO - Simulation of Urban MObility
GNESelector.h
Go to the documentation of this file.
1 /****************************************************************************/
7 // The Widget for modifying selections of network-elements
8 // (some elements adapted from GUIDialog_GLChosenEditor)
9 /****************************************************************************/
10 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
11 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
12 /****************************************************************************/
13 //
14 // This file is part of SUMO.
15 // SUMO is free software: you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 /****************************************************************************/
21 #ifndef GNESelector_h
22 #define GNESelector_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #include <fx.h>
35 #include <GL/gl.h>
39 
40 // ===========================================================================
41 // class declarations
42 // ===========================================================================
43 class GNEViewNet;
45 class GNEUndoList;
46 
47 // ===========================================================================
48 // class definitions
49 // ===========================================================================
54 class GNESelector : public FXScrollWindow, public GUISelectedStorage::UpdateTarget {
55  // FOX-declarations
56  FXDECLARE(GNESelector)
57 
58 public:
59 
60  enum SetOperation {
61  SET_ADD = 1,
62  SET_SUB = 2,
65  SET_DEFAULT = 5 // use mySetOperation instead of override
66  };
67 
71  GNESelector(FXComposite* parent, GNEViewNet* updateTarget, GNEUndoList* undoList);
72 
73 
75  ~GNESelector();
76 
77 
78  FXFont* getHeaderFont() {
79  return myHeaderFont;
80  }
81 
84 
90  long onCmdLoad(FXObject*, FXSelector, void*);
91 
99  long onCmdSave(FXObject*, FXSelector, void*);
100 
106  long onCmdClear(FXObject*, FXSelector, void*);
107 
112  long onCmdInvert(FXObject*, FXSelector, void*);
113 
118  long onCmdSelMBTag(FXObject*, FXSelector, void*);
119 
123  long onCmdSelMBString(FXObject*, FXSelector, void*);
124 
128  long onCmdHelp(FXObject*, FXSelector, void*);
129 
132  long onCmdScaleSelection(FXObject*, FXSelector, void*);
133 
135 
136  void show();
137 
138  void hide();
139 
140  /* apply list of ids to the current selection according to SetOperation,
141  * if setop==SET_DEFAULT than the currently set mode (mySetOperation) is used */
142  void handleIDs(std::vector<GUIGlID> ids, bool selectEdges, SetOperation setop = SET_DEFAULT);
143 
144  /* @brief called if currently registered for updates for changes of global selection */
145  void selectionUpdated();
146 
147 protected:
150 
151 private:
153  FXVerticalFrame* myContentFrame;
154 
156  FXFont* myHeaderFont;
157 
159  FXLabel* myStats;
160 
161  /* @brief the window to inform when selection changes
162  * we also need this to query for existing elements when inverting selection
163  */
165 
168  FXDataTarget mySetOperationTarget;
169 
171  FXListBox* myMatchTagBox;
172  FXListBox* myMatchAttrBox;
173  FXTextField* myMatchString;
174 
175  FXRealSpinDial* mySelectionScaling;
176 
177  static const int WIDTH;
178 
180 private:
181 
182  std::string getStats() const;
183 
188  std::vector<GUIGlID> getMatches(
189  SumoXMLTag tag, SumoXMLAttr attr, char compOp, SUMOReal val, const std::string& expr);
190 
191  // the string that should be matched against if attr 'allowed' or 'disalloed' are set to "all"
192  const std::string ALL_VCLASS_NAMES_MATCH_STRING;
193 
194 };
195 
196 
197 #endif
198 
199 /****************************************************************************/
200 
SumoXMLTag
Numbers representing SUMO-XML - element names.
GNEUndoList * myUndoList
Definition: GNESelector.h:179
long onCmdLoad(FXObject *, FXSelector, void *)
Called when the user presses the Load-button.
FXFont * getHeaderFont()
Definition: GNESelector.h:78
GNESelector()
FOX needs this.
Definition: GNESelector.h:149
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
FXListBox * myMatchAttrBox
Definition: GNESelector.h:172
FXuint mySetOperation
how to modify selection
Definition: GNESelector.h:167
FXDataTarget mySetOperationTarget
Definition: GNESelector.h:168
GNEViewNet * myUpdateTarget
Definition: GNESelector.h:164
FXFont * myHeaderFont
Font for the widget.
Definition: GNESelector.h:156
const std::string ALL_VCLASS_NAMES_MATCH_STRING
Definition: GNESelector.h:192
long onCmdSelMBString(FXObject *, FXSelector, void *)
Called when the user enters a new selection expression validates expression and modifies current sele...
FXVerticalFrame * myContentFrame
the panel to hold all member widgets
Definition: GNESelector.h:153
long onCmdSelMBTag(FXObject *, FXSelector, void *)
Called when the user selectes a tag in the match box updates the attr listbox Repaints itself...
FXLabel * myStats
the label for selection statistics
Definition: GNESelector.h:159
long onCmdInvert(FXObject *, FXSelector, void *)
Called when the user presses the Invert-button invert the selection Repaints itself.
long onCmdClear(FXObject *, FXSelector, void *)
Called when the user presses the Clear-button.
void selectionUpdated()
long onCmdScaleSelection(FXObject *, FXSelector, void *)
Called when the user changes visual scaling.
~GNESelector()
Destructor.
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user presses the Save-button.
std::string getStats() const
FXListBox * myMatchTagBox
state variables for the match box
Definition: GNESelector.h:171
#define SUMOReal
Definition: config.h:214
FXRealSpinDial * mySelectionScaling
Definition: GNESelector.h:175
static const int WIDTH
Definition: GNESelector.h:177
void handleIDs(std::vector< GUIGlID > ids, bool selectEdges, SetOperation setop=SET_DEFAULT)
std::vector< GUIGlID > getMatches(SumoXMLTag tag, SumoXMLAttr attr, char compOp, SUMOReal val, const std::string &expr)
return objects of the given type with matching attrs
long onCmdHelp(FXObject *, FXSelector, void *)
Called when the user clicks the help button pop up help window.
FXTextField * myMatchString
Definition: GNESelector.h:173