Eclipse SUMO - Simulation of Urban MObility
GNEFrameModules.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-2022 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 // Auxiliar class for GNEFrame Modules
19 /****************************************************************************/
20 #include <config.h>
21 
23 #include <netedit/GNENet.h>
24 #include <netedit/GNEUndoList.h>
25 #include <netedit/GNEViewNet.h>
26 #include <netedit/GNEViewParent.h>
73 #include <utils/gui/div/GLHelper.h>
77 
78 #include "GNEFrameModules.h"
79 
80 
81 // ===========================================================================
82 // FOX callback mapping
83 // ===========================================================================
84 
87 };
88 
89 FXDEFMAP(GNEFrameModules::DemandElementSelector) DemandElementSelectorMap[] = {
91 };
92 
93 FXDEFMAP(GNEFrameModules::HierarchicalElementTree) HierarchicalElementTreeMap[] = {
100 };
101 
106 };
107 
108 FXDEFMAP(GNEFrameModules::OverlappedInspection) OverlappedInspectionMap[] = {
114 };
115 
121 };
122 
123 
124 // Object implementation
125 FXIMPLEMENT(GNEFrameModules::TagSelector, FXGroupBoxModule, TagSelectorMap, ARRAYNUMBER(TagSelectorMap))
126 FXIMPLEMENT(GNEFrameModules::DemandElementSelector, FXGroupBoxModule, DemandElementSelectorMap, ARRAYNUMBER(DemandElementSelectorMap))
127 FXIMPLEMENT(GNEFrameModules::HierarchicalElementTree, FXGroupBoxModule, HierarchicalElementTreeMap, ARRAYNUMBER(HierarchicalElementTreeMap))
128 FXIMPLEMENT(GNEFrameModules::DrawingShape, FXGroupBoxModule, DrawingShapeMap, ARRAYNUMBER(DrawingShapeMap))
129 FXIMPLEMENT(GNEFrameModules::OverlappedInspection, FXGroupBoxModule, OverlappedInspectionMap, ARRAYNUMBER(OverlappedInspectionMap))
130 FXIMPLEMENT(GNEFrameModules::PathCreator, FXGroupBoxModule, PathCreatorMap, ARRAYNUMBER(PathCreatorMap))
131 
132 
133 // ===========================================================================
134 // method definitions
135 // ===========================================================================
136 
137 // ---------------------------------------------------------------------------
138 // GNEFrameModules::TagSelector - methods
139 // ---------------------------------------------------------------------------
140 
141 GNEFrameModules::TagSelector::TagSelector(GNEFrame* frameParent, GNETagProperties::TagType type, SumoXMLTag tag, bool onlyDrawables) :
142  FXGroupBoxModule(frameParent->myContentFrame, "Element"),
143  myFrameParent(frameParent),
144  myTagType(type),
145  myCurrentTemplateAC(nullptr) {
146  // Create MFXIconComboBox
147  myTagsMatchBox = new MFXIconComboBox(getCollapsableFrame(), GUIDesignComboBoxNCol, this, MID_GNE_TAG_SELECTED, GUIDesignComboBox);
148  // set current tag type without notifying
149  setCurrentTagType(myTagType, onlyDrawables, false);
150  // set current tag without notifying
151  setCurrentTag(tag, false);
152  // TagSelector is always shown
153  show();
154 }
155 
156 
158  // clear myACTemplates and myTagsMatchBox
159  for (const auto& ACTemplate : myACTemplates) {
160  delete ACTemplate;
161  }
162  myACTemplates.clear();
163 }
164 
165 
166 void
168  show();
169 }
170 
171 
172 void
174  hide();
175 }
176 
177 
180  // clear myACTemplates and myTagsMatchBox
181  for (const auto& ACTemplate : myACTemplates) {
182  if (ACTemplate->getAC()->getTagProperty().getTag() == ACTag) {
183  return ACTemplate->getAC();
184  }
185  }
186  return nullptr;
187 }
188 
189 
192  return myCurrentTemplateAC;
193 }
194 
195 
196 void
197 GNEFrameModules::TagSelector::setCurrentTagType(GNETagProperties::TagType tagType, const bool onlyDrawables, const bool notifyFrameParent) {
198  // check if net has proj
199  const bool proj = (GeoConvHelper::getFinal().getProjString() != "!");
200  // set new tagType
201  myTagType = tagType;
202  // change TagSelector text
203  switch (myTagType) {
204  case GNETagProperties::TagType::NETWORKELEMENT:
205  setText("network elements");
206  break;
207  case GNETagProperties::TagType::ADDITIONALELEMENT:
208  setText("Additional elements");
209  break;
210  case GNETagProperties::TagType::SHAPE:
211  setText("Shape elements");
212  break;
213  case GNETagProperties::TagType::TAZELEMENT:
214  setText("TAZ elements");
215  break;
216  case GNETagProperties::TagType::VEHICLE:
217  setText("Vehicles");
218  break;
219  case GNETagProperties::TagType::STOP:
220  setText("Stops");
221  break;
222  case GNETagProperties::TagType::PERSON:
223  setText("Persons");
224  break;
225  case GNETagProperties::TagType::PERSONPLAN:
226  setText("Person plans");
227  break;
228  case GNETagProperties::TagType::CONTAINER:
229  setText("Container");
230  break;
231  case GNETagProperties::TagType::CONTAINERPLAN:
232  setText("Container plans");
233  break;
234  case GNETagProperties::TagType::PERSONTRIP:
235  setText("Person trips");
236  break;
237  case GNETagProperties::TagType::WALK:
238  setText("Walks");
239  break;
240  case GNETagProperties::TagType::RIDE:
241  setText("Rides");
242  break;
243  case GNETagProperties::TagType::STOPPERSON:
244  setText("Person stops");
245  break;
246  default:
247  throw ProcessError("invalid tag property");
248  }
249  // clear myACTemplates and myTagsMatchBox
250  for (const auto& ACTemplate : myACTemplates) {
251  delete ACTemplate;
252  }
253  myACTemplates.clear();
254  myTagsMatchBox->clearItems();
255  // get tag properties
256  const auto tagProperties = GNEAttributeCarrier::getTagPropertiesByType(myTagType);
257  // fill myACTemplates and myTagsMatchBox
258  for (const auto& tagProperty : tagProperties) {
259  if ((!onlyDrawables || tagProperty.isDrawable()) && (!tagProperty.requireProj() || proj)) {
260  myACTemplates.push_back(new ACTemplate(myFrameParent->getViewNet()->getNet(), tagProperty));
261  myTagsMatchBox->appendIconItem(tagProperty.getFieldString().c_str(), GUIIconSubSys::getIcon(tagProperty.getGUIIcon()), tagProperty.getBackGroundColor());
262  }
263  }
264  // set color of myTypeMatchBox to black (valid)
265  myTagsMatchBox->setTextColor(FXRGB(0, 0, 0));
266  // Set visible items
267  myTagsMatchBox->setNumVisible((int)myTagsMatchBox->getNumItems());
268  // set first myACTemplate as edited AC
269  myCurrentTemplateAC = myACTemplates.front()->getAC();
270  // call tag selected function
271  if (notifyFrameParent) {
272  myFrameParent->tagSelected();
273  }
274 }
275 
276 
277 void
278 GNEFrameModules::TagSelector::setCurrentTag(SumoXMLTag newTag, const bool notifyFrameParent) {
279  // first reset myCurrentTemplateAC
280  myCurrentTemplateAC = nullptr;
281  // iterate over all myTagsMatchBox
282  for (int i = 0; i < (int)myACTemplates.size(); i++) {
283  if (myACTemplates.at(i)->getAC() && (myACTemplates.at(i)->getAC()->getTagProperty().getTag() == newTag)) {
284  // set current template and currentItem
285  myCurrentTemplateAC = myACTemplates.at(i)->getAC();
286  myTagsMatchBox->setCurrentItem(i);
287  // set color of myTypeMatchBox to black (valid)
288  myTagsMatchBox->setTextColor(FXRGB(0, 0, 0));
289  }
290  }
291  // call tag selected function
292  if (notifyFrameParent) {
293  myFrameParent->tagSelected();
294  }
295 }
296 
297 
298 void
300  // call tag selected function
301  myFrameParent->tagSelected();
302 }
303 
304 
305 long
306 GNEFrameModules::TagSelector::onCmdSelectTag(FXObject*, FXSelector, void*) {
307  // iterate over all myTagsMatchBox
308  for (int i = 0; i < (int)myACTemplates.size(); i++) {
309  if (myACTemplates.at(i)->getAC() && myACTemplates.at(i)->getAC()->getTagProperty().getFieldString() == myTagsMatchBox->getText().text()) {
310  // set templateAC and currentItem
311  myCurrentTemplateAC = myACTemplates.at(i)->getAC();
312  myTagsMatchBox->setCurrentItem(i);
313  // set color of myTypeMatchBox to black (valid)
314  myTagsMatchBox->setTextColor(FXRGB(0, 0, 0));
315  // call tag selected function
316  myFrameParent->tagSelected();
317  // Write Warning in console if we're in testing mode
318  WRITE_DEBUG(("Selected item '" + myTagsMatchBox->getText() + "' in TagSelector").text());
319  return 1;
320  }
321  }
322  // reset templateAC
323  myCurrentTemplateAC = nullptr;
324  // set color of myTypeMatchBox to red (invalid)
325  myTagsMatchBox->setTextColor(FXRGB(255, 0, 0));
326  // Write Warning in console if we're in testing mode
327  WRITE_DEBUG("Selected invalid item in TagSelector");
328  // call tag selected function
329  myFrameParent->tagSelected();
330  return 1;
331 }
332 
333 
336  return myAC;
337 }
338 
339 
341  myAC(nullptr) {
342  // create attribute carrier depending of
343  switch (tagProperty.getTag()) {
344  // additional elements
345  case SUMO_TAG_BUS_STOP:
346  case SUMO_TAG_TRAIN_STOP:
347  myAC = new GNEBusStop(tagProperty.getTag(), net);
348  break;
349  case SUMO_TAG_ACCESS:
350  myAC = new GNEAccess(net);
351  break;
353  myAC = new GNEContainerStop(net);
354  break;
356  myAC = new GNEChargingStation(net);
357  break;
359  myAC = new GNEParkingArea(net);
360  break;
362  myAC = new GNEParkingSpace(net);
363  break;
364  case SUMO_TAG_E1DETECTOR:
365  myAC = new GNEDetectorE1(net);
366  break;
367  case SUMO_TAG_E2DETECTOR:
369  myAC = new GNEDetectorE2(tagProperty.getTag(), net);
370  break;
371  case SUMO_TAG_E3DETECTOR:
372  myAC = new GNEDetectorE3(net);
373  break;
374  case SUMO_TAG_DET_ENTRY:
375  case SUMO_TAG_DET_EXIT:
376  myAC = new GNEDetectorEntryExit(tagProperty.getTag(), net);
377  break;
379  myAC = new GNEDetectorE1Instant(net);
380  break;
381  case SUMO_TAG_VSS:
382  myAC = new GNEVariableSpeedSign(net);
383  break;
384  case SUMO_TAG_STEP:
385  myAC = new GNEVariableSpeedSignStep(net);
386  break;
387  case SUMO_TAG_CALIBRATOR:
389  myAC = new GNECalibrator(tagProperty.getTag(), net);
390  break;
392  myAC = new GNECalibratorFlow(net);
393  break;
394  case SUMO_TAG_REROUTER:
395  myAC = new GNERerouter(net);
396  break;
397  case SUMO_TAG_INTERVAL:
398  myAC = new GNERerouterInterval(net);
399  break;
401  myAC = new GNEClosingReroute(net);
402  break;
404  myAC = new GNEClosingLaneReroute(net);
405  break;
407  myAC = new GNEDestProbReroute(net);
408  break;
410  myAC = new GNEParkingAreaReroute(net);
411  break;
413  myAC = new GNERouteProbReroute(net);
414  break;
415  case SUMO_TAG_ROUTEPROBE:
416  myAC = new GNERouteProbe(net);
417  break;
418  case SUMO_TAG_VAPORIZER:
419  myAC = new GNEVaporizer(net);
420  break;
421  // shapes
422  case SUMO_TAG_POLY:
423  myAC = new GNEPoly(net);
424  break;
425  case SUMO_TAG_POI:
426  case GNE_TAG_POILANE:
427  case GNE_TAG_POIGEO:
428  myAC = new GNEPOI(tagProperty.getTag(), net);
429  break;
430  // TAZs
431  case SUMO_TAG_TAZ:
432  myAC = new GNETAZ(net);
433  break;
434  case SUMO_TAG_TAZSOURCE:
435  case SUMO_TAG_TAZSINK:
436  myAC = new GNETAZSourceSink(tagProperty.getTag(), net);
437  break;
438  // Demand elements
439  case SUMO_TAG_ROUTE:
441  myAC = new GNERoute(tagProperty.getTag(), net);
442  break;
443  case SUMO_TAG_VTYPE:
444  myAC = new GNEVType(net);
445  break;
447  myAC = new GNEVTypeDistribution(net);
448  break;
449  case SUMO_TAG_VEHICLE:
451  case GNE_TAG_FLOW_ROUTE:
453  case SUMO_TAG_TRIP:
455  case SUMO_TAG_FLOW:
457  myAC = new GNEVehicle(tagProperty.getTag(), net);
458  break;
459  case SUMO_TAG_STOP_LANE:
468  myAC = new GNEStop(tagProperty.getTag(), net);
469  break;
470  case SUMO_TAG_PERSON:
471  case SUMO_TAG_PERSONFLOW:
472  myAC = new GNEPerson(tagProperty.getTag(), net);
473  break;
474  case SUMO_TAG_CONTAINER:
476  myAC = new GNEContainer(tagProperty.getTag(), net);
477  break;
480  myAC = new GNETransport(tagProperty.getTag(), net);
481  break;
485  myAC = new GNETranship(tagProperty.getTag(), net);
486  break;
490  myAC = new GNEPersonTrip(tagProperty.getTag(), net);
491  break;
492  case GNE_TAG_WALK_EDGE:
494  case GNE_TAG_WALK_EDGES:
495  case GNE_TAG_WALK_ROUTE:
497  myAC = new GNEWalk(tagProperty.getTag(), net);
498  break;
499  case GNE_TAG_RIDE_EDGE:
501  myAC = new GNERide(tagProperty.getTag(), net);
502  break;
503  default:
504  throw ProcessError("Non-supported tagProperty in ACTemplate");
505  break;
506  }
507 }
508 
509 
511  delete myAC;
512 }
513 
514 // ---------------------------------------------------------------------------
515 // GNEFrameModules::DemandElementSelector - methods
516 // ---------------------------------------------------------------------------
517 
519  FXGroupBoxModule(frameParent->myContentFrame, ("Parent " + toString(demandElementTag)).c_str()),
520  myFrameParent(frameParent),
521  myCurrentDemandElement(defaultElement),
522  myDemandElementTags({demandElementTag}) {
523  // Create MFXIconComboBox
524  myDemandElementsMatchBox = new MFXIconComboBox(getCollapsableFrame(), GUIDesignComboBoxNCol, this, MID_GNE_SET_TYPE, GUIDesignComboBox);
525  // refresh demand element MatchBox
526  refreshDemandElementSelector();
527  // shown after creation
528  show();
529 }
530 
531 
532 GNEFrameModules::DemandElementSelector::DemandElementSelector(GNEFrame* frameParent, const std::vector<GNETagProperties::TagType>& tagTypes) :
533  FXGroupBoxModule(frameParent->myContentFrame, "Parent element"),
534  myFrameParent(frameParent),
535  myCurrentDemandElement(nullptr) {
536  // fill myDemandElementTags
537  for (const auto& tagType : tagTypes) {
538  const auto tagProperties = GNEAttributeCarrier::getTagPropertiesByType(tagType);
539  for (const auto& tagProperty : tagProperties) {
540  myDemandElementTags.push_back(tagProperty.getTag());
541  }
542  }
543  // Create MFXIconComboBox
545  // refresh demand element MatchBox
547  // shown after creation
548  show();
549 }
550 
551 
553 
554 
557  return myCurrentDemandElement;
558 }
559 
560 
561 const std::vector<SumoXMLTag>&
563  return myDemandElementTags;
564 }
565 
566 
567 void
569  // first check that demandElement tag correspond to a tag of myDemandElementTags
570  if (std::find(myDemandElementTags.begin(), myDemandElementTags.end(), demandElement->getTagProperty().getTag()) != myDemandElementTags.end()) {
571  // update text of myDemandElementsMatchBox
572  myDemandElementsMatchBox->setItem(demandElement->getID().c_str(), demandElement->getIcon());
573  // Set new current demand element
574  myCurrentDemandElement = demandElement;
575  // call demandElementSelected function
576  myFrameParent->demandElementSelected();
577  }
578 }
579 
580 
581 void
583  // first refresh modul
584  refreshDemandElementSelector();
585  // if current selected item isn't valid, set DEFAULT_VTYPE_ID or DEFAULT_PEDTYPE_ID
586  if (myCurrentDemandElement) {
587  myDemandElementsMatchBox->setItem(myCurrentDemandElement->getID().c_str(), myCurrentDemandElement->getIcon());
588  } else if (myDemandElementTags.size() == 1) {
589  if (myDemandElementTags.at(0) == SUMO_TAG_VTYPE) {
590  const auto defaultVType = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->retrieveDemandElement(SUMO_TAG_VTYPE, DEFAULT_VTYPE_ID);
591  myDemandElementsMatchBox->setItem(defaultVType->getID().c_str(), defaultVType->getIcon());
592  }
593  }
594  onCmdSelectDemandElement(nullptr, 0, nullptr);
595  show();
596 }
597 
598 
599 void
601  hide();
602 }
603 
604 
605 bool
607  return shown();
608 }
609 
610 
611 void
613  // get demand elemenst container
614  const auto& demandElements = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getDemandElements();
615  // clear demand elements comboBox
616  myDemandElementsMatchBox->clearItems();
617  // fill myTypeMatchBox with list of demand elements
618  for (const auto& demandElementTag : myDemandElementTags) {
619  // special case for VTypes
620  if (demandElementTag == SUMO_TAG_VTYPE) {
621  // add default types in the first positions
622  myDemandElementsMatchBox->appendIconItem(DEFAULT_VTYPE_ID.c_str(), GUIIconSubSys::getIcon(GUIIcon::VTYPE));
623  myDemandElementsMatchBox->appendIconItem(DEFAULT_BIKETYPE_ID.c_str(), GUIIconSubSys::getIcon(GUIIcon::VTYPE));
624  myDemandElementsMatchBox->appendIconItem(DEFAULT_TAXITYPE_ID.c_str(), GUIIconSubSys::getIcon(GUIIcon::VTYPE));
625  myDemandElementsMatchBox->appendIconItem(DEFAULT_PEDTYPE_ID.c_str(), GUIIconSubSys::getIcon(GUIIcon::VTYPE));
626  myDemandElementsMatchBox->appendIconItem(DEFAULT_CONTAINERTYPE_ID.c_str(), GUIIconSubSys::getIcon(GUIIcon::VTYPE));
627  // add rest of vTypes
628  for (const auto& vType : demandElements.at(demandElementTag)) {
629  // avoid insert duplicated default vType
630  if (DEFAULT_VTYPES.count(vType->getID()) == 0) {
631  myDemandElementsMatchBox->appendIconItem(vType->getID().c_str(), vType->getIcon());
632  }
633  }
634  } else {
635  // insert all Ids
636  for (const auto& demandElement : demandElements.at(demandElementTag)) {
637  myDemandElementsMatchBox->appendIconItem(demandElement->getID().c_str(), demandElement->getIcon());
638  }
639  }
640  }
641  // Set number of items (maximum 10)
642  if (myDemandElementsMatchBox->getNumItems() < 10) {
643  myDemandElementsMatchBox->setNumVisible((int)myDemandElementsMatchBox->getNumItems());
644  } else {
645  myDemandElementsMatchBox->setNumVisible(10);
646  }
647  // update myCurrentDemandElement
648  if (myDemandElementsMatchBox->getNumItems() == 0) {
649  myCurrentDemandElement = nullptr;
650  } else if (myCurrentDemandElement) {
651  for (int i = 0; i < myDemandElementsMatchBox->getNumItems(); i++) {
652  if (myDemandElementsMatchBox->getItem(i).text() == myCurrentDemandElement->getID()) {
653  myDemandElementsMatchBox->setCurrentItem(i, FALSE);
654  }
655  }
656  } else {
657  // set first element in the list as myCurrentDemandElement (Special case for default person and vehicle type)
658  if (myDemandElementsMatchBox->getItem(0).text() == DEFAULT_VTYPE_ID) {
659  myCurrentDemandElement = myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getDefaultType();
660  } else {
661  // disable myCurrentDemandElement
662  myCurrentDemandElement = nullptr;
663  // update myCurrentDemandElement with the first allowed element
664  for (auto i = myDemandElementTags.begin(); (i != myDemandElementTags.end()) && (myCurrentDemandElement == nullptr); i++) {
665  if (demandElements.at(*i).size() > 0) {
666  myCurrentDemandElement = *demandElements.at(*i).begin();
667  }
668  }
669  }
670  }
671 }
672 
673 
674 GNEEdge*
676  if (myCurrentDemandElement == nullptr) {
677  return nullptr;
678  }
679  if (!myCurrentDemandElement->getTagProperty().isPerson()) {
680  return nullptr;
681  }
682  if (myCurrentDemandElement->getChildDemandElements().empty()) {
683  return nullptr;
684  }
685  // get last person plan
686  const GNEDemandElement* lastPersonPlan = myCurrentDemandElement->getChildDemandElements().back();
687  // check tag
688  switch (lastPersonPlan->getTagProperty().getTag()) {
689  // person trips
691  // rides
692  case GNE_TAG_RIDE_EDGE:
693  // walks
694  case GNE_TAG_WALK_EDGE:
695  case GNE_TAG_WALK_EDGES:
696  // stops
698  return lastPersonPlan->getParentEdges().back();
699  // person trips
701  // person trips
703  // walks
705  // stops
707  return lastPersonPlan->getParentAdditionals().back()->getParentLanes().front()->getParentEdge();
708  // route walks
709  case GNE_TAG_WALK_ROUTE:
710  return lastPersonPlan->getParentDemandElements().back()->getParentEdges().back();
711  default:
712  return nullptr;
713  }
714 }
715 
716 
717 GNEEdge*
719  if (myCurrentDemandElement == nullptr) {
720  return nullptr;
721  }
722  if (!myCurrentDemandElement->getTagProperty().isContainer()) {
723  return nullptr;
724  }
725  if (myCurrentDemandElement->getChildDemandElements().empty()) {
726  return nullptr;
727  }
728  // get last container plan
729  const GNEDemandElement* lastContainerPlan = myCurrentDemandElement->getChildDemandElements().back();
730  // check tag
731  switch (lastContainerPlan->getTagProperty().getTag()) {
732  // transport
734  // tranship
737  // stop
739  return lastContainerPlan->getParentEdges().back();
740  // transport
742  // tranship
744  // stop
746  return lastContainerPlan->getParentAdditionals().back()->getParentLanes().front()->getParentEdge();
747  default:
748  return nullptr;
749  }
750 }
751 
752 
753 long
755  // Check if value of myTypeMatchBox correspond to a demand element
756  for (const auto& demandElementTag : myDemandElementTags) {
757  for (const auto& demandElement : myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getDemandElements().at(demandElementTag)) {
758  if (demandElement->getID() == myDemandElementsMatchBox->getText().text()) {
759  // set color of myTypeMatchBox to black (valid)
760  myDemandElementsMatchBox->setTextColor(FXRGB(0, 0, 0));
761  // Set new current demand element
762  myCurrentDemandElement = demandElement;
763  // call demandElementSelected function
764  myFrameParent->demandElementSelected();
765  // Write Warning in console if we're in testing mode
766  WRITE_DEBUG(("Selected item '" + myDemandElementsMatchBox->getText() + "' in DemandElementSelector").text());
767  return 1;
768  }
769  }
770  }
771  // if demand element selected is invalid, set demand element as null
772  myCurrentDemandElement = nullptr;
773  // call demandElementSelected function
774  myFrameParent->demandElementSelected();
775  // change color of myDemandElementsMatchBox to red (invalid)
776  myDemandElementsMatchBox->setTextColor(FXRGB(255, 0, 0));
777  // Write Warning in console if we're in testing mode
778  WRITE_DEBUG("Selected invalid item in DemandElementSelector");
779  return 1;
780 }
781 
782 // ---------------------------------------------------------------------------
783 // GNEFrameModules::HierarchicalElementTree - methods
784 // ---------------------------------------------------------------------------
785 
787  FXGroupBoxModule(frameParent->myContentFrame, "Hierarchy"),
788  myFrameParent(frameParent),
789  myHE(nullptr),
790  myClickedAC(nullptr),
791  myClickedJunction(nullptr),
792  myClickedEdge(nullptr),
793  myClickedLane(nullptr),
794  myClickedCrossing(nullptr),
795  myClickedConnection(nullptr),
796  myClickedShape(nullptr),
797  myClickedTAZElement(nullptr),
798  myClickedAdditional(nullptr),
799  myClickedDemandElement(nullptr),
800  myClickedDataSet(nullptr),
801  myClickedDataInterval(nullptr),
802  myClickedGenericData(nullptr) {
803  // Create three list
805  hide();
806 }
807 
808 
810 
811 
812 void
814  myHE = dynamic_cast<GNEHierarchicalElement*>(AC);
815  // show HierarchicalElementTree and refresh HierarchicalElementTree
816  if (myHE) {
817  // refresh HierarchicalElementTree
818  refreshHierarchicalElementTree();
819  // show myTreeListDinamic
820  myTreeListDinamic->show();
821  //show modul
822  show();
823  }
824 }
825 
826 
827 void
829  // set all pointers null
830  myHE = nullptr;
831  myClickedAC = nullptr;
832  myClickedJunction = nullptr;
833  myClickedEdge = nullptr;
834  myClickedLane = nullptr;
835  myClickedCrossing = nullptr;
836  myClickedConnection = nullptr;
837  myClickedShape = nullptr;
838  myClickedTAZElement = nullptr;
839  myClickedAdditional = nullptr;
840  myClickedDemandElement = nullptr;
841  myClickedDataSet = nullptr;
842  myClickedDataInterval = nullptr;
843  myClickedGenericData = nullptr;
844  // hide myTreeListDinamic
845  myTreeListDinamic->hide();
846  // hide modul
847  hide();
848 }
849 
850 
851 void
853  // clear items
854  myTreeListDinamic->clearItems();
855  myTreeItemToACMap.clear();
856  myTreeItemsConnections.clear();
857  // show children of myHE
858  if (myHE) {
859  showHierarchicalElementChildren(myHE, showAttributeCarrierParents());
860  }
861 }
862 
863 
864 void
866  // simply check if AC is the same of myHE
867  if (AC == myHE) {
868  myHE = nullptr;
869  }
870 }
871 
872 
873 long
874 GNEFrameModules::HierarchicalElementTree::onCmdShowChildMenu(FXObject*, FXSelector, void* eventData) {
875  // Obtain event
876  FXEvent* e = (FXEvent*)eventData;
877  // obtain FXTreeItem in the given position
878  FXTreeItem* item = myTreeListDinamic->getItemAt(e->win_x, e->win_y);
879  // open Pop-up if FXTreeItem has a Attribute Carrier vinculated
880  if (item && (myTreeItemsConnections.find(item) == myTreeItemsConnections.end())) {
881  createPopUpMenu(e->root_x, e->root_y, myTreeItemToACMap[item]);
882  }
883  return 1;
884 }
885 
886 
887 long
889  // Center item
890  if (myClickedJunction) {
891  myFrameParent->myViewNet->centerTo(myClickedJunction->getGlID(), true, -1);
892  } else if (myClickedEdge) {
893  myFrameParent->myViewNet->centerTo(myClickedEdge->getGlID(), true, -1);
894  } else if (myClickedLane) {
895  myFrameParent->myViewNet->centerTo(myClickedLane->getGlID(), true, -1);
896  } else if (myClickedCrossing) {
897  myFrameParent->myViewNet->centerTo(myClickedCrossing->getGlID(), true, -1);
898  } else if (myClickedConnection) {
899  myFrameParent->myViewNet->centerTo(myClickedConnection->getGlID(), true, -1);
900  } else if (myClickedAdditional) {
901  myFrameParent->myViewNet->centerTo(myClickedAdditional->getGlID(), true, -1);
902  } else if (myClickedShape) {
903  myFrameParent->myViewNet->centerTo(myClickedShape->getGlID(), true, -1);
904  } else if (myClickedTAZElement) {
905  myFrameParent->myViewNet->centerTo(myClickedTAZElement->getGlID(), true, -1);
906  } else if (myClickedDemandElement) {
907  myFrameParent->myViewNet->centerTo(myClickedDemandElement->getGlID(), true, -1);
908  } else if (myClickedGenericData) {
909  myFrameParent->myViewNet->centerTo(myClickedGenericData->getGlID(), true, -1);
910  }
911  // update view after centering
912  myFrameParent->myViewNet->updateViewNet();
913  return 1;
914 }
915 
916 
917 long
919  if ((myHE != nullptr) && (myClickedAC != nullptr)) {
920  myFrameParent->myViewNet->getViewParent()->getInspectorFrame()->inspectChild(myClickedAC, myHE);
921  }
922  return 1;
923 }
924 
925 
926 long
928  // Remove Attribute Carrier
929  if (myClickedJunction) {
930  myFrameParent->myViewNet->getNet()->deleteJunction(myClickedJunction, myFrameParent->myViewNet->getUndoList());
931  } else if (myClickedEdge) {
932  myFrameParent->myViewNet->getNet()->deleteEdge(myClickedEdge, myFrameParent->myViewNet->getUndoList(), false);
933  } else if (myClickedLane) {
934  myFrameParent->myViewNet->getNet()->deleteLane(myClickedLane, myFrameParent->myViewNet->getUndoList(), false);
935  } else if (myClickedCrossing) {
936  myFrameParent->myViewNet->getNet()->deleteCrossing(myClickedCrossing, myFrameParent->myViewNet->getUndoList());
937  } else if (myClickedConnection) {
938  myFrameParent->myViewNet->getNet()->deleteConnection(myClickedConnection, myFrameParent->myViewNet->getUndoList());
939  } else if (myClickedAdditional) {
940  myFrameParent->myViewNet->getNet()->deleteAdditional(myClickedAdditional, myFrameParent->myViewNet->getUndoList());
941  } else if (myClickedShape) {
942  myFrameParent->myViewNet->getNet()->deleteShape(myClickedShape, myFrameParent->myViewNet->getUndoList());
943  } else if (myClickedTAZElement) {
944  myFrameParent->myViewNet->getNet()->deleteTAZElement(myClickedTAZElement, myFrameParent->myViewNet->getUndoList());
945  } else if (myClickedDemandElement) {
946  // check that default VTypes aren't removed
947  if ((myClickedDemandElement->getTagProperty().getTag() == SUMO_TAG_VTYPE) && (GNEAttributeCarrier::parse<bool>(myClickedDemandElement->getAttribute(GNE_ATTR_DEFAULT_VTYPE)))) {
948  WRITE_WARNING("Default Vehicle Type '" + myClickedDemandElement->getAttribute(SUMO_ATTR_ID) + "' cannot be removed");
949  return 1;
950  } else if (myClickedDemandElement->getTagProperty().isPersonPlan() && (myClickedDemandElement->getParentDemandElements().front()->getChildDemandElements().size() == 1)) {
951  // we need to check if we're removing the last person plan of a person.
952  myFrameParent->myViewNet->getNet()->deleteDemandElement(myClickedDemandElement->getParentDemandElements().front(), myFrameParent->myViewNet->getUndoList());
953  } else {
954  myFrameParent->myViewNet->getNet()->deleteDemandElement(myClickedDemandElement, myFrameParent->myViewNet->getUndoList());
955  }
956  } else if (myClickedDataSet) {
957  myFrameParent->myViewNet->getNet()->deleteDataSet(myClickedDataSet, myFrameParent->myViewNet->getUndoList());
958  } else if (myClickedDataInterval) {
959  // check if we have to remove data Set
960  if (myClickedDataInterval->getDataSetParent()->getDataIntervalChildren().size() == 1) {
961  myFrameParent->myViewNet->getNet()->deleteDataSet(myClickedDataInterval->getDataSetParent(), myFrameParent->myViewNet->getUndoList());
962  } else {
963  myFrameParent->myViewNet->getNet()->deleteDataInterval(myClickedDataInterval, myFrameParent->myViewNet->getUndoList());
964  }
965  } else if (myClickedGenericData) {
966  // check if we have to remove interval
967  if (myClickedGenericData->getDataIntervalParent()->getGenericDataChildren().size() == 1) {
968  // check if we have to remove data Set
969  if (myClickedGenericData->getDataIntervalParent()->getDataSetParent()->getDataIntervalChildren().size() == 1) {
970  myFrameParent->myViewNet->getNet()->deleteDataSet(myClickedGenericData->getDataIntervalParent()->getDataSetParent(), myFrameParent->myViewNet->getUndoList());
971  } else {
972  myFrameParent->myViewNet->getNet()->deleteDataInterval(myClickedGenericData->getDataIntervalParent(), myFrameParent->myViewNet->getUndoList());
973  }
974  } else {
975  myFrameParent->myViewNet->getNet()->deleteGenericData(myClickedGenericData, myFrameParent->myViewNet->getUndoList());
976  }
977  }
978  // update net
979  myFrameParent->myViewNet->updateViewNet();
980  // refresh AC Hierarchy
981  refreshHierarchicalElementTree();
982  // check if inspector frame has to be shown again
983  if (myFrameParent->myViewNet->getInspectedAttributeCarriers().size() == 1) {
984  if (myFrameParent->myViewNet->getInspectedAttributeCarriers().front() != myClickedAC) {
985  myFrameParent->myViewNet->getViewParent()->getInspectorFrame()->inspectSingleElement(myFrameParent->myViewNet->getInspectedAttributeCarriers().front());
986  } else {
987  // inspect a nullprt element to reset inspector frame
988  myFrameParent->myViewNet->getViewParent()->getInspectorFrame()->inspectSingleElement(nullptr);
989  }
990  }
991  return 1;
992 }
993 
994 
995 long
997  // currently only children of demand elements can be moved
998  if (myClickedDemandElement) {
999  myFrameParent->myViewNet->getUndoList()->begin(myClickedDemandElement->getTagProperty().getGUIIcon(), ("moving up " + myClickedDemandElement->getTagStr()).c_str());
1000  // move element one position back
1001  myFrameParent->myViewNet->getUndoList()->add(new GNEChange_Children(myClickedDemandElement->getParentDemandElements().at(0), myClickedDemandElement,
1002  GNEChange_Children::Operation::MOVE_BACK), true);
1003  myFrameParent->myViewNet->getUndoList()->end();
1004  }
1005  // refresh after moving child
1006  refreshHierarchicalElementTree();
1007  return 1;
1008 }
1009 
1010 
1011 long
1013  // currently only children of demand elements can be moved
1014  if (myClickedDemandElement) {
1015  myFrameParent->myViewNet->getUndoList()->begin(myClickedDemandElement->getTagProperty().getGUIIcon(), ("moving down " + myClickedDemandElement->getTagStr()).c_str());
1016  // move element one position front
1017  myFrameParent->myViewNet->getUndoList()->add(new GNEChange_Children(myClickedDemandElement->getParentDemandElements().at(0), myClickedDemandElement,
1018  GNEChange_Children::Operation::MOVE_FRONT), true);
1019  myFrameParent->myViewNet->getUndoList()->end();
1020  }
1021  // refresh after moving child
1022  refreshHierarchicalElementTree();
1023  return 1;
1024 }
1025 
1026 
1027 void
1029  // get attributeCarrirs
1030  const auto& attributeCarriers = myFrameParent->myViewNet->getNet()->getAttributeCarriers();
1031  // first check that AC exist
1032  if (clickedAC) {
1033  // set current clicked AC
1034  myClickedAC = clickedAC;
1035  // cast all elements
1036  myClickedJunction = attributeCarriers->retrieveJunction(clickedAC->getID(), false);
1037  myClickedEdge = attributeCarriers->retrieveEdge(clickedAC->getID(), false);
1038  myClickedLane = attributeCarriers->retrieveLane(clickedAC, false);
1039  myClickedCrossing = attributeCarriers->retrieveCrossing(clickedAC, false);
1040  myClickedConnection = attributeCarriers->retrieveConnection(clickedAC, false);
1041  myClickedShape = attributeCarriers->retrieveShape(clickedAC, false);
1042  myClickedTAZElement = attributeCarriers->retrieveTAZElement(clickedAC, false);
1043  myClickedAdditional = attributeCarriers->retrieveAdditional(clickedAC, false);
1044  myClickedDemandElement = attributeCarriers->retrieveDemandElement(clickedAC, false);
1045  myClickedDataSet = attributeCarriers->retrieveDataSet(clickedAC, false);
1046  myClickedDataInterval = attributeCarriers->retrieveDataInterval(clickedAC, false);
1047  myClickedGenericData = attributeCarriers->retrieveGenericData(clickedAC, false);
1048  // create FXMenuPane
1049  FXMenuPane* pane = new FXMenuPane(myTreeListDinamic);
1050  // set item name and icon
1051  new MFXMenuHeader(pane, myFrameParent->myViewNet->getViewParent()->getGUIMainWindow()->getBoldFont(), myClickedAC->getPopUpID().c_str(), myClickedAC->getIcon());
1052  // insert separator
1053  new FXMenuSeparator(pane);
1054  // create center menu command
1055  FXMenuCommand* centerMenuCommand = GUIDesigns::buildFXMenuCommand(pane, "Center", GUIIconSubSys::getIcon(GUIIcon::RECENTERVIEW), this, MID_GNE_CENTER);
1056  // disable Centering for Vehicle Types, data sets and data intervals
1057  if (myClickedAC->getTagProperty().isVehicleType() || (myClickedAC->getTagProperty().getTag() == SUMO_TAG_DATASET) ||
1058  (myClickedAC->getTagProperty().getTag() == SUMO_TAG_DATAINTERVAL)) {
1059  centerMenuCommand->disable();
1060  }
1061  // create inspect and delete menu commands
1062  FXMenuCommand* inspectMenuCommand = GUIDesigns::buildFXMenuCommand(pane, "Inspect", GUIIconSubSys::getIcon(GUIIcon::MODEINSPECT), this, MID_GNE_INSPECT);
1063  FXMenuCommand* deleteMenuCommand = GUIDesigns::buildFXMenuCommand(pane, "Delete", GUIIconSubSys::getIcon(GUIIcon::MODEDELETE), this, MID_GNE_DELETE);
1064  // check if inspect and delete menu commands has to be disabled
1065  if (GNEFrameAttributeModules::isSupermodeValid(myFrameParent->myViewNet, myClickedAC) == false) {
1066  inspectMenuCommand->disable();
1067  deleteMenuCommand->disable();
1068  }
1069  // now chec if given AC support manually moving of their item up and down (Currently only for certain demand elements)
1070  /* if (myClickedDemandElement && myClickedAC->getTagProperty().canBeSortedManually()) {
1071  // insert separator
1072  new FXMenuSeparator(pane);
1073  // create both moving menu commands
1074  FXMenuCommand* moveUpMenuCommand = GUIDesigns::buildFXMenuCommand(pane, "Move up", GUIIconSubSys::getIcon(GUIIcon::ARROW_UP), this, MID_GNE_ACHIERARCHY_MOVEUP);
1075  FXMenuCommand* moveDownMenuCommand = GUIDesigns::buildFXMenuCommand(pane, "Move down", GUIIconSubSys::getIcon(GUIIcon::ARROW_DOWN), this, MID_GNE_ACHIERARCHY_MOVEDOWN);
1076  // check if both commands has to be disabled
1077  if (myClickedDemandElement->getTagProperty().isStopPerson()) {
1078  moveUpMenuCommand->setText("Move up (Stops cannot be moved)");
1079  moveDownMenuCommand->setText("Move down (Stops cannot be moved)");
1080  moveUpMenuCommand->disable();
1081  moveDownMenuCommand->disable();
1082  } else {
1083  // check if moveUpMenuCommand has to be disabled
1084  if (myClickedDemandElement->getParentDemandElements().front()->getChildDemandElements().front() == myClickedDemandElement) {
1085  moveUpMenuCommand->setText("Move up (It's already the first element)");
1086  moveUpMenuCommand->disable();
1087  } else if (myClickedDemandElement->getParentDemandElements().front()->getPreviousChildDemandElement(myClickedDemandElement)->getTagProperty().isStopPerson()) {
1088  moveUpMenuCommand->setText("Move up (Previous element is a Stop)");
1089  moveUpMenuCommand->disable();
1090  }
1091  // check if moveDownMenuCommand has to be disabled
1092  if (myClickedDemandElement->getParentDemandElements().front()->getChildDemandElements().back() == myClickedDemandElement) {
1093  moveDownMenuCommand->setText("Move down (It's already the last element)");
1094  moveDownMenuCommand->disable();
1095  } else if (myClickedDemandElement->getParentDemandElements().front()->getNextChildDemandElement(myClickedDemandElement)->getTagProperty().isStopPerson()) {
1096  moveDownMenuCommand->setText("Move down (Next element is a Stop)");
1097  moveDownMenuCommand->disable();
1098  }
1099  }
1100  } */
1101  // Center in the mouse position and create pane
1102  pane->setX(X);
1103  pane->setY(Y);
1104  pane->create();
1105  pane->show();
1106  } else {
1107  // set all clicked elements to null
1108  myClickedAC = nullptr;
1109  myClickedJunction = nullptr;
1110  myClickedEdge = nullptr;
1111  myClickedLane = nullptr;
1112  myClickedCrossing = nullptr;
1113  myClickedConnection = nullptr;
1114  myClickedShape = nullptr;
1115  myClickedTAZElement = nullptr;
1116  myClickedAdditional = nullptr;
1117  myClickedDemandElement = nullptr;
1118  myClickedDataSet = nullptr;
1119  myClickedDataInterval = nullptr;
1120  myClickedGenericData = nullptr;
1121  }
1122 }
1123 
1124 
1125 FXTreeItem*
1127  // get attributeCarrirs
1128  const auto& attributeCarriers = myFrameParent->myViewNet->getNet()->getAttributeCarriers();
1129  // check tags
1130  if (myHE->getTagProperty().isNetworkElement()) {
1131  // check demand element type
1132  switch (myHE->getTagProperty().getTag()) {
1133  case SUMO_TAG_EDGE: {
1134  // obtain Edge
1135  GNEEdge* edge = attributeCarriers->retrieveEdge(myHE->getID(), false);
1136  if (edge) {
1137  // insert Junctions of edge in tree (Pararell because a edge has always two Junctions)
1138  FXTreeItem* junctionSourceItem = myTreeListDinamic->insertItem(nullptr, nullptr, (edge->getFromJunction()->getHierarchyName() + " origin").c_str(), edge->getFromJunction()->getIcon(), edge->getFromJunction()->getIcon());
1139  FXTreeItem* junctionDestinyItem = myTreeListDinamic->insertItem(nullptr, nullptr, (edge->getFromJunction()->getHierarchyName() + " destiny").c_str(), edge->getFromJunction()->getIcon(), edge->getFromJunction()->getIcon());
1140  junctionDestinyItem->setExpanded(true);
1141  // Save items in myTreeItemToACMap
1142  myTreeItemToACMap[junctionSourceItem] = edge->getFromJunction();
1143  myTreeItemToACMap[junctionDestinyItem] = edge->getToJunction();
1144  // return junction destiny Item
1145  return junctionDestinyItem;
1146  } else {
1147  return nullptr;
1148  }
1149  }
1150  case SUMO_TAG_LANE: {
1151  // obtain lane
1152  GNELane* lane = attributeCarriers->retrieveLane(myHE->getID(), false);
1153  if (lane) {
1154  // obtain parent edge
1155  GNEEdge* edge = attributeCarriers->retrieveEdge(lane->getParentEdge()->getID());
1156  //inser Junctions of lane of edge in tree (Pararell because a edge has always two Junctions)
1157  FXTreeItem* junctionSourceItem = myTreeListDinamic->insertItem(nullptr, nullptr, (edge->getFromJunction()->getHierarchyName() + " origin").c_str(), edge->getFromJunction()->getIcon(), edge->getFromJunction()->getIcon());
1158  FXTreeItem* junctionDestinyItem = myTreeListDinamic->insertItem(nullptr, nullptr, (edge->getFromJunction()->getHierarchyName() + " destiny").c_str(), edge->getFromJunction()->getIcon(), edge->getFromJunction()->getIcon());
1159  junctionDestinyItem->setExpanded(true);
1160  // Create edge item
1161  FXTreeItem* edgeItem = myTreeListDinamic->insertItem(nullptr, junctionDestinyItem, edge->getHierarchyName().c_str(), edge->getIcon(), edge->getIcon());
1162  edgeItem->setExpanded(true);
1163  // Save items in myTreeItemToACMap
1164  myTreeItemToACMap[junctionSourceItem] = edge->getFromJunction();
1165  myTreeItemToACMap[junctionDestinyItem] = edge->getToJunction();
1166  myTreeItemToACMap[edgeItem] = edge;
1167  // return edge item
1168  return edgeItem;
1169  } else {
1170  return nullptr;
1171  }
1172  }
1173  case SUMO_TAG_CROSSING: {
1174  // obtain crossing parent junction
1175  GNEJunction* junction = attributeCarriers->retrieveCrossing(myHE)->getParentJunction();
1176  // create junction item
1177  FXTreeItem* junctionItem = myTreeListDinamic->insertItem(nullptr, nullptr, junction->getHierarchyName().c_str(), junction->getIcon(), junction->getIcon());
1178  junctionItem->setExpanded(true);
1179  // Save items in myTreeItemToACMap
1180  myTreeItemToACMap[junctionItem] = junction;
1181  // return junction Item
1182  return junctionItem;
1183  }
1184  case SUMO_TAG_CONNECTION: {
1185  // obtain Connection
1186  GNEConnection* connection = attributeCarriers->retrieveConnection(myHE->getID(), false);
1187  if (connection) {
1188  // create edge from item
1189  FXTreeItem* edgeFromItem = myTreeListDinamic->insertItem(nullptr, nullptr, connection->getEdgeFrom()->getHierarchyName().c_str(), connection->getEdgeFrom()->getIcon(), connection->getEdgeFrom()->getIcon());
1190  edgeFromItem->setExpanded(true);
1191  // create edge to item
1192  FXTreeItem* edgeToItem = myTreeListDinamic->insertItem(nullptr, nullptr, connection->getEdgeTo()->getHierarchyName().c_str(), connection->getEdgeTo()->getIcon(), connection->getEdgeTo()->getIcon());
1193  edgeToItem->setExpanded(true);
1194  // create connection item
1195  FXTreeItem* connectionItem = myTreeListDinamic->insertItem(nullptr, edgeToItem, connection->getHierarchyName().c_str(), connection->getIcon(), connection->getIcon());
1196  connectionItem->setExpanded(true);
1197  // Save items in myTreeItemToACMap
1198  myTreeItemToACMap[edgeFromItem] = connection->getEdgeFrom();
1199  myTreeItemToACMap[edgeToItem] = connection->getEdgeTo();
1200  myTreeItemToACMap[connectionItem] = connection;
1201  // return connection item
1202  return connectionItem;
1203  } else {
1204  return nullptr;
1205  }
1206  }
1207  default:
1208  break;
1209  }
1210  } else if (myHE->getTagProperty().getTag() == GNE_TAG_POILANE) {
1211  // Obtain POILane
1212  const GNEShape* POILane = myFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveShape(myHE);
1213  // obtain parent lane
1214  GNELane* lane = attributeCarriers->retrieveLane(POILane->getParentLanes().at(0)->getID());
1215  // obtain parent edge
1216  GNEEdge* edge = attributeCarriers->retrieveEdge(lane->getParentEdge()->getID());
1217  //inser Junctions of lane of edge in tree (Pararell because a edge has always two Junctions)
1218  FXTreeItem* junctionSourceItem = myTreeListDinamic->insertItem(nullptr, nullptr, (edge->getFromJunction()->getHierarchyName() + " origin").c_str(), edge->getFromJunction()->getIcon(), edge->getFromJunction()->getIcon());
1219  FXTreeItem* junctionDestinyItem = myTreeListDinamic->insertItem(nullptr, nullptr, (edge->getFromJunction()->getHierarchyName() + " destiny").c_str(), edge->getFromJunction()->getIcon(), edge->getFromJunction()->getIcon());
1220  junctionDestinyItem->setExpanded(true);
1221  // Create edge item
1222  FXTreeItem* edgeItem = myTreeListDinamic->insertItem(nullptr, junctionDestinyItem, edge->getHierarchyName().c_str(), edge->getIcon(), edge->getIcon());
1223  edgeItem->setExpanded(true);
1224  // Create lane item
1225  FXTreeItem* laneItem = myTreeListDinamic->insertItem(nullptr, edgeItem, lane->getHierarchyName().c_str(), lane->getIcon(), lane->getIcon());
1226  laneItem->setExpanded(true);
1227  // Save items in myTreeItemToACMap
1228  myTreeItemToACMap[junctionSourceItem] = edge->getFromJunction();
1229  myTreeItemToACMap[junctionDestinyItem] = edge->getToJunction();
1230  myTreeItemToACMap[edgeItem] = edge;
1231  myTreeItemToACMap[laneItem] = lane;
1232  // return Lane item
1233  return laneItem;
1234  } else if (myHE->getTagProperty().isAdditionalElement()) {
1235  // Obtain Additional
1236  const GNEAdditional* additional = attributeCarriers->retrieveAdditional(myHE);
1237  // declare auxiliar FXTreeItem, due a demand element can have multiple "roots"
1238  FXTreeItem* root = nullptr;
1239  // check if there is demand elements parents
1240  if (additional->getParentAdditionals().size() > 0) {
1241  // check if we have more than one edge
1242  if (additional->getParentAdditionals().size() > 1) {
1243  // insert first item
1244  addListItem(additional->getParentAdditionals().front());
1245  // insert "spacer"
1246  if (additional->getParentAdditionals().size() > 2) {
1247  addListItem(nullptr, ("..." + toString((int)additional->getParentAdditionals().size() - 2) + " additionals...").c_str(), 0, false);
1248  }
1249  }
1250  // return last inserted item
1251  root = addListItem(additional->getParentAdditionals().back());
1252  }
1253  // check if there is parent demand elements
1254  if (additional->getParentDemandElements().size() > 0) {
1255  // check if we have more than one demand element
1256  if (additional->getParentDemandElements().size() > 1) {
1257  // insert first item
1258  addListItem(additional->getParentDemandElements().front());
1259  // insert "spacer"
1260  if (additional->getParentDemandElements().size() > 2) {
1261  addListItem(nullptr, ("..." + toString((int)additional->getParentDemandElements().size() - 2) + " demand elements...").c_str(), 0, false);
1262  }
1263  }
1264  // return last inserted item
1265  root = addListItem(additional->getParentDemandElements().back());
1266  }
1267  // check if there is parent edges
1268  if (additional->getParentEdges().size() > 0) {
1269  // check if we have more than one edge
1270  if (additional->getParentEdges().size() > 1) {
1271  // insert first item
1272  addListItem(additional->getParentEdges().front());
1273  // insert "spacer"
1274  if (additional->getParentEdges().size() > 2) {
1275  addListItem(nullptr, ("..." + toString((int)additional->getParentEdges().size() - 2) + " edges...").c_str(), 0, false);
1276  }
1277  }
1278  // return last inserted item
1279  root = addListItem(additional->getParentEdges().back());
1280  }
1281  // check if there is parent lanes
1282  if (additional->getParentLanes().size() > 0) {
1283  // check if we have more than one parent lane
1284  if (additional->getParentLanes().size() > 1) {
1285  // insert first item
1286  addListItem(additional->getParentLanes().front());
1287  // insert "spacer"
1288  if (additional->getParentLanes().size() > 2) {
1289  addListItem(nullptr, ("..." + toString((int)additional->getParentLanes().size() - 2) + " lanes...").c_str(), 0, false);
1290  }
1291  }
1292  // return last inserted item
1293  root = addListItem(additional->getParentLanes().back());
1294  }
1295  // return last inserted list item
1296  return root;
1297  } else if (myHE->getTagProperty().isTAZElement()) {
1298  // Obtain TAZElement
1299  const GNETAZElement* TAZElement = myFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveTAZElement(myHE);
1300  // declare auxiliar FXTreeItem, due a demand element can have multiple "roots"
1301  FXTreeItem* root = nullptr;
1302  // check if there is demand elements parents
1303  if (TAZElement->getParentTAZElements().size() > 0) {
1304  // check if we have more than one edge
1305  if (TAZElement->getParentTAZElements().size() > 1) {
1306  // insert first item
1307  addListItem(TAZElement->getParentTAZElements().front());
1308  // insert "spacer"
1309  if (TAZElement->getParentTAZElements().size() > 2) {
1310  addListItem(nullptr, ("..." + toString((int)TAZElement->getParentTAZElements().size() - 2) + " TAZElements...").c_str(), 0, false);
1311  }
1312  }
1313  // return last inserted item
1314  root = addListItem(TAZElement->getParentTAZElements().back());
1315  }
1316  // check if there is parent demand elements
1317  if (TAZElement->getParentDemandElements().size() > 0) {
1318  // check if we have more than one demand element
1319  if (TAZElement->getParentDemandElements().size() > 1) {
1320  // insert first item
1321  addListItem(TAZElement->getParentDemandElements().front());
1322  // insert "spacer"
1323  if (TAZElement->getParentDemandElements().size() > 2) {
1324  addListItem(nullptr, ("..." + toString((int)TAZElement->getParentDemandElements().size() - 2) + " demand elements...").c_str(), 0, false);
1325  }
1326  }
1327  // return last inserted item
1328  root = addListItem(TAZElement->getParentDemandElements().back());
1329  }
1330  // check if there is parent edges
1331  if (TAZElement->getParentEdges().size() > 0) {
1332  // check if we have more than one edge
1333  if (TAZElement->getParentEdges().size() > 1) {
1334  // insert first item
1335  addListItem(TAZElement->getParentEdges().front());
1336  // insert "spacer"
1337  if (TAZElement->getParentEdges().size() > 2) {
1338  addListItem(nullptr, ("..." + toString((int)TAZElement->getParentEdges().size() - 2) + " edges...").c_str(), 0, false);
1339  }
1340  }
1341  // return last inserted item
1342  root = addListItem(TAZElement->getParentEdges().back());
1343  }
1344  // check if there is parent lanes
1345  if (TAZElement->getParentLanes().size() > 0) {
1346  // check if we have more than one parent lane
1347  if (TAZElement->getParentLanes().size() > 1) {
1348  // insert first item
1349  addListItem(TAZElement->getParentLanes().front());
1350  // insert "spacer"
1351  if (TAZElement->getParentLanes().size() > 2) {
1352  addListItem(nullptr, ("..." + toString((int)TAZElement->getParentLanes().size() - 2) + " lanes...").c_str(), 0, false);
1353  }
1354  }
1355  // return last inserted item
1356  root = addListItem(TAZElement->getParentLanes().back());
1357  }
1358  // return last inserted list item
1359  return root;
1360  } else if (myHE->getTagProperty().isDemandElement()) {
1361  // Obtain DemandElement
1362  GNEDemandElement* demandElement = myFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveDemandElement(myHE);
1363  // declare auxiliar FXTreeItem, due a demand element can have multiple "roots"
1364  FXTreeItem* root = nullptr;
1365  // check if there are demand element parents
1366  if (demandElement->getParentAdditionals().size() > 0) {
1367  // check if we have more than one edge
1368  if (demandElement->getParentAdditionals().size() > 1) {
1369  // insert first item
1370  addListItem(demandElement->getParentAdditionals().front());
1371  // insert "spacer"
1372  if (demandElement->getParentAdditionals().size() > 2) {
1373  addListItem(nullptr, ("..." + toString((int)demandElement->getParentAdditionals().size() - 2) + " additionals...").c_str(), 0, false);
1374  }
1375  }
1376  // return last inserted item
1377  root = addListItem(demandElement->getParentAdditionals().back());
1378  }
1379  // check if there is parent demand elements
1380  if (demandElement->getParentDemandElements().size() > 0) {
1381  // check if we have more than one demand element
1382  if (demandElement->getParentDemandElements().size() > 1) {
1383  // insert first item
1384  addListItem(demandElement->getParentDemandElements().front());
1385  // insert "spacer"
1386  if (demandElement->getParentDemandElements().size() > 2) {
1387  addListItem(nullptr, ("..." + toString((int)demandElement->getParentDemandElements().size() - 2) + " demand elements...").c_str(), 0, false);
1388  }
1389  }
1390  // return last inserted item
1391  root = addListItem(demandElement->getParentDemandElements().back());
1392  }
1393  // check if there is parent edges
1394  if (demandElement->getParentEdges().size() > 0) {
1395  // check if we have more than one edge
1396  if (demandElement->getParentEdges().size() > 1) {
1397  // insert first item
1398  addListItem(demandElement->getParentEdges().front());
1399  // insert "spacer"
1400  if (demandElement->getParentEdges().size() > 2) {
1401  addListItem(nullptr, ("..." + toString((int)demandElement->getParentEdges().size() - 2) + " edges...").c_str(), 0, false);
1402  }
1403  }
1404  // return last inserted item
1405  root = addListItem(demandElement->getParentEdges().back());
1406  }
1407  // check if there is parent lanes
1408  if (demandElement->getParentLanes().size() > 0) {
1409  // check if we have more than one parent lane
1410  if (demandElement->getParentLanes().size() > 1) {
1411  // insert first item
1412  addListItem(demandElement->getParentLanes().front());
1413  // insert "spacer"
1414  if (demandElement->getParentLanes().size() > 2) {
1415  addListItem(nullptr, ("..." + toString((int)demandElement->getParentLanes().size() - 2) + " lanes...").c_str(), 0, false);
1416  }
1417  }
1418  // return last inserted item
1419  root = addListItem(demandElement->getParentLanes().back());
1420  }
1421  // return last inserted list item
1422  return root;
1423  } else if (myHE->getTagProperty().isDataElement()) {
1424  // check if is a GNEDataInterval or a GNEGenericData
1425  if (myHE->getTagProperty().getTag() == SUMO_TAG_DATASET) {
1426  return nullptr;
1427  } else if (myHE->getTagProperty().getTag() == SUMO_TAG_DATAINTERVAL) {
1428  return addListItem(myFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveDataSet(myHE->getID()));
1429  } else {
1430  // Obtain DataElement
1431  GNEGenericData* dataElement = dynamic_cast<GNEGenericData*>(myHE);
1432  if (dataElement) {
1433  // declare auxiliar FXTreeItem, due a data element can have multiple "roots"
1434  FXTreeItem* root = nullptr;
1435  // set dataset
1436  addListItem(dataElement->getDataIntervalParent()->getDataSetParent());
1437  // set data interval
1438  addListItem(dataElement->getDataIntervalParent());
1439  // check if there is data elements parents
1440  if (dataElement->getParentAdditionals().size() > 0) {
1441  // check if we have more than one edge
1442  if (dataElement->getParentAdditionals().size() > 1) {
1443  // insert first item
1444  addListItem(dataElement->getParentAdditionals().front());
1445  // insert "spacer"
1446  if (dataElement->getParentAdditionals().size() > 2) {
1447  addListItem(nullptr, ("..." + toString((int)dataElement->getParentAdditionals().size() - 2) + " additionals...").c_str(), 0, false);
1448  }
1449  }
1450  // return last inserted item
1451  root = addListItem(dataElement->getParentAdditionals().back());
1452  }
1453  // check if there is parent demand elements
1454  if (dataElement->getParentDemandElements().size() > 0) {
1455  // check if we have more than one demand element
1456  if (dataElement->getParentDemandElements().size() > 1) {
1457  // insert first item
1458  addListItem(dataElement->getParentDemandElements().front());
1459  // insert "spacer"
1460  if (dataElement->getParentDemandElements().size() > 2) {
1461  addListItem(nullptr, ("..." + toString((int)dataElement->getParentDemandElements().size() - 2) + " demand elements...").c_str(), 0, false);
1462  }
1463  }
1464  // return last inserted item
1465  root = addListItem(dataElement->getParentDemandElements().back());
1466  }
1467  // check if there is parent edges
1468  if (dataElement->getParentEdges().size() > 0) {
1469  // check if we have more than one edge
1470  if (dataElement->getParentEdges().size() > 1) {
1471  // insert first ege
1472  if (dataElement->getTagProperty().getTag() == SUMO_TAG_EDGEREL) {
1473  addListItem(dataElement->getParentEdges().front(), nullptr, "from ");
1474  } else {
1475  addListItem(dataElement->getParentEdges().front());
1476  }
1477  // insert "spacer"
1478  if (dataElement->getParentEdges().size() > 2) {
1479  addListItem(nullptr, ("..." + toString((int)dataElement->getParentEdges().size() - 2) + " edges...").c_str(), 0, false);
1480  }
1481  }
1482  // insert last ege
1483  if (dataElement->getTagProperty().getTag() == SUMO_TAG_EDGEREL) {
1484  addListItem(dataElement->getParentEdges().back(), nullptr, "to ");
1485  } else {
1486  addListItem(dataElement->getParentEdges().back());
1487  }
1488  }
1489  // check if there is parent lanes
1490  if (dataElement->getParentLanes().size() > 0) {
1491  // check if we have more than one parent lane
1492  if (dataElement->getParentLanes().size() > 1) {
1493  // insert first item
1494  addListItem(dataElement->getParentLanes().front());
1495  // insert "spacer"
1496  if (dataElement->getParentLanes().size() > 2) {
1497  addListItem(nullptr, ("..." + toString((int)dataElement->getParentLanes().size() - 2) + " lanes...").c_str(), 0, false);
1498  }
1499  }
1500  // return last inserted item
1501  root = addListItem(dataElement->getParentLanes().back());
1502  }
1503  // return last inserted list item
1504  return root;
1505  }
1506  }
1507  }
1508  // there aren't parents
1509  return nullptr;
1510 }
1511 
1512 
1513 void
1515  if (HE->getTagProperty().isNetworkElement()) {
1516  // Switch gl type of ac
1517  switch (HE->getTagProperty().getTag()) {
1518  case SUMO_TAG_JUNCTION: {
1519  // retrieve junction
1520  GNEJunction* junction = myFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveJunction(HE->getID(), false);
1521  if (junction) {
1522  // insert junction item
1523  FXTreeItem* junctionItem = addListItem(HE, itemParent);
1524  // insert edges
1525  for (const auto& edge : junction->getChildEdges()) {
1526  showHierarchicalElementChildren(edge, junctionItem);
1527  }
1528  // insert crossings
1529  for (const auto& crossing : junction->getGNECrossings()) {
1530  showHierarchicalElementChildren(crossing, junctionItem);
1531  }
1532  }
1533  break;
1534  }
1535  case SUMO_TAG_EDGE: {
1536  // retrieve edge
1537  GNEEdge* edge = myFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveEdge(HE->getID(), false);
1538  if (edge) {
1539  // insert edge item
1540  FXTreeItem* edgeItem = addListItem(HE, itemParent);
1541  // insert lanes
1542  for (const auto& lane : edge->getLanes()) {
1543  showHierarchicalElementChildren(lane, edgeItem);
1544  }
1545  // insert child additional
1546  for (const auto& additional : edge->getChildAdditionals()) {
1547  showHierarchicalElementChildren(additional, edgeItem);
1548  }
1549  // insert child shapes
1550  for (const auto& shape : edge->getChildShapes()) {
1551  showHierarchicalElementChildren(shape, edgeItem);
1552  }
1553  // insert child TAZElements
1554  for (const auto& TAZElement : edge->getChildTAZElements()) {
1555  // use addListItem because TAZElement doesn't have children
1556  addListItem(TAZElement, edgeItem);
1557  }
1558  // insert child demand elements
1559  for (const auto& demandElement : edge->getChildDemandElements()) {
1560  showHierarchicalElementChildren(demandElement, edgeItem);
1561  }
1562  /*
1563  CHECK THIS
1564 
1565  // insert demand elements children (note: use getChildDemandElementsSortedByType to avoid duplicated elements)
1566  for (const auto& route : edge->getChildDemandElementsByType(SUMO_TAG_ROUTE)) {
1567  showHierarchicalElementChildren(route, edgeItem);
1568  }
1569  for (const auto& trip : edge->getChildDemandElementsByType(SUMO_TAG_TRIP)) {
1570  showHierarchicalElementChildren(trip, edgeItem);
1571  }
1572  for (const auto& flow : edge->getChildDemandElementsByType(SUMO_TAG_FLOW)) {
1573  showHierarchicalElementChildren(flow, edgeItem);
1574  }
1575  */
1576  // show data elements
1577  for (const auto& genericDatas : edge->getChildGenericDatas()) {
1578  showHierarchicalElementChildren(genericDatas, edgeItem);
1579  }
1580  }
1581  break;
1582  }
1583  case SUMO_TAG_LANE: {
1584  // retrieve lane
1585  GNELane* lane = myFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveLane(HE->getID(), false);
1586  if (lane) {
1587  // insert lane item
1588  FXTreeItem* laneItem = addListItem(HE, itemParent);
1589  // insert child additional
1590  for (const auto& additional : lane->getChildAdditionals()) {
1591  showHierarchicalElementChildren(additional, laneItem);
1592  }
1593  // insert child shapes
1594  for (const auto& shape : lane->getChildShapes()) {
1595  showHierarchicalElementChildren(shape, laneItem);
1596  }
1597  // insert child TAZElements
1598  for (const auto& TAZElement : lane->getChildTAZElements()) {
1599  // use addListItem because TAZElement doesn't have children
1600  addListItem(TAZElement, laneItem);
1601  }
1602  // insert demand elements children
1603  for (const auto& demandElement : lane->getChildDemandElements()) {
1604  showHierarchicalElementChildren(demandElement, laneItem);
1605  }
1606  // insert incoming connections of lanes (by default isn't expanded)
1607  if (lane->getGNEIncomingConnections().size() > 0) {
1608  std::vector<GNEConnection*> incomingLaneConnections = lane->getGNEIncomingConnections();
1609  // insert intermediate list item
1610  FXTreeItem* incomingConnections = addListItem(laneItem, "Incomings", incomingLaneConnections.front()->getIcon(), false);
1611  // insert incoming connections
1612  for (const auto& connection : incomingLaneConnections) {
1613  showHierarchicalElementChildren(connection, incomingConnections);
1614  }
1615  }
1616  // insert outcoming connections of lanes (by default isn't expanded)
1617  if (lane->getGNEOutcomingConnections().size() > 0) {
1618  std::vector<GNEConnection*> outcomingLaneConnections = lane->getGNEOutcomingConnections();
1619  // insert intermediate list item
1620  FXTreeItem* outgoingConnections = addListItem(laneItem, "Outgoing", outcomingLaneConnections.front()->getIcon(), false);
1621  // insert outcoming connections
1622  for (const auto& connection : outcomingLaneConnections) {
1623  showHierarchicalElementChildren(connection, outgoingConnections);
1624  }
1625  }
1626  }
1627  break;
1628  }
1629  case SUMO_TAG_CROSSING:
1630  case SUMO_TAG_CONNECTION: {
1631  // insert connection item
1632  addListItem(HE, itemParent);
1633  break;
1634  }
1635  default:
1636  break;
1637  }
1639  // insert additional item
1640  FXTreeItem* treeItem = addListItem(HE, itemParent);
1641  // insert child edges
1642  for (const auto& edge : HE->getChildEdges()) {
1643  showHierarchicalElementChildren(edge, treeItem);
1644  }
1645  // insert child lanes
1646  for (const auto& lane : HE->getChildLanes()) {
1647  showHierarchicalElementChildren(lane, treeItem);
1648  }
1649  // insert additional symbols
1650  std::vector<GNEAdditional*> symbols;
1651  for (const auto& additional : HE->getChildAdditionals()) {
1652  if (additional->getTagProperty().isSymbol()) {
1653  symbols.push_back(additional);
1654  }
1655  }
1656  if (symbols.size() > 0) {
1657  // insert intermediate list item
1658  const auto additionalParent = symbols.front()->getParentAdditionals().front();
1659  const std::string symbolType = additionalParent->getTagProperty().hasAttribute(SUMO_ATTR_EDGES) ? "Edges" : "Lanes";
1660  GUIIcon symbolIcon = additionalParent->getTagProperty().hasAttribute(SUMO_ATTR_EDGES) ? GUIIcon::EDGE : GUIIcon::LANE;
1661  FXTreeItem* symbolListItem = addListItem(treeItem, symbolType, GUIIconSubSys::getIcon(symbolIcon), false);
1662  // insert symbols
1663  for (const auto& symbol : symbols) {
1664  showHierarchicalElementChildren(symbol, symbolListItem);
1665  }
1666  }
1667  // insert additional children
1668  for (const auto& additional : HE->getChildAdditionals()) {
1669  if (!additional->getTagProperty().isSymbol()) {
1670  showHierarchicalElementChildren(additional, treeItem);
1671  }
1672  }
1673  // insert child shapes
1674  for (const auto& shape : HE->getChildShapes()) {
1675  showHierarchicalElementChildren(shape, treeItem);
1676  }
1677  // insert TAZElements children
1678  for (const auto& TAZElement : HE->getChildTAZElements()) {
1679  // use addListItem because TAZElement doesn't have children
1680  addListItem(TAZElement, treeItem);
1681  }
1682  // insert child demand elements
1683  for (const auto& demandElement : HE->getChildDemandElements()) {
1684  showHierarchicalElementChildren(demandElement, treeItem);
1685  }
1686  } else if (HE->getTagProperty().isDataElement()) {
1687  // insert data item
1688  FXTreeItem* dataElementItem = addListItem(HE, itemParent);
1689  // insert intervals
1690  if (HE->getTagProperty().getTag() == SUMO_TAG_DATASET) {
1691  GNEDataSet* dataSet = myFrameParent->myViewNet->getNet()->getAttributeCarriers()->retrieveDataSet(HE->getID());
1692  // iterate over intevals
1693  for (const auto& interval : dataSet->getDataIntervalChildren()) {
1694  showHierarchicalElementChildren(interval.second, dataElementItem);
1695  }
1696  } else if (HE->getTagProperty().getTag() == SUMO_TAG_DATAINTERVAL) {
1697  GNEDataInterval* dataInterval = dynamic_cast<GNEDataInterval*>(HE);
1698  // iterate over generic datas
1699  for (const auto& genericData : dataInterval->getGenericDataChildren()) {
1700  showHierarchicalElementChildren(genericData, dataElementItem);
1701  }
1702  }
1703  }
1704 }
1705 
1706 
1707 FXTreeItem*
1708 GNEFrameModules::HierarchicalElementTree::addListItem(GNEAttributeCarrier* AC, FXTreeItem* itemParent, std::string prefix, std::string sufix) {
1709  // insert item in Tree list
1710  FXTreeItem* item = myTreeListDinamic->insertItem(nullptr, itemParent, (prefix + AC->getHierarchyName() + sufix).c_str(), AC->getIcon(), AC->getIcon());
1711  // insert item in map
1712  myTreeItemToACMap[item] = AC;
1713  // by default item is expanded
1714  item->setExpanded(true);
1715  // return created FXTreeItem
1716  return item;
1717 }
1718 
1719 
1720 FXTreeItem*
1721 GNEFrameModules::HierarchicalElementTree::addListItem(FXTreeItem* itemParent, const std::string& text, FXIcon* icon, bool expanded) {
1722  // insert item in Tree list
1723  FXTreeItem* item = myTreeListDinamic->insertItem(nullptr, itemParent, text.c_str(), icon, icon);
1724  // expand item depending of flag expanded
1725  item->setExpanded(expanded);
1726  // return created FXTreeItem
1727  return item;
1728 }
1729 
1730 // ---------------------------------------------------------------------------
1731 // GNEFrameModules::DrawingShape - methods
1732 // ---------------------------------------------------------------------------
1733 
1735  FXGroupBoxModule(frameParent->myContentFrame, "Drawing"),
1736  myFrameParent(frameParent),
1737  myDeleteLastCreatedPoint(false) {
1738  // create start and stop buttons
1739  myStartDrawingButton = new FXButton(getCollapsableFrame(), "Start drawing", 0, this, MID_GNE_STARTDRAWING, GUIDesignButton);
1740  myStopDrawingButton = new FXButton(getCollapsableFrame(), "Stop drawing", 0, this, MID_GNE_STOPDRAWING, GUIDesignButton);
1741  myAbortDrawingButton = new FXButton(getCollapsableFrame(), "Abort drawing", 0, this, MID_GNE_ABORTDRAWING, GUIDesignButton);
1742  // create information label
1743  std::ostringstream information;
1744  information
1745  << "- 'Start drawing' or ENTER\n"
1746  << " to create shape.\n"
1747  << "- 'Stop drawing' or ENTER to\n"
1748  << " finish shape creation.\n"
1749  << "- 'Abort drawing' or ESC to\n"
1750  << " abort shape creation.\n"
1751  << "- 'Shift + Click' to remove\n"
1752  << " last inserted point.";
1753  myInformationLabel = new FXLabel(getCollapsableFrame(), information.str().c_str(), 0, GUIDesignLabelFrameInformation);
1754  // disable stop and abort functions as init
1755  myStopDrawingButton->disable();
1756  myAbortDrawingButton->disable();
1757 }
1758 
1759 
1761 
1762 
1764  // abort current drawing before show
1765  abortDrawing();
1766  // show FXGroupBoxModule
1767  FXGroupBoxModule::show();
1768 }
1769 
1770 
1772  // abort current drawing before hide
1773  abortDrawing();
1774  // show FXGroupBoxModule
1775  FXGroupBoxModule::hide();
1776 }
1777 
1778 
1779 void
1781  // Only start drawing if DrawingShape modul is shown
1782  if (shown()) {
1783  // change buttons
1784  myStartDrawingButton->disable();
1785  myStopDrawingButton->enable();
1786  myAbortDrawingButton->enable();
1787  }
1788 }
1789 
1790 
1791 void
1793  // try to build shape
1794  if (myFrameParent->shapeDrawed()) {
1795  // clear created points
1796  myTemporalShape.clear();
1797  // change buttons
1798  myStartDrawingButton->enable();
1799  myStopDrawingButton->disable();
1800  myAbortDrawingButton->disable();
1801  } else {
1802  // abort drawing if shape cannot be created
1803  abortDrawing();
1804  }
1805 }
1806 
1807 
1808 void
1810  // clear created points
1811  myTemporalShape.clear();
1812  // change buttons
1813  myStartDrawingButton->enable();
1814  myStopDrawingButton->disable();
1815  myAbortDrawingButton->disable();
1816 }
1817 
1818 
1819 void
1821  if (myStopDrawingButton->isEnabled()) {
1822  myTemporalShape.push_back(P);
1823  } else {
1824  throw ProcessError("A new point cannot be added if drawing wasn't started");
1825  }
1826 }
1827 
1828 
1829 void
1831  if (myTemporalShape.size() > 1) {
1832  myTemporalShape.pop_back();
1833  }
1834 }
1835 
1836 
1837 const PositionVector&
1839  return myTemporalShape;
1840 }
1841 
1842 
1843 bool
1845  return myStopDrawingButton->isEnabled();
1846 }
1847 
1848 
1849 void
1851  myDeleteLastCreatedPoint = value;
1852 }
1853 
1854 
1855 bool
1857  return myDeleteLastCreatedPoint;
1858 }
1859 
1860 
1861 long
1863  startDrawing();
1864  return 0;
1865 }
1866 
1867 
1868 long
1870  stopDrawing();
1871  return 0;
1872 }
1873 
1874 
1875 long
1877  abortDrawing();
1878  return 0;
1879 }
1880 
1881 // ---------------------------------------------------------------------------
1882 // GNEFrameModules::SelectorParent - methods
1883 // ---------------------------------------------------------------------------
1884 
1886  FXGroupBoxModule(frameParent->myContentFrame, "Parent selector"),
1887  myFrameParent(frameParent) {
1888  // Create label with the type of SelectorParent
1889  myParentsLabel = new FXLabel(getCollapsableFrame(), "No additional selected", nullptr, GUIDesignLabelLeftThick);
1890  // Create list
1892  // Hide List
1894 }
1895 
1896 
1898 
1899 
1900 std::string
1902  for (int i = 0; i < myParentsList->getNumItems(); i++) {
1903  if (myParentsList->isItemSelected(i)) {
1904  return myParentsList->getItem(i)->getText().text();
1905  }
1906  }
1907  return "";
1908 }
1909 
1910 
1911 void
1913  // first unselect all
1914  for (int i = 0; i < myParentsList->getNumItems(); i++) {
1915  myParentsList->getItem(i)->setSelected(false);
1916  }
1917  // select element if correspond to given ID
1918  for (int i = 0; i < myParentsList->getNumItems(); i++) {
1919  if (myParentsList->getItem(i)->getText().text() == id) {
1920  myParentsList->getItem(i)->setSelected(true);
1921  }
1922  }
1923  // recalc myFirstParentsList
1924  myParentsList->recalc();
1925 }
1926 
1927 
1928 bool
1929 GNEFrameModules::SelectorParent::showSelectorParentModule(const std::vector<SumoXMLTag>& additionalTypeParents) {
1930  // make sure that we're editing an additional tag
1931  const auto listOfTags = GNEAttributeCarrier::getTagPropertiesByType(GNETagProperties::TagType::ADDITIONALELEMENT);
1932  for (const auto& tagIt : listOfTags) {
1933  if (std::find(additionalTypeParents.begin(), additionalTypeParents.end(), tagIt.getTag()) != additionalTypeParents.end()) {
1934  myParentTags = additionalTypeParents;
1935  myParentsLabel->setText(("Parent type: " + tagIt.getFieldString()).c_str());
1936  refreshSelectorParentModule();
1937  show();
1938  return true;
1939  }
1940  }
1941  return false;
1942 }
1943 
1944 
1945 void
1947  myParentTags.clear();
1948  hide();
1949 }
1950 
1951 
1952 void
1954  // save current edited elements
1955  std::set<std::string> selectedItems;
1956  for (int i = 0; i < myParentsList->getNumItems(); i++) {
1957  if (myParentsList->isItemSelected(i)) {
1958  selectedItems.insert(myParentsList->getItem(i)->getText().text());
1959  }
1960  }
1961  myParentsList->clearItems();
1962  if (myParentTags.size() > 0) {
1963  // insert additionals sorted
1964  std::set<std::string> IDs;
1965  // fill list with IDs of additionals
1966  for (const auto& parentTag : myParentTags) {
1967  for (const auto& additional : myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getAdditionals().at(parentTag)) {
1968  IDs.insert(additional->getID().c_str());
1969  }
1970  }
1971  // fill list with IDs of additionals
1972  for (const auto& ID : IDs) {
1973  const int item = myParentsList->appendItem(ID.c_str());
1974  if (selectedItems.find(ID) != selectedItems.end()) {
1975  myParentsList->selectItem(item);
1976  }
1977  }
1978  }
1979 }
1980 
1981 // ---------------------------------------------------------------------------
1982 // GNEFrameModules::OverlappedInspection - methods
1983 // ---------------------------------------------------------------------------
1984 
1986  FXGroupBoxModule(frameParent->myContentFrame, "Overlapped elements"),
1987  myFrameParent(frameParent),
1988  myFilteredTag(SUMO_TAG_NOTHING),
1989  myItemIndex(0) {
1990  // build elements
1991  buildFXElements();
1992 }
1993 
1994 
1996  FXGroupBoxModule(frameParent->myContentFrame, ("Overlapped " + toString(filteredTag) + "s").c_str()),
1997  myFrameParent(frameParent),
1998  myFilteredTag(filteredTag),
1999  myItemIndex(0) {
2000  // build elements
2001  buildFXElements();
2002 }
2003 
2004 
2006 
2007 
2008 void
2010  // first clear myOverlappedACs
2011  myOverlappedACs.clear();
2012  // reserve
2013  myOverlappedACs.reserve(objectsUnderCursor.getClickedAttributeCarriers().size());
2014  // iterate over objects under cursor
2015  for (const auto& AC : objectsUnderCursor.getClickedAttributeCarriers()) {
2016  bool insert = true;
2017  // check supermode demand
2018  if (myFrameParent->getViewNet()->getEditModes().isCurrentSupermodeDemand() &&
2019  !AC->getTagProperty().isDemandElement()) {
2020  insert = false;
2021  }
2022  // check supermode data
2023  if (myFrameParent->getViewNet()->getEditModes().isCurrentSupermodeData() &&
2024  !AC->getTagProperty().isGenericData()) {
2025  insert = false;
2026  }
2027  // check filter
2028  if ((myFilteredTag != SUMO_TAG_NOTHING) && (AC->getTagProperty().getTag() != myFilteredTag)) {
2029  insert = false;
2030  }
2031  if (insert) {
2032  myOverlappedACs.push_back(AC);
2033  }
2034  }
2035  // continue depending of number of myOverlappedACs
2036  if (myOverlappedACs.size() > 1) {
2037  mySavedClickedPosition = clickedPosition;
2038  // by default we inspect first element
2039  myItemIndex = 0;
2040  // update text of current index button
2041  myCurrentIndexButton->setText(("1 / " + toString(myOverlappedACs.size())).c_str());
2042  // clear and fill list again
2043  myOverlappedElementList->clearItems();
2044  for (int i = 0; i < (int)myOverlappedACs.size(); i++) {
2045  myOverlappedElementList->insertItem(i, myOverlappedACs.at(i)->getID().c_str(), myOverlappedACs.at(i)->getIcon());
2046  }
2047  // set first element as selected element
2048  myOverlappedElementList->getItem(0)->setSelected(TRUE);
2049  // by default list hidden
2050  myOverlappedElementList->hide();
2051  // show OverlappedInspection modul
2052  show();
2053  } else {
2054  // hide OverlappedInspection modul
2055  hide();
2056  }
2057 }
2058 
2059 
2060 void
2062  // hide OverlappedInspection modul
2063  hide();
2064 }
2065 
2066 
2067 bool
2069  // show OverlappedInspection modul
2070  return shown();
2071 }
2072 
2073 
2074 int
2076  return (int)myOverlappedACs.size();
2077 }
2078 
2079 
2080 bool
2082  return (mySavedClickedPosition.distanceSquaredTo2D(clickedPosition) < 0.25);
2083 }
2084 
2085 
2086 bool
2088  // first check if OverlappedInspection is shown
2089  if (shown()) {
2090  // check if given position is near saved position
2091  if (checkSavedPosition(clickedPosition)) {
2092  // inspect next element
2093  onCmdNextElement(0, 0, 0);
2094  return true;
2095  } else {
2096  return false;
2097  }
2098  } else {
2099  return false;
2100  }
2101 }
2102 
2103 
2104 bool
2106  // first check if OverlappedInspection is shown
2107  if (shown()) {
2108  // check if given position is near saved position
2109  if (checkSavedPosition(clickedPosition)) {
2110  // inspect previousElement
2111  onCmdPreviousElement(0, 0, 0);
2112  return true;
2113  } else {
2114  return false;
2115  }
2116  } else {
2117  return false;
2118  }
2119 }
2120 
2121 
2122 long
2124  // check if there is items
2125  if (myOverlappedElementList->getNumItems() > 0) {
2126  // unselect current list element
2127  myOverlappedElementList->getItem((int)myItemIndex)->setSelected(FALSE);
2128  // set index (it works as a ring)
2129  if (myItemIndex > 0) {
2130  myItemIndex--;
2131  } else {
2132  myItemIndex = (myOverlappedACs.size() - 1);
2133  }
2134  // selected current list element
2135  myOverlappedElementList->getItem((int)myItemIndex)->setSelected(TRUE);
2136  myOverlappedElementList->update();
2137  // update current index button
2138  myCurrentIndexButton->setText((toString(myItemIndex + 1) + " / " + toString(myOverlappedACs.size())).c_str());
2139  // inspect overlapped attribute carrier
2140  myFrameParent->selectedOverlappedElement(myOverlappedACs.at(myItemIndex));
2141  // show OverlappedInspection again (because it's hidden in inspectSingleElement)
2142  show();
2143  }
2144  return 1;
2145 }
2146 
2147 
2148 long
2150  // check if there is items
2151  if (myOverlappedElementList->getNumItems() > 0) {
2152  // unselect current list element
2153  myOverlappedElementList->getItem((int)myItemIndex)->setSelected(FALSE);
2154  // set index (it works as a ring)
2155  myItemIndex = (myItemIndex + 1) % myOverlappedACs.size();
2156  // selected current list element
2157  myOverlappedElementList->getItem((int)myItemIndex)->setSelected(TRUE);
2158  myOverlappedElementList->update();
2159  // update current index button
2160  myCurrentIndexButton->setText((toString(myItemIndex + 1) + " / " + toString(myOverlappedACs.size())).c_str());
2161  // inspect overlapped attribute carrier
2162  myFrameParent->selectedOverlappedElement(myOverlappedACs.at(myItemIndex));
2163  // show OverlappedInspection again (because it's hidden in inspectSingleElement)
2164  show();
2165  }
2166  return 1;
2167 }
2168 
2169 
2170 long
2172  // show or hidde element list
2173  if (myOverlappedElementList->shown()) {
2174  myOverlappedElementList->hide();
2175  } else {
2176  myOverlappedElementList->show();
2177  }
2178  if (myOverlappedElementList->getNumItems() <= 10) {
2179  myOverlappedElementList->setHeight(23 * myOverlappedElementList->getNumItems());
2180  } else {
2181  myOverlappedElementList->setHeight(230);
2182  }
2183  myOverlappedElementList->recalc();
2184  // recalc and update frame
2185  recalc();
2186  return 1;
2187 }
2188 
2189 long
2191  for (int i = 0; i < myOverlappedElementList->getNumItems(); i++) {
2192  if (myOverlappedElementList->getItem(i)->isSelected()) {
2193  myItemIndex = i;
2194  // update current index button
2195  myCurrentIndexButton->setText((toString(myItemIndex + 1) + " / " + toString(myOverlappedACs.size())).c_str());
2196  // inspect overlapped attribute carrier
2197  myFrameParent->selectedOverlappedElement(myOverlappedACs.at(myItemIndex));
2198  // show OverlappedInspection again (because it's hidden in inspectSingleElement)
2199  show();
2200  return 1;
2201  }
2202  }
2203  return 0;
2204 }
2205 
2206 
2207 long
2209  FXDialogBox* helpDialog = new FXDialogBox(getCollapsableFrame(), "GEO attributes Help", GUIDesignDialogBox);
2210  std::ostringstream help;
2211  help
2212  << " - Click in the same position\n"
2213  << " for inspect next element\n"
2214  << " - Shift + Click in the same\n"
2215  << " position for inspect\n"
2216  << " previous element";
2217  new FXLabel(helpDialog, help.str().c_str(), nullptr, GUIDesignLabelFrameInformation);
2218  // "OK"
2219  new FXButton(helpDialog, "OK\t\tclose", GUIIconSubSys::getIcon(GUIIcon::ACCEPT), helpDialog, FXDialogBox::ID_ACCEPT, GUIDesignButtonOK);
2220  helpDialog->create();
2221  helpDialog->show();
2222  return 1;
2223 }
2224 
2225 
2227  myFrameParent(nullptr),
2228  myPreviousElement(nullptr),
2229  myCurrentIndexButton(nullptr),
2230  myNextElement(nullptr),
2231  myOverlappedElementList(nullptr),
2232  myHelpButton(nullptr),
2233  myFilteredTag(SUMO_TAG_NOTHING),
2234  myItemIndex(0) {
2235 }
2236 
2237 
2238 void
2240  FXHorizontalFrame* frameButtons = new FXHorizontalFrame(getCollapsableFrame(), GUIDesignAuxiliarHorizontalFrame);
2241  // Create previous Item Button
2242  myPreviousElement = new FXButton(frameButtons, "", GUIIconSubSys::getIcon(GUIIcon::BIGARROWLEFT), this, MID_GNE_OVERLAPPED_PREVIOUS, GUIDesignButtonIconRectangular);
2243  // create current index button
2244  myCurrentIndexButton = new FXButton(frameButtons, "", nullptr, this, MID_GNE_OVERLAPPED_SHOWLIST, GUIDesignButton);
2245  // Create next Item Button
2246  myNextElement = new FXButton(frameButtons, "", GUIIconSubSys::getIcon(GUIIcon::BIGARROWRIGHT), this, MID_GNE_OVERLAPPED_NEXT, GUIDesignButtonIconRectangular);
2247  // Create list of overlapped elements (by default hidden)
2248  myOverlappedElementList = new FXList(getCollapsableFrame(), this, MID_GNE_OVERLAPPED_ITEMSELECTED, GUIDesignListFixedHeight);
2249  // by default list of overlapped elements is hidden)
2250  myOverlappedElementList->hide();
2251  // Create help button
2252  myHelpButton = new FXButton(getCollapsableFrame(), "Help", nullptr, this, MID_HELP, GUIDesignButtonRectangular);
2253 }
2254 
2255 // ---------------------------------------------------------------------------
2256 // GNEFrameModules::PathCreator - methods
2257 // ---------------------------------------------------------------------------
2258 
2260  mySubPath({edge}),
2261  myFromBusStop(nullptr),
2262  myToBusStop(nullptr),
2263  myConflictVClass(false),
2264 myConflictDisconnected(false) {
2265  // check if we have to change vClass flag
2266  if (edge->getNBEdge()->getNumLanesThatAllow(vClass) == 0) {
2267  myConflictVClass = true;
2268  }
2269 }
2270 
2271 
2273  myFromBusStop(nullptr),
2274  myToBusStop(nullptr),
2275  myConflictVClass(false),
2276  myConflictDisconnected(false) {
2277  // calculate subpath
2278  mySubPath = viewNet->getNet()->getPathManager()->getPathCalculator()->calculateDijkstraPath(vClass, {edgeFrom, edgeTo});
2279  // if subPath is empty, try it with pedestrian (i.e. ignoring vCass)
2280  if (mySubPath.empty()) {
2281  mySubPath = viewNet->getNet()->getPathManager()->getPathCalculator()->calculateDijkstraPath(SVC_PEDESTRIAN, {edgeFrom, edgeTo});
2282  if (mySubPath.empty()) {
2283  mySubPath = { edgeFrom, edgeTo };
2284  myConflictDisconnected = true;
2285  } else {
2286  myConflictVClass = true;
2287  }
2288  }
2289 }
2290 
2291 
2292 const std::vector<GNEEdge*>&
2294  return mySubPath;
2295 }
2296 
2297 
2299  return myFromBusStop;
2300 }
2301 
2302 
2304  return myToBusStop;
2305 }
2306 
2307 
2308 bool
2310  return myConflictVClass;
2311 }
2312 
2313 
2314 bool
2316  return myConflictDisconnected;
2317 }
2318 
2319 
2321  myFromBusStop(nullptr),
2322  myToBusStop(nullptr),
2323  myConflictVClass(false),
2324  myConflictDisconnected(false) {
2325 }
2326 
2327 
2329  FXGroupBoxModule(frameParent->myContentFrame, "Route creator"),
2330  myFrameParent(frameParent),
2332  myCreationMode(0),
2333  myToStoppingPlace(nullptr),
2334  myRoute(nullptr) {
2335  // create label for route info
2336  myInfoRouteLabel = new FXLabel(getCollapsableFrame(), "No edges selected", 0, GUIDesignLabelFrameThicked);
2337  // create button for finish route creation
2338  myFinishCreationButton = new FXButton(getCollapsableFrame(), "Finish route creation", nullptr, this, MID_GNE_EDGEPATH_FINISH, GUIDesignButton);
2339  myFinishCreationButton->disable();
2340  // create button for abort route creation
2341  myAbortCreationButton = new FXButton(getCollapsableFrame(), "Abort route creation", nullptr, this, MID_GNE_EDGEPATH_ABORT, GUIDesignButton);
2342  myAbortCreationButton->disable();
2343  // create button for remove last inserted edge
2344  myRemoveLastInsertedElement = new FXButton(getCollapsableFrame(), "Remove last inserted edge", nullptr, this, MID_GNE_EDGEPATH_REMOVELAST, GUIDesignButton);
2345  myRemoveLastInsertedElement->disable();
2346  // create check button
2347  myShowCandidateEdges = new FXCheckButton(getCollapsableFrame(), "Show candidate edges", this, MID_GNE_EDGEPATH_SHOWCANDIDATES, GUIDesignCheckButton);
2348  myShowCandidateEdges->setCheck(TRUE);
2349  // create shift label
2350  myShiftLabel = new FXLabel(this,
2351  "SHIFT-click: ignore vClass",
2353  // create control label
2354  myControlLabel = new FXLabel(this,
2355  "CTRL-click: add disconnected",
2357  // create backspace label (always shown)
2358  new FXLabel(this,
2359  "BACKSPACE: undo click",
2361 }
2362 
2363 
2365 
2366 
2367 void
2368 GNEFrameModules::PathCreator::showPathCreatorModule(SumoXMLTag element, const bool firstElement, const bool consecutives) {
2369  // declare flag
2370  bool showPathCreator = true;
2371  // first abort creation
2372  abortPathCreation();
2373  // disable buttons
2374  myFinishCreationButton->disable();
2375  myAbortCreationButton->disable();
2376  myRemoveLastInsertedElement->disable();
2377  // reset creation mode
2378  myCreationMode = 0;
2379  // set first element
2380  if (firstElement) {
2381  myCreationMode |= REQUIRE_FIRSTELEMENT;
2382  }
2383  // set consecutive or non consecuives
2384  if (consecutives) {
2385  myCreationMode |= CONSECUTIVE_EDGES;
2386  } else {
2387  myCreationMode |= NONCONSECUTIVE_EDGES;
2388  }
2389  // set specific mode depending of tag
2390  switch (element) {
2391  // routes
2392  case SUMO_TAG_ROUTE:
2394  myCreationMode |= SHOW_CANDIDATE_EDGES;
2395  myCreationMode |= START_EDGE;
2396  myCreationMode |= END_EDGE;
2397  break;
2398  // vehicles
2399  case SUMO_TAG_VEHICLE:
2400  case GNE_TAG_FLOW_ROUTE:
2401  case GNE_TAG_WALK_ROUTE:
2402  myCreationMode |= SINGLE_ELEMENT;
2403  myCreationMode |= ROUTE;
2404  break;
2405  case SUMO_TAG_TRIP:
2406  case SUMO_TAG_FLOW:
2409  myCreationMode |= SHOW_CANDIDATE_EDGES;
2410  myCreationMode |= START_EDGE;
2411  myCreationMode |= END_EDGE;
2412  break;
2415  myCreationMode |= START_JUNCTION;
2416  myCreationMode |= END_JUNCTION;
2417  myCreationMode |= ONLY_FROMTO;
2418  break;
2419  // walk edges
2420  case GNE_TAG_WALK_EDGES:
2421  myCreationMode |= SHOW_CANDIDATE_EDGES;
2422  myCreationMode |= START_EDGE;
2423  myCreationMode |= END_EDGE;
2424  break;
2425  // edge->edge
2427  case GNE_TAG_RIDE_EDGE:
2428  case GNE_TAG_WALK_EDGE:
2429  myCreationMode |= SHOW_CANDIDATE_EDGES;
2430  myCreationMode |= ONLY_FROMTO;
2431  myCreationMode |= START_EDGE;
2432  myCreationMode |= END_EDGE;
2433  break;
2434  // edge->busStop
2436  case GNE_TAG_RIDE_BUSSTOP:
2437  case GNE_TAG_WALK_BUSSTOP:
2438  myCreationMode |= SHOW_CANDIDATE_EDGES;
2439  myCreationMode |= ONLY_FROMTO;
2440  myCreationMode |= END_BUSSTOP;
2441  break;
2442  // junction->junction
2445  myCreationMode |= START_JUNCTION;
2446  myCreationMode |= END_JUNCTION;
2447  myCreationMode |= ONLY_FROMTO;
2448  break;
2449  // stops
2451  myCreationMode |= SINGLE_ELEMENT;
2452  myCreationMode |= END_BUSSTOP;
2453  break;
2455  myCreationMode |= SINGLE_ELEMENT;
2456  myCreationMode |= START_EDGE;
2457  break;
2458  // generic datas
2459  case SUMO_TAG_EDGEREL:
2460  myCreationMode |= ONLY_FROMTO;
2461  myCreationMode |= START_EDGE;
2462  myCreationMode |= END_EDGE;
2463  break;
2464  default:
2465  showPathCreator = false;
2466  break;
2467  }
2468  // check if show path creator
2469  if (showPathCreator) {
2470  // update colors
2471  if (myCreationMode & SHOW_CANDIDATE_EDGES) {
2472  updateEdgeColors();
2473  }
2474  if (myCreationMode & START_JUNCTION) {
2475  updateEdgeColors();
2476  }
2477  // recalc before show (to avoid graphic problems)
2478  recalc();
2479  // show modul
2480  show();
2481  } else {
2482  // hide modul
2483  hide();
2484  }
2485 }
2486 
2487 
2488 void
2490  // clear path
2491  clearPath();
2492  // hide modul
2493  hide();
2494 }
2495 
2496 
2499  return myVClass;
2500 }
2501 
2502 
2503 void
2505  myVClass = vClass;
2506  // update edge colors
2507  updateEdgeColors();
2508 }
2509 
2510 
2511 bool
2512 GNEFrameModules::PathCreator::addJunction(GNEJunction* junction, const bool /* shiftKeyPressed */, const bool /* controlKeyPressed */) {
2513  // check if junctions are allowed
2514  if (((myCreationMode & START_JUNCTION) + (myCreationMode & END_JUNCTION)) == 0) {
2515  return false;
2516  }
2517  // check if only an junction is allowed
2518  if ((myCreationMode & SINGLE_ELEMENT) && (mySelectedJunctions.size() == 1)) {
2519  return false;
2520  }
2521  // continue depending of number of selected edge
2522  if (mySelectedJunctions.size() > 0) {
2523  // check double junctions
2524  if (mySelectedJunctions.back() == junction) {
2525  // Write warning
2526  WRITE_WARNING("Double junctions aren't allowed");
2527  // abort add junction
2528  return false;
2529  }
2530  }
2531  // check number of junctions
2532  if (mySelectedJunctions.size() == 2 && (myCreationMode & Mode::ONLY_FROMTO)) {
2533  // Write warning
2534  WRITE_WARNING("Only two junctions are allowed");
2535  // abort add junction
2536  return false;
2537  }
2538  // All checks ok, then add it in selected elements
2539  mySelectedJunctions.push_back(junction);
2540  // enable abort route button
2541  myAbortCreationButton->enable();
2542  // enable finish button
2543  myFinishCreationButton->enable();
2544  // disable undo/redo
2545  myFrameParent->myViewNet->getViewParent()->getGNEAppWindows()->disableUndoRedo("route creation");
2546  // enable or disable remove last junction button
2547  if (mySelectedJunctions.size() > 1) {
2548  myRemoveLastInsertedElement->enable();
2549  } else {
2550  myRemoveLastInsertedElement->disable();
2551  }
2552  // recalculate path
2553  recalculatePath();
2554  // update info route label
2555  updateInfoRouteLabel();
2556  // update junction colors
2557  updateJunctionColors();
2558  return true;
2559 }
2560 
2561 
2562 bool
2563 GNEFrameModules::PathCreator::addEdge(GNEEdge* edge, const bool shiftKeyPressed, const bool controlKeyPressed) {
2564  // check if edges are allowed
2565  if (((myCreationMode & CONSECUTIVE_EDGES) + (myCreationMode & NONCONSECUTIVE_EDGES) +
2566  (myCreationMode & START_EDGE) + (myCreationMode & END_EDGE)) == 0) {
2567  return false;
2568  }
2569  // check if only an edge is allowed
2570  if ((myCreationMode & SINGLE_ELEMENT) && (mySelectedEdges.size() == 1)) {
2571  return false;
2572  }
2573  // continue depending of number of selected eges
2574  if (mySelectedEdges.size() > 0) {
2575  // check double edges
2576  if (mySelectedEdges.back() == edge) {
2577  // Write warning
2578  WRITE_WARNING("Double edges aren't allowed");
2579  // abort add edge
2580  return false;
2581  }
2582  // check consecutive edges
2583  if (myCreationMode & Mode::CONSECUTIVE_EDGES) {
2584  // check that new edge is consecutive
2585  const auto& outgoingEdges = mySelectedEdges.back()->getToJunction()->getGNEOutgoingEdges();
2586  if (std::find(outgoingEdges.begin(), outgoingEdges.end(), edge) == outgoingEdges.end()) {
2587  // Write warning
2588  WRITE_WARNING("Only consecutives edges are allowed");
2589  // abort add edge
2590  return false;
2591  }
2592  }
2593  }
2594  // check number of edges
2595  if (mySelectedEdges.size() == 2 && (myCreationMode & Mode::ONLY_FROMTO)) {
2596  // Write warning
2597  WRITE_WARNING("Only two edges are allowed");
2598  // abort add edge
2599  return false;
2600  }
2601  // check candidate edge
2602  if ((myShowCandidateEdges->getCheck() == TRUE) && !edge->isPossibleCandidate()) {
2603  if (edge->isSpecialCandidate()) {
2604  if (!shiftKeyPressed) {
2605  // Write warning
2606  WRITE_WARNING("Invalid edge (SHIFT + click to add an invalid vClass edge)");
2607  // abort add edge
2608  return false;
2609  }
2610  } else if (edge->isConflictedCandidate()) {
2611  if (!controlKeyPressed) {
2612  // Write warning
2613  WRITE_WARNING("Invalid edge (CONTROL + click to add a disconnected edge)");
2614  // abort add edge
2615  return false;
2616  }
2617  }
2618  }
2619  // All checks ok, then add it in selected elements
2620  mySelectedEdges.push_back(edge);
2621  // enable abort route button
2622  myAbortCreationButton->enable();
2623  // enable finish button
2624  myFinishCreationButton->enable();
2625  // disable undo/redo
2626  myFrameParent->myViewNet->getViewParent()->getGNEAppWindows()->disableUndoRedo("route creation");
2627  // enable or disable remove last edge button
2628  if (mySelectedEdges.size() > 1) {
2629  myRemoveLastInsertedElement->enable();
2630  } else {
2631  myRemoveLastInsertedElement->disable();
2632  }
2633  // recalculate path
2634  recalculatePath();
2635  // update info route label
2636  updateInfoRouteLabel();
2637  // update edge colors
2638  updateEdgeColors();
2639  return true;
2640 }
2641 
2642 
2643 const std::vector<GNEEdge*>&
2645  return mySelectedEdges;
2646 }
2647 
2648 
2649 const std::vector<GNEJunction*>&
2651  return mySelectedJunctions;
2652 }
2653 
2654 
2655 bool
2656 GNEFrameModules::PathCreator::addStoppingPlace(GNEAdditional* stoppingPlace, const bool /*shiftKeyPressed*/, const bool /*controlKeyPressed*/) {
2657  // check if stoppingPlaces aren allowed
2658  if ((myCreationMode & END_BUSSTOP) == 0) {
2659  return false;
2660  }
2661  // check if previously stopping place from was set
2662  if (myToStoppingPlace) {
2663  return false;
2664  } else {
2665  myToStoppingPlace = stoppingPlace;
2666  }
2667  // enable abort route button
2668  myAbortCreationButton->enable();
2669  // enable finish button
2670  myFinishCreationButton->enable();
2671  // disable undo/redo
2672  myFrameParent->myViewNet->getViewParent()->getGNEAppWindows()->disableUndoRedo("route creation");
2673  // enable or disable remove last stoppingPlace button
2674  if (myToStoppingPlace) {
2675  myRemoveLastInsertedElement->enable();
2676  } else {
2677  myRemoveLastInsertedElement->disable();
2678  }
2679  // recalculate path
2680  recalculatePath();
2681  // update info route label
2682  updateInfoRouteLabel();
2683  // update stoppingPlace colors
2684  updateEdgeColors();
2685  return true;
2686 }
2687 
2688 
2691  if (myToStoppingPlace && (myToStoppingPlace->getTagProperty().getTag() == expectedTag)) {
2692  return myToStoppingPlace;
2693  } else {
2694  return nullptr;
2695  }
2696 }
2697 
2698 
2699 bool
2700 GNEFrameModules::PathCreator::addRoute(GNEDemandElement* route, const bool /*shiftKeyPressed*/, const bool /*controlKeyPressed*/) {
2701  // check if routes aren allowed
2702  if ((myCreationMode & ROUTE) == 0) {
2703  return false;
2704  }
2705  // check if previously a route was added
2706  if (myRoute) {
2707  return false;
2708  }
2709  // set route
2710  myRoute = route;
2711  // recalculate path
2712  recalculatePath();
2713  updateInfoRouteLabel();
2714  updateEdgeColors();
2715  return true;
2716 }
2717 
2718 
2719 void
2721  // set route
2722  myRoute = nullptr;
2723  // recalculate path
2724  recalculatePath();
2725  updateInfoRouteLabel();
2726  updateEdgeColors();
2727 }
2728 
2729 
2732  return myRoute;
2733 }
2734 
2735 
2736 const std::vector<GNEFrameModules::PathCreator::Path>&
2738  return myPath;
2739 }
2740 
2741 
2742 bool
2744  return (myShowCandidateEdges->getCheck() == TRUE);
2745 }
2746 
2747 
2748 void
2750  // reset all flags
2751  for (const auto& junction : myFrameParent->myViewNet->getNet()->getAttributeCarriers()->getJunctions()) {
2752  junction.second->resetCandidateFlags();
2753  junction.second->setPossibleCandidate(true);
2754  }
2755  // set selected junctions
2756  if (mySelectedJunctions.size() > 0) {
2757  // mark selected eges
2758  for (const auto& junction : mySelectedJunctions) {
2759  junction->resetCandidateFlags();
2760  junction->setSourceCandidate(true);
2761  }
2762  // finally mark last selected element as target
2763  mySelectedJunctions.back()->resetCandidateFlags();
2764  mySelectedJunctions.back()->setTargetCandidate(true);
2765  }
2766  // update view net
2767  myFrameParent->myViewNet->updateViewNet();
2768 }
2769 
2770 
2771 void
2773  // reset all flags
2774  clearEdgeColors();
2775  // set reachability
2776  if (mySelectedEdges.size() > 0) {
2777  // only coloring edges if checkbox "show candidate edges" is enabled
2778  if ((myShowCandidateEdges->getCheck() == TRUE) && (myCreationMode & SHOW_CANDIDATE_EDGES)) {
2779  // mark all edges as conflicted (to mark special candidates)
2780  for (const auto& edge : myFrameParent->myViewNet->getNet()->getAttributeCarriers()->getEdges()) {
2781  edge.second->setConflictedCandidate(true);
2782  }
2783  // set special candidates (Edges that are connected but aren't compatibles with current vClass
2784  setSpecialCandidates(mySelectedEdges.back());
2785  // mark again all edges as conflicted (to mark possible candidates)
2786  for (const auto& edge : myFrameParent->myViewNet->getNet()->getAttributeCarriers()->getEdges()) {
2787  edge.second->setConflictedCandidate(true);
2788  }
2789  // set possible candidates (Edges that are connected AND are compatibles with current vClass
2790  setPossibleCandidates(mySelectedEdges.back(), myVClass);
2791  }
2792  // now mark selected eges
2793  for (const auto& edge : mySelectedEdges) {
2794  edge->resetCandidateFlags();
2795  edge->setSourceCandidate(true);
2796  }
2797  // finally mark last selected element as target
2798  mySelectedEdges.back()->resetCandidateFlags();
2799  mySelectedEdges.back()->setTargetCandidate(true);
2800  } else if (myShowCandidateEdges->getCheck() == TRUE && (myCreationMode & SHOW_CANDIDATE_EDGES)) {
2801  // mark all edges that have at least one lane that allow given vClass
2802  for (const auto& edge : myFrameParent->myViewNet->getNet()->getAttributeCarriers()->getEdges()) {
2803  if (edge.second->getNBEdge()->getNumLanesThatAllow(myVClass) > 0) {
2804  edge.second->setPossibleCandidate(true);
2805  } else {
2806  edge.second->setSpecialCandidate(true);
2807  }
2808  }
2809  }
2810  // update view net
2811  myFrameParent->myViewNet->updateViewNet();
2812 }
2813 
2814 
2815 void
2817  // reset all junction flags
2818  for (const auto& junction : myFrameParent->myViewNet->getNet()->getAttributeCarriers()->getJunctions()) {
2819  junction.second->resetCandidateFlags();
2820  }
2821 }
2822 
2823 
2824 void
2826  // reset all junction flags
2827  for (const auto& edge : myFrameParent->myViewNet->getNet()->getAttributeCarriers()->getEdges()) {
2828  edge.second->resetCandidateFlags();
2829  }
2830 }
2831 
2832 
2833 void
2835  const double lineWidth = 0.35;
2836  const double lineWidthin = 0.25;
2837  // Add a draw matrix
2839  // Start with the drawing of the area traslating matrix to origin
2840  glTranslated(0, 0, GLO_MAX - 0.1);
2841  // check if draw bewteen junction or edges
2842  if (myPath.size() > 0) {
2843  // set first color
2845  // iterate over path
2846  for (int i = 0; i < (int)myPath.size(); i++) {
2847  // get path
2848  const GNEFrameModules::PathCreator::Path& path = myPath.at(i);
2849  // draw line over
2850  for (int j = 0; j < (int)path.getSubPath().size(); j++) {
2851  const GNELane* lane = path.getSubPath().at(j)->getLanes().back();
2852  if (((i == 0) && (j == 0)) || (j > 0)) {
2853  GLHelper::drawBoxLines(lane->getLaneShape(), lineWidth);
2854  }
2855  // draw connection between lanes
2856  if ((j + 1) < (int)path.getSubPath().size()) {
2857  const GNELane* nextLane = path.getSubPath().at(j + 1)->getLanes().back();
2858  if (lane->getLane2laneConnections().exist(nextLane)) {
2860  } else {
2861  GLHelper::drawBoxLines({lane->getLaneShape().back(), nextLane->getLaneShape().front()}, lineWidth);
2862  }
2863  }
2864  }
2865  }
2866  glTranslated(0, 0, 0.1);
2867  // iterate over path again
2868  for (int i = 0; i < (int)myPath.size(); i++) {
2869  // get path
2870  const GNEFrameModules::PathCreator::Path& path = myPath.at(i);
2871  // set path color color
2872  if ((myCreationMode & SHOW_CANDIDATE_EDGES) == 0) {
2874  } else if (path.isConflictDisconnected()) {
2876  } else if (path.isConflictVClass()) {
2878  } else {
2880  }
2881  // draw line over
2882  for (int j = 0; j < (int)path.getSubPath().size(); j++) {
2883  const GNELane* lane = path.getSubPath().at(j)->getLanes().back();
2884  if (((i == 0) && (j == 0)) || (j > 0)) {
2885  GLHelper::drawBoxLines(lane->getLaneShape(), lineWidthin);
2886  }
2887  // draw connection between lanes
2888  if ((j + 1) < (int)path.getSubPath().size()) {
2889  const GNELane* nextLane = path.getSubPath().at(j + 1)->getLanes().back();
2890  if (lane->getLane2laneConnections().exist(nextLane)) {
2892  } else {
2893  GLHelper::drawBoxLines({ lane->getLaneShape().back(), nextLane->getLaneShape().front() }, lineWidthin);
2894  }
2895  }
2896  }
2897  }
2898  } else if (mySelectedJunctions.size() > 0) {
2899  // set color
2901  // draw line between junctions
2902  for (int i = 0; i < (int)mySelectedJunctions.size() - 1; i++) {
2903  // get two points
2904  const Position posA = mySelectedJunctions.at(i)->getPositionInView();
2905  const Position posB = mySelectedJunctions.at(i + 1)->getPositionInView();
2906  const double rot = ((double)atan2((posB.x() - posA.x()), (posA.y() - posB.y())) * (double) 180.0 / (double)M_PI);
2907  const double len = posA.distanceTo2D(posB);
2908  // draw line
2909  GLHelper::drawBoxLine(posA, rot, len, 0.25);
2910  }
2911  }
2912  // Pop last matrix
2914 }
2915 
2916 
2917 void
2919  // call create path implemented in frame parent
2920  myFrameParent->createPath();
2921 }
2922 
2923 
2924 void
2926  // first check that there is elements
2927  if ((mySelectedJunctions.size() > 0) || (mySelectedEdges.size() > 0) || myToStoppingPlace || myRoute) {
2928  // unblock undo/redo
2929  myFrameParent->myViewNet->getViewParent()->getGNEAppWindows()->enableUndoRedo();
2930  // clear edges
2931  clearPath();
2932  // disable buttons
2933  myFinishCreationButton->disable();
2934  myAbortCreationButton->disable();
2935  myRemoveLastInsertedElement->disable();
2936  // update info route label
2937  updateInfoRouteLabel();
2938  // update junction colors
2939  updateJunctionColors();
2940  // update edge colors
2941  updateEdgeColors();
2942  // update view (to see the new route)
2943  myFrameParent->getViewNet()->updateViewNet();
2944  }
2945 }
2946 
2947 
2948 void
2950  if (mySelectedEdges.size() > 1) {
2951  // remove special color of last selected edge
2952  mySelectedEdges.back()->resetCandidateFlags();
2953  // remove last edge
2954  mySelectedEdges.pop_back();
2955  // change last edge flag
2956  if ((mySelectedEdges.size() > 0) && mySelectedEdges.back()->isSourceCandidate()) {
2957  mySelectedEdges.back()->setSourceCandidate(false);
2958  mySelectedEdges.back()->setTargetCandidate(true);
2959  }
2960  // enable or disable remove last edge button
2961  if (mySelectedEdges.size() > 1) {
2962  myRemoveLastInsertedElement->enable();
2963  } else {
2964  myRemoveLastInsertedElement->disable();
2965  }
2966  // recalculate path
2967  recalculatePath();
2968  // update info route label
2969  updateInfoRouteLabel();
2970  // update junction colors
2971  updateJunctionColors();
2972  // update edge colors
2973  updateEdgeColors();
2974  // update view
2975  myFrameParent->myViewNet->updateViewNet();
2976  }
2977 }
2978 
2979 
2980 long
2981 GNEFrameModules::PathCreator::onCmdCreatePath(FXObject*, FXSelector, void*) {
2982  // just call create path
2983  createPath();
2984  return 1;
2985 }
2986 
2987 
2988 long
2990  // just call abort path creation
2991  abortPathCreation();
2992  return 1;
2993 }
2994 
2995 
2996 long
2998  // just call remove last element
2999  removeLastElement();
3000  return 1;
3001 }
3002 
3003 
3004 long
3006  // update labels
3007  if (myShowCandidateEdges->getCheck() == TRUE) {
3008  myShiftLabel->show();
3009  myControlLabel->show();
3010  } else {
3011  myShiftLabel->hide();
3012  myControlLabel->hide();
3013  }
3014  // recalc frame
3015  recalc();
3016  // update edge colors (view will be updated within function)
3017  updateEdgeColors();
3018  return 1;
3019 }
3020 
3021 
3022 void
3024  if (myPath.size() > 0) {
3025  // declare variables for route info
3026  double length = 0;
3027  double speed = 0;
3028  int pathSize = 0;
3029  for (const auto& path : myPath) {
3030  for (const auto& edge : path.getSubPath()) {
3031  length += edge->getNBEdge()->getLength();
3032  speed += edge->getNBEdge()->getSpeed();
3033  }
3034  pathSize += (int)path.getSubPath().size();
3035  }
3036  // declare ostringstream for label and fill it
3037  std::ostringstream information;
3038  information
3039  << "- Selected edges: " << toString(mySelectedEdges.size()) << "\n"
3040  << "- Path edges: " << toString(pathSize) << "\n"
3041  << "- Length: " << toString(length) << "\n"
3042  << "- Average speed: " << toString(speed / pathSize);
3043  // set new label
3044  myInfoRouteLabel->setText(information.str().c_str());
3045  } else {
3046  myInfoRouteLabel->setText("No edges selected");
3047  }
3048 }
3049 
3050 
3051 void
3054  clearJunctionColors();
3055  clearEdgeColors();
3056  // clear junction, edges, additionals and route
3057  mySelectedJunctions.clear();
3058  mySelectedEdges.clear();
3059  myToStoppingPlace = nullptr;
3060  myRoute = nullptr;
3061  // clear path
3062  myPath.clear();
3063  // update info route label
3064  updateInfoRouteLabel();
3065 }
3066 
3067 
3068 void
3070  // first clear path
3071  myPath.clear();
3072  // set edges
3073  std::vector<GNEEdge*> edges;
3074  // add route edges
3075  if (myRoute) {
3076  edges = myRoute->getParentEdges();
3077  } else {
3078  // add selected edges
3079  for (const auto& edge : mySelectedEdges) {
3080  edges.push_back(edge);
3081  }
3082  // add to stopping place edge
3083  if (myToStoppingPlace) {
3084  edges.push_back(myToStoppingPlace->getParentLanes().front()->getParentEdge());
3085  }
3086  }
3087  // fill paths
3088  if (edges.size() == 1) {
3089  myPath.push_back(Path(myVClass, edges.front()));
3090  } else {
3091  // add every segment
3092  for (int i = 1; i < (int)edges.size(); i++) {
3093  myPath.push_back(Path(myFrameParent->getViewNet(), myVClass, edges.at(i - 1), edges.at(i)));
3094  }
3095  }
3096 }
3097 
3098 
3099 void
3101  // first calculate reachability for pedestrians (we use it, because pedestran can walk in almost all edges)
3102  myFrameParent->getViewNet()->getNet()->getPathManager()->getPathCalculator()->calculateReachability(SVC_PEDESTRIAN, originEdge);
3103  // change flags
3104  for (const auto& edge : myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
3105  for (const auto& lane : edge.second->getLanes()) {
3106  if (lane->getReachability() > 0) {
3107  lane->getParentEdge()->resetCandidateFlags();
3108  lane->getParentEdge()->setSpecialCandidate(true);
3109  }
3110  }
3111  }
3112 }
3113 
3114 void
3116  // first calculate reachability for pedestrians
3117  myFrameParent->getViewNet()->getNet()->getPathManager()->getPathCalculator()->calculateReachability(vClass, originEdge);
3118  // change flags
3119  for (const auto& edge : myFrameParent->getViewNet()->getNet()->getAttributeCarriers()->getEdges()) {
3120  for (const auto& lane : edge.second->getLanes()) {
3121  if (lane->getReachability() > 0) {
3122  lane->getParentEdge()->resetCandidateFlags();
3123  lane->getParentEdge()->setPossibleCandidate(true);
3124  }
3125  }
3126  }
3127 }
3128 
3129 // ---------------------------------------------------------------------------
3130 // GNERouteFrame::Legend - methods
3131 // ---------------------------------------------------------------------------
3132 
3134  FXGroupBoxModule(frameParent->myContentFrame, "Information") {
3135  // declare label
3136  FXLabel* legendLabel = nullptr;
3137  // edge candidate
3138  legendLabel = new FXLabel(getCollapsableFrame(), " edge candidate", 0, GUIDesignLabelLeft);
3139  legendLabel->setBackColor(MFXUtils::getFXColor(frameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.possible));
3140  legendLabel->setTextColor(MFXUtils::getFXColor(RGBColor::WHITE));
3141  // last edge selected
3142  legendLabel = new FXLabel(getCollapsableFrame(), " last edge selected", 0, GUIDesignLabelLeft);
3143  legendLabel->setBackColor(MFXUtils::getFXColor(frameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.target));
3144  // edge selected
3145  legendLabel = new FXLabel(getCollapsableFrame(), " edge selected", 0, GUIDesignLabelLeft);
3146  legendLabel->setBackColor(MFXUtils::getFXColor(frameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.source));
3147  // edge conflict (vClass)
3148  legendLabel = new FXLabel(getCollapsableFrame(), " edge conflict (vClass)", 0, GUIDesignLabelLeft);
3149  legendLabel->setBackColor(MFXUtils::getFXColor(frameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.special));
3150  // edge disconnected
3151  legendLabel = new FXLabel(getCollapsableFrame(), " edge disconnected", 0, GUIDesignLabelLeft);
3152  legendLabel->setBackColor(MFXUtils::getFXColor(frameParent->getViewNet()->getVisualisationSettings().candidateColorSettings.conflict));
3153 }
3154 
3155 
3157 
3158 
3159 void
3161  show();
3162 }
3163 
3164 void
3166  hide();
3167 }
3168 
3169 // ---------------------------------------------------------------------------
3170 // GNEFrameModules - methods
3171 // ---------------------------------------------------------------------------
3172 
3173 FXLabel*
3174 GNEFrameModules::buildRainbow(FXComposite* parent) {
3175  // create label for color information
3176  FXLabel* label = new FXLabel(parent, "Scale: Min -> Max", nullptr, GUIDesignLabelCenterThick);
3177  // create frame for color scale
3178  FXHorizontalFrame* horizontalFrameColors = new FXHorizontalFrame(parent, GUIDesignAuxiliarHorizontalFrame);
3179  for (const auto& color : GNEViewNetHelper::getRainbowScaledColors()) {
3180  FXLabel* colorLabel = new FXLabel(horizontalFrameColors, "", nullptr, GUIDesignLabelLeft);
3181  colorLabel->setBackColor(MFXUtils::getFXColor(color));
3182  }
3183  // return label
3184  return label;
3185 }
3186 
3187 /****************************************************************************/
FXDEFMAP(GNEFrameModules::TagSelector) TagSelectorMap[]
@ MID_GNE_DELETE
delete element
Definition: GUIAppEnum.h:801
@ MID_GNE_OVERLAPPED_PREVIOUS
inspect previous element in overlapped modul
Definition: GUIAppEnum.h:867
@ MID_GNE_TAG_SELECTED
tag selected in ComboBox
Definition: GUIAppEnum.h:819
@ MID_GNE_OVERLAPPED_ITEMSELECTED
list item selected in overlapped modul
Definition: GUIAppEnum.h:871
@ MID_GNE_CENTER
center element
Definition: GUIAppEnum.h:809
@ MID_GNE_EDGEPATH_FINISH
finish edge path creation
Definition: GUIAppEnum.h:839
@ MID_GNE_ACHIERARCHY_SHOWCHILDMENU
In HierarchicalElementTree list, show child menu.
Definition: GUIAppEnum.h:853
@ MID_GNE_STARTDRAWING
start drawing polygon
Definition: GUIAppEnum.h:859
@ MID_GNE_ACHIERARCHY_MOVEUP
In HierarchicalElementTree list, move element to up.
Definition: GUIAppEnum.h:855
@ MID_HELP
help button
Definition: GUIAppEnum.h:600
@ MID_GNE_OVERLAPPED_SHOWLIST
show list of overlapped elements
Definition: GUIAppEnum.h:869
@ MID_GNE_EDGEPATH_REMOVELAST
remove last inserted element in path
Definition: GUIAppEnum.h:841
@ MID_GNE_INSPECT
inspect element
Definition: GUIAppEnum.h:803
@ MID_GNE_OVERLAPPED_NEXT
inspect next element in overlapped modul
Definition: GUIAppEnum.h:865
@ MID_GNE_ABORTDRAWING
abort drawing polygon
Definition: GUIAppEnum.h:863
@ MID_GNE_ACHIERARCHY_MOVEDOWN
In HierarchicalElementTree list, move element to down.
Definition: GUIAppEnum.h:857
@ MID_GNE_EDGEPATH_SHOWCANDIDATES
enable or disable show path candidates
Definition: GUIAppEnum.h:843
@ MID_GNE_STOPDRAWING
stop drawing polygon
Definition: GUIAppEnum.h:861
@ MID_GNE_EDGEPATH_ABORT
abort edge path creation
Definition: GUIAppEnum.h:837
@ MID_GNE_SET_TYPE
used to select a type of element in a combo box
Definition: GUIAppEnum.h:815
#define GUIDesignLabelLeft
Definition: GUIDesigns.h:193
#define GUIDesignButton
Definition: GUIDesigns.h:68
#define GUIDesignComboBox
Definition: GUIDesigns.h:267
#define GUIDesignListFixedHeight
design for FXLists with height fixed
Definition: GUIDesigns.h:618
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:285
#define GUIDesignAuxiliarHorizontalFrame
design for auxiliar (Without borders) horizontal frame used to pack another frames
Definition: GUIDesigns.h:343
#define GUIDesignDialogBox
Definition: GUIDesigns.h:527
#define GUIDesignButtonRectangular
little button rectangula used in frames (For example, in "help" buttons)
Definition: GUIDesigns.h:74
#define GUIDesignLabelLeftThick
label extended over frame with thick and with text justify to left
Definition: GUIDesigns.h:205
#define GUIDesignButtonIconRectangular
button only with icon
Definition: GUIDesigns.h:80
#define GUIDesignLabelFrameThicked
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:247
#define GUIDesignListSingleElementFixedHeight
design for FXLists that only allow a single selected elements selected and height fixed
Definition: GUIDesigns.h:621
#define GUIDesignButtonOK
Definition: GUIDesigns.h:124
#define GUIDesignLabelCenterThick
label extended over frame with thick and with text justify to center
Definition: GUIDesigns.h:211
#define GUIDesignCheckButton
checkButton placed in left position
Definition: GUIDesigns.h:145
#define GUIDesignTreeListDinamic
Definition: GUIDesigns.h:602
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:244
@ GLO_MAX
empty max
GUIIcon
An enumeration of icons used by the gui applications.
Definition: GUIIcons.h:33
@ BIGARROWLEFT
@ RECENTERVIEW
@ BIGARROWRIGHT
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:290
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:280
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_PEDESTRIAN
pedestrian
const std::string DEFAULT_TAXITYPE_ID
const std::string DEFAULT_PEDTYPE_ID
const std::set< std::string > DEFAULT_VTYPES
const std::string DEFAULT_VTYPE_ID
const std::string DEFAULT_CONTAINERTYPE_ID
const std::string DEFAULT_BIKETYPE_ID
SumoXMLTag
Numbers representing SUMO-XML - element names.
@ GNE_TAG_TRIP_JUNCTIONS
a trip between junctions (used in NETEDIT)
@ SUMO_TAG_INTERVAL
an aggreagated-output interval
@ SUMO_TAG_CLOSING_REROUTE
reroute of type closing
@ SUMO_TAG_STOP_CONTAINERSTOP
stop placed over a containerStop (used in netedit)
@ GNE_TAG_PERSONTRIP_JUNCTIONS
@ SUMO_TAG_REROUTER
A rerouter.
@ SUMO_TAG_EDGEREL
a relation between two edges
@ SUMO_TAG_DATAINTERVAL
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
@ GNE_TAG_TRANSPORT_CONTAINERSTOP
@ SUMO_TAG_TAZ
a traffic assignment zone
@ SUMO_TAG_E2DETECTOR
an e2 detector
@ SUMO_TAG_CHARGING_STATION
A Charging Station.
@ SUMO_TAG_VTYPE
description of a vehicle/person/container type
@ SUMO_TAG_ACCESS
An access point for a train stop.
@ GNE_TAG_PERSONTRIP_BUSSTOP
@ SUMO_TAG_NOTHING
invalid tag
@ GNE_TAG_WALK_EDGES
@ SUMO_TAG_CONTAINER_STOP
A container stop.
@ SUMO_TAG_CONTAINERFLOW
@ SUMO_TAG_PARKING_AREA_REROUTE
entry for an alternative parking zone
@ SUMO_TAG_STOP_CHARGINGSTATION
stop placed over a charging station (used in netedit)
@ SUMO_TAG_TAZSINK
a sink within a district (connection road)
@ SUMO_TAG_STOP_LANE
stop placed over a lane (used in netedit)
@ GNE_TAG_STOPCONTAINER_EDGE
@ SUMO_TAG_BUS_STOP
A bus stop.
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ GNE_TAG_FLOW_CALIBRATOR
a flow definition within in Calibrator
@ SUMO_TAG_LANECALIBRATOR
A calibrator placed over lane (used in netedit)
@ GNE_TAG_STOPPERSON_BUSSTOP
@ SUMO_TAG_STEP
trigger: a step description
@ 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_JUNCTIONS
a flow between junctions (used in NETEDIT)
@ GNE_TAG_POIGEO
Point of interest over view with GEO attributes.
@ GNE_TAG_TRANSHIP_EDGES
@ GNE_TAG_STOPCONTAINER_CONTAINERSTOP
@ 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)
@ SUMO_TAG_CONNECTION
connectio between two lanes
@ SUMO_TAG_PARKING_AREA
A parking area.
@ SUMO_TAG_ROUTE_PROB_REROUTE
probability of route of a reroute
@ SUMO_TAG_DET_ENTRY
an e3 entry point
@ GNE_TAG_E2DETECTOR_MULTILANE
an e2 detector over multiple lanes (placed here due create Additional Frame)
@ SUMO_TAG_PARKING_SPACE
A parking space for a single vehicle within a parking area.
@ SUMO_TAG_CONTAINER
@ SUMO_TAG_JUNCTION
begin/end of the description of a junction
@ SUMO_TAG_CROSSING
crossing between edges for pedestrians
@ GNE_TAG_WALK_BUSSTOP
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ SUMO_TAG_TRAIN_STOP
A train stop (alias for bus stop)
@ GNE_TAG_RIDE_EDGE
@ SUMO_TAG_STOP_BUSSTOP
stop placed over a busStop (used in netedit)
@ SUMO_TAG_VTYPE_DISTRIBUTION
distribution of a vehicle type
@ SUMO_TAG_LANE
begin/end of the description of a single lane
@ GNE_TAG_TRANSHIP_EDGE
@ SUMO_TAG_INSTANT_INDUCTION_LOOP
An instantenous induction loop.
@ GNE_TAG_WALK_JUNCTIONS
@ GNE_TAG_VEHICLE_WITHROUTE
description of a vehicle with an embedded route (used in NETEDIT)
@ SUMO_TAG_DEST_PROB_REROUTE
probability of destiny of a reroute
@ GNE_TAG_POILANE
Point of interest over Lane.
@ SUMO_TAG_DATASET
@ SUMO_TAG_E1DETECTOR
an e1 detector
@ SUMO_TAG_PERSON
@ SUMO_TAG_DET_EXIT
an e3 exit point
@ SUMO_TAG_VAPORIZER
vaporizer of vehicles
@ SUMO_TAG_STOP_PARKINGAREA
stop placed over a parking area (used in netedit)
@ GNE_TAG_WALK_EDGE
@ SUMO_TAG_TAZSOURCE
a source within a district (connection road)
@ SUMO_TAG_CLOSING_LANE_REROUTE
lane of a reroute of type closing
@ GNE_TAG_PERSONTRIP_EDGE
@ GNE_TAG_ROUTE_EMBEDDED
embedded route (used in NETEDIT)
@ GNE_TAG_RIDE_BUSSTOP
@ SUMO_TAG_CALIBRATOR
A calibrator placed over edge.
@ SUMO_TAG_E3DETECTOR
an e3 detector
@ SUMO_TAG_VSS
A variable speed sign.
@ GNE_TAG_STOPPERSON_EDGE
@ GNE_TAG_WALK_ROUTE
@ SUMO_TAG_PERSONFLOW
@ SUMO_TAG_TRIP
a single trip definition (used by router)
@ GNE_TAG_TRANSHIP_CONTAINERSTOP
@ SUMO_TAG_EDGE
begin/end of the description of an edge
@ GNE_TAG_TRANSPORT_EDGE
@ SUMO_ATTR_EDGES
the edges of a route
@ GNE_ATTR_DEFAULT_VTYPE
Flag to check if VType is a default VType.
@ SUMO_ATTR_ID
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
FXGroupBoxModule (based on FXGroupBox)
FXVerticalFrame * getCollapsableFrame()
get collapsable frame (used by all elements that will be collapsed if button is toogled)
FXTreeListDinamic.
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:507
static void popMatrix()
pop matrix
Definition: GLHelper.cpp:123
static void drawBoxLines(const PositionVector &geom, const std::vector< double > &rots, const std::vector< double > &lengths, double width, int cornerDetail=0, double offset=0)
Draws thick lines.
Definition: GLHelper.cpp:277
static void drawBoxLine(const Position &beg, double rot, double visLength, double width, double offset=0)
Draws a thick line.
Definition: GLHelper.cpp:231
static void pushMatrix()
push matrix
Definition: GLHelper.cpp:114
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:48
static const std::vector< GNETagProperties > getTagPropertiesByType(const int tagPropertyCategory)
get tagProperties associated to the given GNETagProperties::TagType (NETWORKELEMENT,...
virtual const std::string & getID() const =0
return ID of object
const GNETagProperties & getTagProperty() const
get tagProperty associated with this Attribute Carrier
FXIcon * getIcon() const
get FXIcon associated to this AC
virtual std::string getHierarchyName() const =0
get Hierarchy Name (Used in AC Hierarchy)
GNENet * getNet() const
get pointer to net
A lane area vehicles can halt at (netedit-version)
Definition: GNEBusStop.h:33
bool isSpecialCandidate() const
check if this element is a special candidate
bool isPossibleCandidate() const
check if this element is a possible candidate
bool isConflictedCandidate() const
check if this element is a conflicted candidate
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
A lane area vehicles can halt at (netedit-version)
An Element which don't belongs to GNENet but has influency in the simulation.
GNEDataSet * getDataSetParent() const
Returns a pointer to GNEDataSet parent.
const std::vector< GNEGenericData * > & getGenericDataChildren() const
get generic data children
const std::map< const double, GNEDataInterval * > & getDataIntervalChildren() const
get data interval children
Definition: GNEDataSet.cpp:298
An Element which don't belongs to GNENet but has influency in the simulation.
const std::string & getID() const
get ID
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:53
GNEJunction * getFromJunction() const
get from Junction (only used to increase readability)
Definition: GNEEdge.h:77
GNEJunction * getToJunction() const
get from Junction (only used to increase readability)
Definition: GNEEdge.h:82
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:782
static bool isSupermodeValid(const GNEViewNet *viewNet, const GNEAttributeCarrier *AC)
return true if AC can be edited in the current supermode
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:133
long onCmdSelectDemandElement(FXObject *, FXSelector, void *)
DemandElementSelector(GNEFrame *frameParent, SumoXMLTag demandElementTag, GNEDemandElement *defaultElement=nullptr)
FOX-declaration.
void setDemandElement(GNEDemandElement *demandElement)
set current demand element
const std::vector< SumoXMLTag > & getAllowedTags() const
MFXIconComboBox * myDemandElementsMatchBox
comboBox with the list of elements type
void showDemandElementSelector()
show demand element selector
GNEDemandElement * getCurrentDemandElement() const
get current demand element
GNEEdge * getContainerPlanPreviousEdge() const
get previous edge for the current container plan
void refreshDemandElementSelector()
refresh demand element selector
GNEEdge * getPersonPlanPreviousEdge() const
get previous edge for the current person plan
bool isDemandElementSelectorShown() const
check if demand element selector is shown
std::vector< SumoXMLTag > myDemandElementTags
demand element tags
void hideDemandElementSelector()
hide demand element selector
long onCmdStopDrawing(FXObject *, FXSelector, void *)
Called when the user press stop drawing button.
void setDeleteLastCreatedPoint(bool value)
enable or disable delete last created point
long onCmdStartDrawing(FXObject *, FXSelector, void *)
void stopDrawing()
stop drawing and check if shape can be created
bool getDeleteLastCreatedPoint()
get flag delete last created point
FXButton * myAbortDrawingButton
button for abort drawing
FXLabel * myInformationLabel
Label with information.
const PositionVector & getTemporalShape() const
get Temporal shape
DrawingShape(GNEFrame *frameParent)
FOX-declaration.
long onCmdAbortDrawing(FXObject *, FXSelector, void *)
Called when the user press abort drawing button.
void hideDrawingShape()
hide Drawing mode
FXButton * myStartDrawingButton
button for start drawing
void addNewPoint(const Position &P)
add new point to temporal shape
FXButton * myStopDrawingButton
button for stop drawing
void removeLastPoint()
remove last added point
void showDrawingShape()
show Drawing mode
bool isDrawing() const
return true if currently a shape is drawed
void createPopUpMenu(int X, int Y, GNEAttributeCarrier *clickedAC)
FXTreeListDinamic * myTreeListDinamic
tree list dinamic to show the children of the element to erase
FXTreeItem * addListItem(GNEAttributeCarrier *AC, FXTreeItem *itemParent=nullptr, std::string prefix="", std::string sufix="")
add item into list
void showHierarchicalElementChildren(GNEHierarchicalElement *HE, FXTreeItem *itemParent)
show children of given hierarchical element
long onCmdMoveItemDown(FXObject *, FXSelector, void *)
called when user click over option "Move down" of child menu
long onCmdCenterItem(FXObject *, FXSelector, void *)
called when user click over option "center" of child Menu
long onCmdShowChildMenu(FXObject *, FXSelector, void *data)
void hideHierarchicalElementTree()
hide HierarchicalElementTree
void refreshHierarchicalElementTree()
refresh HierarchicalElementTree
void removeCurrentEditedAttributeCarrier(const GNEAttributeCarrier *HE)
if given AttributeCarrier is the same of myHE, set it as nullptr
long onCmdInspectItem(FXObject *, FXSelector, void *)
called when user click over option "inspect" of child menu
long onCmdDeleteItem(FXObject *, FXSelector, void *)
called when user click over option "delete" of child menu
long onCmdMoveItemUp(FXObject *, FXSelector, void *)
called when user click over option "Move up" of child menu
HierarchicalElementTree(GNEFrame *frameParent)
FOX-declaration.
void showHierarchicalElementTree(GNEAttributeCarrier *AC)
show HierarchicalElementTree
FXTreeItem * showAttributeCarrierParents()
show child of current attributeCarrier
long onCmdListItemSelected(FXObject *, FXSelector, void *)
called when a list item is selected
long onCmdShowList(FXObject *, FXSelector, void *)
show list of overlapped elements
void showOverlappedInspection(const GNEViewNetHelper::ObjectsUnderCursor &objectsUnderCursor, const Position &clickedPosition)
show template editor
bool overlappedInspectionShown() const
check if overlappedInspection modul is shown
long onCmdOverlappingHelp(FXObject *, FXSelector, void *)
Called when user press the help button.
long onCmdNextElement(FXObject *, FXSelector, void *)
Inspect next Element (from top to bot)
void buildFXElements()
build Fox Toolkit elemements
bool checkSavedPosition(const Position &clickedPosition) const
check if given position is near to saved position
int getNumberOfOverlappedACs() const
get number of overlapped ACSs
long onCmdPreviousElement(FXObject *, FXSelector, void *)
Inspect previous element (from top to bot)
void hideOverlappedInspection()
hide template editor
bool previousElement(const Position &clickedPosition)
try to go to previous element if clicked position is near to saved position
bool nextElement(const Position &clickedPosition)
try to go to next element if clicked position is near to saved position
GNEAdditional * getToBusStop() const
to additional
bool isConflictVClass() const
check if current path is conflict due vClass
bool myConflictDisconnected
flag to mark this path as disconnected
std::vector< GNEEdge * > mySubPath
sub path
bool myConflictVClass
flag to mark this path as conflicted
GNEAdditional * getFromBusStop() const
get from additional
bool isConflictDisconnected() const
check if current path is conflict due is disconnected
const std::vector< GNEEdge * > & getSubPath() const
get sub path
void setVClass(SUMOVehicleClass vClass)
set vClass
const std::vector< Path > & getPath() const
get path route
GNEFrame * myFrameParent
current frame parent
FXButton * myAbortCreationButton
button for abort route creation
PathCreator(GNEFrame *frameParent)
default constructor
void recalculatePath()
recalculate path
GNEAdditional * getToStoppingPlace(SumoXMLTag expectedTag) const
get to stoppingPlace
bool addEdge(GNEEdge *edge, const bool shiftKeyPressed, const bool controlKeyPressed)
add edge
FXButton * myFinishCreationButton
button for finish route creation
int myCreationMode
current creation mode
void abortPathCreation()
abort path creation
void hidePathCreatorModule()
show PathCreator
long onCmdShowCandidateEdges(FXObject *, FXSelector, void *)
Called when the user click over check button "show candidate edges".
FXLabel * myInfoRouteLabel
label with route info
SUMOVehicleClass getVClass() const
get vClass
long onCmdCreatePath(FXObject *, FXSelector, void *)
GNEAdditional * myToStoppingPlace
to additional (usually a busStop)
long onCmdAbortPathCreation(FXObject *, FXSelector, void *)
Called when the user click over button "Abort route creation".
void setSpecialCandidates(GNEEdge *originEdge)
set special candidates (This function will be called recursively)
FXButton * myRemoveLastInsertedElement
button for removing last inserted element
void clearEdgeColors()
clear edge colors
void updateInfoRouteLabel()
update InfoRouteLabel
void setPossibleCandidates(GNEEdge *originEdge, const SUMOVehicleClass vClass)
set edgereachability (This function will be called recursively)
FXCheckButton * myShowCandidateEdges
CheckBox for show candidate edges.
void updateJunctionColors()
update junction colors
GNEDemandElement * myRoute
route (usually a busStop)
GNEDemandElement * getRoute() const
get route
void clearPath()
clear edges (and restore colors)
const std::vector< GNEEdge * > & getSelectedEdges() const
get current selected edges
FXLabel * myControlLabel
label for control information
void clearJunctionColors()
clear junction colors
bool drawCandidateEdgesWithSpecialColor() const
draw candidate edges with special color (Only for candidates, special and conflicted)
FXLabel * myShiftLabel
label for shift information
void removeLastElement()
remove path element
SUMOVehicleClass myVClass
current vClass
void updateEdgeColors()
update edge colors
bool addRoute(GNEDemandElement *route, const bool shiftKeyPressed, const bool controlKeyPressed)
add route
bool addJunction(GNEJunction *junction, const bool shiftKeyPressed, const bool controlKeyPressed)
add junction
const std::vector< GNEJunction * > & getSelectedJunctions() const
get current selected junctions
void drawTemporalRoute(const GUIVisualizationSettings &s) const
draw temporal route
long onCmdRemoveLastElement(FXObject *, FXSelector, void *)
Called when the user click over button "Remove las inserted edge".
bool addStoppingPlace(GNEAdditional *stoppingPlace, const bool shiftKeyPressed, const bool controlKeyPressed)
add stoppingPlace
void showPathCreatorModule(SumoXMLTag element, const bool firstElement, const bool consecutives)
show PathCreator for the given tag
PathLegend(GNEFrame *frameParent)
constructor
void hidePathLegendModule()
hide Legend modul
void showPathLegendModule()
show Legend modul
SelectorParent(GNEFrame *frameParent)
constructor
void setIDSelected(const std::string &id)
select manually a element of the list
FXLabel * myParentsLabel
Label with parent name.
FXList * myParentsList
List of parents.
std::string getIdSelected() const
get currently parent additional selected
void refreshSelectorParentModule()
Refresh list of Additional Parents Module.
void hideSelectorParentModule()
hide SelectorParent Module
bool showSelectorParentModule(const std::vector< SumoXMLTag > &additionalTypeParents)
Show list of SelectorParent Module.
GNEAttributeCarrier * getAC() const
get template AC
GNEAttributeCarrier * myAC
editedAC
ACTemplate(GNENet *net, const GNETagProperties tagProperty)
constructor
void hideTagSelector()
hide item selector
long onCmdSelectTag(FXObject *, FXSelector, void *)
GNEAttributeCarrier * getTemplateAC(SumoXMLTag ACTag) const
get templateAC
void setCurrentTag(SumoXMLTag newTag, const bool notifyFrameParent=true)
set current type manually
void refreshTagSelector()
refresh tagSelector (used when frameParent is show)
GNEFrame * myFrameParent
pointer to Frame Parent
void setCurrentTagType(GNETagProperties::TagType tagType, const bool onlyDrawables, const bool notifyFrameParent=true)
set current type manually
std::vector< ACTemplate * > myACTemplates
list with ACTemplates
GNEAttributeCarrier * getCurrentTemplateAC() const
get current templateAC
void showTagSelector()
show item selector
static FXLabel * buildRainbow(FXComposite *parent)
build rainbow in frame modul
An Element which don't belongs to GNENet but has influency in the simulation.
GNEDataInterval * getDataIntervalParent() const
get data interval parent
const std::vector< GNETAZElement * > & getChildTAZElements() const
get child TAZElements
const std::vector< GNEDemandElement * > & getChildDemandElements() const
return child demand elements
const std::vector< GNELane * > & getChildLanes() const
get child lanes
const std::vector< GNEDemandElement * > & getParentDemandElements() const
get parent demand elements
const std::vector< GNEAdditional * > & getParentAdditionals() const
get parent additionals
const std::vector< GNEEdge * > & getChildEdges() const
get child edges
const std::vector< GNEEdge * > & getParentEdges() const
get parent edges
const std::vector< GNELane * > & getParentLanes() const
get parent lanes
const std::vector< GNEShape * > & getChildShapes() const
get child shapes
const std::vector< GNETAZElement * > & getParentTAZElements() const
get parent TAZElements
const std::vector< GNEAdditional * > & getChildAdditionals() const
return child additionals
const std::vector< GNEGenericData * > & getChildGenericDatas() const
return child generic data elements
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
bool exist(const GNELane *toLane) const
check if exist a lane2lane geometry for the given tolane
const GUIGeometry & getLane2laneGeometry(const GNELane *toLane) const
get lane2lane geometry
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
const PositionVector & getLaneShape() const
get elements shape
Definition: GNELane.cpp:131
const GNELane2laneConnection & getLane2laneConnections() const
get Lane2laneConnection struct
Definition: GNELane.cpp:838
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition: GNELane.cpp:1683
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1662
GNEEdge * getParentEdge() const
get arent edge
Definition: GNELane.cpp:113
GNETAZElement * retrieveTAZElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named TAZElement.
GNELane * retrieveLane(const std::string &id, bool hardFail=true, bool checkVolatileChange=false) const
get lane by id
GNEShape * retrieveShape(SumoXMLTag, const std::string &id, bool hardFail=true) const
Returns the named shape.
GNEJunction * retrieveJunction(const std::string &id, bool hardFail=true) const
get junction by id
GNEDataSet * retrieveDataSet(const std::string &id, bool hardFail=true) const
Returns the named data set.
GNEEdge * retrieveEdge(const std::string &id, bool hardFail=true) const
get edge by id
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:42
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
get all attribute carriers used in this net
Definition: GNENet.cpp:125
GNEPathManager * getPathManager()
get path manager
Definition: GNENet.cpp:131
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
const std::string & getID() const
get ID
Definition: GNEPOI.h:43
A lane area vehicles can park at (netedit-version)
vehicle space used by GNEParkingAreas
std::vector< GNEEdge * > calculateDijkstraPath(const SUMOVehicleClass vClass, const std::vector< GNEEdge * > &partialEdges) const
calculate Dijkstra path between a list of partial edges
PathCalculator * getPathCalculator()
obtain instance of PathCalculator
Representation of a RouteProbe in netedit.
Definition: GNERouteProbe.h:32
An Element which don't belongs to GNENet but has influency in the simulation.
Definition: GNETAZElement.h:45
Definition: GNETAZ.h:34
bool isShape() const
return true if tag correspond to a shape
bool isTAZElement() const
return true if tag correspond to a TAZ element
bool isNetworkElement() const
return true if tag correspond to a network element
bool isDataElement() const
return true if tag correspond to a data element
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
bool isDemandElement() const
return true if tag correspond to a demand element
bool isAdditionalElement() const
return true if tag correspond to an additional element
Representation of a vaporizer in netedit.
Definition: GNEVaporizer.h:33
class used to group all variables related with objects under cursor after a click over view
const std::vector< GNEAttributeCarrier * > & getClickedAttributeCarriers() const
get vector with clicked ACs
GNENet * getNet() const
get the net object
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:42
const PositionVector & getShape() const
The shape of the additional element.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
Stores the information about how to visualize structures.
GUIVisualizationCandidateColorSettings candidateColorSettings
candidate color settings
const std::string & getProjString() const
Returns the original projection definition.
static const GeoConvHelper & getFinal()
the coordinate transformation for writing the location element and for tracking the original coordina...
ComboBox with icon.
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:112
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
double distanceTo2D(const Position &p2) const
returns the euclidean distance in the x-y-plane
Definition: Position.h:252
double x() const
Returns the x-position.
Definition: Position.h:55
double y() const
Returns the y-position.
Definition: Position.h:60
A list of positions.
static const RGBColor WHITE
Definition: RGBColor.h:192
static const RGBColor GREY
Definition: RGBColor.h:194
static const RGBColor ORANGE
Definition: RGBColor.h:191
#define M_PI
Definition: odrSpiral.cpp:40
static const std::vector< RGBColor > & getRainbowScaledColors()
get scaled rainbow colors
static const RGBColor special
color for selected special candidate element (Usually selected using shift+click)
static const RGBColor conflict
color for selected conflict candidate element (Usually selected using ctrl+click)
static const RGBColor target
color for selected candidate target
static const RGBColor possible
color for possible candidate element
static const RGBColor source
color for selected candidate source