SUMO - Simulation of Urban MObility
GNESelector.cpp
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 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #ifdef _MSC_VER
27 #include <windows_config.h>
28 #else
29 #include <config.h>
30 #endif
31 
32 #ifdef HAVE_VERSION_H
33 #include <version.h>
34 #endif
35 
36 #include <iostream>
45 #include "GNESelector.h"
46 #include "GNEViewNet.h"
47 #include "GNENet.h"
48 #include "GNEJunction.h"
49 #include "GNEEdge.h"
50 #include "GNELane.h"
51 #include "GNEUndoList.h"
52 #include "GNEChange_Selection.h"
53 #include "GNEAttributeCarrier.h"
54 
55 #ifdef CHECK_MEMORY_LEAKS
56 #include <foreign/nvwa/debug_new.h>
57 #endif // CHECK_MEMORY_LEAKS
58 
59 
60 // ===========================================================================
61 // FOX callback mapping
62 // ===========================================================================
63 FXDEFMAP(GNESelector) GNESelectorMap[] = {
64  FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_LOAD, GNESelector::onCmdLoad),
65  FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_SAVE, GNESelector::onCmdSave),
66  FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_INVERT, GNESelector::onCmdInvert),
67  FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_CLEAR, GNESelector::onCmdClear),
68  FXMAPFUNC(SEL_COMMAND, MID_GNE_SELMB_TAG, GNESelector::onCmdSelMBTag),
69  FXMAPFUNC(SEL_COMMAND, MID_GNE_SELMB_STRING, GNESelector::onCmdSelMBString),
70  FXMAPFUNC(SEL_COMMAND, MID_HELP, GNESelector::onCmdHelp),
72 };
73 
74 // Object implementation
75 FXIMPLEMENT(GNESelector, FXScrollWindow, GNESelectorMap, ARRAYNUMBER(GNESelectorMap))
76 
77 // ===========================================================================
78 // static members
79 // ===========================================================================
80 const int GNESelector::WIDTH = 140;
81 
82 // ===========================================================================
83 // method definitions
84 // ===========================================================================
85 GNESelector::GNESelector(FXComposite* parent, GNEViewNet* updateTarget, GNEUndoList* undoList):
86  FXScrollWindow(parent, LAYOUT_FILL_Y | LAYOUT_FIX_WIDTH, 0, 0, WIDTH, 0),
87  myHeaderFont(new FXFont(getApp(), "Arial", 14, FXFont::Bold)),
88  myUpdateTarget(updateTarget),
89  mySetOperation(SET_ADD),
90  mySetOperationTarget(mySetOperation),
91  myUndoList(undoList),
92  ALL_VCLASS_NAMES_MATCH_STRING("all " + joinToString(SumoVehicleClassStrings.getStrings(), " ")) {
93  // stats
94  myContentFrame = new FXVerticalFrame(this, LAYOUT_FILL_Y | LAYOUT_FIX_WIDTH, 0, 0, WIDTH, 0);
95  myStats = new FXLabel(myContentFrame, getStats().c_str(), 0, JUSTIFY_LEFT);
96  myStats->setFont(myHeaderFont);
97 
98  // selection modification mode
99  FXGroupBox* selBox = new FXGroupBox(myContentFrame, "Modification Mode",
100  GROUPBOX_NORMAL | FRAME_GROOVE | LAYOUT_FILL_X, 2, 0, 0, 0, 4, 2, 2, 2);
101  new FXRadioButton(selBox, "add\t\tSelected objects are added to the previous selection",
102  &mySetOperationTarget, FXDataTarget::ID_OPTION + SET_ADD);
103  new FXRadioButton(selBox, "remove\t\tSelected objects are removed from the previous selection",
104  &mySetOperationTarget, FXDataTarget::ID_OPTION + SET_SUB);
105  new FXRadioButton(selBox, "keep\t\tRestrict previous selection by the current selection",
106  &mySetOperationTarget, FXDataTarget::ID_OPTION + SET_RESTRICT);
107  new FXRadioButton(selBox, "replace\t\tReplace previous selection by the current selection",
108  &mySetOperationTarget, FXDataTarget::ID_OPTION + SET_REPLACE);
109 
110  // selection by expression matching (match box)
111  FXGroupBox* matchBox = new FXGroupBox(myContentFrame, "Match Attribute",
112  GROUPBOX_NORMAL | FRAME_GROOVE | LAYOUT_FILL_X, 2, 0, 0, 0, 4, 2, 2, 2);
113  myMatchTagBox = new FXListBox(matchBox, this, MID_GNE_SELMB_TAG);
114  const std::vector<SumoXMLTag>& tags = GNEAttributeCarrier::allowedTags();
115  for (std::vector<SumoXMLTag>::const_iterator it = tags.begin(); it != tags.end(); it++) {
116  myMatchTagBox->appendItem(toString(*it).c_str());
117  }
118  myMatchTagBox->setCurrentItem(1); // edges
119  myMatchTagBox->setNumVisible(myMatchTagBox->getNumItems());
120  myMatchAttrBox = new FXListBox(matchBox);
121  onCmdSelMBTag(0, 0, 0);
122  myMatchAttrBox->setCurrentItem(3); // speed
123  myMatchString = new FXTextField(matchBox, 12, this, MID_GNE_SELMB_STRING, TEXTFIELD_NORMAL, 0, 0, 0, 0, 4, 2, 0, 2);
124  myMatchString->setText(">10.0");
125  new FXButton(matchBox, "Help", 0, this, MID_HELP);
126 
127  FXGroupBox* selSizeBox = new FXGroupBox(myContentFrame, "Visual Scaling",
128  GROUPBOX_NORMAL | FRAME_GROOVE | LAYOUT_FILL_X, 2, 0, 0, 0, 4, 2, 2, 2);
129  mySelectionScaling =
130  new FXRealSpinDial(selSizeBox, 7, this, MID_GNE_SELECT_SCALE,
131  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_Y);
132  mySelectionScaling->setNumberFormat(1);
133  mySelectionScaling->setIncrements(0.1, .5, 1);
134  mySelectionScaling->setRange(1, 100);
135  mySelectionScaling->setValue(1);
136  mySelectionScaling->setHelpText("Enlarge selected objects");
137 
138  // additional buttons
139  // new FXHorizontalSeparator(this,SEPARATOR_GROOVE|LAYOUT_FILL_X);
140  // "Clear List"
141  new FXButton(myContentFrame, "Clear\t\t", 0, this, MID_CHOOSEN_CLEAR,
142  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
143  0, 0, 0, 0, 4, 4, 3, 3);
144  // "Invert"
145  new FXButton(myContentFrame, "Invert\t\t", 0, this, MID_CHOOSEN_INVERT,
146  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
147  0, 0, 0, 0, 4, 4, 3, 3);
148  // "Save"
149  new FXButton(myContentFrame, "Save\t\tSave ids of currently selected objects to a file.", 0, this, MID_CHOOSEN_SAVE,
150  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
151  0, 0, 0, 0, 4, 4, 3, 3);
152 
153  // "Load"
154  new FXButton(myContentFrame, "Load\t\tLoad ids from a file according to the current modfication mode.", 0, this, MID_CHOOSEN_LOAD,
155  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
156  0, 0, 0, 0, 4, 4, 3, 3);
157 
158 
159  // Selection Hint
160  new FXLabel(myContentFrame, "Hold <SHIFT> for\nrectangle selection.\nPress <DEL> to\ndelete selected items.", 0, JUSTIFY_LEFT);
161 }
162 
163 
165  delete myHeaderFont;
167 }
168 
169 
170 long
171 GNESelector::onCmdLoad(FXObject*, FXSelector, void*) {
172  // get the new file name
173  FXFileDialog opendialog(this, "Open List of Selected Items");
174  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
175  opendialog.setSelectMode(SELECTFILE_EXISTING);
176  opendialog.setPatternList("Selection files (*.txt)\nAll files (*)");
177  if (gCurrentFolder.length() != 0) {
178  opendialog.setDirectory(gCurrentFolder);
179  }
180  if (opendialog.execute()) {
181  gCurrentFolder = opendialog.getDirectory();
182  std::string file = opendialog.getFilename().text();
183  // @todo maybe rewrite so that mySetOperation also applies to loaded items?
184  std::string errors;
185  std::set<GUIGlID> ids = gSelected.loadIDs(file, errors);
186  handleIDs(std::vector<GUIGlID>(ids.begin(), ids.end()), false);
187  if (errors != "") {
188  FXMessageBox::error(this, MBOX_OK, "Errors while loading Selection", "%s", errors.c_str());
189  }
190  }
191  myUpdateTarget->update();
192  return 1;
193 }
194 
195 
196 long
197 GNESelector::onCmdSave(FXObject*, FXSelector, void*) {
198  FXString file = MFXUtils::getFilename2Write(
199  this, "Save List of selected Items", ".txt", GUIIconSubSys::getIcon(ICON_EMPTY), gCurrentFolder);
200  if (file == "") {
201  return 1;
202  }
203  try {
204  gSelected.save(file.text());
205  } catch (IOError& e) {
206  FXMessageBox::error(this, MBOX_OK, "Storing Selection failed", "%s", e.what());
207  }
208  return 1;
209 }
210 
211 
212 long
213 GNESelector::onCmdClear(FXObject*, FXSelector, void*) {
214  myUndoList->add(new GNEChange_Selection(std::set<GUIGlID>(), gSelected.getSelected(), true), true);
215  myUpdateTarget->update();
216  return 1;
217 }
218 
219 
220 long
221 GNESelector::onCmdInvert(FXObject*, FXSelector, void*) {
222  std::set<GUIGlID> ids = myUpdateTarget->getNet()->getGlIDs(GLO_JUNCTION);
223  for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
225  }
227  for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
229  }
230  myUpdateTarget->update();
231  return 1;
232 }
233 
234 
235 long
236 GNESelector::onCmdSelMBTag(FXObject*, FXSelector, void*) {
237  const std::vector<SumoXMLTag>& tags = GNEAttributeCarrier::allowedTags();
238  SumoXMLTag tag = tags[myMatchTagBox->getCurrentItem()];
239  myMatchAttrBox->clearItems();
240  const std::vector<SumoXMLAttr>& attrs = GNEAttributeCarrier::allowedAttributes(tag);
241  for (std::vector<SumoXMLAttr>::const_iterator it = attrs.begin(); it != attrs.end(); it++) {
242  myMatchAttrBox->appendItem(toString(*it).c_str());
243  }
244  myMatchAttrBox->setNumVisible(myMatchAttrBox->getNumItems());
245  update();
246  return 1;
247 }
248 
249 
250 long
251 GNESelector::onCmdSelMBString(FXObject*, FXSelector, void*) {
252  const std::vector<SumoXMLTag>& tags = GNEAttributeCarrier::allowedTags();
253  SumoXMLTag tag = tags[myMatchTagBox->getCurrentItem()];
254  const std::vector<SumoXMLAttr>& attrs = GNEAttributeCarrier::allowedAttributes(tag);
255  SumoXMLAttr attr = attrs[myMatchAttrBox->getCurrentItem()];
256  std::string expr(myMatchString->getText().text());
257  bool valid = true;
258 
259  if (expr == "") {
260  // the empty expression matches all objects
261  handleIDs(getMatches(tag, attr, '@', 0, expr), false);
262  } else if (GNEAttributeCarrier::isNumerical(attr)) {
263  // The expression must have the form
264  // <val matches if attr < val
265  // >val matches if attr > val
266  // =val matches if attr = val
267  // val matches if attr = val
268  char compOp = expr[0];
269  if (compOp == '<' || compOp == '>' || compOp == '=') {
270  expr = expr.substr(1);
271  } else {
272  compOp = '=';
273  }
274  SUMOReal val;
275  std::istringstream buf(expr);
276  buf >> val;
277  if (!buf.fail() && (size_t)buf.tellg() == expr.size()) {
278  handleIDs(getMatches(tag, attr, compOp, val, expr), false);
279  } else {
280  valid = false;
281  }
282  } else {
283  // The expression must have the form
284  // =str: matches if <str> is an exact match
285  // !str: matches if <str> is not a substring
286  // ^str: matches if <str> is not an exact match
287  // str: matches if <str> is a substring (sends compOp '@')
288  // Alternatively, if the expression is empty it matches all objects
289  char compOp = expr[0];
290  if (compOp == '=' || compOp == '!' || compOp == '^') {
291  expr = expr.substr(1);
292  } else {
293  compOp = '@';
294  }
295  handleIDs(getMatches(tag, attr, compOp, 0, expr), false);
296  }
297  if (valid) {
298  myMatchString->setTextColor(FXRGB(0, 0, 0));
299  myMatchString->killFocus();
300  } else {
301  myMatchString->setTextColor(FXRGB(255, 0, 0));
302  }
303 
304  return 1;
305 }
306 
307 
308 long
309 GNESelector::onCmdHelp(FXObject*, FXSelector, void*) {
310  FXDialogBox* helpDialog = new FXDialogBox(this, "Match Attribute Help", DECOR_CLOSE | DECOR_TITLE);
311  std::ostringstream help;
312  help
313  << "The 'Match Attribute' controls allow to specify a set of objects which are then applied to the current selection "
314  << "according to the current 'Modification Mode'.\n"
315  << "1. Select an object type from the first input box\n"
316  << "2. Select an attribute from the second input box\n"
317  << "3. Enter a 'match expression' in the third input box and press <return>\n"
318  << "\n"
319  << "The empty expression matches all objects\n"
320  << "For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.\n"
321  << "An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'\n"
322  << "\n"
323  << "For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.\n"
324  << " '' (no operator) matches if string is a substring of that object'ts attribute.\n"
325  << " '=' matches if string is an exact match.\n"
326  << " '!' matches if string is not a substring.\n"
327  << " '^' matches if string is not an exact match.\n"
328  << "\n"
329  << "Examples:\n"
330  << "junction; id; 'foo' -> match all junctions that have 'foo' in their id\n"
331  << "junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'\n" // PABLO #1985
332  << "edge; speed; '>10' -> match all edges with a speed above 10\n";
333  new FXLabel(helpDialog, help.str().c_str(), 0, JUSTIFY_LEFT);
334  // "OK"
335  new FXButton(helpDialog, "OK\t\tSave modifications", 0, helpDialog, FXDialogBox::ID_ACCEPT,
336  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
337  0, 0, 0, 0, 4, 4, 3, 3);
338  helpDialog->create();
339  helpDialog->show();
340  return 1;
341 }
342 
343 
344 long
345 GNESelector::onCmdScaleSelection(FXObject*, FXSelector, void*) {
347  myUpdateTarget->update();
348  return 1;
349 }
350 
351 
352 void
354  gSelected.add2Update(this);
355  selectionUpdated(); // selection may have changed due to deletions
356  FXScrollWindow::show();
357 }
358 
359 
360 void
363  FXScrollWindow::hide();
364 }
365 
366 
367 std::string
369  return "Selection:\n" +
370  toString(gSelected.getSelected(GLO_JUNCTION).size()) + " Junctions\n" +
371  toString(gSelected.getSelected(GLO_EDGE).size()) + " Edges\n" +
372  toString(gSelected.getSelected(GLO_LANE).size()) + " Lanes\n";
373 }
374 
375 
376 void
378  myStats->setText(getStats().c_str());
379  update();
380 }
381 
382 
383 void
384 GNESelector::handleIDs(std::vector<GUIGlID> ids, bool selectEdges, SetOperation setop) {
385  const SetOperation setOperation = (setop == SET_DEFAULT ? (SetOperation)mySetOperation : setop);
386  std::set<GUIGlID> previousSelection;
387  myUndoList->p_begin("change selection");
388  if (setOperation == SET_REPLACE) {
389  myUndoList->add(new GNEChange_Selection(std::set<GUIGlID>(), gSelected.getSelected(), true), true);
390  } else if (setOperation == SET_RESTRICT) {
391  previousSelection = gSelected.getSelected(); // have to make a copy
392  myUndoList->add(new GNEChange_Selection(std::set<GUIGlID>(), gSelected.getSelected(), true), true);
393  }
394  // handle ids
395  GUIGlObject* object;
396  GUIGlObjectType type;
397  std::set<GUIGlID> idsSet(ids.begin(), ids.end());
398  std::set<GUIGlID> selected;
399  std::set<GUIGlID> deselected;
401  for (std::vector<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
402  GUIGlID id = *it;
403  if (id > 0) { // net object?
405  if (object->getType() == GLO_LANE && selectEdges) {
406  const GNEEdge& edge = (static_cast<GNELane*>(object))->getParentEdge();
407  idsSet.insert(edge.getSource()->getGlID());
408  idsSet.insert(edge.getDest()->getGlID());
409  }
411  }
412  }
413  }
414  for (std::set<GUIGlID>::const_iterator it = idsSet.begin(); it != idsSet.end(); it++) {
415  GUIGlID id = *it;
416  if (id > 0) { // net object?
418  if (object == 0) {
419  // in debug mode we would like to know about this.
420  // It might be caused by a corrupted gl-name stack.
421  // However, most cases of uninitizliaed values would go hidden since 0 is assumed to be the net object anyway
422  assert(false);
423  continue;
424  }
425  type = object->getType();
427  if (type == GLO_LANE && selectEdges) {
428  // @note edge may be selected/deselected multiple times but this shouldn't
429  // hurt unless we add SET_TOGGLE
430  id = (static_cast<GNELane*>(object))->getParentEdge().getGlID();
431  }
432  // doing the switch outside the loop requires functional techniques. this was deemed to ugly
433  switch (setOperation) {
436  selected.insert(id);
437  break;
439  deselected.insert(id);
440  break;
442  if (previousSelection.count(id)) {
443  selected.insert(id);
444  }
445  break;
446  default:
447  break;
448  }
449  }
450  }
451  myUndoList->add(new GNEChange_Selection(selected, deselected, true), true);
452  myUndoList->p_end();
453  myUpdateTarget->update();
454 }
455 
456 
457 std::vector<GUIGlID>
458 GNESelector::getMatches(SumoXMLTag tag, SumoXMLAttr attr, char compOp, SUMOReal val, const std::string& expr) {
459  GUIGlObject* object;
461  std::vector<GUIGlID> result;
462  const std::set<GUIGlID> allIDs = myUpdateTarget->getNet()->getGlIDs();
463  const bool numerical = GNEAttributeCarrier::isNumerical(attr);
464  for (std::set<GUIGlID>::const_iterator it = allIDs.begin(); it != allIDs.end(); it++) {
465  GUIGlID id = *it;
467  if (!object) {
468  throw ProcessError("Unkown object passed to GNESelector::getMatches (id=" + toString(id) + ").");
469  }
470  ac = dynamic_cast<GNEAttributeCarrier*>(object);
471  if (ac && ac->getTag() == tag) { // not all objects need to be attribute carriers
472  if (expr == "") {
473  result.push_back(id);
474  } else if (numerical) {
475  SUMOReal acVal;
476  std::istringstream buf(ac->getAttribute(attr));
477  buf >> acVal;
478  switch (compOp) {
479  case '<':
480  if (acVal < val) {
481  result.push_back(id);
482  }
483  break;
484  case '>':
485  if (acVal > val) {
486  result.push_back(id);
487  }
488  break;
489  case '=':
490  if (acVal == val) {
491  result.push_back(id);
492  }
493  break;
494  }
495  } else {
496  // string match
497  std::string acVal = ac->getAttribute(attr);
498  if ((attr == SUMO_ATTR_ALLOW || attr == SUMO_ATTR_DISALLOW) && acVal == "all") {
500  }
501  switch (compOp) {
502  case '@':
503  if (acVal.find(expr) != std::string::npos) {
504  result.push_back(id);
505  }
506  break;
507  case '!':
508  if (acVal.find(expr) == std::string::npos) {
509  result.push_back(id);
510  }
511  break;
512  case '=':
513  if (acVal == expr) {
514  result.push_back(id);
515  }
516  break;
517  case '^':
518  if (acVal != expr) {
519  result.push_back(id);
520  }
521  break;
522  }
523  }
524  }
526  }
527  return result;
528 }
529 
530 /****************************************************************************/
SumoXMLTag
Numbers representing SUMO-XML - element names.
bool selectEdges()
Definition: GNEViewNet.h:184
static bool isNumerical(SumoXMLAttr attr)
whether an attribute is numerical
GUIGlObjectType
void toggleSelection(GUIGlID id)
Toggles selection of an object.
std::set< GUIGlID > getGlIDs(GUIGlObjectType type=GLO_MAX)
Definition: GNENet.cpp:635
GNEUndoList * myUndoList
Definition: GNESelector.h:179
long onCmdLoad(FXObject *, FXSelector, void *)
Called when the user presses the Load-button.
void setSelectionScaling(SUMOReal selectionScale)
Definition: GNEViewNet.h:199
void remove2Update()
Removes the dialog to be updated.
Deselect selected items.
Definition: GUIAppEnum.h:333
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:56
void p_begin(const std::string &description)
Definition: GNEUndoList.cpp:75
FXString gCurrentFolder
The folder used as last.
GNENet * getNet()
Definition: GNEViewNet.h:176
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
FXListBox * myMatchAttrBox
Definition: GNESelector.h:172
Save set.
Definition: GUIAppEnum.h:325
FXuint mySetOperation
how to modify selection
Definition: GNESelector.h:167
virtual std::string getAttribute(SumoXMLAttr key) const =0
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString &currentFolder)
Returns the file name to write.
Definition: MFXUtils.cpp:95
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:123
GNEViewNet * myUpdateTarget
Definition: GNESelector.h:164
FXFont * myHeaderFont
Font for the widget.
Definition: GNESelector.h:156
std::set< GUIGlID > loadIDs(const std::string &filename, std::string &msgOut, GUIGlObjectType type=GLO_MAX, int maxErrors=16)
Loads a selection list (optionally with restricted type) and returns the ids of all active objects...
#define new
Definition: debug_new.h:121
const std::string ALL_VCLASS_NAMES_MATCH_STRING
Definition: GNESelector.h:192
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
Definition: GUIGlObject.h:167
selector match box messages
Definition: GUIAppEnum.h:397
const std::set< GUIGlID > & getSelected() const
Returns the list of ids of all selected objects.
static const std::vector< SumoXMLTag > & allowedTags()
get all editable attributes for tag.
FXdouble getValue() const
Return current value.
long onCmdSelMBString(FXObject *, FXSelector, void *)
Called when the user enters a new selection expression validates expression and modifies current sele...
void p_end()
Definition: GNEUndoList.cpp:82
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.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
bool autoSelectNodes()
Definition: GNEViewNet.h:190
long onCmdClear(FXObject *, FXSelector, void *)
Called when the user presses the Clear-button.
void selectionUpdated()
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
FXDEFMAP(GNESelector) GNESelectorMap[]
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:53
Clear set.
Definition: GUIAppEnum.h:327
long onCmdScaleSelection(FXObject *, FXSelector, void *)
Called when the user changes visual scaling.
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:61
unsigned int GUIGlID
Definition: GUIGlObject.h:49
void add2Update(UpdateTarget *updateTarget)
Adds a dialog to be updated.
Load set.
Definition: GUIAppEnum.h:323
static const std::vector< SumoXMLAttr > & allowedAttributes(SumoXMLTag tag)
get all editable attributes for tag.
an edge
~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
GNEJunction * getDest() const
returns the destination-junction
Definition: GNEEdge.cpp:135
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:159
SumoXMLTag getTag() const
#define SUMOReal
Definition: config.h:214
FXRealSpinDial * mySelectionScaling
Definition: GNESelector.h:175
void unblockObject(GUIGlID id)
Marks an object as unblocked.
void handleIDs(std::vector< GUIGlID > ids, bool selectEdges, SetOperation setop=SET_DEFAULT)
Spinner control.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
GUISelectedStorage gSelected
A global holder of selected objects.
static FXIcon * getIcon(GUIIcon which)
GNEJunction * getSource() const
returns the source-junction
Definition: GNEEdge.cpp:129
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.
void save(GUIGlObjectType type, const std::string &filename)
Saves a selection list.
a junction
FXTextField * myMatchString
Definition: GNESelector.h:173