Eclipse SUMO - Simulation of Urban MObility
GNESelectorFrame.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // The Widget for modifying selections of network-elements
19 /****************************************************************************/
20 #include <config.h>
21 
22 #include <netedit/GNENet.h>
23 #include <netedit/GNEUndoList.h>
24 #include <netedit/GNEViewNet.h>
31 
32 #include "GNESelectorFrame.h"
33 
34 
35 // ===========================================================================
36 // FOX callback mapping
37 // ===========================================================================
40 };
41 
42 FXDEFMAP(GNESelectorFrame::ModificationMode) ModificationModeMap[] = {
44 };
45 
48 };
49 
55 };
56 
57 FXDEFMAP(GNESelectorFrame::MatchGenericDataAttribute) MatchGenericDataAttributeMap[] = {
65 };
66 
69 };
70 
71 FXDEFMAP(GNESelectorFrame::SelectionOperation) SelectionOperationMap[] = {
76 };
77 
78 // Object implementation
79 FXIMPLEMENT(GNESelectorFrame::LockGLObjectTypes::ObjectTypeEntry, FXObject, ObjectTypeEntryMap, ARRAYNUMBER(ObjectTypeEntryMap))
80 FXIMPLEMENT(GNESelectorFrame::ModificationMode, FXGroupBox, ModificationModeMap, ARRAYNUMBER(ModificationModeMap))
81 FXIMPLEMENT(GNESelectorFrame::ElementSet, FXGroupBox, ElementSetMap, ARRAYNUMBER(ElementSetMap))
82 FXIMPLEMENT(GNESelectorFrame::MatchAttribute, FXGroupBox, MatchAttributeMap, ARRAYNUMBER(MatchAttributeMap))
83 FXIMPLEMENT(GNESelectorFrame::MatchGenericDataAttribute, FXGroupBox, MatchGenericDataAttributeMap, ARRAYNUMBER(MatchGenericDataAttributeMap))
84 FXIMPLEMENT(GNESelectorFrame::VisualScaling, FXGroupBox, VisualScalingMap, ARRAYNUMBER(VisualScalingMap))
85 FXIMPLEMENT(GNESelectorFrame::SelectionOperation, FXGroupBox, SelectionOperationMap, ARRAYNUMBER(SelectionOperationMap))
86 
87 // ===========================================================================
88 // method definitions
89 // ===========================================================================
90 
91 // ---------------------------------------------------------------------------
92 // ModificationMode::LockGLObjectTypes - methods
93 // ---------------------------------------------------------------------------
94 
96  FXGroupBox(selectorFrameParent->myContentFrame, "Locked selected items", GUIDesignGroupBoxFrame),
97  mySelectorFrameParent(selectorFrameParent) {
98  // create a matrix for TypeEntries
99  FXMatrix* matrixLockGLObjectTypes = new FXMatrix(this, 3, GUIDesignMatrixLockGLTypes);
100  // create typeEntries for Network elements
101  myTypeEntries[GLO_JUNCTION] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::NETWORK, "Junctions");
102  myTypeEntries[GLO_EDGE] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::NETWORK, "Edges");
103  myTypeEntries[GLO_LANE] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::NETWORK, "Lanes");
104  myTypeEntries[GLO_CONNECTION] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::NETWORK, "Connections");
105  myTypeEntries[GLO_CROSSING] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::NETWORK, "Crossings");
106  myTypeEntries[GLO_ADDITIONALELEMENT] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::NETWORK, "Additionals");
107  myTypeEntries[GLO_TAZ] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::NETWORK, "TAZs");
108  myTypeEntries[GLO_POLYGON] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::NETWORK, "Polygons");
109  myTypeEntries[GLO_POI] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::NETWORK, "POIs");
110  // create typeEntries for Demand elements
111  myTypeEntries[GLO_ROUTE] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DEMAND, "Routes");
112  myTypeEntries[GLO_VEHICLE] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DEMAND, "Vehicles");
113  myTypeEntries[GLO_ROUTEFLOW] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DEMAND, "Flows");
114  myTypeEntries[GLO_TRIP] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DEMAND, "Trips");
115  myTypeEntries[GLO_FLOW] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DEMAND, "Flow");
116  myTypeEntries[GLO_STOP] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DEMAND, "Stops");
117  myTypeEntries[GLO_PERSON] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DEMAND, "Persons");
118  myTypeEntries[GLO_PERSONFLOW] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DEMAND, "PersonFlows");
119  myTypeEntries[GLO_PERSONTRIP] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DEMAND, "PersonTrips");
120  myTypeEntries[GLO_RIDE] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DEMAND, "Rides");
121  myTypeEntries[GLO_WALK] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DEMAND, "Walks");
122  myTypeEntries[GLO_PERSONSTOP] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DEMAND, "PersonStops");
123  // create typeEntries for Data elements
124  myTypeEntries[GLO_EDGEDATA] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DATA, "EdgeDatas");
125  myTypeEntries[GLO_EDGERELDATA] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DATA, "EdgeRelDatas");
126  myTypeEntries[GLO_TAZRELDATA] = new ObjectTypeEntry(matrixLockGLObjectTypes, Supermode::DATA, "EdgeRelDatas");
127 }
128 
129 
131  // remove all type entries
132  for (const auto& typeEntry : myTypeEntries) {
133  delete typeEntry.second;
134  }
135 }
136 
137 
138 void
140  if ((type >= 100) && (type < 199)) {
141  myTypeEntries.at(GLO_ADDITIONALELEMENT)->counterUp();
142  } else {
143  myTypeEntries.at(type)->counterUp();
144  }
145 }
146 
147 
148 void
150  if ((type >= 100) && (type < 199)) {
151  myTypeEntries.at(GLO_ADDITIONALELEMENT)->counterDown();
152  } else {
153  myTypeEntries.at(type)->counterDown();
154  }
155 }
156 
157 
158 bool
160  if ((type >= 100) && (type < 199)) {
161  return myTypeEntries.at(GLO_ADDITIONALELEMENT)->isGLTypeLocked();
162  } else {
163  return myTypeEntries.at(type)->isGLTypeLocked();
164  }
165 }
166 
167 
168 void
170  for (const auto& typeEntry : myTypeEntries) {
171  // show or hidde type entries depending of current supermode
172  if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork() && (typeEntry.second->getSupermode() == Supermode::NETWORK)) {
173  typeEntry.second->showObjectTypeEntry();
174  } else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeDemand() && (typeEntry.second->getSupermode() == Supermode::DEMAND)) {
175  typeEntry.second->showObjectTypeEntry();
176  } else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeData() && (typeEntry.second->getSupermode() == Supermode::DATA)) {
177  typeEntry.second->showObjectTypeEntry();
178  } else {
179  typeEntry.second->hideObjectTypeEntry();
180  }
181  }
182  // recalc frame parent
183  recalc();
184 }
185 
186 
187 GNESelectorFrame::LockGLObjectTypes::ObjectTypeEntry::ObjectTypeEntry(FXMatrix* matrixParent, const Supermode supermode, const std::string& label) :
188  FXObject(),
189  mySupermode(supermode),
190  myLabelCounter(nullptr),
191  myLabelTypeName(nullptr),
192  myCheckBoxLocked(nullptr),
193  myCounter(0) {
194  // create elements
195  myLabelCounter = new FXLabel(matrixParent, "0", nullptr, GUIDesignLabelLeft);
196  myLabelTypeName = new FXLabel(matrixParent, (label + " ").c_str(), nullptr, GUIDesignLabelLeft);
197  myCheckBoxLocked = new FXCheckButton(matrixParent, "unlocked", this, MID_GNE_SET_ATTRIBUTE, GUIDesignCheckButton);
198 }
199 
200 
201 Supermode
203  return mySupermode;
204 }
205 
206 
207 void
209  myLabelCounter->show();
210  myLabelTypeName->show();
211  myCheckBoxLocked->show();
212 }
213 
214 
215 void
217  myLabelCounter->hide();
218  myLabelTypeName->hide();
219  myCheckBoxLocked->hide();
220 }
221 
222 
223 void
225  myCounter++;
226  myLabelCounter->setText(toString(myCounter).c_str());
227 }
228 
229 
230 void
232  myCounter--;
233  myLabelCounter->setText(toString(myCounter).c_str());
234 }
235 
236 
237 bool
239  return (myCheckBoxLocked->getCheck() == TRUE);
240 }
241 
242 
243 long
245  if (myCheckBoxLocked->getCheck() == TRUE) {
246  myCheckBoxLocked->setText("locked");
247  } else {
248  myCheckBoxLocked->setText("unlocked");
249  }
250  return 1;
251 }
252 
253 
255  FXObject(),
256  mySupermode(Supermode::NETWORK),
257  myLabelCounter(nullptr),
258  myLabelTypeName(nullptr),
259  myCheckBoxLocked(nullptr),
260  myCounter(0) {
261 }
262 
263 // ---------------------------------------------------------------------------
264 // ModificationMode::ModificationMode - methods
265 // ---------------------------------------------------------------------------
266 
268  FXGroupBox(selectorFrameParent->myContentFrame, "Modification Mode", GUIDesignGroupBoxFrame),
269  myModificationModeType(Operation::ADD) {
270  // Create all options buttons
271  myAddRadioButton = new FXRadioButton(this, "add\t\tSelected objects are added to the previous selection",
273  myRemoveRadioButton = new FXRadioButton(this, "remove\t\tSelected objects are removed from the previous selection",
275  myKeepRadioButton = new FXRadioButton(this, "keep\t\tRestrict previous selection by the current selection",
277  myReplaceRadioButton = new FXRadioButton(this, "replace\t\tReplace previous selection by the current selection",
279  myAddRadioButton->setCheck(true);
280 }
281 
282 
284 
285 
288  return myModificationModeType;
289 }
290 
291 
292 long
294  if (obj == myAddRadioButton) {
295  myModificationModeType = Operation::ADD;
296  myAddRadioButton->setCheck(true);
297  myRemoveRadioButton->setCheck(false);
298  myKeepRadioButton->setCheck(false);
299  myReplaceRadioButton->setCheck(false);
300  return 1;
301  } else if (obj == myRemoveRadioButton) {
302  myModificationModeType = Operation::SUB;
303  myAddRadioButton->setCheck(false);
304  myRemoveRadioButton->setCheck(true);
305  myKeepRadioButton->setCheck(false);
306  myReplaceRadioButton->setCheck(false);
307  return 1;
308  } else if (obj == myKeepRadioButton) {
309  myModificationModeType = Operation::RESTRICT;
310  myAddRadioButton->setCheck(false);
311  myRemoveRadioButton->setCheck(false);
312  myKeepRadioButton->setCheck(true);
313  myReplaceRadioButton->setCheck(false);
314  return 1;
315  } else if (obj == myReplaceRadioButton) {
316  myModificationModeType = Operation::REPLACE;
317  myAddRadioButton->setCheck(false);
318  myRemoveRadioButton->setCheck(false);
319  myKeepRadioButton->setCheck(false);
320  myReplaceRadioButton->setCheck(true);
321  return 1;
322  } else {
323  return 0;
324  }
325 }
326 
327 // ---------------------------------------------------------------------------
328 // ModificationMode::ElementSet - methods
329 // ---------------------------------------------------------------------------
330 
332  FXGroupBox(selectorFrameParent->myContentFrame, "Element Set", GUIDesignGroupBoxFrame),
333  mySelectorFrameParent(selectorFrameParent),
334  myCurrentElementSet(Type::NETWORKELEMENT) {
335  // Create MatchTagBox for tags and fill it
337 }
338 
339 
341 
342 
345  return myCurrentElementSet;
346 }
347 
348 
349 void
351  // first clear item
352  mySetComboBox->clearItems();
353  // now fill elements depending of supermode
354  if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) {
355  mySetComboBox->appendItem("network element");
356  mySetComboBox->appendItem("Additional");
357  mySetComboBox->appendItem("Shape");
358  // show Modul
359  show();
360  // set num items
361  mySetComboBox->setNumVisible(mySetComboBox->getNumItems());
362  } else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeDemand()) {
363  mySetComboBox->appendItem("Demand Element");
364  // hide Modul (because there is only an element)
365  hide();
366  } else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeData()) {
367  mySetComboBox->appendItem("Data Element");
368  // hide Modul (because there is only an element)
369  hide();
370  }
371  // update rest of elements
372  onCmdSelectElementSet(0, 0, 0);
373 }
374 
375 
376 long
378  // check depending of current supermode
379  if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) {
380  // enable moduls
381  mySelectorFrameParent->myMatchAttribute->showMatchAttribute();
382  mySelectorFrameParent->myMatchGenericDataAttribute->hideMatchGenericDataAttribute();
383  if (mySetComboBox->getText() == "network element") {
384  myCurrentElementSet = Type::NETWORKELEMENT;
385  mySetComboBox->setTextColor(FXRGB(0, 0, 0));
386  // enable match attribute
387  mySelectorFrameParent->myMatchAttribute->enableMatchAttribute();
388  } else if (mySetComboBox->getText() == "Additional") {
389  myCurrentElementSet = Type::ADDITIONALELEMENT;
390  mySetComboBox->setTextColor(FXRGB(0, 0, 0));
391  // enable match attribute
392  mySelectorFrameParent->myMatchAttribute->enableMatchAttribute();
393  } else if (mySetComboBox->getText() == "TAZ") {
394  myCurrentElementSet = Type::TAZELEMENT;
395  mySetComboBox->setTextColor(FXRGB(0, 0, 0));
396  // enable match attribute
397  mySelectorFrameParent->myMatchAttribute->enableMatchAttribute();
398  } else if (mySetComboBox->getText() == "Shape") {
399  myCurrentElementSet = Type::SHAPE;
400  mySetComboBox->setTextColor(FXRGB(0, 0, 0));
401  // enable match attribute
402  mySelectorFrameParent->myMatchAttribute->enableMatchAttribute();
403  } else {
404  myCurrentElementSet = Type::INVALID;
405  mySetComboBox->setTextColor(FXRGB(255, 0, 0));
406  // disable match attribute
407  mySelectorFrameParent->myMatchAttribute->disableMatchAttribute();
408  }
409  } else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeDemand()) {
410  // enable moduls
411  mySelectorFrameParent->myMatchAttribute->showMatchAttribute();
412  mySelectorFrameParent->myMatchGenericDataAttribute->hideMatchGenericDataAttribute();
413  if (mySetComboBox->getText() == "Demand Element") {
414  myCurrentElementSet = Type::DEMANDELEMENT;
415  mySetComboBox->setTextColor(FXRGB(0, 0, 0));
416  // enable match attribute
417  mySelectorFrameParent->myMatchAttribute->enableMatchAttribute();
418  } else {
419  myCurrentElementSet = Type::INVALID;
420  mySetComboBox->setTextColor(FXRGB(255, 0, 0));
421  // disable match attribute
422  mySelectorFrameParent->myMatchAttribute->disableMatchAttribute();
423  }
424  } else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeData()) {
425  // enable moduls
426  mySelectorFrameParent->myMatchAttribute->hideMatchAttribute();
427  mySelectorFrameParent->myMatchGenericDataAttribute->showMatchGenericDataAttribute();
428  if (mySetComboBox->getText() == "Data Element") {
429  myCurrentElementSet = Type::DATA;
430  mySetComboBox->setTextColor(FXRGB(0, 0, 0));
431  // enable match attribute
432  mySelectorFrameParent->myMatchGenericDataAttribute->enableMatchGenericDataAttribute();
433  } else {
434  myCurrentElementSet = Type::INVALID;
435  mySetComboBox->setTextColor(FXRGB(255, 0, 0));
436  // disable match attribute
437  mySelectorFrameParent->myMatchGenericDataAttribute->enableMatchGenericDataAttribute();
438  }
439  }
440  return 1;
441 }
442 
443 // ---------------------------------------------------------------------------
444 // ModificationMode::MatchAttribute - methods
445 // ---------------------------------------------------------------------------
446 
448  FXGroupBox(selectorFrameParent->myContentFrame, "Match Attribute", GUIDesignGroupBoxFrame),
449  mySelectorFrameParent(selectorFrameParent),
450  myCurrentTag(SUMO_TAG_EDGE),
451  myCurrentAttribute(SUMO_ATTR_ID) {
452  // Create MatchTagBox for tags
454  // Create listBox for Attributes
456  // Create TextField for Match string
458  // create button
459  myMatchStringButton = new FXButton(this, "Apply selection", nullptr, this, MID_GNE_SELECTORFRAME_PROCESSSTRING, GUIDesignButton);
460  // Create help button
461  new FXButton(this, "Help", nullptr, this, MID_HELP, GUIDesignButtonRectangular);
462  // Fill list of sub-items (first element will be "edge")
464  // Set speed of edge as default attribute
465  myMatchAttrComboBox->setText("speed");
467  // Set default value for Match string
468  myMatchString->setText(">10.0");
469 }
470 
471 
473 
474 
475 void
477  // enable comboBox, text field and button
478  myMatchTagComboBox->enable();
479  myMatchAttrComboBox->enable();
480  myMatchString->enable();
481  myMatchStringButton->enable();
482  // Clear items of myMatchTagComboBox
483  myMatchTagComboBox->clearItems();
484  // Set items depending of current item set
485  std::vector<std::pair<SumoXMLTag, const std::string> > ACTags;
486  if (mySelectorFrameParent->myElementSet->getElementSet() == ElementSet::Type::NETWORKELEMENT) {
487  ACTags = GNEAttributeCarrier::getAllowedTagsByCategory(GNETagProperties::TagType::NETWORKELEMENT, true);
488  } else if (mySelectorFrameParent->myElementSet->getElementSet() == ElementSet::Type::ADDITIONALELEMENT) {
489  ACTags = GNEAttributeCarrier::getAllowedTagsByCategory(GNETagProperties::TagType::ADDITIONALELEMENT, true);
490  } else if (mySelectorFrameParent->myElementSet->getElementSet() == ElementSet::Type::SHAPE) {
491  ACTags = GNEAttributeCarrier::getAllowedTagsByCategory(GNETagProperties::TagType::SHAPE, true);
492  } else if (mySelectorFrameParent->myElementSet->getElementSet() == ElementSet::Type::TAZELEMENT) {
493  ACTags = GNEAttributeCarrier::getAllowedTagsByCategory(GNETagProperties::TagType::TAZELEMENT, true);
494  } else if (mySelectorFrameParent->myElementSet->getElementSet() == ElementSet::Type::DEMANDELEMENT) {
495  ACTags = GNEAttributeCarrier::getAllowedTagsByCategory(GNETagProperties::TagType::DEMANDELEMENT | GNETagProperties::TagType::STOP, true);
496  } else {
497  throw ProcessError("Invalid element set");
498  }
499  // fill combo box
500  for (const auto& ACTag : ACTags) {
501  myMatchTagComboBox->appendItem(ACTag.second.c_str());
502  }
503  // set first item as current item
504  myMatchTagComboBox->setCurrentItem(0);
505  myMatchTagComboBox->setNumVisible(myMatchTagComboBox->getNumItems());
506  // Fill attributes with the current element type
507  onCmdSelMBTag(nullptr, 0, nullptr);
508 }
509 
510 
511 void
513  // disable comboboxes and text field
514  myMatchTagComboBox->disable();
515  myMatchAttrComboBox->disable();
516  myMatchString->disable();
517  myMatchStringButton->disable();
518  // change colors to black (even if there are invalid values)
519  myMatchTagComboBox->setTextColor(FXRGB(0, 0, 0));
520  myMatchAttrComboBox->setTextColor(FXRGB(0, 0, 0));
521  myMatchString->setTextColor(FXRGB(0, 0, 0));
522 }
523 
524 
525 void
527  show();
528 }
529 
530 
531 void
533  hide();
534 }
535 
536 
537 long
538 GNESelectorFrame::MatchAttribute::onCmdSelMBTag(FXObject*, FXSelector, void*) {
539  // First check what type of elementes is being selected
540  myCurrentTag = SUMO_TAG_NOTHING;
541  // find current element tag
542  std::vector<std::pair<SumoXMLTag, const std::string> > ACTags;
543  if (mySelectorFrameParent->myElementSet->getElementSet() == ElementSet::Type::NETWORKELEMENT) {
544  ACTags = GNEAttributeCarrier::getAllowedTagsByCategory(GNETagProperties::TagType::NETWORKELEMENT, true);
545  } else if (mySelectorFrameParent->myElementSet->getElementSet() == ElementSet::Type::ADDITIONALELEMENT) {
546  ACTags = GNEAttributeCarrier::getAllowedTagsByCategory(GNETagProperties::TagType::ADDITIONALELEMENT, true);
547  } else if (mySelectorFrameParent->myElementSet->getElementSet() == ElementSet::Type::SHAPE) {
548  ACTags = GNEAttributeCarrier::getAllowedTagsByCategory(GNETagProperties::TagType::SHAPE, true);
549  } else if (mySelectorFrameParent->myElementSet->getElementSet() == ElementSet::Type::TAZELEMENT) {
550  ACTags = GNEAttributeCarrier::getAllowedTagsByCategory(GNETagProperties::TagType::TAZELEMENT, true);
551  } else if (mySelectorFrameParent->myElementSet->getElementSet() == ElementSet::Type::DEMANDELEMENT) {
552  ACTags = GNEAttributeCarrier::getAllowedTagsByCategory(GNETagProperties::TagType::DEMANDELEMENT | GNETagProperties::TagType::STOP, true);
553  } else {
554  throw ProcessError("Unkown set");
555  }
556  // fill myMatchTagComboBox
557  for (const auto& ACTag : ACTags) {
558  if (ACTag.second == myMatchTagComboBox->getText().text()) {
559  myCurrentTag = ACTag.first;
560  }
561  }
562  // check that typed-by-user value is correct
563  if (myCurrentTag != SUMO_TAG_NOTHING) {
564  // obtain tag property (only for improve code legibility)
565  const auto& tagValue = GNEAttributeCarrier::getTagProperties(myCurrentTag);
566  // set color and enable items
567  myMatchTagComboBox->setTextColor(FXRGB(0, 0, 0));
568  myMatchAttrComboBox->enable();
569  myMatchString->enable();
570  myMatchStringButton->enable();
571  myMatchAttrComboBox->clearItems();
572  // fill attribute combo box
573  for (const auto& attribute : tagValue) {
574  myMatchAttrComboBox->appendItem(attribute.getAttrStr().c_str());
575  }
576  // Add extra attribute "Parameter"
577  myMatchAttrComboBox->appendItem(toString(GNE_ATTR_PARAMETERS).c_str());
578  // check if item can block movement
579  if (tagValue.canBlockMovement()) {
580  myMatchAttrComboBox->appendItem(toString(GNE_ATTR_BLOCK_MOVEMENT).c_str());
581  }
582  // check if item can block shape
583  if (tagValue.canBlockShape()) {
584  myMatchAttrComboBox->appendItem(toString(GNE_ATTR_BLOCK_SHAPE).c_str());
585  }
586  // check if item can close shape
587  if (tagValue.canCloseShape()) {
588  myMatchAttrComboBox->appendItem(toString(GNE_ATTR_CLOSE_SHAPE).c_str());
589  }
590  // check if item can have parent
591  if (tagValue.isSlave()) {
592  myMatchAttrComboBox->appendItem(toString(GNE_ATTR_PARENT).c_str());
593  }
594  // @ToDo: Here can be placed a button to set the default value
595  myMatchAttrComboBox->setNumVisible(myMatchAttrComboBox->getNumItems());
596  // check if we have to update attribute
597  if (tagValue.hasAttribute(myCurrentAttribute)) {
598  myMatchAttrComboBox->setText(toString(myCurrentAttribute).c_str());
599  } else {
600  onCmdSelMBAttribute(nullptr, 0, nullptr);
601  }
602  } else {
603  // change color to red and disable items
604  myMatchTagComboBox->setTextColor(FXRGB(255, 0, 0));
605  myMatchAttrComboBox->disable();
606  myMatchString->disable();
607  myMatchStringButton->disable();
608  }
609  update();
610  return 1;
611 }
612 
613 
614 long
616  // first obtain a copy of item attributes vinculated with current tag
617  auto tagPropertiesCopy = GNEAttributeCarrier::getTagProperties(myCurrentTag);
618  // obtain tag property (only for improve code legibility)
619  const auto& tagValue = GNEAttributeCarrier::getTagProperties(myCurrentTag);
620  // add an extra AttributeValues to allow select ACs using as criterium "parameters"
621  GNEAttributeProperties extraAttrProperty;
622  extraAttrProperty = GNEAttributeProperties(GNE_ATTR_PARAMETERS,
623  GNEAttributeProperties::AttrProperty::STRING,
624  "Parameters");
625  tagPropertiesCopy.addAttribute(extraAttrProperty);
626  // add extra attribute if item can block movement
627  if (tagValue.canBlockMovement()) {
628  // add an extra AttributeValues to allow select ACs using as criterium "block movement"
630  GNEAttributeProperties::AttrProperty::BOOL | GNEAttributeProperties::AttrProperty::DEFAULTVALUESTATIC,
631  "Block movement",
632  "false");
633  tagPropertiesCopy.addAttribute(extraAttrProperty);
634  }
635  // add extra attribute if item can block shape
636  if (tagValue.canBlockShape()) {
637  // add an extra AttributeValues to allow select ACs using as criterium "block shape"
638  extraAttrProperty = GNEAttributeProperties(GNE_ATTR_BLOCK_SHAPE,
639  GNEAttributeProperties::AttrProperty::BOOL | GNEAttributeProperties::AttrProperty::DEFAULTVALUESTATIC,
640  "Block shape",
641  "false");
642  tagPropertiesCopy.addAttribute(extraAttrProperty);
643  }
644  // add extra attribute if item can close shape
645  if (tagValue.canCloseShape()) {
646  // add an extra AttributeValues to allow select ACs using as criterium "close shape"
647  extraAttrProperty = GNEAttributeProperties(GNE_ATTR_CLOSE_SHAPE,
648  GNEAttributeProperties::AttrProperty::BOOL | GNEAttributeProperties::AttrProperty::DEFAULTVALUESTATIC,
649  "Close shape",
650  "true");
651  tagPropertiesCopy.addAttribute(extraAttrProperty);
652  }
653  // add extra attribute if item can have parent
654  if (tagValue.isSlave()) {
655  // add an extra AttributeValues to allow select ACs using as criterium "parent"
656  extraAttrProperty = GNEAttributeProperties(GNE_ATTR_PARENT,
657  GNEAttributeProperties::AttrProperty::STRING,
658  "Parent element");
659  tagPropertiesCopy.addAttribute(extraAttrProperty);
660  }
661  // set current selected attribute
662  myCurrentAttribute = SUMO_ATTR_NOTHING;
663  for (const auto& attribute : tagPropertiesCopy) {
664  if (attribute.getAttrStr() == myMatchAttrComboBox->getText().text()) {
665  myCurrentAttribute = attribute.getAttr();
666  }
667  }
668  // check if selected attribute is valid
669  if (myCurrentAttribute != SUMO_ATTR_NOTHING) {
670  myMatchAttrComboBox->setTextColor(FXRGB(0, 0, 0));
671  myMatchString->enable();
672  myMatchStringButton->enable();
673  } else {
674  myMatchAttrComboBox->setTextColor(FXRGB(255, 0, 0));
675  myMatchString->disable();
676  myMatchStringButton->disable();
677  }
678  return 1;
679 }
680 
681 
682 long
684  // obtain expresion
685  std::string expr(myMatchString->getText().text());
686  const auto& tagValue = GNEAttributeCarrier::getTagProperties(myCurrentTag);
687  bool valid = true;
688  if (expr == "") {
689  // the empty expression matches all objects
690  mySelectorFrameParent->handleIDs(mySelectorFrameParent->getMatches(myCurrentTag, myCurrentAttribute, '@', 0, expr));
691  } else if (tagValue.hasAttribute(myCurrentAttribute) && tagValue.getAttributeProperties(myCurrentAttribute).isNumerical()) {
692  // The expression must have the form
693  // <val matches if attr < val
694  // >val matches if attr > val
695  // =val matches if attr = val
696  // val matches if attr = val
697  char compOp = expr[0];
698  if (compOp == '<' || compOp == '>' || compOp == '=') {
699  expr = expr.substr(1);
700  } else {
701  compOp = '=';
702  }
703  // check if value can be parsed to double
704  if (GNEAttributeCarrier::canParse<double>(expr.c_str())) {
705  mySelectorFrameParent->handleIDs(mySelectorFrameParent->getMatches(myCurrentTag, myCurrentAttribute, compOp, GNEAttributeCarrier::parse<double>(expr.c_str()), expr));
706  } else {
707  valid = false;
708  }
709  } else {
710  // The expression must have the form
711  // =str: matches if <str> is an exact match
712  // !str: matches if <str> is not a substring
713  // ^str: matches if <str> is not an exact match
714  // str: matches if <str> is a substring (sends compOp '@')
715  // Alternatively, if the expression is empty it matches all objects
716  char compOp = expr[0];
717  if (compOp == '=' || compOp == '!' || compOp == '^') {
718  expr = expr.substr(1);
719  } else {
720  compOp = '@';
721  }
722  mySelectorFrameParent->handleIDs(mySelectorFrameParent->getMatches(myCurrentTag, myCurrentAttribute, compOp, 0, expr));
723  }
724  if (valid) {
725  myMatchString->setTextColor(FXRGB(0, 0, 0));
726  myMatchString->killFocus();
727  myMatchStringButton->enable();
728  } else {
729  myMatchString->setTextColor(FXRGB(255, 0, 0));
730  myMatchStringButton->disable();
731  }
732  return 1;
733 }
734 
735 
736 long
737 GNESelectorFrame::MatchAttribute::onCmdHelp(FXObject*, FXSelector, void*) {
738  // Create dialog box
739  FXDialogBox* additionalNeteditAttributesHelpDialog = new FXDialogBox(this, "Netedit Parameters Help", GUIDesignDialogBox);
740  additionalNeteditAttributesHelpDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::MODEADDITIONAL));
741  // set help text
742  std::ostringstream help;
743  help
744  << "- The 'Match Attribute' controls allow to specify a set of objects which are then applied to the current selection\n"
745  << " according to the current 'Modification Mode'.\n"
746  << " 1. Select an object type from the first input box\n"
747  << " 2. Select an attribute from the second input box\n"
748  << " 3. Enter a 'match expression' in the third input box and press <return>\n"
749  << "\n"
750  << "- The empty expression matches all objects\n"
751  << "- For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.\n"
752  << "- An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'\n"
753  << "\n"
754  << "- For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.\n"
755  << " '' (no operator) matches if string is a substring of that object'ts attribute.\n"
756  << " '=' matches if string is an exact match.\n"
757  << " '!' matches if string is not a substring.\n"
758  << " '^' matches if string is not an exact match.\n"
759  << "\n"
760  << "- Examples:\n"
761  << " junction; id; 'foo' -> match all junctions that have 'foo' in their id\n"
762  << " junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'\n"
763  << " edge; speed; '>10' -> match all edges with a speed above 10\n";
764  // Create label with the help text
765  new FXLabel(additionalNeteditAttributesHelpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
766  // Create horizontal separator
767  new FXHorizontalSeparator(additionalNeteditAttributesHelpDialog, GUIDesignHorizontalSeparator);
768  // Create frame for OK Button
769  FXHorizontalFrame* myHorizontalFrameOKButton = new FXHorizontalFrame(additionalNeteditAttributesHelpDialog, GUIDesignAuxiliarHorizontalFrame);
770  // Create Button Close (And two more horizontal frames to center it)
771  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
772  new FXButton(myHorizontalFrameOKButton, "OK\t\tclose", GUIIconSubSys::getIcon(GUIIcon::ACCEPT), additionalNeteditAttributesHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
773  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
774  // Write Warning in console if we're in testing mode
775  WRITE_DEBUG("Opening help dialog of selector frame");
776  // create Dialog
777  additionalNeteditAttributesHelpDialog->create();
778  // show in the given position
779  additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
780  // refresh APP
781  getApp()->refresh();
782  // open as modal dialog (will block all windows until stop() or stopModal() is called)
783  getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
784  // Write Warning in console if we're in testing mode
785  WRITE_DEBUG("Close help dialog of selector frame");
786  return 1;
787 }
788 
789 // ---------------------------------------------------------------------------
790 // ModificationMode::MatchGenericDataAttribute - methods
791 // ---------------------------------------------------------------------------
792 
794  FXGroupBox(selectorFrameParent->myContentFrame, "Match GenericData Attribute", GUIDesignGroupBoxFrame),
795  mySelectorFrameParent(selectorFrameParent),
796  myIntervalSelector(nullptr),
797  myBegin(nullptr),
798  myEnd(nullptr),
799  myMatchGenericDataTagComboBox(nullptr),
800  myMatchGenericDataAttrComboBox(nullptr),
801  myCurrentTag(SUMO_TAG_EDGE),
802  myMatchGenericDataString(nullptr) {
803  // Create MatchGenericDataTagBox for tags
804  new FXLabel(this, "Interval [begin, end]", nullptr, GUIDesignLabelThick);
806  // Create textfield for begin and end
807  FXHorizontalFrame* myHorizontalFrameBeginEnd = new FXHorizontalFrame(this, GUIDesignAuxiliarHorizontalFrame);
808  myBegin = new FXTextField(myHorizontalFrameBeginEnd, GUIDesignTextFieldNCol, this, MID_GNE_SELECTORFRAME_SETBEGIN, GUIDesignTextField);
809  myEnd = new FXTextField(myHorizontalFrameBeginEnd, GUIDesignTextFieldNCol, this, MID_GNE_SELECTORFRAME_SETEND, GUIDesignTextField);
810  // Create MatchGenericDataTagBox myHorizontalFrameEnd tags
812  // Create listBox for Attributes
814  // Create TextField for MatchGenericData string
816  // Create help button
817  new FXButton(this, "Help", nullptr, this, MID_HELP, GUIDesignButtonRectangular);
818  // Fill list of sub-items (first element will be "edge")
820  // Set speed of edge as default attribute
821  myMatchGenericDataAttrComboBox->setText("speed");
823  // Set default value for MatchGenericData string
824  myMatchGenericDataString->setText(">10.0");
825 }
826 
827 
829 
830 
831 void
833  // first drop intervals
834  myIntervals.clear();
835  // iterate over all data sets
836  for (const auto& dataSet : mySelectorFrameParent->getViewNet()->getNet()->retrieveDataSets()) {
837  for (const auto& dataInterval : dataSet->getDataIntervalChildren()) {
838  myIntervals[std::make_pair(dataInterval.second->getAttributeDouble(SUMO_ATTR_BEGIN), dataInterval.second->getAttributeDouble(SUMO_ATTR_END))] = -1;
839  }
840  }
841  // disable modul if there isn't intervals
842  if (myIntervals.size() == 0) {
843  disableMatchGenericDataAttribute();
844  } else {
845  // enable comboboxes and text field
846  myIntervalSelector->enable();
847  myBegin->enable();
848  myEnd->enable();
849  myMatchGenericDataTagComboBox->enable();
850  myMatchGenericDataAttrComboBox->enable();
851  myMatchGenericDataString->enable();
852  // clear combo box interval selector
853  myIntervalSelector->clearItems();
854  // fill combo Box
855  for (auto& interval : myIntervals) {
856  interval.second = myIntervalSelector->appendItem((" [" + toString(interval.first.first) + "," + toString(interval.first.second) + "]").c_str());
857  }
858  // set number of visible items
859  if (myIntervalSelector->getNumItems() < 10) {
860  myIntervalSelector->setNumVisible(myIntervalSelector->getNumItems());
861  } else {
862  myIntervalSelector->setNumVisible(10);
863  }
864  // Clear items of myMatchGenericDataTagComboBox
865  myMatchGenericDataTagComboBox->clearItems();
866  // update begin and end
867  myBegin->setText(toString(myIntervals.begin()->first.first).c_str());
868  myBegin->setTextColor(FXRGB(0, 0, 0));
869  myEnd->setText(toString(myIntervals.begin()->first.second).c_str());
870  myEnd->setTextColor(FXRGB(0, 0, 0));
871  // get generic datas
872  const auto genericDataTags = GNEAttributeCarrier::getAllowedTagsByCategory(GNETagProperties::TagType::GENERICDATA, true);
873  // fill combo box
874  for (const auto& genericDataTag : genericDataTags) {
875  myMatchGenericDataTagComboBox->appendItem(genericDataTag.second.c_str());
876  }
877  // set first item as current item
878  myMatchGenericDataTagComboBox->setCurrentItem(0);
879  myMatchGenericDataTagComboBox->setNumVisible(myMatchGenericDataTagComboBox->getNumItems());
880  // call select tag
881  onCmdSelectTag(nullptr, 0, nullptr);
882  }
883 }
884 
885 
886 void
888  // disable comboboxes and text field
889  myIntervalSelector->disable();
890  myBegin->disable();
891  myEnd->disable();
892  myMatchGenericDataTagComboBox->disable();
893  myMatchGenericDataAttrComboBox->disable();
894  myMatchGenericDataString->disable();
895  // change colors to black (even if there are invalid values)
896  myMatchGenericDataTagComboBox->setTextColor(FXRGB(0, 0, 0));
897  myMatchGenericDataAttrComboBox->setTextColor(FXRGB(0, 0, 0));
898  myMatchGenericDataString->setTextColor(FXRGB(0, 0, 0));
899 }
900 
901 
902 void
904  // just show Modul
905  show();
906 }
907 
908 
909 void
911  // just hide modul
912  hide();
913 }
914 
915 
916 long
918  // iterate over interval and update begin and end
919  for (auto& interval : myIntervals) {
920  if (interval.second == myIntervalSelector->getCurrentItem()) {
921  // update begin
922  myBegin->setTextColor(FXRGB(0, 0, 0));
923  myBegin->setText(toString(interval.first.first).c_str());
924  // update end
925  myEnd->setTextColor(FXRGB(0, 0, 0));
926  myEnd->setText(toString(interval.first.second).c_str());
927  }
928  }
929  // call onCmdSelectTag
930  onCmdSelectTag(0, 0, 0);
931  return 1;
932 }
933 
934 
935 long
937  // check if can be parsed to double
938  if (GNEAttributeCarrier::canParse<double>(myBegin->getText().text()) &&
939  GNEAttributeCarrier::canParse<double>(myEnd->getText().text())) {
940  // set valid color text and kill focus
941  myBegin->setTextColor(FXRGB(0, 0, 0));
942  myBegin->killFocus();
943  // enable elements
944  myMatchGenericDataTagComboBox->enable();
945  myMatchGenericDataAttrComboBox->enable();
946  myMatchGenericDataString->enable();
947  // call onCmdSelectTag
948  onCmdSelectTag(0, 0, 0);
949  } else {
950  // set invalid color text
951  myBegin->setTextColor(FXRGB(255, 0, 0));
952  // disable elements
953  myMatchGenericDataTagComboBox->disable();
954  myMatchGenericDataAttrComboBox->disable();
955  myMatchGenericDataString->disable();
956  }
957  return 1;
958 }
959 
960 
961 long
963  // check if can be parsed to double
964  if (GNEAttributeCarrier::canParse<double>(myBegin->getText().text()) &&
965  GNEAttributeCarrier::canParse<double>(myEnd->getText().text())) {
966  // set valid color text and kill focus
967  myEnd->setTextColor(FXRGB(0, 0, 0));
968  myEnd->killFocus();
969  // enable elements
970  myMatchGenericDataTagComboBox->enable();
971  myMatchGenericDataAttrComboBox->enable();
972  myMatchGenericDataString->enable();
973  // call onCmdSelectTag
974  onCmdSelectTag(0, 0, 0);
975  } else {
976  // set invalid color text
977  myEnd->setTextColor(FXRGB(255, 0, 0));
978  // disable elements
979  myMatchGenericDataTagComboBox->disable();
980  myMatchGenericDataAttrComboBox->disable();
981  myMatchGenericDataString->disable();
982  }
983  return 1;
984 }
985 
986 
987 long
989  // First check what type of elementes is being selected
990  myCurrentTag = SUMO_TAG_NOTHING;
991  // get generic data tags
992  const auto listOfTags = GNEAttributeCarrier::getAllowedTagsByCategory(GNETagProperties::TagType::GENERICDATA, true);
993  // fill myMatchGenericDataTagComboBox
994  for (const auto& genericDataTag : listOfTags) {
995  if (genericDataTag.second == myMatchGenericDataTagComboBox->getText().text()) {
996  myCurrentTag = genericDataTag.first;
997  }
998  }
999  // check that typed-by-user value is correct
1000  if (myCurrentTag != SUMO_TAG_NOTHING) {
1001  // obtain begin and end
1002  const double begin = GNEAttributeCarrier::parse<double>(myBegin->getText().text());
1003  const double end = GNEAttributeCarrier::parse<double>(myEnd->getText().text());
1004  // obtain all Generic Data attributes for current generic tag
1005  auto attributes = mySelectorFrameParent->getViewNet()->getNet()->retrieveGenericDataParameters(toString(myCurrentTag), begin, end);
1006  // set color and enable items
1007  myMatchGenericDataTagComboBox->setTextColor(FXRGB(0, 0, 0));
1008  myMatchGenericDataAttrComboBox->enable();
1009  myMatchGenericDataString->enable();
1010  myMatchGenericDataAttrComboBox->clearItems();
1011  // add data set parent
1012  myMatchGenericDataAttrComboBox->appendItem(toString(GNE_ATTR_DATASET).c_str());
1013  // fill attribute combo box
1014  for (const auto& attribute : attributes) {
1015  myMatchGenericDataAttrComboBox->appendItem(attribute.c_str());
1016  }
1017  myMatchGenericDataAttrComboBox->setNumVisible(myMatchGenericDataAttrComboBox->getNumItems());
1018  onCmdSelectAttribute(nullptr, 0, nullptr);
1019  } else {
1020  // change color to red and disable items
1021  myMatchGenericDataTagComboBox->setTextColor(FXRGB(255, 0, 0));
1022  myMatchGenericDataAttrComboBox->disable();
1023  myMatchGenericDataString->disable();
1024  }
1025  update();
1026  return 1;
1027 }
1028 
1029 
1030 long
1032  // obtain all Generic Data attributes for current generic tag
1033  std::set<std::string> attributes = mySelectorFrameParent->getViewNet()->getNet()->retrieveGenericDataParameters(
1034  toString(myCurrentTag),
1035  GNEAttributeCarrier::parse<double>(myBegin->getText().text()),
1036  GNEAttributeCarrier::parse<double>(myEnd->getText().text()));
1037  // add extra data set parent attribute
1038  attributes.insert(toString(GNE_ATTR_DATASET));
1039  // clear current attribute
1040  myCurrentAttribute.clear();
1041  // set current selected attribute
1042  for (const auto& attribute : attributes) {
1043  if (attribute == myMatchGenericDataAttrComboBox->getText().text()) {
1044  myCurrentAttribute = attribute;
1045  }
1046  }
1047  // check if selected attribute is valid
1048  if (myCurrentAttribute.empty()) {
1049  myMatchGenericDataAttrComboBox->setTextColor(FXRGB(255, 0, 0));
1050  myMatchGenericDataString->disable();
1051  } else {
1052  myMatchGenericDataAttrComboBox->setTextColor(FXRGB(0, 0, 0));
1053  myMatchGenericDataString->enable();
1054  }
1055  return 1;
1056 }
1057 
1058 
1059 long
1061  // obtain expression and tag value
1062  std::string expression = myMatchGenericDataString->getText().text();
1063  bool valid = true;
1064  // get all Generic datas
1065  const auto genericDatas = mySelectorFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveGenericDatas(myCurrentTag,
1066  GNEAttributeCarrier::parse<double>(myBegin->getText().text()),
1067  GNEAttributeCarrier::parse<double>(myEnd->getText().text()));
1068  if (expression == "") {
1069  // the empty expression matches all objects
1070  mySelectorFrameParent->handleIDs(mySelectorFrameParent->getGenericMatches(genericDatas, myCurrentAttribute, '@', 0, expression));
1071  } else if (myCurrentAttribute != toString(GNE_ATTR_DATASET)) {
1072  // The expression must have the form
1073  // <val matches if attr < val
1074  // >val matches if attr > val
1075  // =val matches if attr = val
1076  // val matches if attr = val
1077  char compOp = expression[0];
1078  if ((compOp == '<') || (compOp == '>') || (compOp == '=')) {
1079  expression = expression.substr(1);
1080  } else {
1081  compOp = '=';
1082  }
1083  // check if value can be parsed to double
1084  if (GNEAttributeCarrier::canParse<double>(expression.c_str())) {
1085  mySelectorFrameParent->handleIDs(mySelectorFrameParent->getGenericMatches(genericDatas, myCurrentAttribute, compOp, GNEAttributeCarrier::parse<double>(expression.c_str()), expression));
1086  } else {
1087  valid = false;
1088  }
1089  } else {
1090  // The expression must have the form
1091  // =str: matches if <str> is an exact match
1092  // !str: matches if <str> is not a substring
1093  // ^str: matches if <str> is not an exact match
1094  // str: matches if <str> is a substring (sends compOp '@')
1095  // Alternatively, if the expression is empty it matches all objects
1096  char compOp = expression[0];
1097  if ((compOp == '=') || (compOp == '!') || (compOp == '^')) {
1098  expression = expression.substr(1);
1099  } else {
1100  compOp = '@';
1101  }
1102  mySelectorFrameParent->handleIDs(mySelectorFrameParent->getGenericMatches(genericDatas, myCurrentAttribute, compOp, 0, expression));
1103  }
1104  // change color depending of flag "valid"
1105  if (valid) {
1106  myMatchGenericDataString->setTextColor(FXRGB(0, 0, 0));
1107  myMatchGenericDataString->killFocus();
1108  } else {
1109  myMatchGenericDataString->setTextColor(FXRGB(255, 0, 0));
1110  }
1111  return 1;
1112 }
1113 
1114 
1115 long
1117  // Create dialog box
1118  FXDialogBox* additionalNeteditAttributesHelpDialog = new FXDialogBox(this, "Netedit Parameters Help", GUIDesignDialogBox);
1119  additionalNeteditAttributesHelpDialog->setIcon(GUIIconSubSys::getIcon(GUIIcon::MODEADDITIONAL));
1120  // set help text
1121  std::ostringstream help;
1122  help
1123  << "- The 'MatchGenericData Attribute' controls allow to specify a set of objects which are then applied to the current selection\n"
1124  << " according to the current 'Modification Mode'.\n"
1125  << " 1. Select an object type from the first input box\n"
1126  << " 2. Select an attribute from the second input box\n"
1127  << " 3. Enter a 'match expression' in the third input box and press <return>\n"
1128  << "\n"
1129  << "- The empty expression matches all objects\n"
1130  << "- For numerical attributes the match expression must consist of a comparison operator ('<', '>', '=') and a number.\n"
1131  << "- An object matches if the comparison between its attribute and the given number by the given operator evaluates to 'true'\n"
1132  << "\n"
1133  << "- For string attributes the match expression must consist of a comparison operator ('', '=', '!', '^') and a string.\n"
1134  << " '' (no operator) matches if string is a substring of that object'ts attribute.\n"
1135  << " '=' matches if string is an exact match.\n"
1136  << " '!' matches if string is not a substring.\n"
1137  << " '^' matches if string is not an exact match.\n"
1138  << "\n"
1139  << "- Examples:\n"
1140  << " junction; id; 'foo' -> match all junctions that have 'foo' in their id\n"
1141  << " junction; type; '=priority' -> match all junctions of type 'priority', but not of type 'priority_stop'\n"
1142  << " edge; speed; '>10' -> match all edges with a speed above 10\n";
1143  // Create label with the help text
1144  new FXLabel(additionalNeteditAttributesHelpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
1145  // Create horizontal separator
1146  new FXHorizontalSeparator(additionalNeteditAttributesHelpDialog, GUIDesignHorizontalSeparator);
1147  // Create frame for OK Button
1148  FXHorizontalFrame* myHorizontalFrameOKButton = new FXHorizontalFrame(additionalNeteditAttributesHelpDialog, GUIDesignAuxiliarHorizontalFrame);
1149  // Create Button Close (And two more horizontal frames to center it)
1150  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
1151  new FXButton(myHorizontalFrameOKButton, "OK\t\tclose", GUIIconSubSys::getIcon(GUIIcon::ACCEPT), additionalNeteditAttributesHelpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
1152  new FXHorizontalFrame(myHorizontalFrameOKButton, GUIDesignAuxiliarHorizontalFrame);
1153  // Write Warning in console if we're in testing mode
1154  WRITE_DEBUG("Opening help dialog of selector frame");
1155  // create Dialog
1156  additionalNeteditAttributesHelpDialog->create();
1157  // show in the given position
1158  additionalNeteditAttributesHelpDialog->show(PLACEMENT_CURSOR);
1159  // refresh APP
1160  getApp()->refresh();
1161  // open as modal dialog (will block all windows until stop() or stopModal() is called)
1162  getApp()->runModalFor(additionalNeteditAttributesHelpDialog);
1163  // Write Warning in console if we're in testing mode
1164  WRITE_DEBUG("Close help dialog of selector frame");
1165  return 1;
1166 }
1167 
1168 // ---------------------------------------------------------------------------
1169 // ModificationMode::VisualScaling - methods
1170 // ---------------------------------------------------------------------------
1171 
1173  FXGroupBox(selectorFrameParent->myContentFrame, "Visual Scaling", GUIDesignGroupBoxFrame),
1174  mySelectorFrameParent(selectorFrameParent) {
1175  // Create spin button and configure it
1176  mySelectionScaling = new FXRealSpinner(this, 7, this, MID_GNE_SELECTORFRAME_SELECTSCALE, GUIDesignSpinDial);
1177  //mySelectionScaling->setNumberFormat(1);
1178  //mySelectionScaling->setIncrements(0.1, .5, 1);
1179  mySelectionScaling->setIncrement(0.5);
1180  mySelectionScaling->setRange(1, 100000);
1181  mySelectionScaling->setValue(1);
1182  mySelectionScaling->setHelpText("Enlarge selected objects");
1183 }
1184 
1185 
1187 
1188 
1189 long
1191  // set scale in viewnet
1192  mySelectorFrameParent->myViewNet->setSelectorFrameScale(mySelectionScaling->getValue());
1193  mySelectorFrameParent->myViewNet->updateViewNet();
1194  return 1;
1195 }
1196 
1197 // ---------------------------------------------------------------------------
1198 // ModificationMode::SelectionOperation - methods
1199 // ---------------------------------------------------------------------------
1200 
1202  FXGroupBox(selectorFrameParent->myContentFrame, "Operations for selections", GUIDesignGroupBoxFrame),
1203  mySelectorFrameParent(selectorFrameParent) {
1204  // Create "Clear List" Button
1205  new FXButton(this, "Clear\t\t", nullptr, this, MID_CHOOSEN_CLEAR, GUIDesignButton);
1206  // Create "Invert" Button
1207  new FXButton(this, "Invert\t\t", nullptr, this, MID_CHOOSEN_INVERT, GUIDesignButton);
1208  // Create "Save" Button
1209  new FXButton(this, "Save\t\tSave ids of currently selected objects to a file.", nullptr, this, MID_CHOOSEN_SAVE, GUIDesignButton);
1210  // Create "Load" Button
1211  new FXButton(this, "Load\t\tLoad ids from a file according to the current modfication mode.", nullptr, this, MID_CHOOSEN_LOAD, GUIDesignButton);
1212 }
1213 
1214 
1216 
1217 
1218 long
1220  // get the new file name
1221  FXFileDialog opendialog(this, "Open List of Selected Items");
1222  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::EMPTY));
1223  opendialog.setSelectMode(SELECTFILE_EXISTING);
1224  opendialog.setPatternList("Selection files (*.txt)\nAll files (*)");
1225  if (gCurrentFolder.length() != 0) {
1226  opendialog.setDirectory(gCurrentFolder);
1227  }
1228  if (opendialog.execute()) {
1229  std::vector<GNEAttributeCarrier*> loadedACs;
1230  gCurrentFolder = opendialog.getDirectory();
1231  std::string file = opendialog.getFilename().text();
1232  std::ostringstream msg;
1233  std::ifstream strm(file.c_str());
1234  // check if file can be opened
1235  if (!strm.good()) {
1236  WRITE_ERROR("Could not open '" + file + "'.");
1237  return 0;
1238  }
1239  while (strm.good()) {
1240  std::string line;
1241  strm >> line;
1242  // check if line isn't empty
1243  if (line.length() != 0) {
1244  // obtain GLObject
1246  // check if GUIGlObject exist and their their GL type isn't blocked
1247  if ((object != nullptr) && !mySelectorFrameParent->myLockGLObjectTypes->IsObjectTypeLocked(object->getType())) {
1248  // obtain GNEAttributeCarrier
1249  GNEAttributeCarrier* AC = mySelectorFrameParent->myViewNet->getNet()->retrieveAttributeCarrier(object->getGlID(), false);
1250  // check if AC exist and if is selectable
1251  if (AC && AC->getTagProperty().isSelectable())
1252  // now check if we're in the correct supermode to load this element
1253  if (((mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) && !AC->getTagProperty().isDemandElement()) ||
1254  ((mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeDemand()) && AC->getTagProperty().isDemandElement())) {
1255  loadedACs.push_back(AC);
1256  }
1257  }
1258  }
1259  }
1260  // change selected attribute in loaded ACs allowing undo/redo
1261  if (loadedACs.size() > 0) {
1262  mySelectorFrameParent->myViewNet->getUndoList()->p_begin("load selection");
1263  mySelectorFrameParent->handleIDs(loadedACs);
1264  mySelectorFrameParent->myViewNet->getUndoList()->p_end();
1265  }
1266  }
1267  mySelectorFrameParent->myViewNet->updateViewNet();
1268  return 1;
1269 }
1270 
1271 
1272 long
1274  FXString file = MFXUtils::getFilename2Write(this,
1275  "Save List of selected Items", ".txt",
1277  if (file == "") {
1278  return 1;
1279  }
1280  try {
1281  OutputDevice& dev = OutputDevice::getDevice(file.text());
1282  // get selected attribute carriers
1283  const auto selectedACs = mySelectorFrameParent->myViewNet->getNet()->getSelectedAttributeCarriers(false);
1284  for (const auto& selectedAC : selectedACs) {
1285  GUIGlObject* object = dynamic_cast<GUIGlObject*>(selectedAC);
1286  if (object) {
1287  dev << GUIGlObject::TypeNames.getString(object->getType()) << ":" << selectedAC->getID() << "\n";
1288  }
1289  }
1290  dev.close();
1291  } catch (IOError& e) {
1292  // write warning if netedit is running in testing mode
1293  WRITE_DEBUG("Opening FXMessageBox 'error storing selection'");
1294  // open message box error
1295  FXMessageBox::error(this, MBOX_OK, "Storing Selection failed", "%s", e.what());
1296  // write warning if netedit is running in testing mode
1297  WRITE_DEBUG("Closed FXMessageBox 'error storing selection' with 'OK'");
1298  }
1299  return 1;
1300 }
1301 
1302 
1303 long
1305  // clear current selection
1306  mySelectorFrameParent->clearCurrentSelection();
1307  return 1;
1308 }
1309 
1310 
1311 long
1313  // only continue if there is element for selecting
1314  if (mySelectorFrameParent->ACsToSelected()) {
1315  // obtan locks (only for improve code legibly)
1316  LockGLObjectTypes* locks = mySelectorFrameParent->getLockGLObjectTypes();
1317  // obtain undoList (only for improve code legibly)
1318  GNEUndoList* undoList = mySelectorFrameParent->myViewNet->getUndoList();
1319  // for invert selection, first clean current selection and next select elements of set "unselectedElements"
1320  undoList->p_begin("invert selection");
1321  // invert selection of elements depending of current supermode
1322  if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeNetwork()) {
1323  // iterate over junctions
1324  for (const auto& junction : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getJunctions()) {
1325  // check if junction selection is locked
1326  if (!locks->IsObjectTypeLocked(GLO_JUNCTION)) {
1327  if (junction.second->isAttributeCarrierSelected()) {
1328  junction.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1329  } else {
1330  junction.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1331  }
1332  }
1333  // due we iterate over all junctions, only it's neccesary iterate over incoming edges
1334  for (const auto& incomingEdge : junction.second->getGNEIncomingEdges()) {
1335  // only select edges if "select edges" flag is enabled. In other case, select only lanes
1336  if (mySelectorFrameParent->myViewNet->getNetworkViewOptions().selectEdges()) {
1337  // check if edge selection is locked
1338  if (!locks->IsObjectTypeLocked(GLO_EDGE)) {
1339  if (incomingEdge->isAttributeCarrierSelected()) {
1340  incomingEdge->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1341  } else {
1342  incomingEdge->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1343  }
1344  }
1345  } else {
1346  // check if lane selection is locked
1347  if (!locks->IsObjectTypeLocked(GLO_LANE)) {
1348  for (const auto& lane : incomingEdge->getLanes()) {
1349  if (lane->isAttributeCarrierSelected()) {
1350  lane->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1351  } else {
1352  lane->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1353  }
1354  }
1355  }
1356  }
1357  // check if connection selection is locked
1358  if (!locks->IsObjectTypeLocked(GLO_CONNECTION)) {
1359  for (const auto& connection : incomingEdge->getGNEConnections()) {
1360  if (connection->isAttributeCarrierSelected()) {
1361  connection->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1362  } else {
1363  connection->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1364  }
1365  }
1366  }
1367  }
1368  // check if crossing selection is locked
1369  if (!locks->IsObjectTypeLocked(GLO_CROSSING)) {
1370  for (const auto& crossing : junction.second->getGNECrossings()) {
1371  if (crossing->isAttributeCarrierSelected()) {
1372  crossing->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1373  } else {
1374  crossing->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1375  }
1376  }
1377  }
1378  }
1379  // check if additionals selection is locked
1381  for (const auto& additionals : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getAdditionals()) {
1382  // first check if additional is selectable
1383  if (GNEAttributeCarrier::getTagProperties(additionals.first).isSelectable()) {
1384  for (const auto& additional : additionals.second) {
1385  if (additional.second->isAttributeCarrierSelected()) {
1386  additional.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1387  } else {
1388  additional.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1389  }
1390  // now iterate over additional children
1391  for (const auto& additionalChild : additional.second->getChildAdditionals()) {
1392  // first check if additional child is selectable
1393  if (additionalChild->getTagProperty().isSelectable()) {
1394  if (additionalChild->isAttributeCarrierSelected()) {
1395  additionalChild->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1396  } else {
1397  additionalChild->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1398  }
1399  }
1400  }
1401  }
1402  }
1403  }
1404  }
1405  // invert polygons
1406  if (!locks->IsObjectTypeLocked(GLO_POLYGON)) {
1407  for (const auto& polygon : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getShapes().at(SUMO_TAG_POLY)) {
1408  if (polygon.second->isAttributeCarrierSelected()) {
1409  polygon.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1410  } else {
1411  polygon.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1412  }
1413  }
1414  }
1415  // invert TAZs
1416  if (!locks->IsObjectTypeLocked(GLO_TAZ)) {
1417  for (const auto& polygon : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getTAZElements().at(SUMO_TAG_TAZ)) {
1418  if (polygon.second->isAttributeCarrierSelected()) {
1419  polygon.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1420  } else {
1421  polygon.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1422  }
1423  }
1424  }
1425  // invert POIs and POILanes
1426  if (!locks->IsObjectTypeLocked(GLO_POI)) {
1427  for (const auto& POI : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getShapes().at(SUMO_TAG_POI)) {
1428  if (POI.second->isAttributeCarrierSelected()) {
1429  POI.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1430  } else {
1431  POI.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1432  }
1433  }
1434  for (const auto& POILane : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getShapes().at(SUMO_TAG_POILANE)) {
1435  if (POILane.second->isAttributeCarrierSelected()) {
1436  POILane.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1437  } else {
1438  POILane.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1439  }
1440  }
1441  }
1442  } else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeDemand()) {
1443  // invert routes
1444  if (!locks->IsObjectTypeLocked(GLO_ROUTE)) {
1445  for (const auto& route : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_ROUTE)) {
1446  if (route.second->isAttributeCarrierSelected()) {
1447  route.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1448  } else {
1449  route.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1450  }
1451  }
1452  for (const auto& embeddedRoute : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_ROUTE_EMBEDDED)) {
1453  if (embeddedRoute.second->isAttributeCarrierSelected()) {
1454  embeddedRoute.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1455  } else {
1456  embeddedRoute.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1457  }
1458  }
1459  }
1460  // invert vehicles
1461  if (!locks->IsObjectTypeLocked(GLO_VEHICLE)) {
1462  for (const auto& vehicle : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_VEHICLE)) {
1463  if (vehicle.second->isAttributeCarrierSelected()) {
1464  vehicle.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1465  } else {
1466  vehicle.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1467  }
1468  }
1469  for (const auto& vehicle : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_VEHICLE_WITHROUTE)) {
1470  if (vehicle.second->isAttributeCarrierSelected()) {
1471  vehicle.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1472  } else {
1473  vehicle.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1474  }
1475  }
1476  }
1477  // invert trips
1478  if (!locks->IsObjectTypeLocked(GLO_TRIP)) {
1479  for (const auto& trip : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_TRIP)) {
1480  if (trip.second->isAttributeCarrierSelected()) {
1481  trip.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1482  } else {
1483  trip.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1484  }
1485  }
1486  }
1487  // invert flows
1488  if (!locks->IsObjectTypeLocked(GLO_FLOW)) {
1489  for (const auto& flow : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_FLOW)) {
1490  if (flow.second->isAttributeCarrierSelected()) {
1491  flow.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1492  } else {
1493  flow.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1494  }
1495  }
1496  }
1497  // invert route flows
1498  if (!locks->IsObjectTypeLocked(GLO_ROUTEFLOW)) {
1499  for (const auto& routeFlow : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_FLOW_ROUTE)) {
1500  if (routeFlow.second->isAttributeCarrierSelected()) {
1501  routeFlow.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1502  } else {
1503  routeFlow.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1504  }
1505  }
1506  for (const auto& routeFlow : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_FLOW_WITHROUTE)) {
1507  if (routeFlow.second->isAttributeCarrierSelected()) {
1508  routeFlow.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1509  } else {
1510  routeFlow.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1511  }
1512  }
1513  }
1514  // invert stops
1515  if (!locks->IsObjectTypeLocked(GLO_STOP)) {
1516  for (const auto& demandElementTag : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements()) {
1517  for (const auto& demandElement : demandElementTag.second) {
1518  for (const auto& stop : demandElement.second->getChildDemandElements()) {
1519  if (stop->getTagProperty().isStop()) {
1520  if (stop->isAttributeCarrierSelected()) {
1521  stop->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1522  } else {
1523  stop->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1524  }
1525  }
1526  }
1527  }
1528  }
1529  }
1530  // invert person
1531  if (!locks->IsObjectTypeLocked(GLO_PERSON)) {
1532  for (const auto& person : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_PERSON)) {
1533  if (person.second->isAttributeCarrierSelected()) {
1534  person.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1535  } else {
1536  person.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1537  }
1538  }
1539  }
1540  // invert person flow
1541  if (!locks->IsObjectTypeLocked(GLO_PERSONFLOW)) {
1542  for (const auto& personFlow : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_PERSONFLOW)) {
1543  if (personFlow.second->isAttributeCarrierSelected()) {
1544  personFlow.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1545  } else {
1546  personFlow.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1547  }
1548  }
1549  }
1550  // invert person trip
1551  if (!locks->IsObjectTypeLocked(GLO_PERSONTRIP)) {
1552  for (const auto& personTripFromTo : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_PERSONTRIP_EDGE_EDGE)) {
1553  if (personTripFromTo.second->isAttributeCarrierSelected()) {
1554  personTripFromTo.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1555  } else {
1556  personTripFromTo.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1557  }
1558  }
1559  for (const auto& personTripBusStop : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_PERSONTRIP_EDGE_BUSSTOP)) {
1560  if (personTripBusStop.second->isAttributeCarrierSelected()) {
1561  personTripBusStop.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1562  } else {
1563  personTripBusStop.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1564  }
1565  }
1566  }
1567  // invert ride
1568  if (!locks->IsObjectTypeLocked(GLO_RIDE)) {
1569  for (const auto& rideFromTo : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_RIDE_EDGE_EDGE)) {
1570  if (rideFromTo.second->isAttributeCarrierSelected()) {
1571  rideFromTo.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1572  } else {
1573  rideFromTo.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1574  }
1575  }
1576  for (const auto& rideBusStop : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_RIDE_EDGE_BUSSTOP)) {
1577  if (rideBusStop.second->isAttributeCarrierSelected()) {
1578  rideBusStop.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1579  } else {
1580  rideBusStop.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1581  }
1582  }
1583  }
1584  // invert walks
1585  if (!locks->IsObjectTypeLocked(GLO_WALK)) {
1586  for (const auto& walkFromTo : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_WALK_EDGE_EDGE)) {
1587  if (walkFromTo.second->isAttributeCarrierSelected()) {
1588  walkFromTo.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1589  } else {
1590  walkFromTo.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1591  }
1592  }
1593  for (const auto& walkBusStop : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_WALK_EDGE_BUSSTOP)) {
1594  if (walkBusStop.second->isAttributeCarrierSelected()) {
1595  walkBusStop.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1596  } else {
1597  walkBusStop.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1598  }
1599  }
1600  for (const auto& walkRoute : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_WALK_ROUTE)) {
1601  if (walkRoute.second->isAttributeCarrierSelected()) {
1602  walkRoute.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1603  } else {
1604  walkRoute.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1605  }
1606  }
1607  }
1608  // invert person stops
1609  if (!locks->IsObjectTypeLocked(GLO_PERSONSTOP)) {
1610  for (const auto& personStopLane : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_PERSONSTOP_EDGE)) {
1611  if (personStopLane.second->isAttributeCarrierSelected()) {
1612  personStopLane.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1613  } else {
1614  personStopLane.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1615  }
1616  }
1617  for (const auto& personStopBusStop : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_PERSONSTOP_BUSSTOP)) {
1618  if (personStopBusStop.second->isAttributeCarrierSelected()) {
1619  personStopBusStop.second->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1620  } else {
1621  personStopBusStop.second->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1622  }
1623  }
1624  }
1625  } else if (mySelectorFrameParent->myViewNet->getEditModes().isCurrentSupermodeData()) {
1626  // invert dataSets
1627  for (const auto& dataSet : mySelectorFrameParent->myViewNet->getNet()->getAttributeCarriers()->getDataSets()) {
1628  for (const auto& dataInterval : dataSet.second->getDataIntervalChildren()) {
1629  for (const auto& genericData : dataInterval.second->getGenericDataChildren()) {
1630  if ((!locks->IsObjectTypeLocked(GLO_EDGEDATA) && (genericData->getType() == GLO_EDGEDATA)) ||
1631  (!locks->IsObjectTypeLocked(GLO_EDGERELDATA) && (genericData->getType() == GLO_EDGERELDATA))) {
1632  if (genericData->isAttributeCarrierSelected()) {
1633  genericData->setAttribute(GNE_ATTR_SELECTED, "false", undoList);
1634  } else {
1635  genericData->setAttribute(GNE_ATTR_SELECTED, "true", undoList);
1636  }
1637  }
1638  }
1639  }
1640  }
1641  }
1642  // finish selection operation
1643  undoList->p_end();
1644  }
1645  return 1;
1646 }
1647 
1648 // ---------------------------------------------------------------------------
1649 // GNESelectorFrame - methods
1650 // ---------------------------------------------------------------------------
1651 
1652 GNESelectorFrame::GNESelectorFrame(FXHorizontalFrame* horizontalFrameParent, GNEViewNet* viewNet) :
1653  GNEFrame(horizontalFrameParent, viewNet, "Selection") {
1654  // create selectedItems modul
1656  // create Modification Mode modul
1658  // create ElementSet modul
1659  myElementSet = new ElementSet(this);
1660  // create MatchAttribute modul
1661  myMatchAttribute = new MatchAttribute(this);
1662  // create MatchGenericDataAttribute modul
1664  // create VisualScaling modul
1665  myVisualScaling = new VisualScaling(this);
1666  // create SelectionOperation modul
1668  // Create groupbox for information about selections
1669  FXGroupBox* selectionHintGroupBox = new FXGroupBox(myContentFrame, "Information", GUIDesignGroupBoxFrame);
1670  // Create Selection Hint
1671  new FXLabel(selectionHintGroupBox, " - Hold <SHIFT> for \n rectangle selection.\n - Press <DEL> to\n delete selected items.", nullptr, GUIDesignLabelFrameInformation);
1672 
1673 }
1674 
1675 
1677 
1678 
1679 void
1681  // show Type Entries depending of current supermode
1683  // refresh element set
1685  // Show frame
1686  GNEFrame::show();
1687 }
1688 
1689 
1690 void
1692  // hide frame
1693  GNEFrame::hide();
1694 }
1695 
1696 
1697 void
1699  // only continue if there is element for selecting
1700  if (ACsToSelected()) {
1701  // for invert selection, first clean current selection and next select elements of set "unselectedElements"
1702  myViewNet->getUndoList()->p_begin("invert selection");
1703  // invert selection of elements depending of current supermode
1705  // iterate over junctions
1706  for (const auto& junction : myViewNet->getNet()->getAttributeCarriers()->getJunctions()) {
1707  // check if junction selection is locked
1709  if (junction.second->isAttributeCarrierSelected()) {
1710  junction.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1711  }
1712  }
1713  // due we iterate over all junctions, only it's neccesary iterate over incoming edges
1714  for (const auto& edge : junction.second->getGNEIncomingEdges()) {
1715  // check if edge selection is locked
1717  if (edge->isAttributeCarrierSelected()) {
1718  edge->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1719  }
1720  }
1721  // check if lane selection is locked
1723  for (const auto& lane : edge->getLanes()) {
1724  if (lane->isAttributeCarrierSelected()) {
1725  lane->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1726  }
1727  }
1728  }
1729  // check if connection selection is locked
1731  for (const auto& connection : edge->getGNEConnections()) {
1732  if (connection->isAttributeCarrierSelected()) {
1733  connection->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1734  }
1735  }
1736  }
1737  }
1738  // check if crossing selection is locked
1740  for (const auto& crossing : junction.second->getGNECrossings()) {
1741  if (crossing->isAttributeCarrierSelected()) {
1742  crossing->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1743  }
1744  }
1745  }
1746  }
1747  // check if additionals selection is locked
1749  for (const auto& additionals : myViewNet->getNet()->getAttributeCarriers()->getAdditionals()) {
1750  // first check if additional is selectable
1751  if (GNEAttributeCarrier::getTagProperties(additionals.first).isSelectable()) {
1752  for (const auto& additional : additionals.second) {
1753  if (additional.second->isAttributeCarrierSelected()) {
1754  additional.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1755  }
1756  // now iterate over additional children
1757  for (const auto& additionalChild : additional.second->getChildAdditionals()) {
1758  // first check if additional child is selectable
1759  if (additionalChild->getTagProperty().isSelectable() && additionalChild->isAttributeCarrierSelected()) {
1760  additionalChild->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1761  }
1762  }
1763  }
1764  }
1765  }
1766  }
1767  // unselect polygons
1769  for (const auto& polygon : myViewNet->getNet()->getAttributeCarriers()->getShapes().at(SUMO_TAG_POLY)) {
1770  if (polygon.second->isAttributeCarrierSelected()) {
1771  polygon.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1772  }
1773  }
1774  }
1775  // unselect TAZs
1777  for (const auto& polygon : myViewNet->getNet()->getAttributeCarriers()->getTAZElements().at(SUMO_TAG_TAZ)) {
1778  if (polygon.second->isAttributeCarrierSelected()) {
1779  polygon.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1780  }
1781  }
1782  }
1783  // unselect POIs and POILanes
1785  for (const auto& POI : myViewNet->getNet()->getAttributeCarriers()->getShapes().at(SUMO_TAG_POI)) {
1786  if (POI.second->isAttributeCarrierSelected()) {
1787  POI.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1788  }
1789  }
1790  for (const auto& POILane : myViewNet->getNet()->getAttributeCarriers()->getShapes().at(SUMO_TAG_POILANE)) {
1791  if (POILane.second->isAttributeCarrierSelected()) {
1792  POILane.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1793  }
1794  }
1795  }
1797  // unselect routes
1799  for (const auto& route : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_ROUTE)) {
1800  if (route.second->isAttributeCarrierSelected()) {
1801  route.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1802  }
1803  }
1804  }
1805  // unselect vehicles
1807  for (const auto& vehicle : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_VEHICLE)) {
1808  if (vehicle.second->isAttributeCarrierSelected()) {
1809  vehicle.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1810  }
1811  }
1812  for (const auto& vehicle : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_VEHICLE_WITHROUTE)) {
1813  if (vehicle.second->isAttributeCarrierSelected()) {
1814  vehicle.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1815  }
1816  for (const auto& embeddedRoute : vehicle.second->getChildDemandElements()) {
1817  if (embeddedRoute->isAttributeCarrierSelected()) {
1818  embeddedRoute->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1819  }
1820  }
1821  }
1822  }
1823  // unselect trips
1825  for (const auto& trip : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_TRIP)) {
1826  if (trip.second->isAttributeCarrierSelected()) {
1827  trip.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1828  }
1829  }
1830  }
1831  // unselect flows
1833  for (const auto& flow : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_FLOW)) {
1834  if (flow.second->isAttributeCarrierSelected()) {
1835  flow.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1836  }
1837  }
1838  }
1839  // unselect route flows
1841  for (const auto& routeFlow : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_FLOW_ROUTE)) {
1842  if (routeFlow.second->isAttributeCarrierSelected()) {
1843  routeFlow.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1844  }
1845  }
1846  for (const auto& routeFlow : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_FLOW_WITHROUTE)) {
1847  if (routeFlow.second->isAttributeCarrierSelected()) {
1848  routeFlow.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1849  }
1850  for (const auto& embeddedRoute : routeFlow.second->getChildDemandElements()) {
1851  if (embeddedRoute->isAttributeCarrierSelected()) {
1852  embeddedRoute->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1853  }
1854  }
1855  }
1856  }
1857  // unselect stops
1859  for (const auto& demandElementTag : myViewNet->getNet()->getAttributeCarriers()->getDemandElements()) {
1860  for (const auto& demandElement : demandElementTag.second) {
1861  for (const auto& stop : demandElement.second->getChildDemandElements()) {
1862  if (stop->getTagProperty().isStop()) {
1863  if (stop->isAttributeCarrierSelected()) {
1864  stop->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1865  }
1866  }
1867  }
1868  }
1869  }
1870  }
1871  // unselect person
1873  for (const auto& person : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_PERSON)) {
1874  if (person.second->isAttributeCarrierSelected()) {
1875  person.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1876  }
1877  }
1878  }
1879  // unselect person flows
1881  for (const auto& personFlow : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_PERSONFLOW)) {
1882  if (personFlow.second->isAttributeCarrierSelected()) {
1883  personFlow.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1884  }
1885  }
1886  }
1887  // unselect person trips
1889  for (const auto& personTripFromTo : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_PERSONTRIP_EDGE_EDGE)) {
1890  if (personTripFromTo.second->isAttributeCarrierSelected()) {
1891  personTripFromTo.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1892  }
1893  }
1894  for (const auto& personTripBusStop : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_PERSONTRIP_EDGE_BUSSTOP)) {
1895  if (personTripBusStop.second->isAttributeCarrierSelected()) {
1896  personTripBusStop.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1897  }
1898  }
1899  }
1900  // unselect ride
1902  for (const auto& rideFromTo : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_RIDE_EDGE_EDGE)) {
1903  if (rideFromTo.second->isAttributeCarrierSelected()) {
1904  rideFromTo.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1905  }
1906  }
1907  for (const auto& rideBusStop : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_RIDE_EDGE_BUSSTOP)) {
1908  if (rideBusStop.second->isAttributeCarrierSelected()) {
1909  rideBusStop.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1910  }
1911  }
1912  }
1913  // unselect walks
1915  for (const auto& walkFromTo : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_WALK_EDGE_EDGE)) {
1916  if (walkFromTo.second->isAttributeCarrierSelected()) {
1917  walkFromTo.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1918  }
1919  }
1920  for (const auto& walkBusStop : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_WALK_EDGE_BUSSTOP)) {
1921  if (walkBusStop.second->isAttributeCarrierSelected()) {
1922  walkBusStop.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1923  }
1924  }
1925  for (const auto& walkRoute : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_WALK_ROUTE)) {
1926  if (walkRoute.second->isAttributeCarrierSelected()) {
1927  walkRoute.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1928  }
1929  }
1930  }
1931  // unselect person stops
1933  for (const auto& personStopLane : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_PERSONSTOP_EDGE)) {
1934  if (personStopLane.second->isAttributeCarrierSelected()) {
1935  personStopLane.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1936  }
1937  }
1938  for (const auto& personStopBusStop : myViewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_PERSONSTOP_BUSSTOP)) {
1939  if (personStopBusStop.second->isAttributeCarrierSelected()) {
1940  personStopBusStop.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1941  }
1942  }
1943  }
1944  } else if (myViewNet->getEditModes().isCurrentSupermodeData()) {
1945  for (const auto& dataSet : myViewNet->getNet()->getAttributeCarriers()->getDataSets()) {
1946  for (const auto& dataInterval : dataSet.second->getDataIntervalChildren()) {
1947  for (const auto& genericData : dataInterval.second->getGenericDataChildren()) {
1948  if (genericData->isAttributeCarrierSelected()) {
1949  genericData->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
1950  }
1951  }
1952  }
1953  }
1954  }
1955  // finish selection operation
1956  myViewNet->getUndoList()->p_end();
1957  }
1958 }
1959 
1960 
1961 void
1962 GNESelectorFrame::handleIDs(const std::vector<GNEAttributeCarrier*>& ACs, const ModificationMode::Operation setop) {
1963  // declare set operation
1965  // declare two sets of attribute carriers, one for select and another for unselect
1966  std::set<std::pair<std::string, GNEAttributeCarrier*> > ACsToSelect, ACsToUnselect;
1967  // in restrict AND replace mode all current selected attribute carriers will be unselected
1968  if ((setOperation == ModificationMode::Operation::REPLACE) || (setOperation == ModificationMode::Operation::RESTRICT)) {
1969  // obtain selected ACs depending of current supermode
1970  std::vector<GNEAttributeCarrier*> selectedACs = myViewNet->getNet()->getSelectedAttributeCarriers(false);
1971  // add id into ACs to unselect
1972  for (const auto& selectedAC : selectedACs) {
1973  ACsToUnselect.insert(std::make_pair(selectedAC->getID(), selectedAC));
1974  }
1975  }
1976  // handle ids
1977  for (const auto& AC : ACs) {
1978  // iterate over AtributeCarriers an place it in ACsToSelect or ACsToUnselect
1979  switch (setOperation) {
1981  ACsToUnselect.insert(std::make_pair(AC->getID(), AC));
1982  break;
1984  if (ACsToUnselect.find(std::make_pair(AC->getID(), AC)) != ACsToUnselect.end()) {
1985  ACsToSelect.insert(std::make_pair(AC->getID(), AC));
1986  }
1987  break;
1988  default:
1989  ACsToSelect.insert(std::make_pair(AC->getID(), AC));
1990  break;
1991  }
1992  }
1993  // select junctions and their connections if Auto select junctions is enabled (note: only for "add mode")
1995  std::set<GNEEdge*> edgesToSelect;
1996  // iterate over ACsToSelect and extract edges
1997  for (const auto& AC : ACsToSelect) {
1998  if (AC.second->getTagProperty().getTag() == SUMO_TAG_EDGE) {
1999  edgesToSelect.insert(myViewNet->getNet()->retrieveEdge(AC.second->getID()));
2000  }
2001  }
2002  // iterate over extracted edges
2003  for (const auto& edgeToSelect : edgesToSelect) {
2004  // select junction source and all connections and crossings
2005  ACsToSelect.insert(std::make_pair(edgeToSelect->getParentJunctions().front()->getID(), edgeToSelect->getParentJunctions().front()));
2006  for (const auto& connectionToSelect : edgeToSelect->getParentJunctions().front()->getGNEConnections()) {
2007  ACsToSelect.insert(std::make_pair(connectionToSelect->getID(), connectionToSelect));
2008  }
2009  for (const auto& crossingToSelect : edgeToSelect->getParentJunctions().front()->getGNECrossings()) {
2010  ACsToSelect.insert(std::make_pair(crossingToSelect->getID(), crossingToSelect));
2011  }
2012  // select junction destiny and all connections and crossings
2013  ACsToSelect.insert(std::make_pair(edgeToSelect->getParentJunctions().back()->getID(), edgeToSelect->getParentJunctions().back()));
2014  for (const auto& connectionToSelect : edgeToSelect->getParentJunctions().back()->getGNEConnections()) {
2015  ACsToSelect.insert(std::make_pair(connectionToSelect->getID(), connectionToSelect));
2016  }
2017  for (const auto& crossingToSelect : edgeToSelect->getParentJunctions().back()->getGNECrossings()) {
2018  ACsToSelect.insert(std::make_pair(crossingToSelect->getID(), crossingToSelect));
2019  }
2020  }
2021  }
2022  // only continue if there is ACs to select or unselect
2023  if ((ACsToSelect.size() + ACsToUnselect.size()) > 0) {
2024  // first unselect AC of ACsToUnselect and then selects AC of ACsToSelect
2025  myViewNet->getUndoList()->p_begin("selection");
2026  for (const auto& ACToUnselect : ACsToUnselect) {
2027  if (ACToUnselect.second->getTagProperty().isSelectable()) {
2028  ACToUnselect.second->setAttribute(GNE_ATTR_SELECTED, "false", myViewNet->getUndoList());
2029  }
2030  }
2031  for (const auto& ACToSelect : ACsToSelect) {
2032  if (ACToSelect.second->getTagProperty().isSelectable()) {
2033  ACToSelect.second->setAttribute(GNE_ATTR_SELECTED, "true", myViewNet->getUndoList());
2034  }
2035  }
2036  // finish operation
2037  myViewNet->getUndoList()->p_end();
2038  }
2039 }
2040 
2041 
2044  return myModificationMode;
2045 }
2046 
2047 
2050  return myLockGLObjectTypes;
2051 }
2052 
2053 
2054 bool
2057  // check if exist junction and edges
2059  return true;
2060  }
2061  // check if exist connections
2063  for (const auto& junction : myViewNet->getNet()->getAttributeCarriers()->getJunctions()) {
2064  if (junction.second->getGNEConnections().size() > 0) {
2065  return true;
2066  }
2067  }
2068  }
2069  // check if exist crossings
2071  for (const auto& junction : myViewNet->getNet()->getAttributeCarriers()->getJunctions()) {
2072  if (junction.second->getGNECrossings().size() > 0) {
2073  return true;
2074  }
2075  }
2076  }
2077  // check edges and lanes
2079  return true;
2080  }
2081  // check if additionals selection is locked
2083  for (const auto& additionalTag : myViewNet->getNet()->getAttributeCarriers()->getAdditionals()) {
2084  // first check if additional is selectable
2085  if (GNEAttributeCarrier::getTagProperties(additionalTag.first).isSelectable() &&
2086  (myViewNet->getNet()->getAttributeCarriers()->getAdditionals().at(additionalTag.first).size() > 0)) {
2087  return true;
2088  }
2089  }
2090  }
2091  // check polygons
2093  (myViewNet->getNet()->getAttributeCarriers()->getShapes().at(SUMO_TAG_POLY).size() > 0)) {
2094  return true;
2095  }
2096  // check POIs
2098  ((myViewNet->getNet()->getAttributeCarriers()->getShapes().at(SUMO_TAG_POI).size() > 0) ||
2099  (myViewNet->getNet()->getAttributeCarriers()->getShapes().at(SUMO_TAG_POILANE).size() > 0))) {
2100  return true;
2101  }
2103  // get demand elements map
2104  const std::map<SumoXMLTag, std::map<std::string, GNEDemandElement*> >& demandElementsMap = myViewNet->getNet()->getAttributeCarriers()->getDemandElements();
2105  // check routes
2106  if (!myLockGLObjectTypes->IsObjectTypeLocked(GLO_ROUTE) && ((demandElementsMap.at(SUMO_TAG_ROUTE).size() + demandElementsMap.at(GNE_TAG_ROUTE_EMBEDDED).size()) > 0)) {
2107  return true;
2108  }
2109  // check vehicles
2110  if (!myLockGLObjectTypes->IsObjectTypeLocked(GLO_VEHICLE) && ((demandElementsMap.at(SUMO_TAG_VEHICLE).size() + demandElementsMap.at(GNE_TAG_VEHICLE_WITHROUTE).size()) > 0)) {
2111  return true;
2112  }
2113  // check trips
2114  if (!myLockGLObjectTypes->IsObjectTypeLocked(GLO_TRIP) && (demandElementsMap.at(SUMO_TAG_TRIP).size() > 0)) {
2115  return true;
2116  }
2117  // check flows
2118  if (!myLockGLObjectTypes->IsObjectTypeLocked(GLO_FLOW) && (demandElementsMap.at(SUMO_TAG_FLOW).size() > 0)) {
2119  return true;
2120  }
2121  // check route flows
2122  if (!myLockGLObjectTypes->IsObjectTypeLocked(GLO_ROUTEFLOW) && ((demandElementsMap.at(GNE_TAG_FLOW_ROUTE).size() + demandElementsMap.at(GNE_TAG_FLOW_WITHROUTE).size()) > 0)) {
2123  return true;
2124  }
2125  // check stops
2127  for (const auto& demandElementTag : demandElementsMap) {
2128  for (const auto& demandElement : demandElementTag.second) {
2129  for (const auto& stop : demandElement.second->getChildDemandElements()) {
2130  if (stop->getTagProperty().isStop()) {
2131  return true;
2132  }
2133  }
2134  }
2135  }
2136  }
2137  // check person
2138  if (!myLockGLObjectTypes->IsObjectTypeLocked(GLO_PERSON) && ((demandElementsMap.at(SUMO_TAG_PERSON).size()) > 0)) {
2139  return true;
2140  }
2141  // check person flows
2142  if (!myLockGLObjectTypes->IsObjectTypeLocked(GLO_PERSONFLOW) && (demandElementsMap.at(SUMO_TAG_PERSONFLOW).size() > 0)) {
2143  return true;
2144  }
2145  // check persontrips
2147  if ((demandElementsMap.at(GNE_TAG_PERSONTRIP_EDGE_EDGE).size() > 0) ||
2148  (demandElementsMap.at(GNE_TAG_PERSONTRIP_EDGE_BUSSTOP).size() > 0)) {
2149  return true;
2150  }
2151  }
2152  // check ride
2154  if ((demandElementsMap.at(GNE_TAG_RIDE_EDGE_EDGE).size() > 0) ||
2155  (demandElementsMap.at(GNE_TAG_RIDE_EDGE_BUSSTOP).size() > 0)) {
2156  return true;
2157  }
2158  }
2159  // check walks
2161  if ((demandElementsMap.at(GNE_TAG_WALK_EDGE_EDGE).size() > 0) ||
2162  (demandElementsMap.at(GNE_TAG_WALK_EDGE_BUSSTOP).size() > 0) ||
2163  (demandElementsMap.at(GNE_TAG_WALK_ROUTE).size() > 0)) {
2164  return true;
2165  }
2166  }
2167  // check person stops
2169  if ((demandElementsMap.at(GNE_TAG_PERSONSTOP_EDGE).size() > 0) ||
2170  (demandElementsMap.at(GNE_TAG_PERSONSTOP_BUSSTOP).size() > 0)) {
2171  return true;
2172  }
2173  }
2174  } else if (myViewNet->getEditModes().isCurrentSupermodeData()) {
2175  for (const auto& dataSet : myViewNet->getNet()->getAttributeCarriers()->getDataSets()) {
2176  for (const auto& dataInterval : dataSet.second->getDataIntervalChildren()) {
2177  for (const auto& genericData : dataInterval.second->getGenericDataChildren()) {
2178  if ((!myLockGLObjectTypes->IsObjectTypeLocked(GLO_EDGEDATA) && (genericData->getType() == GLO_EDGEDATA)) ||
2179  (!myLockGLObjectTypes->IsObjectTypeLocked(GLO_EDGERELDATA) && (genericData->getType() == GLO_EDGERELDATA))) {
2180  return true;
2181  }
2182  }
2183  }
2184  }
2185  }
2186  // nothing to select
2187  return false;
2188 }
2189 
2190 
2191 std::vector<GNEAttributeCarrier*>
2192 GNESelectorFrame::getMatches(const SumoXMLTag ACTag, const SumoXMLAttr ACAttr, const char compOp, const double val, const std::string& expr) {
2193  std::vector<GNEAttributeCarrier*> result;
2194  // first retrieve all ACs using ACTag
2195  std::vector<GNEAttributeCarrier*> allACbyTag = myViewNet->getNet()->retrieveAttributeCarriers(ACTag);
2196  // get Tag value
2197  const auto& tagValue = GNEAttributeCarrier::getTagProperties(ACTag);
2198  // iterate over all ACs
2199  for (const auto& AC : allACbyTag) {
2200  if (expr == "") {
2201  result.push_back(AC);
2202  } else if (tagValue.hasAttribute(ACAttr) && tagValue.getAttributeProperties(ACAttr).isNumerical()) {
2203  double acVal;
2204  std::istringstream buf(AC->getAttribute(ACAttr));
2205  buf >> acVal;
2206  switch (compOp) {
2207  case '<':
2208  if (acVal < val) {
2209  result.push_back(AC);
2210  }
2211  break;
2212  case '>':
2213  if (acVal > val) {
2214  result.push_back(AC);
2215  }
2216  break;
2217  case '=':
2218  if (acVal == val) {
2219  result.push_back(AC);
2220  }
2221  break;
2222  }
2223  } else {
2224  // string match
2225  std::string acVal = AC->getAttributeForSelection(ACAttr);
2226  switch (compOp) {
2227  case '@':
2228  if (acVal.find(expr) != std::string::npos) {
2229  result.push_back(AC);
2230  }
2231  break;
2232  case '!':
2233  if (acVal.find(expr) == std::string::npos) {
2234  result.push_back(AC);
2235  }
2236  break;
2237  case '=':
2238  if (acVal == expr) {
2239  result.push_back(AC);
2240  }
2241  break;
2242  case '^':
2243  if (acVal != expr) {
2244  result.push_back(AC);
2245  }
2246  break;
2247  }
2248  }
2249  }
2250  return result;
2251 }
2252 
2253 
2254 std::vector<GNEAttributeCarrier*>
2255 GNESelectorFrame::getGenericMatches(const std::vector<GNEGenericData*>& genericDatas, const std::string& attr, const char compOp, const double val, const std::string& expr) {
2256  std::vector<GNEAttributeCarrier*> result;
2257  // iterate over generic datas
2258  for (const auto& genericData : genericDatas) {
2259  if (expr == "") {
2260  result.push_back(genericData);
2261  } else if (attr != toString(GNE_ATTR_PARENT)) {
2262  double acVal;
2263  std::istringstream buf(genericData->getParameter(attr, "0"));
2264  buf >> acVal;
2265  switch (compOp) {
2266  case '<':
2267  if (acVal < val) {
2268  result.push_back(genericData);
2269  }
2270  break;
2271  case '>':
2272  if (acVal > val) {
2273  result.push_back(genericData);
2274  }
2275  break;
2276  case '=':
2277  if (acVal == val) {
2278  result.push_back(genericData);
2279  }
2280  break;
2281  }
2282  } else {
2283  // string match
2284  std::string acVal = genericData->getAttributeForSelection(GNE_ATTR_PARENT);
2285  switch (compOp) {
2286  case '@':
2287  if (acVal.find(expr) != std::string::npos) {
2288  result.push_back(genericData);
2289  }
2290  break;
2291  case '!':
2292  if (acVal.find(expr) == std::string::npos) {
2293  result.push_back(genericData);
2294  }
2295  break;
2296  case '=':
2297  if (acVal == expr) {
2298  result.push_back(genericData);
2299  }
2300  break;
2301  case '^':
2302  if (acVal != expr) {
2303  result.push_back(genericData);
2304  }
2305  break;
2306  }
2307  }
2308  }
2309  return result;
2310 }
2311 
2312 
2313 /****************************************************************************/
FXDEFMAP(GNESelectorFrame::LockGLObjectTypes::ObjectTypeEntry) ObjectTypeEntryMap[]
Supermode
@brie enum for supermodes
@ NETWORK
Network mode (Edges, junctions, etc..)
@ DATA
Data mode (edgeData, LaneData etc..)
@ DEMAND
Demand mode (Routes, Vehicles etc..)
@ MID_GNE_SELECTORFRAME_SELECTSCALE
changes the visual scaling of selected items
Definition: GUIAppEnum.h:804
@ MID_GNE_SELECTORFRAME_SETINTERVAL
change interval
Definition: GUIAppEnum.h:806
@ MID_GNE_SET_ATTRIBUTE
attribute edited
Definition: GUIAppEnum.h:717
@ MID_CHOOSEN_SAVE
Save set.
Definition: GUIAppEnum.h:541
@ MID_GNE_SELECTORFRAME_SELECTATTRIBUTE
select attribute in selector frame
Definition: GUIAppEnum.h:800
@ MID_CHOOSEN_INVERT
Deselect selected items.
Definition: GUIAppEnum.h:549
@ MID_GNE_SELECTORFRAME_SETEND
end text field
Definition: GUIAppEnum.h:810
@ MID_GNE_SELECTORFRAME_SELECTTAG
select tag in selector frame
Definition: GUIAppEnum.h:798
@ MID_CHOOSEN_ELEMENTS
set subset of elements
Definition: GUIAppEnum.h:537
@ MID_CHOOSEN_OPERATION
set type of selection
Definition: GUIAppEnum.h:535
@ MID_HELP
help button
Definition: GUIAppEnum.h:578
@ MID_GNE_SELECTORFRAME_SETBEGIN
edit begin text field
Definition: GUIAppEnum.h:808
@ MID_CHOOSEN_LOAD
Load set.
Definition: GUIAppEnum.h:539
@ MID_CHOOSEN_CLEAR
Clear set.
Definition: GUIAppEnum.h:543
@ MID_GNE_SELECTORFRAME_PROCESSSTRING
process string
Definition: GUIAppEnum.h:802
#define GUIDesignLabelLeft
Definition: GUIDesigns.h:175
#define GUIDesignMatrixLockGLTypes
Matrix for pack GLTypes (used in GNESelectorFrame)
Definition: GUIDesigns.h:293
#define GUIDesignSpinDial
Definition: GUIDesigns.h:384
#define GUIDesignButton
Definition: GUIDesigns.h:62
#define GUIDesignComboBox
Definition: GUIDesigns.h:237
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:255
#define GUIDesignTextField
Definition: GUIDesigns.h:36
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:313
#define GUIDesignDialogBox
Definition: GUIDesigns.h:494
#define GUIDesignButtonRectangular
little button rectangula used in frames (For example, in "help" buttons)
Definition: GUIDesigns.h:68
#define GUIDesignComboBoxStaticExtended
Combo box static (not editable) extended over the all frame.
Definition: GUIDesigns.h:243
#define GUIDesignTextFieldNCol
Num of column of text field.
Definition: GUIDesigns.h:54
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:278
#define GUIDesignButtonOK
Definition: GUIDesigns.h:115
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:133
#define GUIDesignRadioButton
Definition: GUIDesigns.h:164
#define GUIDesignHorizontalSeparator
Definition: GUIDesigns.h:362
#define GUIDesignLabelThick
label extended over frame with thick and with text justify to left
Definition: GUIDesigns.h:184
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:223
GUIGlObjectType
@ GLO_EDGERELDATA
edge relation data
@ GLO_TAZRELDATA
TAZ relation data.
@ GLO_TRIP
a trip
@ GLO_ROUTEFLOW
a routeFlow
@ GLO_WALK
a walk
@ GLO_ROUTE
a route
@ GLO_JUNCTION
a junction
@ GLO_LANE
a lane
@ GLO_RIDE
a ride
@ GLO_FLOW
a flow
@ GLO_TAZ
Traffic Assignment Zones (TAZs)
@ GLO_EDGEDATA
edge data
@ GLO_CONNECTION
a connection
@ GLO_ADDITIONALELEMENT
reserved GLO type to pack all additionals elements
@ GLO_PERSONTRIP
a person trip
@ GLO_EDGE
an edge
@ GLO_VEHICLE
a vehicle
@ GLO_PERSON
a person
@ GLO_POI
a poi
@ GLO_STOP
a stop
@ GLO_POLYGON
a polygon
@ GLO_CROSSING
a tl-logic
@ GLO_PERSONSTOP
a person stop
@ GLO_PERSONFLOW
a person flow
FXString gCurrentFolder
The folder used as last.
@ MODEADDITIONAL
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:286
#define WRITE_ERROR(msg)
Definition: MsgHandler.h:284
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_PERSONTRIP_EDGE_EDGE
@ GNE_TAG_PERSONSTOP_BUSSTOP
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_NOTHING
invalid tag
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ SUMO_TAG_VEHICLE
description of a vehicle
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route (used in NETEDIT)
@ GNE_TAG_FLOW_WITHROUTE
description of a vehicle with an embedded route (used in NETEDIT)
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ GNE_TAG_RIDE_EDGE_EDGE
@ GNE_TAG_PERSONSTOP_EDGE
@ GNE_TAG_WALK_EDGE_EDGE
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ GNE_TAG_PERSONTRIP_EDGE_BUSSTOP
@ GNE_TAG_VEHICLE_WITHROUTE
@ GNE_TAG_RIDE_EDGE_BUSSTOP
@ SUMO_TAG_POILANE
begin/end of the description of a Point of interest over Lane (used by Netedit)
@ SUMO_TAG_PERSON
@ GNE_TAG_WALK_EDGE_BUSSTOP
@ GNE_TAG_ROUTE_EMBEDDED
embedded route (used in NETEDIT)
@ GNE_TAG_WALK_ROUTE
@ SUMO_TAG_PERSONFLOW
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ SUMO_TAG_EDGE
begin/end of the description of an edge
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
@ SUMO_ATTR_SPEED
@ GNE_ATTR_BLOCK_MOVEMENT
block movement of a graphic element
@ GNE_ATTR_PARENT
parent of an additional element
@ GNE_ATTR_SELECTED
element is selected
@ SUMO_ATTR_BEGIN
weights: time range begin
@ GNE_ATTR_PARAMETERS
parameters "key1=value1|key2=value2|...|keyN=valueN"
@ GNE_ATTR_CLOSE_SHAPE
Close shape of a polygon (Used by GNEPolys)
@ SUMO_ATTR_END
weights: time range end
@ GNE_ATTR_DATASET
data set of a generic data
@ GNE_ATTR_BLOCK_SHAPE
block shape of a graphic element (Used mainly in GNEShapes)
@ SUMO_ATTR_ID
@ SUMO_ATTR_NOTHING
invalid attribute
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
static const GNETagProperties & getTagProperties(SumoXMLTag tag)
get Tag Properties
const GNETagProperties & getTagProperty() const
get Tag Property assigned to this object
static std::vector< std::pair< SumoXMLTag, const std::string > > getAllowedTagsByCategory(const int tagPropertyCategory, const bool onlyDrawables)
get tags of all editable element types using TagProperty Type (NetworkEditMode::NETWORKELEMENT,...
GNENet * getNet() const
get pointer to net
GNEViewNet * myViewNet
View Net.
Definition: GNEFrame.h:113
FXVerticalFrame * myContentFrame
Vertical frame that holds all widgets of frame.
Definition: GNEFrame.h:116
virtual void show()
show Frame
Definition: GNEFrame.cpp:108
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:117
const std::map< std::string, GNEDataSet * > & getDataSets() const
const std::map< std::string, GNEEdge * > & getEdges() const
map with the ID and pointer to edges of net
const std::map< SumoXMLTag, std::map< std::string, GNETAZElement * > > & getTAZElements() const
const std::map< SumoXMLTag, std::map< std::string, GNEAdditional * > > & getAdditionals() const
const std::map< SumoXMLTag, std::map< std::string, GNEDemandElement * > > & getDemandElements() const
const std::map< std::string, GNEJunction * > & getJunctions() const
map with the ID and pointer to junctions of net
const std::map< SumoXMLTag, std::map< std::string, GNEShape * > > & getShapes() const
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true) const
get edge by id
Definition: GNENet.cpp:1141
GNEAttributeCarrier * retrieveAttributeCarrier(const GUIGlID id, bool failHard=true) const
get a single attribute carrier based on a GLID
Definition: GNENet.cpp:1435
std::vector< GNEAttributeCarrier * > getSelectedAttributeCarriers(bool ignoreCurrentSupermode)
get all selected attribute carriers (or only relative to current supermode
Definition: GNENet.cpp:2251
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
retrieve all attribute carriers of Net
Definition: GNENet.cpp:130
std::vector< GNEAttributeCarrier * > retrieveAttributeCarriers(SumoXMLTag type=SUMO_TAG_NOTHING)
get the attribute carriers based on Type
Definition: GNENet.cpp:1458
Type getElementSet() const
get current selected element set
void refreshElementSet()
refresh element set
ElementSet(GNESelectorFrame *selectorFrameParent)
constructor
FXComboBox * mySetComboBox
Combo Box with the element sets.
long onCmdSelectElementSet(FXObject *, FXSelector, void *)
Called when the user change the set of element to search (networkElement, Additional or shape)
class for object types entries
Supermode getSupermode() const
get supermode associated to this ObjectTypeEntry
void showObjectTypeEntry()
show ObjectTypeEntry
void counterDown()
down count
bool isGLTypeLocked() const
check if current GLType is blocked
FXCheckButton * myCheckBoxLocked
check box to check if GLObject type is blocked
FXLabel * myLabelTypeName
label type nane
void counterUp()
up count
FXLabel * myLabelCounter
label counter
long onCmdSetCheckBox(FXObject *, FXSelector, void *)
called when user change the CheckBox
ObjectTypeEntry()
void hideObjectTypeEntry()
hide ObjectTypeEntry
void addedLockedObject(const GUIGlObjectType type)
set object selected
std::map< GUIGlObjectType, ObjectTypeEntry * > myTypeEntries
check boxes for type-based selection locking and selected object counts
void showTypeEntries()
show type Entries (depending if we're in Network or demand supermode)
bool IsObjectTypeLocked(const GUIGlObjectType type) const
check if an object is locked
void removeLockedObject(const GUIGlObjectType type)
set object unselected
void disableMatchAttribute()
disable match attributes
void hideMatchAttribute()
hide match attributes
FXTextField * myMatchString
string of the match
MatchAttribute(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
FXButton * myMatchStringButton
match string button
FXComboBox * myMatchAttrComboBox
attributes of the match box
void showMatchAttribute()
show match attributes
long onCmdSelMBString(FXObject *, FXSelector, void *)
Called when the user enters a new selection expression.
long onCmdHelp(FXObject *, FXSelector, void *)
Called when the user clicks the help button.
long onCmdSelMBAttribute(FXObject *, FXSelector, void *)
Called when the user selectes a tag in the match box.
void enableMatchAttribute()
enable match attributes
long onCmdSelMBTag(FXObject *, FXSelector, void *)
Called when the user selectes a tag in the match box.
FXComboBox * myMatchTagComboBox
tag of the match box
SumoXMLAttr myCurrentAttribute
current SumoXMLTag Attribute
long onCmdProcessString(FXObject *, FXSelector, void *)
Called when the user enters a new selection expression.
MatchGenericDataAttribute(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
long onCmdSelectTag(FXObject *, FXSelector, void *)
Called when the user selects a tag in the match box.
void enableMatchGenericDataAttribute()
enable match attributes
void showMatchGenericDataAttribute()
show match attributes
FXTextField * myEnd
TextField for end.
long onCmdHelp(FXObject *, FXSelector, void *)
Called when the user clicks the help button.
FXComboBox * myIntervalSelector
tag of the match box
long onCmdSetBegin(FXObject *, FXSelector, void *)
Called when the user change begin text field.
long onCmdSetInterval(FXObject *, FXSelector, void *)
Called when the user selects an interval.
long onCmdSelectAttribute(FXObject *, FXSelector, void *)
Called when the user selects an attribute in the match box.
FXComboBox * myMatchGenericDataTagComboBox
tag of the match box
void disableMatchGenericDataAttribute()
disable match attributes
long onCmdSetEnd(FXObject *, FXSelector, void *)
Called when the user change end text field.
FXTextField * myBegin
TextField for begin.
FXComboBox * myMatchGenericDataAttrComboBox
attributes of the match box
FXTextField * myMatchGenericDataString
string of the match
std::string myCurrentAttribute
current string Attribute
void hideMatchGenericDataAttribute()
hide match attributes
FXRadioButton * myReplaceRadioButton
replace radio button
ModificationMode(GNESelectorFrame *selectorFrameParent)
constructor
long onCmdSelectModificationMode(FXObject *, FXSelector, void *)
FXRadioButton * myAddRadioButton
add radio button
Operation getModificationMode() const
get current modification mode
FXRadioButton * myRemoveRadioButton
remove radio button
FXRadioButton * myKeepRadioButton
keep button
SelectionOperation(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
long onCmdSave(FXObject *, FXSelector, void *)
Called when the user presses the Save-button.
long onCmdInvert(FXObject *, FXSelector, void *)
Called when the user presses the Invert-button.
long onCmdClear(FXObject *, FXSelector, void *)
Called when the user presses the Clear-button.
long onCmdLoad(FXObject *, FXSelector, void *)
Called when the user presses the Load-button.
long onCmdScaleSelection(FXObject *, FXSelector, void *)
Called when the user changes visual scaling.
VisualScaling(GNESelectorFrame *selectorFrameParent)
FOX-declaration.
FXRealSpinner * mySelectionScaling
Spinner for selection scaling.
std::vector< GNEAttributeCarrier * > getMatches(const SumoXMLTag ACTag, const SumoXMLAttr ACAttr, const char compOp, const double val, const std::string &expr)
return ACs of the given type with matching attrs
MatchGenericDataAttribute * myMatchGenericDataAttribute
modul for match generic data attribute
ModificationMode * getModificationModeModul() const
get modification mode modul
MatchAttribute * myMatchAttribute
modul for match attribute
std::vector< GNEAttributeCarrier * > getGenericMatches(const std::vector< GNEGenericData * > &genericDatas, const std::string &attr, const char compOp, const double val, const std::string &expr)
return GenericDatas of the given type with matching attrs
SelectionOperation * mySelectionOperation
modul for selection operations
GNESelectorFrame(FXHorizontalFrame *horizontalFrameParent, GNEViewNet *viewNet)
Constructor.
LockGLObjectTypes * getLockGLObjectTypes() const
get selected items Modul
bool ACsToSelected() const
check if there is ACs to select/unselect
void show()
show Frame
~GNESelectorFrame()
Destructor.
ModificationMode * myModificationMode
modul for change modification mode
VisualScaling * myVisualScaling
modul for visual scaling
void clearCurrentSelection() const
clear current selection with possibility of undo/redo
void hide()
hide Frame
LockGLObjectTypes * myLockGLObjectTypes
modul for lock selected items
void handleIDs(const std::vector< GNEAttributeCarrier * > &ACs, const ModificationMode::Operation setop=ModificationMode::Operation::DEFAULT)
apply list of ids to the current selection according to Operation,
ElementSet * myElementSet
modul for select element set
bool isSelectable() const
return true if tag correspond to a selectable element
bool isDemandElement() const
return true if tag correspond to a demand element
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:71
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise,...
Definition: GNEUndoList.cpp:78
GNENet * getNet() const
get the net object
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:467
bool autoSelectNodes()
whether to autoselect nodes or to lanes
Definition: GNEViewNet.cpp:581
GNEUndoList * getUndoList() const
get the undoList object
static StringBijection< GUIGlObjectType > TypeNames
associates object types with strings
Definition: GUIGlObject.h:66
GUIGlObjectType getType() const
Returns the type of the object as coded in GUIGlObjectType.
GUIGlID getGlID() const
Returns the numerical id of the object.
static GUIGlObjectStorage gIDStorage
A single static instance of this class.
GUIGlObject * getObjectBlocking(GUIGlID id)
Returns the object from the container locking it.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static FXString getFilename2Write(FXWindow *parent, const FXString &header, const FXString &extension, FXIcon *icon, FXString &currentFolder)
Returns the file name to write.
Definition: MFXUtils.cpp:82
Static storage of an output device and its base (abstract) implementation.
Definition: OutputDevice.h:60
void close()
Closes the device and removes it from the dictionary.
static OutputDevice & getDevice(const std::string &name)
Returns the described OutputDevice.
C++ TraCI client API implementation.
const std::string & getString(const T key) const
bool isCurrentSupermodeDemand() const
@check if current supermode is Demand
bool isCurrentSupermodeData() const
@check if current supermode is Data
bool isCurrentSupermodeNetwork() const
@check if current supermode is Network