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