SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GNESelectorFrame.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-2016 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 "GNESelectorFrame.h"
46 #include "GNEViewNet.h"
47 #include "GNEViewParent.h"
48 #include "GNENet.h"
49 #include "GNEJunction.h"
50 #include "GNEEdge.h"
51 #include "GNELane.h"
52 #include "GNEUndoList.h"
53 #include "GNEChange_Selection.h"
54 #include "GNEAttributeCarrier.h"
55 
56 #ifdef CHECK_MEMORY_LEAKS
57 #include <foreign/nvwa/debug_new.h>
58 #endif // CHECK_MEMORY_LEAKS
59 
60 
61 // ===========================================================================
62 // FOX callback mapping
63 // ===========================================================================
64 FXDEFMAP(GNESelectorFrame) GNESelectorFrameMap[] = {
65  FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_ELEMENTS, GNESelectorFrame::onCmdSubset),
66  FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_LOAD, GNESelectorFrame::onCmdLoad),
67  FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_SAVE, GNESelectorFrame::onCmdSave),
68  FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_INVERT, GNESelectorFrame::onCmdInvert),
69  FXMAPFUNC(SEL_COMMAND, MID_CHOOSEN_CLEAR, GNESelectorFrame::onCmdClear),
70  FXMAPFUNC(SEL_COMMAND, MID_GNE_SELMB_TAG, GNESelectorFrame::onCmdSelMBTag),
72  FXMAPFUNC(SEL_COMMAND, MID_HELP, GNESelectorFrame::onCmdHelp),
74 };
75 
76 // Object implementation
77 FXIMPLEMENT(GNESelectorFrame, FXScrollWindow, GNESelectorFrameMap, ARRAYNUMBER(GNESelectorFrameMap))
78 
79 // ===========================================================================
80 // method definitions
81 // ===========================================================================
82 GNESelectorFrame::GNESelectorFrame(FXComposite* parent, GNEViewNet* viewNet):
83  GNEFrame(parent, viewNet, getStats().c_str()),
84  mySetOperation(SET_ADD),
85  mySetOperationTarget(mySetOperation),
86  ALL_VCLASS_NAMES_MATCH_STRING("all " + joinToString(SumoVehicleClassStrings.getStrings(), " ")) {
87  // selection modification mode
88  FXGroupBox* selBox = new FXGroupBox(myContentFrame, "Modification Mode", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X);
89  // Create all options buttons
90  new FXRadioButton(selBox, "add\t\tSelected objects are added to the previous selection",
91  &mySetOperationTarget, FXDataTarget::ID_OPTION + SET_ADD);
92  new FXRadioButton(selBox, "remove\t\tSelected objects are removed from the previous selection",
93  &mySetOperationTarget, FXDataTarget::ID_OPTION + SET_SUB);
94  new FXRadioButton(selBox, "keep\t\tRestrict previous selection by the current selection",
95  &mySetOperationTarget, FXDataTarget::ID_OPTION + SET_RESTRICT);
96  new FXRadioButton(selBox, "replace\t\tReplace previous selection by the current selection",
97  &mySetOperationTarget, FXDataTarget::ID_OPTION + SET_REPLACE);
98  // Create groupBox for selection by expression matching (match box)
99  FXGroupBox* elementBox = new FXGroupBox(myContentFrame, "type of element", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X);
100  // Create MatchTagBox for tags and fill it
101  mySetBox = new FXListBox(elementBox, this, MID_CHOOSEN_ELEMENTS, FRAME_GROOVE | LAYOUT_FILL_X);
102  mySetBox->appendItem("Net Element");
103  mySetBox->appendItem("Additional");
104  mySetBox->setNumVisible(mySetBox->getNumItems());
105  // Create groupBox fro selection by expression matching (match box)
106  FXGroupBox* matchBox = new FXGroupBox(myContentFrame, "Match Attribute", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X);
107  // Create MatchTagBox for tags
108  myMatchTagBox = new FXListBox(matchBox, this, MID_GNE_SELMB_TAG, FRAME_GROOVE | LAYOUT_FILL_X);
109  // Create listBox for Attributes
110  myMatchAttrBox = new FXListBox(matchBox, NULL, 0, FRAME_GROOVE | LAYOUT_FILL_X);
111  // Set netElements as default tag
112  mySetBox->setCurrentItem(0);
113  // Fill list of sub-items
114  onCmdSubset(0, 0, 0);
115  // Set speed as default attribute
116  myMatchAttrBox->setCurrentItem(3);
117  // Create TextField for Match string
118  myMatchString = new FXTextField(matchBox, 12, this, MID_GNE_SELMB_STRING, FRAME_THICK | LAYOUT_FILL_X);
119  // Set default value for Match string
120  myMatchString->setText(">10.0");
121  // Create help button
122  new FXButton(matchBox, "Help", 0, this, MID_HELP);
123  // Create Groupbox for visual scalings
124  FXGroupBox* selSizeBox = new FXGroupBox(myContentFrame, "Visual Scaling", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X);
125  // Create spin button and configure it
126  mySelectionScaling = new FXRealSpinDial(selSizeBox, 7, this, MID_GNE_SELECT_SCALE, LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_Y);
127  mySelectionScaling->setNumberFormat(1);
128  mySelectionScaling->setIncrements(0.1, .5, 1);
129  mySelectionScaling->setRange(1, 100);
130  mySelectionScaling->setValue(1);
131  mySelectionScaling->setHelpText("Enlarge selected objects");
132  // Create groupbox for additional buttons
133  FXGroupBox* additionalButtons = new FXGroupBox(myContentFrame, "Operations for selections", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X);
134  // Create "Clear List" Button
135  new FXButton(additionalButtons, "Clear\t\t", 0, this, MID_CHOOSEN_CLEAR, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED);
136  // Create "Invert" Button
137  new FXButton(additionalButtons, "Invert\t\t", 0, this, MID_CHOOSEN_INVERT, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED);
138  // Create "Save" Button
139  new FXButton(additionalButtons, "Save\t\tSave ids of currently selected objects to a file.", 0, this, MID_CHOOSEN_SAVE, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED);
140  // Create "Load" Button
141  new FXButton(additionalButtons, "Load\t\tLoad ids from a file according to the current modfication mode.", 0, this, MID_CHOOSEN_LOAD, ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED);
142  // Create groupbox for information about selections
143  FXGroupBox* selectionHintGroupBox = new FXGroupBox(myContentFrame, "Information", GROUPBOX_TITLE_CENTER | FRAME_GROOVE | LAYOUT_FILL_X);
144  // Create Selection Hint
145  new FXLabel(selectionHintGroupBox, " - Hold <SHIFT> for \n rectangle selection.\n - Press <DEL> to\n delete selected items.", 0, JUSTIFY_LEFT);
146 }
147 
148 
151 }
152 
153 
154 long
155 GNESelectorFrame::onCmdSubset(FXObject*, FXSelector, void*) {
156  // Clear items of myMatchTagBox
157  myMatchTagBox->clearItems();
158  // Set items depending of current items
159  if (mySetBox->getCurrentItem() == 0) {
160  // If we want to work with net elementsn Get net Elements allowed tags
161  const std::vector<SumoXMLTag>& tags = GNEAttributeCarrier::allowedNetElementTags();
162  // iterate over tags
163  for (std::vector<SumoXMLTag>::const_iterator it = tags.begin(); it != tags.end(); it++) {
164  // Add trag to MatchTagBox
165  myMatchTagBox->appendItem(toString(*it).c_str());
166  }
167  myMatchTagBox->setCurrentItem(1); // edges
168  myMatchTagBox->setNumVisible(myMatchTagBox->getNumItems());
169  // Fill attributes with the current element type
170  onCmdSelMBTag(0, 0, 0);
171  } else {
172  // If we want to work with additionals, get net additionals allowed tags
173  const std::vector<SumoXMLTag>& tags = GNEAttributeCarrier::allowedAdditionalTags();
174  // iterate over tags
175  for (std::vector<SumoXMLTag>::const_iterator it = tags.begin(); it != tags.end(); it++) {
176  // Add trag to MatchTagBox
177  myMatchTagBox->appendItem(toString(*it).c_str());
178  }
179  myMatchTagBox->setCurrentItem(1); // busStops
180  myMatchTagBox->setNumVisible(myMatchTagBox->getNumItems());
181  // Fill attributes with the current element type
182  onCmdSelMBTag(0, 0, 0);
183  }
184  return 1;
185 }
186 
187 
188 long
189 GNESelectorFrame::onCmdLoad(FXObject*, FXSelector, void*) {
190  // get the new file name
191  FXFileDialog opendialog(this, "Open List of Selected Items");
192  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
193  opendialog.setSelectMode(SELECTFILE_EXISTING);
194  opendialog.setPatternList("Selection files (*.txt)\nAll files (*)");
195  if (gCurrentFolder.length() != 0) {
196  opendialog.setDirectory(gCurrentFolder);
197  }
198  if (opendialog.execute()) {
199  gCurrentFolder = opendialog.getDirectory();
200  std::string file = opendialog.getFilename().text();
201  // @todo maybe rewrite so that mySetOperation also applies to loaded items?
202  std::string errors;
203  std::set<GUIGlID> ids = gSelected.loadIDs(file, errors);
204  handleIDs(std::vector<GUIGlID>(ids.begin(), ids.end()), false);
205  if (errors != "") {
206  FXMessageBox::error(this, MBOX_OK, "Errors while loading Selection", "%s", errors.c_str());
207  }
208  }
209  myViewNet->update();
210  return 1;
211 }
212 
213 
214 long
215 GNESelectorFrame::onCmdSave(FXObject*, FXSelector, void*) {
216  FXString file = MFXUtils::getFilename2Write(
217  this, "Save List of selected Items", ".txt", GUIIconSubSys::getIcon(ICON_EMPTY), gCurrentFolder);
218  if (file == "") {
219  return 1;
220  }
221  try {
222  gSelected.save(file.text());
223  } catch (IOError& e) {
224  FXMessageBox::error(this, MBOX_OK, "Storing Selection failed", "%s", e.what());
225  }
226  return 1;
227 }
228 
229 
230 long
231 GNESelectorFrame::onCmdClear(FXObject*, FXSelector, void*) {
232  myViewNet->getUndoList()->add(new GNEChange_Selection(myViewNet->getNet(), std::set<GUIGlID>(), gSelected.getSelected(), true), true);
233  myViewNet->update();
234  return 1;
235 }
236 
237 
238 long
239 GNESelectorFrame::onCmdInvert(FXObject*, FXSelector, void*) {
240  std::set<GUIGlID> ids = myViewNet->getNet()->getGlIDs(GLO_JUNCTION);
241  for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
243  }
245  for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
247  }
249  for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
251  }
253  for (std::set<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
255  }
256  myViewNet->update();
257  return 1;
258 }
259 
260 
261 long
262 GNESelectorFrame::onCmdSelMBTag(FXObject*, FXSelector, void*) {
263  const std::vector<SumoXMLTag>& tags = GNEAttributeCarrier::allowedTags();
264  SumoXMLTag tag = tags[myMatchTagBox->getCurrentItem()];
265  myMatchAttrBox->clearItems();
266  const std::vector<std::pair <SumoXMLAttr, std::string> >& attrs = GNEAttributeCarrier::allowedAttributes(tag);
267  for (std::vector<std::pair <SumoXMLAttr, std::string> >::const_iterator it = attrs.begin(); it != attrs.end(); it++) {
268  myMatchAttrBox->appendItem(toString(it->first).c_str());
269  }
270 
271  // @ToDo: Here can be placed a butto to set the default value
272  myMatchAttrBox->setNumVisible(myMatchAttrBox->getNumItems());
273  update();
274  return 1;
275 }
276 
277 
278 long
279 GNESelectorFrame::onCmdSelMBString(FXObject*, FXSelector, void*) {
280  const std::vector<SumoXMLTag>& tags = GNEAttributeCarrier::allowedTags();
281  SumoXMLTag tag = tags[myMatchTagBox->getCurrentItem()];
282  const std::vector<std::pair <SumoXMLAttr, std::string> >& attrs = GNEAttributeCarrier::allowedAttributes(tag);
283  SumoXMLAttr attr = attrs.at(myMatchAttrBox->getCurrentItem()).first;
284  std::string expr(myMatchString->getText().text());
285  bool valid = true;
286 
287  if (expr == "") {
288  // the empty expression matches all objects
289  handleIDs(getMatches(tag, attr, '@', 0, expr), false);
290  } else if (GNEAttributeCarrier::isNumerical(attr)) {
291  // The expression must have the form
292  // <val matches if attr < val
293  // >val matches if attr > val
294  // =val matches if attr = val
295  // val matches if attr = val
296  char compOp = expr[0];
297  if (compOp == '<' || compOp == '>' || compOp == '=') {
298  expr = expr.substr(1);
299  } else {
300  compOp = '=';
301  }
302  SUMOReal val;
303  std::istringstream buf(expr);
304  buf >> val;
305  if (!buf.fail() && (int)buf.tellg() == (int)expr.size()) {
306  handleIDs(getMatches(tag, attr, compOp, val, expr), false);
307  } else {
308  valid = false;
309  }
310  } else {
311  // The expression must have the form
312  // =str: matches if <str> is an exact match
313  // !str: matches if <str> is not a substring
314  // ^str: matches if <str> is not an exact match
315  // str: matches if <str> is a substring (sends compOp '@')
316  // Alternatively, if the expression is empty it matches all objects
317  char compOp = expr[0];
318  if (compOp == '=' || compOp == '!' || compOp == '^') {
319  expr = expr.substr(1);
320  } else {
321  compOp = '@';
322  }
323  handleIDs(getMatches(tag, attr, compOp, 0, expr), false);
324  }
325  if (valid) {
326  myMatchString->setTextColor(FXRGB(0, 0, 0));
327  myMatchString->killFocus();
328  } else {
329  myMatchString->setTextColor(FXRGB(255, 0, 0));
330  }
331 
332  return 1;
333 }
334 
335 
336 long
337 GNESelectorFrame::onCmdHelp(FXObject*, FXSelector, void*) {
338  FXDialogBox* helpDialog = new FXDialogBox(this, "Match Attribute Help", DECOR_CLOSE | DECOR_TITLE);
339  std::ostringstream help;
340  help
341  << "The 'Match Attribute' controls allow to specify a set of objects which are then applied to the current selection "
342  << "according to the current 'Modification Mode'.\n"
343  << "1. Select an object type from the first input box\n"
344  << "2. Select an attribute from the second input box\n"
345  << "3. Enter a 'match expression' in the third input box and press <return>\n"
346  << "\n"
347  << "The empty expression matches all objects\n"
348  << "For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.\n"
349  << "An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'\n"
350  << "\n"
351  << "For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.\n"
352  << " '' (no operator) matches if string is a substring of that object'ts attribute.\n"
353  << " '=' matches if string is an exact match.\n"
354  << " '!' matches if string is not a substring.\n"
355  << " '^' matches if string is not an exact match.\n"
356  << "\n"
357  << "Examples:\n"
358  << "junction; id; 'foo' -> match all junctions that have 'foo' in their id\n"
359  << "junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'\n"
360  << "edge; speed; '>10' -> match all edges with a speed above 10\n";
361  new FXLabel(helpDialog, help.str().c_str(), 0, JUSTIFY_LEFT);
362  // "OK"
363  new FXButton(helpDialog, "OK\t\tSave modifications", 0, helpDialog, FXDialogBox::ID_ACCEPT,
364  ICON_BEFORE_TEXT | LAYOUT_FILL_X | FRAME_THICK | FRAME_RAISED,
365  0, 0, 0, 0, 4, 4, 3, 3);
366  helpDialog->create();
367  helpDialog->show();
368  return 1;
369 }
370 
371 
372 long
373 GNESelectorFrame::onCmdScaleSelection(FXObject*, FXSelector, void*) {
375  myViewNet->update();
376  return 1;
377 }
378 
379 
380 void
382  gSelected.add2Update(this);
383  selectionUpdated(); // selection may have changed due to deletions
384  FXScrollWindow::show();
385  // Show and Frame Area in which this GNEFrame is placed
387 }
388 
389 
390 void
393  FXScrollWindow::hide();
394  // Hide Frame Area in which this GNEFrame is placed
396 }
397 
398 
399 std::string
401  return "Selection:\n" +
402  toString(gSelected.getSelected(GLO_JUNCTION).size()) + " Junctions\n" +
403  toString(gSelected.getSelected(GLO_EDGE).size()) + " Edges\n" +
404  toString(gSelected.getSelected(GLO_LANE).size()) + " Lanes\n" +
405  toString(gSelected.getSelected(GLO_CONNECTION).size()) + " Connections\n" +
406  toString(gSelected.getSelected(GLO_ADDITIONAL).size()) + " Additionals\n";
407 }
408 
409 
410 void
412  myFrameHeaderLabel->setText(getStats().c_str());
413  update();
414 }
415 
416 
417 void
418 GNESelectorFrame::handleIDs(std::vector<GUIGlID> ids, bool selectEdges, SetOperation setop) {
419  const SetOperation setOperation = (setop == SET_DEFAULT ? (SetOperation)mySetOperation : setop);
420  std::set<GUIGlID> previousSelection;
421  myViewNet->getUndoList()->p_begin("change selection");
422  if (setOperation == SET_REPLACE) {
423  myViewNet->getUndoList()->add(new GNEChange_Selection(myViewNet->getNet(), std::set<GUIGlID>(), gSelected.getSelected(), true), true);
424  } else if (setOperation == SET_RESTRICT) {
425  previousSelection = gSelected.getSelected(); // have to make a copy
426  myViewNet->getUndoList()->add(new GNEChange_Selection(myViewNet->getNet(), std::set<GUIGlID>(), gSelected.getSelected(), true), true);
427  }
428  // handle ids
429  GUIGlObject* object;
430  GUIGlObjectType type;
431  std::set<GUIGlID> idsSet(ids.begin(), ids.end());
432  std::set<GUIGlID> selected;
433  std::set<GUIGlID> deselected;
434  if (myViewNet->autoSelectNodes()) {
435  for (std::vector<GUIGlID>::const_iterator it = ids.begin(); it != ids.end(); it++) {
436  GUIGlID id = *it;
437  if (id > 0) { // net object?
439  if (object->getType() == GLO_LANE && selectEdges) {
440  const GNEEdge& edge = (static_cast<GNELane*>(object))->getParentEdge();
441  idsSet.insert(edge.getGNEJunctionSource()->getGlID());
442  idsSet.insert(edge.getGNEJunctionDest()->getGlID());
443  }
445  }
446  }
447  }
448  for (std::set<GUIGlID>::const_iterator it = idsSet.begin(); it != idsSet.end(); it++) {
449  GUIGlID id = *it;
450  if (id > 0) { // net object?
452  if (object == 0) {
453  // in debug mode we would like to know about this.
454  // It might be caused by a corrupted gl-name stack.
455  // However, most cases of uninitizliaed values would go hidden since 0 is assumed to be the net object anyway
456  assert(false);
457  continue;
458  }
459  type = object->getType();
461  if (type == GLO_LANE && selectEdges) {
462  // @note edge may be selected/deselected multiple times but this shouldn't
463  // hurt unless we add SET_TOGGLE
464  id = (static_cast<GNELane*>(object))->getParentEdge().getGlID();
465  }
466  // doing the switch outside the loop requires functional techniques. this was deemed to ugly
467  switch (setOperation) {
470  selected.insert(id);
471  break;
473  deselected.insert(id);
474  break;
476  if (previousSelection.count(id)) {
477  selected.insert(id);
478  }
479  break;
480  default:
481  break;
482  }
483  }
484  }
485  myViewNet->getUndoList()->add(new GNEChange_Selection(myViewNet->getNet(), selected, deselected, true), true);
487  myViewNet->update();
488 }
489 
490 
491 std::vector<GUIGlID>
492 GNESelectorFrame::getMatches(SumoXMLTag tag, SumoXMLAttr attr, char compOp, SUMOReal val, const std::string& expr) {
493  GUIGlObject* object;
495  std::vector<GUIGlID> result;
496  const std::set<GUIGlID> allIDs = myViewNet->getNet()->getGlIDs();
497  const bool numerical = GNEAttributeCarrier::isNumerical(attr);
498  for (std::set<GUIGlID>::const_iterator it = allIDs.begin(); it != allIDs.end(); it++) {
499  GUIGlID id = *it;
501  if (!object) {
502  throw ProcessError("Unkown object passed to GNESelectorFrame::getMatches (id=" + toString(id) + ").");
503  }
504  ac = dynamic_cast<GNEAttributeCarrier*>(object);
505  if (ac && ac->getTag() == tag) { // not all objects need to be attribute carriers
506  if (expr == "") {
507  result.push_back(id);
508  } else if (numerical) {
509  SUMOReal acVal;
510  std::istringstream buf(ac->getAttribute(attr));
511  buf >> acVal;
512  switch (compOp) {
513  case '<':
514  if (acVal < val) {
515  result.push_back(id);
516  }
517  break;
518  case '>':
519  if (acVal > val) {
520  result.push_back(id);
521  }
522  break;
523  case '=':
524  if (acVal == val) {
525  result.push_back(id);
526  }
527  break;
528  }
529  } else {
530  // string match
531  std::string acVal = ac->getAttribute(attr);
532  if ((attr == SUMO_ATTR_ALLOW || attr == SUMO_ATTR_DISALLOW) && acVal == "all") {
534  }
535  switch (compOp) {
536  case '@':
537  if (acVal.find(expr) != std::string::npos) {
538  result.push_back(id);
539  }
540  break;
541  case '!':
542  if (acVal.find(expr) == std::string::npos) {
543  result.push_back(id);
544  }
545  break;
546  case '=':
547  if (acVal == expr) {
548  result.push_back(id);
549  }
550  break;
551  case '^':
552  if (acVal != expr) {
553  result.push_back(id);
554  }
555  break;
556  }
557  }
558  }
560  }
561  return result;
562 }
563 
564 /****************************************************************************/
SumoXMLTag
Numbers representing SUMO-XML - element names.
bool selectEdges()
whether inspection, selection and inversion should apply to edges or to lanes
Definition: GNEViewNet.cpp:322
void selectionUpdated()
called if currently registered for updates for changes of global selection
void hideFramesArea()
hide frames area if all GNEFrames are hidden
FXuint mySetOperation
how to modify selection
GNEJunction * getGNEJunctionSource() const
returns the source-junction
Definition: GNEEdge.cpp:159
static bool isNumerical(SumoXMLAttr attr)
whether an attribute is numerical (int or float)
long onCmdSelMBString(FXObject *, FXSelector, void *)
Called when the user enters a new selection expression.
std::string getStats() const
get stats
GUIGlObjectType
SetOperation
FOX-declaration.
FXDEFMAP(GNESelectorFrame) GNESelectorFrameMap[]
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user presses the Save-button.
void toggleSelection(GUIGlID id)
Toggles selection of an object.
std::set< GUIGlID > getGlIDs(GUIGlObjectType type=GLO_MAX)
Definition: GNENet.cpp:838
a connection
void show()
show Frame
FXTextField * myMatchString
string of the match
FXRealSpinDial * mySelectionScaling
selection scaling
void showFramesArea()
show frames area if at least a GNEFrame is showed
FXListBox * myMatchTagBox
tag of the match box
void setSelectionScaling(SUMOReal selectionScale)
set selection scaling
Definition: GNEViewNet.cpp:346
void remove2Update()
Removes the dialog to be updated.
Deselect selected items.
Definition: GUIAppEnum.h:353
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:55
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:86
long onCmdLoad(FXObject *, FXSelector, void *)
Called when the user presses the Load-button.
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
FXString gCurrentFolder
The folder used as last.
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
Save set.
Definition: GUIAppEnum.h:345
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:906
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.
static const std::vector< std::pair< SumoXMLAttr, std::string > > & allowedAttributes(SumoXMLTag tag)
get all editable attributes for tag and their default values.
long onCmdHelp(FXObject *, FXSelector, void *)
Called when the user clicks the help button.
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:918
GNEViewNet * myViewNet
the window to inform when the tls is modfied
Definition: GNEFrame.h:85
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...
~GNESelectorFrame()
Destructor.
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
long onCmdScaleSelection(FXObject *, FXSelector, void *)
Called when the user changes visual scaling.
long onCmdClear(FXObject *, FXSelector, void *)
Called when the user presses the Clear-button.
selector match box messages
Definition: GUIAppEnum.h:422
const std::set< GUIGlID > & getSelected() const
Returns the list of ids of all selected objects.
static const std::vector< SumoXMLTag > & allowedTags()
get all editable for tag.
FXdouble getValue() const
Return current value.
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:93
FXLabel * myFrameHeaderLabel
the label for the frame's header
Definition: GNEFrame.h:91
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
GNEJunction * getGNEJunctionDest() const
returns the destination-junction
Definition: GNEEdge.cpp:165
bool autoSelectNodes()
whether to autoselect nodes or to lanes
Definition: GNEViewNet.cpp:340
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
const std::string ALL_VCLASS_NAMES_MATCH_STRING
the string that should be matched against if attr 'allowed' or 'disalloed' are set to "all" ...
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:55
Clear set.
Definition: GUIAppEnum.h:347
set subset of elements
Definition: GUIAppEnum.h:341
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:55
unsigned int GUIGlID
Definition: GUIGlObject.h:50
compound additional
long onCmdSubset(FXObject *, FXSelector, void *)
static const std::vector< SumoXMLTag > & allowedAdditionalTags()
get all editable tags for additionals
void add2Update(UpdateTarget *updateTarget)
Adds a dialog to be updated.
Load set.
Definition: GUIAppEnum.h:343
long onCmdInvert(FXObject *, FXSelector, void *)
Called when the user presses the Invert-button.
static const std::vector< SumoXMLTag > & allowedNetElementTags()
get all editable tags for netElements
an edge
FXListBox * myMatchAttrBox
attributes of the match box
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:912
void handleIDs(std::vector< GUIGlID > ids, bool selectEdges, SetOperation setop=SET_DEFAULT)
apply list of ids to the current selection according to SetOperation,
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:188
SumoXMLTag getTag() const
get Tag assigned to this object
#define SUMOReal
Definition: config.h:214
void unblockObject(GUIGlID id)
Marks an object as unblocked.
void hide()
hide Frame
Spinner control.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
long onCmdSelMBTag(FXObject *, FXSelector, void *)
Called when the user selectes a tag in the match box.
FXListBox * mySetBox
tag of the sets of elements
GUISelectedStorage gSelected
A global holder of selected objects.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void save(GUIGlObjectType type, const std::string &filename)
Saves a selection list.
a junction