Eclipse SUMO - Simulation of Urban MObility
GNEFrameModuls.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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
15 // Auxiliar class for GNEFrame Moduls
16 /****************************************************************************/
17 
18 // ===========================================================================
19 // included modules
20 // ===========================================================================
21 
22 #include <config.h>
23 
25 #include <netedit/GNENet.h>
26 #include <netedit/GNEUndoList.h>
27 #include <netedit/GNEViewNet.h>
28 #include <netedit/GNEViewParent.h>
39 #include <utils/gui/div/GLHelper.h>
43 
44 #include "GNEFrameModuls.h"
45 #include "GNEInspectorFrame.h"
46 
47 
48 // ===========================================================================
49 // FOX callback mapping
50 // ===========================================================================
51 
52 FXDEFMAP(GNEFrameModuls::TagSelector) TagSelectorMap[] = {
55 };
56 
57 FXDEFMAP(GNEFrameModuls::DemandElementSelector) DemandElementSelectorMap[] = {
59 };
60 
61 FXDEFMAP(GNEFrameModuls::EdgePathCreator) EdgePathCreatorMap[] = {
65 };
66 
67 FXDEFMAP(GNEFrameModuls::AttributeCarrierHierarchy) AttributeCarrierHierarchyMap[] = {
74 };
75 
76 FXDEFMAP(GNEFrameModuls::DrawingShape) DrawingShapeMap[] = {
80 };
81 
82 // Object implementation
83 FXIMPLEMENT(GNEFrameModuls::TagSelector, FXGroupBox, TagSelectorMap, ARRAYNUMBER(TagSelectorMap))
84 FXIMPLEMENT(GNEFrameModuls::DemandElementSelector, FXGroupBox, DemandElementSelectorMap, ARRAYNUMBER(DemandElementSelectorMap))
85 FXIMPLEMENT(GNEFrameModuls::EdgePathCreator, FXGroupBox, EdgePathCreatorMap, ARRAYNUMBER(EdgePathCreatorMap))
86 FXIMPLEMENT(GNEFrameModuls::AttributeCarrierHierarchy, FXGroupBox, AttributeCarrierHierarchyMap, ARRAYNUMBER(AttributeCarrierHierarchyMap))
87 FXIMPLEMENT(GNEFrameModuls::DrawingShape, FXGroupBox, DrawingShapeMap, ARRAYNUMBER(DrawingShapeMap))
88 
89 
90 // ===========================================================================
91 // method definitions
92 // ===========================================================================
93 
94 // ---------------------------------------------------------------------------
95 // GNEFrameModuls::TagSelector - methods
96 // ---------------------------------------------------------------------------
97 
98 GNEFrameModuls::TagSelector::TagSelector(GNEFrame* frameParent, GNEAttributeCarrier::TagType type, bool onlyDrawables) :
99  FXGroupBox(frameParent->myContentFrame, "Element", GUIDesignGroupBoxFrame),
100  myFrameParent(frameParent) {
101  // first check that property is valid
102  switch (type) {
103  case GNEAttributeCarrier::TagType::TAGTYPE_NETELEMENT:
104  setText("Net elements");
105  break;
106  case GNEAttributeCarrier::TagType::TAGTYPE_ADDITIONAL:
107  setText("Additional elements");
108  break;
109  case GNEAttributeCarrier::TagType::TAGTYPE_SHAPE:
110  setText("Shape elements");
111  break;
112  case GNEAttributeCarrier::TagType::TAGTYPE_TAZ:
113  setText("TAZ elements");
114  break;
115  case GNEAttributeCarrier::TagType::TAGTYPE_VEHICLE:
116  setText("Vehicles");
117  break;
118  case GNEAttributeCarrier::TagType::TAGTYPE_STOP:
119  setText("Stops");
120  break;
121  case GNEAttributeCarrier::TagType::TAGTYPE_PERSON:
122  setText("Persons");
123  break;
124  case GNEAttributeCarrier::TagType::TAGTYPE_PERSONPLAN:
125  setText("Person plans");
126  // person plan type has four sub-groups
127  myListOfTagTypes.push_back(std::make_pair("person trips", GNEAttributeCarrier::TagType::TAGTYPE_PERSONTRIP));
128  myListOfTagTypes.push_back(std::make_pair("walks", GNEAttributeCarrier::TagType::TAGTYPE_WALK));
129  myListOfTagTypes.push_back(std::make_pair("rides", GNEAttributeCarrier::TagType::TAGTYPE_RIDE));
130  myListOfTagTypes.push_back(std::make_pair("stops", GNEAttributeCarrier::TagType::TAGTYPE_PERSONSTOP));
131  break;
132  case GNEAttributeCarrier::TagType::TAGTYPE_PERSONTRIP:
133  setText("Person trips");
134  break;
135  case GNEAttributeCarrier::TagType::TAGTYPE_WALK:
136  setText("Walks");
137  break;
138  case GNEAttributeCarrier::TagType::TAGTYPE_RIDE:
139  setText("Rides");
140  break;
141  case GNEAttributeCarrier::TagType::TAGTYPE_PERSONSTOP:
142  setText("Person stops");
143  break;
144  default:
145  throw ProcessError("invalid tag property");
146  }
147 
148  // Create FXComboBox
149  myTagTypesMatchBox = new FXComboBox(this, GUIDesignComboBoxNCol, this, MID_GNE_TAGTYPE_SELECTED, GUIDesignComboBox);
150  // Create FXComboBox
151  myTagsMatchBox = new FXComboBox(this, GUIDesignComboBoxNCol, this, MID_GNE_TAG_SELECTED, GUIDesignComboBox);
152  // Fill comboBox depending of TagTypes
153  if (myListOfTagTypes.size() > 0) {
154  // fill myTypeMatchBox with list of tags
155  for (const auto& i : myListOfTagTypes) {
156  myTagTypesMatchBox->appendItem(i.first.c_str());
157  }
158  // Set visible items
159  myTagTypesMatchBox->setNumVisible((int)myTagTypesMatchBox->getNumItems());
160  // fill myListOfTags with personTrips (the first Tag Type)
161  myListOfTags = GNEAttributeCarrier::allowedTagsByCategory(GNEAttributeCarrier::TagType::TAGTYPE_PERSONTRIP, onlyDrawables);
162  } else {
163  myTagTypesMatchBox->hide();
164  // fill myListOfTags
165  myListOfTags = GNEAttributeCarrier::allowedTagsByCategory(type, onlyDrawables);
166 
167  }
168  // fill myTypeMatchBox with list of tags
169  for (const auto& i : myListOfTags) {
170  myTagsMatchBox->appendItem(toString(i).c_str());
171  }
172  // Set visible items
173  myTagsMatchBox->setNumVisible((int)myTagsMatchBox->getNumItems());
174  // TagSelector is always shown
175  show();
176 }
177 
178 
180 
181 
182 void
184  show();
185 }
186 
187 
188 void
190  hide();
191 }
192 
193 
196  return myCurrentTagProperties;
197 }
198 
199 
200 void
202  // set empty tag properties
204  // make sure that tag is in myTypeMatchBox
205  for (int i = 0; i < (int)myTagsMatchBox->getNumItems(); i++) {
206  if (myTagsMatchBox->getItem(i).text() == toString(tagType)) {
207  myTagsMatchBox->setCurrentItem(i);
208  // fill myListOfTags with personTrips (the first Tag Type)
209  myListOfTags = GNEAttributeCarrier::allowedTagsByCategory(GNEAttributeCarrier::TagType::TAGTYPE_PERSONTRIP, true);
210  // clear myTagsMatchBox
211  myTagsMatchBox->clearItems();
212  // fill myTypeMatchBox with list of tags
213  for (const auto& j : myListOfTags) {
214  myTagsMatchBox->appendItem(toString(j).c_str());
215  }
216  // Set visible items
217  myTagsMatchBox->setNumVisible((int)myTagsMatchBox->getNumItems());
218  }
219  }
220  // call tag selected function
222 }
223 
224 
225 void
227  // set empty tag properties
229  // make sure that tag is in myTypeMatchBox
230  for (int i = 0; i < (int)myTagsMatchBox->getNumItems(); i++) {
231  if (myTagsMatchBox->getItem(i).text() == toString(newTag)) {
232  myTagsMatchBox->setCurrentItem(i);
233  // Set new current type
235  }
236  }
237  // call tag selected function
239 }
240 
241 
242 void
244  // simply call onCmdSelectItem (to avoid duplicated code)
245  onCmdSelectTag(0, 0, 0);
246 }
247 
248 
249 long GNEFrameModuls::TagSelector::onCmdSelectTagType(FXObject*, FXSelector, void*) {
250  // Check if value of myTypeMatchBox correspond of an allowed additional tags
251  for (const auto& i : myListOfTagTypes) {
252  if (i.first == myTagTypesMatchBox->getText().text()) {
253  // set color of myTagTypesMatchBox to black (valid)
254  myTagTypesMatchBox->setTextColor(FXRGB(0, 0, 0));
255  // fill myListOfTags with personTrips (the first Tag Type)
257  // show and clear myTagsMatchBox
258  myTagsMatchBox->show();
259  myTagsMatchBox->clearItems();
260  // fill myTypeMatchBox with list of tags
261  for (const auto& j : myListOfTags) {
262  myTagsMatchBox->appendItem(toString(j).c_str());
263  }
264  // Set visible items
265  myTagsMatchBox->setNumVisible((int)myTagsMatchBox->getNumItems());
266  // Write Warning in console if we're in testing mode
267  WRITE_DEBUG(("Selected item '" + myTagsMatchBox->getText() + "' in TagTypeSelector").text());
268  // call onCmdSelectTag
269  return onCmdSelectTag(nullptr, 0, nullptr);
270  }
271  }
272  // if TagType isn't valid, hide myTagsMatchBox
273  myTagsMatchBox->hide();
274  // if additional name isn't correct, set SUMO_TAG_NOTHING as current type
276  // call tag selected function
278  // set color of myTagTypesMatchBox to red (invalid)
279  myTagTypesMatchBox->setTextColor(FXRGB(255, 0, 0));
280  // Write Warning in console if we're in testing mode
281  WRITE_DEBUG("Selected invalid item in TagTypeSelector");
282  return 1;
283 }
284 
285 
286 long
287 GNEFrameModuls::TagSelector::onCmdSelectTag(FXObject*, FXSelector, void*) {
288  // Check if value of myTypeMatchBox correspond of an allowed additional tags
289  for (const auto& i : myListOfTags) {
290  if (toString(i) == myTagsMatchBox->getText().text()) {
291  // set color of myTypeMatchBox to black (valid)
292  myTagsMatchBox->setTextColor(FXRGB(0, 0, 0));
293  // Set new current type
295  // call tag selected function
297  // Write Warning in console if we're in testing mode
298  WRITE_DEBUG(("Selected item '" + myTagsMatchBox->getText() + "' in TagSelector").text());
299  return 1;
300  }
301  }
302  // if additional name isn't correct, set SUMO_TAG_NOTHING as current type
304  // call tag selected function
306  // set color of myTypeMatchBox to red (invalid)
307  myTagsMatchBox->setTextColor(FXRGB(255, 0, 0));
308  // Write Warning in console if we're in testing mode
309  WRITE_DEBUG("Selected invalid item in TagSelector");
310  return 1;
311 }
312 
313 // ---------------------------------------------------------------------------
314 // GNEFrameModuls::DemandElementSelector - methods
315 // ---------------------------------------------------------------------------
316 
318  FXGroupBox(frameParent->myContentFrame, ("Parent " + toString(demandElementTag)).c_str(), GUIDesignGroupBoxFrame),
319  myFrameParent(frameParent),
320  myCurrentDemandElement(nullptr),
321  myDemandElementTags({demandElementTag}) {
322  // Create FXComboBox
324  // refresh demand element MatchBox
326  // shown after creation
327  show();
328 }
329 
330 
331 GNEFrameModuls::DemandElementSelector::DemandElementSelector(GNEFrame* frameParent, const std::vector<GNEAttributeCarrier::TagType>& tagTypes) :
332  FXGroupBox(frameParent->myContentFrame, "Parent element", GUIDesignGroupBoxFrame),
333  myFrameParent(frameParent),
334  myCurrentDemandElement(nullptr) {
335  // fill myDemandElementTags
336  for (const auto& i : tagTypes) {
337  auto tags = GNEAttributeCarrier::allowedTagsByCategory(i, false);
338  myDemandElementTags.insert(myDemandElementTags.end(), tags.begin(), tags.end());
339  }
340  // Create FXComboBox
342  // refresh demand element MatchBox
344  // shown after creation
345  show();
346 }
347 
348 
350 
351 
354  return myCurrentDemandElement;
355 }
356 
357 
358 const std::vector<SumoXMLTag>&
360  return myDemandElementTags;
361 }
362 
363 void
365  // first check that demandElement tag correspond to a tag of myDemandElementTags
366  if (std::find(myDemandElementTags.begin(), myDemandElementTags.end(), demandElement->getTagProperty().getTag()) != myDemandElementTags.end()) {
367  // update text of myDemandElementsMatchBox
368  myDemandElementsMatchBox->setText(demandElement->getID().c_str());
369  // Set new current demand element
370  myCurrentDemandElement = demandElement;
371  // call demandElementSelected function
373  }
374 }
375 
376 
377 void
379  // first refresh modul
381  // if current selected item isn't valid, set DEFAULT_VTYPE_ID or DEFAULT_PEDTYPE_ID
384  } else if (myDemandElementTags.size() == 1) {
385  if (myDemandElementTags.at(0) == SUMO_TAG_VTYPE) {
386  myDemandElementsMatchBox->setText(DEFAULT_VTYPE_ID.c_str());
387  } else if (myDemandElementTags.at(0) == SUMO_TAG_PTYPE) {
389  }
390  }
391  onCmdSelectDemandElement(nullptr, 0, nullptr);
392  show();
393 }
394 
395 
396 void
398  hide();
399 }
400 
401 
402 bool
404  return shown();
405 }
406 
407 
408 void
410  // clear demand elements comboBox
411  myDemandElementsMatchBox->clearItems();
412  // fill myTypeMatchBox with list of demand elements
413  for (const auto& i : myDemandElementTags) {
414  // special case for VTypes and PTypes
415  if (i == SUMO_TAG_VTYPE) {
416  // add default Vehicle an Bike types in the first and second positions
417  myDemandElementsMatchBox->appendItem(DEFAULT_VTYPE_ID.c_str());
418  myDemandElementsMatchBox->appendItem(DEFAULT_BIKETYPE_ID.c_str());
419  // add rest of vTypes
420  for (const auto& j : myFrameParent->getViewNet()->getNet()->getAttributeCarriers().demandElements.at(i)) {
421  // avoid insert duplicated default vType
422  if ((j.first != DEFAULT_VTYPE_ID) && (j.first != DEFAULT_BIKETYPE_ID)) {
423  myDemandElementsMatchBox->appendItem(j.first.c_str());
424  }
425  }
426  } else if (i == SUMO_TAG_PTYPE) {
427  // add default Person type in the firs
428  myDemandElementsMatchBox->appendItem(DEFAULT_PEDTYPE_ID.c_str());
429  // add rest of pTypes
430  for (const auto& j : myFrameParent->getViewNet()->getNet()->getAttributeCarriers().demandElements.at(i)) {
431  // avoid insert duplicated default pType
432  if (j.first != DEFAULT_PEDTYPE_ID) {
433  myDemandElementsMatchBox->appendItem(j.first.c_str());
434  }
435  }
436  } else {
437  // insert all Ids
438  for (const auto& j : myFrameParent->getViewNet()->getNet()->getAttributeCarriers().demandElements.at(i)) {
439  myDemandElementsMatchBox->appendItem(j.first.c_str());
440  }
441  }
442  }
443  // Set number of items (maximum 10)
444  if (myDemandElementsMatchBox->getNumItems() < 10) {
445  myDemandElementsMatchBox->setNumVisible((int)myDemandElementsMatchBox->getNumItems());
446  } else {
447  myDemandElementsMatchBox->setNumVisible(10);
448  }
449  // update myCurrentDemandElement
450  if (myDemandElementsMatchBox->getNumItems() == 0) {
451  myCurrentDemandElement = nullptr;
452  } else if (myCurrentDemandElement) {
453  for (int i = 0; i < myDemandElementsMatchBox->getNumItems(); i++) {
454  if (myDemandElementsMatchBox->getItem(i).text() == myCurrentDemandElement->getID()) {
455  myDemandElementsMatchBox->setCurrentItem(i, FALSE);
456  }
457  }
458  } else {
459  // set first element in the list as myCurrentDemandElement (Special case for default person and vehicle type)
460  if (myDemandElementsMatchBox->getItem(0).text() == DEFAULT_VTYPE_ID) {
462  } else if (myDemandElementsMatchBox->getItem(0).text() == DEFAULT_PEDTYPE_ID) {
464  } else {
465  // disable myCurrentDemandElement
466  myCurrentDemandElement = nullptr;
467  // update myCurrentDemandElement with the first allowed element
468  for (auto i = myDemandElementTags.begin(); (i != myDemandElementTags.end()) && (myCurrentDemandElement == nullptr); i++) {
469  if (myFrameParent->getViewNet()->getNet()->getAttributeCarriers().demandElements.at(*i).size() > 0) {
471  }
472  }
473  }
474  }
475 }
476 
477 
478 long
480  // Check if value of myTypeMatchBox correspond to a demand element
481  for (const auto& i : myDemandElementTags) {
482  for (const auto& j : myFrameParent->getViewNet()->getNet()->getAttributeCarriers().demandElements.at(i)) {
483  if (j.first == myDemandElementsMatchBox->getText().text()) {
484  // set color of myTypeMatchBox to black (valid)
485  myDemandElementsMatchBox->setTextColor(FXRGB(0, 0, 0));
486  // Set new current demand element
487  myCurrentDemandElement = j.second;
488  // call demandElementSelected function
490  // Write Warning in console if we're in testing mode
491  WRITE_DEBUG(("Selected item '" + myDemandElementsMatchBox->getText() + "' in DemandElementSelector").text());
492  return 1;
493  }
494  }
495  }
496  // if demand element selected is invalid, set demand element as null
497  myCurrentDemandElement = nullptr;
498  // call demandElementSelected function
500  // change color of myDemandElementsMatchBox to red (invalid)
501  myDemandElementsMatchBox->setTextColor(FXRGB(255, 0, 0));
502  // Write Warning in console if we're in testing mode
503  WRITE_DEBUG("Selected invalid item in DemandElementSelector");
504  return 1;
505 }
506 
507 // ---------------------------------------------------------------------------
508 // GNEFrameModuls::EdgePathCreator - methods
509 // ---------------------------------------------------------------------------
510 
511 GNEFrameModuls::EdgePathCreator::EdgePathCreator(GNEFrame* frameParent, int edgePathCreatorModes) :
512  FXGroupBox(frameParent->myContentFrame, "Route creator", GUIDesignGroupBoxFrame),
513  myFrameParent(frameParent),
514  myVClass(SVC_PASSENGER),
515  mySelectedBusStop(nullptr),
516  myEdgePathCreatorModes(edgePathCreatorModes) {
517 
518  // create button for create GEO POIs
519  myFinishCreationButton = new FXButton(this, "Finish route creation", nullptr, this, MID_GNE_EDGEPATH_FINISH, GUIDesignButton);
520  myFinishCreationButton->disable();
521 
522  // create button for create GEO POIs
523  myAbortCreationButton = new FXButton(this, "Abort route creation", nullptr, this, MID_GNE_EDGEPATH_ABORT, GUIDesignButton);
524  myAbortCreationButton->disable();
525 
526  // create button for create GEO POIs
527  myRemoveLastInsertedEdge = new FXButton(this, "Remove last inserted edge", nullptr, this, MID_GNE_EDGEPATH_REMOVELAST, GUIDesignButton);
528  myRemoveLastInsertedEdge->disable();
529 }
530 
531 
533 
534 
535 void
537  // header needs the first capitalized letter
538  std::string nameWithFirstCapitalizedLetter = name;
539  nameWithFirstCapitalizedLetter[0] = (char)toupper(nameWithFirstCapitalizedLetter.at(0));
540  setText((nameWithFirstCapitalizedLetter + " creator").c_str());
541  myFinishCreationButton->setText(("Finish " + name + " creation").c_str());
542  myAbortCreationButton->setText(("Abort " + name + " creation").c_str());
543 }
544 
545 
546 void
548  // disable buttons
549  myFinishCreationButton->disable();
550  myAbortCreationButton->disable();
551  myRemoveLastInsertedEdge->disable();
552  // show modul
553  show();
554 }
555 
556 
557 void
559  // restore colors
560  for (const auto& i : myClickedEdges) {
561  restoreEdgeColor(i);
562  }
563  // clear edges
564  myClickedEdges.clear();
565  // clear myTemporalEdgePath
566  myTemporalRoute.clear();
567  // hide modul
568  hide();
569 }
570 
571 
572 void
574  myVClass = vClass;
575 }
576 
577 
578 void
580  myEdgePathCreatorModes = edgePathCreatorModes;
581 }
582 
583 
584 std::vector<GNEEdge*>
586  return myClickedEdges;
587 }
588 
589 
592  return mySelectedBusStop;
593 }
594 
595 
596 bool
598  bool addEdge = true;
599  // check if final busStop was selected
600  if (mySelectedBusStop != nullptr) {
601  addEdge = false;
602  // write status bar text
604  // Write Warning in console if we're in testing mode
605  WRITE_DEBUG("Final " + mySelectedBusStop->getTagProperty().getTagStr() + " selected");
606  } else if ((myClickedEdges.size() > 0) && (myClickedEdges.back() == edge)) {
607  // avoid duplicated consecutive edges
608  addEdge = false;
609  // write status bar text
610  myFrameParent->getViewNet()->setStatusBarText("Duplicated consecutive edges aren't allowed");
611  // Write Warning in console if we're in testing mode
612  WRITE_DEBUG("Duplicated consecutive edges aren't allowed");
613  }
614  // check permissions
615  if (addEdge) {
616  addEdge = false;
617  for (const auto& i : edge->getNBEdge()->getLanes()) {
618  if ((i.permissions & myVClass) != 0) {
619  addEdge = true;
620  }
621  }
622  if (addEdge == false) {
623  // write status bar text
624  myFrameParent->getViewNet()->setStatusBarText("Invalid edge permissions");
625  // Write Warning in console if we're in testing mode
626  WRITE_DEBUG("Invalid edge permissions");
627  }
628  }
629  // check if edge can be added
630  if (addEdge) {
631  // insert edge in myClickedEdges
632  myClickedEdges.push_back(edge);
633  // enable abort route button
634  myAbortCreationButton->enable();
635  // disable undo/redo
637  // set special color
638  for (auto i : edge->getLanes()) {
639  i->setSpecialColor(&myFrameParent->getEdgeCandidateSelectedColor());
640  }
641  // enable remove last edge button
642  myRemoveLastInsertedEdge->enable();
643  // enable finish button
644  myFinishCreationButton->enable();
645  // calculate route if there is more than two edges
646  if (myClickedEdges.size() > 1) {
647  // calculate temporal route
649  } else {
650  // use single edge as temporal route
652  }
653  return true;
654  } else {
655  return false;
656  }
657 }
658 
659 
660 bool
662  // check that at least there is a selected edge
663  if (!myClickedEdges.empty() && (mySelectedBusStop == nullptr)) {
664  mySelectedBusStop = busStop;
666  }
667  return false;
668 }
669 
670 
671 void
673  // restore colors
674  for (const auto& i : myClickedEdges) {
675  restoreEdgeColor(i);
676  }
677  // clear edges
678  myClickedEdges.clear();
679  myTemporalRoute.clear();
680  // clear busStop
681  if (mySelectedBusStop) {
683  mySelectedBusStop = nullptr;
684  }
685  // enable undo/redo
687 }
688 
689 
690 void
692  // draw depending of number of edges
693  if (myClickedEdges.size() > 0) {
694  // Add a draw matrix
695  glPushMatrix();
696  // Start with the drawing of the area traslating matrix to origin
697  glTranslated(0, 0, GLO_MAX);
698  // set orange color
700  // set line width
701  glLineWidth(5);
702  // draw first line
703  GLHelper::drawLine(myTemporalRoute.at(0)->getNBEdge()->getLanes().front().shape.front(),
704  myTemporalRoute.at(0)->getNBEdge()->getLanes().front().shape.back());
705  // draw rest of lines
706  for (int i = 1; i < (int)myTemporalRoute.size(); i++) {
707  GLHelper::drawLine(myTemporalRoute.at(i - 1)->getNBEdge()->getLanes().front().shape.back(),
708  myTemporalRoute.at(i)->getNBEdge()->getLanes().front().shape.front());
709  GLHelper::drawLine(myTemporalRoute.at(i)->getNBEdge()->getLanes().front().shape.front(),
710  myTemporalRoute.at(i)->getNBEdge()->getLanes().front().shape.back());
711  }
712  // draw a line to center of selected bus
713  if (mySelectedBusStop) {
714  GLHelper::drawLine(myTemporalRoute.back()->getNBEdge()->getLanes().front().shape.back(),
716  }
717  // Pop last matrix
718  glPopMatrix();
719  }
720 }
721 
722 
723 void
725  if (myAbortCreationButton->isEnabled()) {
726  onCmdAbortRouteCreation(nullptr, 0, nullptr);
727  }
728 }
729 
730 
731 void
733  if (myFinishCreationButton->isEnabled()) {
734  onCmdFinishRouteCreation(nullptr, 0, nullptr);
735  }
736 }
737 
738 
739 void
741  if (myRemoveLastInsertedEdge->isEnabled()) {
742  onCmdRemoveLastInsertedElement(nullptr, 0, nullptr);
743  }
744 }
745 
746 
747 long
749  // clear edges
750  clearEdges();
751  // disable buttons
752  myAbortCreationButton->disable();
753  myFinishCreationButton->disable();
754  myRemoveLastInsertedEdge->disable();
755  return 1;
756 }
757 
758 
759 long
761  // only create route if there is more than two edges
762  if (myClickedEdges.size() > 0) {
763  // call edgePathCreated
765  // update view
767  // clear edges after creation
768  clearEdges();
769  // disable buttons
770  myFinishCreationButton->disable();
771  myAbortCreationButton->disable();
772  myRemoveLastInsertedEdge->disable();
773  }
774  return 1;
775 }
776 
777 
778 long
780  if (myClickedEdges.size() > 1) {
781  // restore color of last clicked edge
783  // remove last edge
784  myClickedEdges.pop_back();
785  // calculate temporal route
787  // update view (to see the new temporal route)
789  // check if after pop edge, there is more than one edge
790  if (myClickedEdges.size() == 1) {
791  // disable remove last edge button
792  myRemoveLastInsertedEdge->disable();
793  }
794  }
795  return 1;
796 }
797 
798 
799 void
801  // restore color of every lane
802  for (const auto& i : edge->getLanes()) {
803  i->setSpecialColor(nullptr);
804  }
805 }
806 
807 // ---------------------------------------------------------------------------
808 // GNEFrameModuls::AttributeCarrierHierarchy - methods
809 // ---------------------------------------------------------------------------
810 
812  FXGroupBox(frameParent->myContentFrame, "Hierarchy", GUIDesignGroupBoxFrame),
813  myFrameParent(frameParent),
814  myAC(nullptr),
815  myClickedAC(nullptr),
816  myClickedJunction(nullptr),
817  myClickedEdge(nullptr),
818  myClickedLane(nullptr),
819  myClickedCrossing(nullptr),
820  myClickedConnection(nullptr),
821  myClickedShape(nullptr),
822  myClickedAdditional(nullptr),
823  myClickedDemandElement(nullptr) {
824  // Create three list
826  hide();
827 }
828 
829 
831 
832 
833 void
835  myAC = AC;
836  // show AttributeCarrierHierarchy and refresh AttributeCarrierHierarchy
837  if (myAC) {
838  show();
840  }
841 }
842 
843 
844 void
846  // set all pointers null
847  myAC = nullptr;
848  myClickedAC = nullptr;
849  myClickedJunction = nullptr;
850  myClickedEdge = nullptr;
851  myClickedLane = nullptr;
852  myClickedCrossing = nullptr;
853  myClickedConnection = nullptr;
854  myClickedShape = nullptr;
855  myClickedAdditional = nullptr;
856  myClickedDemandElement = nullptr;
857  // hide modul
858  hide();
859 }
860 
861 
862 void
864  // clear items
865  myTreelist->clearItems();
866  myTreeItemToACMap.clear();
867  myTreeItemsConnections.clear();
868  // show ACChildren of myAC
869  if (myAC) {
871  }
872 }
873 
874 
875 long
876 GNEFrameModuls::AttributeCarrierHierarchy::onCmdShowChildMenu(FXObject*, FXSelector, void* eventData) {
877  // Obtain event
878  FXEvent* e = (FXEvent*)eventData;
879  // obtain FXTreeItem in the given position
880  FXTreeItem* item = myTreelist->getItemAt(e->win_x, e->win_y);
881  // open Pop-up if FXTreeItem has a Attribute Carrier vinculated
882  if (item && (myTreeItemsConnections.find(item) == myTreeItemsConnections.end())) {
883  createPopUpMenu(e->root_x, e->root_y, myTreeItemToACMap[item]);
884  }
885  return 1;
886 }
887 
888 
889 long
891  // Center item
892  if (myClickedJunction) {
894  } else if (myClickedEdge) {
896  } else if (myClickedLane) {
898  } else if (myClickedCrossing) {
900  } else if (myClickedConnection) {
902  } else if (myClickedAdditional) {
904  } else if (myClickedShape) {
906  } else if (myClickedDemandElement) {
908  }
909  // update view after centering
911  return 1;
912 }
913 
914 
915 long
917  if ((myAC != nullptr) && (myClickedAC != nullptr)) {
919  }
920  return 1;
921 }
922 
923 
924 long
926  // check if Inspector frame was opened before removing
927  const std::vector<GNEAttributeCarrier*>& currentInspectedACs = myFrameParent->myViewNet->getViewParent()->getInspectorFrame()->getAttributesEditor()->getEditedACs();
928  // Remove Attribute Carrier
929  if (myClickedJunction) {
931  } else if (myClickedEdge) {
933  } else if (myClickedLane) {
935  } else if (myClickedCrossing) {
937  } else if (myClickedConnection) {
939  } else if (myClickedAdditional) {
941  } else if (myClickedShape) {
943  } else if (myClickedDemandElement) {
944  // check that default VTypes aren't removed
946  WRITE_WARNING("Default Vehicle Type '" + myClickedDemandElement->getAttribute(SUMO_ATTR_ID) + "' cannot be removed");
947  return 1;
948  } else {
950  }
951  }
952  // update viewNet
954  // refresh AC Hierarchy
956  // check if inspector frame has to be shown again
957  if (currentInspectedACs.size() == 1) {
958  if (currentInspectedACs.front() != myClickedAC) {
959  myFrameParent->myViewNet->getViewParent()->getInspectorFrame()->inspectSingleElement(currentInspectedACs.front());
960  } else {
961  // inspect a nullprt element to reset inspector frame
963  }
964  }
965  return 1;
966 }
967 
968 
969 long
971  // currently only children of demand elements can be moved
974  // move element one position back
976  GNEChange_Children::Operation::MOVE_BACK), true);
978  }
979  // refresh after moving child
981  return 1;
982 }
983 
984 
985 long
987  // currently only children of demand elements can be moved
989  myFrameParent->myViewNet->getUndoList()->p_begin(("moving down " + myClickedDemandElement->getTagStr()).c_str());
990  // move element one position front
992  GNEChange_Children::Operation::MOVE_FRONT), true);
994  }
995  // refresh after moving child
997  return 1;
998 }
999 
1000 
1001 void
1003  // first check that AC exist
1004  if (clickedAC) {
1005  // set current clicked AC
1006  myClickedAC = clickedAC;
1007  // cast all elements
1008  myClickedJunction = dynamic_cast<GNEJunction*>(clickedAC);
1009  myClickedEdge = dynamic_cast<GNEEdge*>(clickedAC);
1010  myClickedLane = dynamic_cast<GNELane*>(clickedAC);
1011  myClickedCrossing = dynamic_cast<GNECrossing*>(clickedAC);
1012  myClickedConnection = dynamic_cast<GNEConnection*>(clickedAC);
1013  myClickedShape = dynamic_cast<GNEShape*>(clickedAC);
1014  myClickedAdditional = dynamic_cast<GNEAdditional*>(clickedAC);
1015  myClickedDemandElement = dynamic_cast<GNEDemandElement*>(clickedAC);
1016  // create FXMenuPane
1017  FXMenuPane* pane = new FXMenuPane(myTreelist);
1018  // set item name and icon
1020  // insert separator
1021  new FXMenuSeparator(pane);
1022  // create center menu command
1023  FXMenuCommand* centerMenuCommand = new FXMenuCommand(pane, "Center", GUIIconSubSys::getIcon(ICON_RECENTERVIEW), this, MID_GNE_CENTER);
1024  // disable Centering for Vehicle Types
1026  centerMenuCommand->disable();
1027  }
1028  // create inspect and delete menu commands
1029  FXMenuCommand* inspectMenuCommand = new FXMenuCommand(pane, "Inspect", GUIIconSubSys::getIcon(ICON_MODEINSPECT), this, MID_GNE_INSPECT);
1030  FXMenuCommand* deleteMenuCommand = new FXMenuCommand(pane, "Delete", GUIIconSubSys::getIcon(ICON_MODEDELETE), this, MID_GNE_DELETE);
1031  // check if inspect and delete menu commands has to be disabled
1034  inspectMenuCommand->disable();
1035  deleteMenuCommand->disable();
1036  }
1037  // now chec if given AC support manually moving of their item up and down (Currently only for demand elements
1039  // insert separator
1040  new FXMenuSeparator(pane);
1041  // create both moving menu commands
1042  FXMenuCommand* moveUpMenuCommand = new FXMenuCommand(pane, "Move up", GUIIconSubSys::getIcon(ICON_ARROW_UP), this, MID_GNE_ACHIERARCHY_MOVEUP);
1043  FXMenuCommand* moveDownMenuCommand = new FXMenuCommand(pane, "Move down", GUIIconSubSys::getIcon(ICON_ARROW_DOWN), this, MID_GNE_ACHIERARCHY_MOVEDOWN);
1044  // check if both commands has to be disabled
1046  moveUpMenuCommand->setText("Move up (Stops cannot be moved)");
1047  moveDownMenuCommand->setText("Move diwb (Stops cannot be moved)");
1048  moveUpMenuCommand->disable();
1049  moveDownMenuCommand->disable();
1050  } else {
1051  // check if moveUpMenuCommand has to be disabled
1052  if (myClickedDemandElement->getDemandElementParents().front()->getDemandElementChildren().front() == myClickedDemandElement) {
1053  moveUpMenuCommand->setText("Move up (It's already the first element)");
1054  moveUpMenuCommand->disable();
1055  } else if (myClickedDemandElement->getDemandElementParents().front()->getPreviousemandElement(myClickedDemandElement)->getTagProperty().isPersonStop()) {
1056  moveUpMenuCommand->setText("Move up (Previous element is a Stop)");
1057  moveUpMenuCommand->disable();
1058  }
1059  // check if moveDownMenuCommand has to be disabled
1060  if (myClickedDemandElement->getDemandElementParents().front()->getDemandElementChildren().back() == myClickedDemandElement) {
1061  moveDownMenuCommand->setText("Move down (It's already the last element)");
1062  moveDownMenuCommand->disable();
1063  } else if (myClickedDemandElement->getDemandElementParents().front()->getNextDemandElement(myClickedDemandElement)->getTagProperty().isPersonStop()) {
1064  moveDownMenuCommand->setText("Move down (Next element is a Stop)");
1065  moveDownMenuCommand->disable();
1066  }
1067  }
1068  }
1069  // Center in the mouse position and create pane
1070  pane->setX(X);
1071  pane->setY(Y);
1072  pane->create();
1073  pane->show();
1074  } else {
1075  // set all clicked elements to null
1076  myClickedAC = nullptr;
1077  myClickedJunction = nullptr;
1078  myClickedEdge = nullptr;
1079  myClickedLane = nullptr;
1080  myClickedCrossing = nullptr;
1081  myClickedConnection = nullptr;
1082  myClickedShape = nullptr;
1083  myClickedAdditional = nullptr;
1084  myClickedDemandElement = nullptr;
1085  }
1086 }
1087 
1088 
1089 FXTreeItem*
1091  if (myAC->getTagProperty().isNetElement()) {
1092  // check demand element type
1093  switch (myAC->getTagProperty().getTag()) {
1094  case SUMO_TAG_EDGE: {
1095  // obtain Edge
1096  GNEEdge* edge = myFrameParent->myViewNet->getNet()->retrieveEdge(myAC->getID(), false);
1097  if (edge) {
1098  // insert Junctions of edge in tree (Pararell because a edge has always two Junctions)
1099  FXTreeItem* junctionSourceItem = myTreelist->insertItem(nullptr, nullptr, (edge->getGNEJunctionSource()->getHierarchyName() + " origin").c_str(), edge->getGNEJunctionSource()->getIcon(), edge->getGNEJunctionSource()->getIcon());
1100  FXTreeItem* junctionDestinyItem = myTreelist->insertItem(nullptr, nullptr, (edge->getGNEJunctionSource()->getHierarchyName() + " destiny").c_str(), edge->getGNEJunctionSource()->getIcon(), edge->getGNEJunctionSource()->getIcon());
1101  junctionDestinyItem->setExpanded(true);
1102  // Save items in myTreeItemToACMap
1103  myTreeItemToACMap[junctionSourceItem] = edge->getGNEJunctionSource();
1104  myTreeItemToACMap[junctionDestinyItem] = edge->getGNEJunctionDestiny();
1105  // return junction destiny Item
1106  return junctionDestinyItem;
1107  } else {
1108  return nullptr;
1109  }
1110  }
1111  case SUMO_TAG_LANE: {
1112  // obtain lane
1113  GNELane* lane = myFrameParent->myViewNet->getNet()->retrieveLane(myAC->getID(), false);
1114  if (lane) {
1115  // obtain edge parent
1117  //inser Junctions of lane of edge in tree (Pararell because a edge has always two Junctions)
1118  FXTreeItem* junctionSourceItem = myTreelist->insertItem(nullptr, nullptr, (edge->getGNEJunctionSource()->getHierarchyName() + " origin").c_str(), edge->getGNEJunctionSource()->getIcon(), edge->getGNEJunctionSource()->getIcon());
1119  FXTreeItem* junctionDestinyItem = myTreelist->insertItem(nullptr, nullptr, (edge->getGNEJunctionSource()->getHierarchyName() + " destiny").c_str(), edge->getGNEJunctionSource()->getIcon(), edge->getGNEJunctionSource()->getIcon());
1120  junctionDestinyItem->setExpanded(true);
1121  // Create edge item
1122  FXTreeItem* edgeItem = myTreelist->insertItem(nullptr, junctionDestinyItem, edge->getHierarchyName().c_str(), edge->getIcon(), edge->getIcon());
1123  edgeItem->setExpanded(true);
1124  // Save items in myTreeItemToACMap
1125  myTreeItemToACMap[junctionSourceItem] = edge->getGNEJunctionSource();
1126  myTreeItemToACMap[junctionDestinyItem] = edge->getGNEJunctionDestiny();
1127  myTreeItemToACMap[edgeItem] = edge;
1128  // return edge item
1129  return edgeItem;
1130  } else {
1131  return nullptr;
1132  }
1133  }
1134  case SUMO_TAG_CROSSING: {
1135  // obtain Crossing
1136  GNECrossing* crossing = myFrameParent->myViewNet->getNet()->retrieveCrossing(myAC->getID(), false);
1137  if (crossing) {
1138  // obtain junction
1139  GNEJunction* junction = crossing->getParentJunction();
1140  // create junction item
1141  FXTreeItem* junctionItem = myTreelist->insertItem(nullptr, nullptr, junction->getHierarchyName().c_str(), junction->getIcon(), junction->getIcon());
1142  junctionItem->setExpanded(true);
1143  // Save items in myTreeItemToACMap
1144  myTreeItemToACMap[junctionItem] = junction;
1145  // return junction Item
1146  return junctionItem;
1147  } else {
1148  return nullptr;
1149  }
1150  }
1151  case SUMO_TAG_CONNECTION: {
1152  // obtain Connection
1154  if (connection) {
1155  // create edge from item
1156  FXTreeItem* edgeFromItem = myTreelist->insertItem(nullptr, nullptr, connection->getEdgeFrom()->getHierarchyName().c_str(), connection->getEdgeFrom()->getIcon(), connection->getEdgeFrom()->getIcon());
1157  edgeFromItem->setExpanded(true);
1158  // create edge to item
1159  FXTreeItem* edgeToItem = myTreelist->insertItem(nullptr, nullptr, connection->getEdgeTo()->getHierarchyName().c_str(), connection->getEdgeTo()->getIcon(), connection->getEdgeTo()->getIcon());
1160  edgeToItem->setExpanded(true);
1161  // create connection item
1162  FXTreeItem* connectionItem = myTreelist->insertItem(nullptr, edgeToItem, connection->getHierarchyName().c_str(), connection->getIcon(), connection->getIcon());
1163  connectionItem->setExpanded(true);
1164  // Save items in myTreeItemToACMap
1165  myTreeItemToACMap[edgeFromItem] = connection->getEdgeFrom();
1166  myTreeItemToACMap[edgeToItem] = connection->getEdgeTo();
1167  myTreeItemToACMap[connectionItem] = connection;
1168  // return connection item
1169  return connectionItem;
1170  } else {
1171  return nullptr;
1172  }
1173  }
1174  default:
1175  break;
1176  }
1177  } else if (myAC->getTagProperty().getTag() == SUMO_TAG_POILANE) {
1178  // Obtain POILane
1179  GNEPOI* POILane = myFrameParent->myViewNet->getNet()->retrievePOI(myAC->getID(), false);
1180  if (POILane) {
1181  // obtain lane parent
1182  GNELane* lane = myFrameParent->myViewNet->getNet()->retrieveLane(POILane->getLaneParents().at(0)->getID());
1183  // obtain edge parent
1185  //inser Junctions of lane of edge in tree (Pararell because a edge has always two Junctions)
1186  FXTreeItem* junctionSourceItem = myTreelist->insertItem(nullptr, nullptr, (edge->getGNEJunctionSource()->getHierarchyName() + " origin").c_str(), edge->getGNEJunctionSource()->getIcon(), edge->getGNEJunctionSource()->getIcon());
1187  FXTreeItem* junctionDestinyItem = myTreelist->insertItem(nullptr, nullptr, (edge->getGNEJunctionSource()->getHierarchyName() + " destiny").c_str(), edge->getGNEJunctionSource()->getIcon(), edge->getGNEJunctionSource()->getIcon());
1188  junctionDestinyItem->setExpanded(true);
1189  // Create edge item
1190  FXTreeItem* edgeItem = myTreelist->insertItem(nullptr, junctionDestinyItem, edge->getHierarchyName().c_str(), edge->getIcon(), edge->getIcon());
1191  edgeItem->setExpanded(true);
1192  // Create lane item
1193  FXTreeItem* laneItem = myTreelist->insertItem(nullptr, edgeItem, lane->getHierarchyName().c_str(), lane->getIcon(), lane->getIcon());
1194  laneItem->setExpanded(true);
1195  // Save items in myTreeItemToACMap
1196  myTreeItemToACMap[junctionSourceItem] = edge->getGNEJunctionSource();
1197  myTreeItemToACMap[junctionDestinyItem] = edge->getGNEJunctionDestiny();
1198  myTreeItemToACMap[edgeItem] = edge;
1199  myTreeItemToACMap[laneItem] = lane;
1200  // return Lane item
1201  return laneItem;
1202  } else {
1203  return nullptr;
1204  }
1205  } else if (myAC->getTagProperty().isAdditional() || myAC->getTagProperty().isTAZ()) {
1206  // Obtain Additional
1208  if (additional) {
1209  // declare auxiliar FXTreeItem, due a demand element can have multiple "roots"
1210  FXTreeItem* root = nullptr;
1211  // check if there is demand elements parents
1212  if (additional->getAdditionalParents().size() > 0) {
1213  // check if we have more than one edge
1214  if (additional->getAdditionalParents().size() > 1) {
1215  // insert first item
1216  addListItem(additional->getAdditionalParents().front());
1217  // insert "spacer"
1218  if (additional->getAdditionalParents().size() > 2) {
1219  addListItem(nullptr, ("..." + toString((int)additional->getAdditionalParents().size() - 2) + " additionals...").c_str(), 0, false);
1220  }
1221  }
1222  // return last inserted item
1223  root = addListItem(additional->getAdditionalParents().back());
1224  }
1225  // check if there is demand element parents
1226  if (additional->getDemandElementParents().size() > 0) {
1227  // check if we have more than one demand element
1228  if (additional->getDemandElementParents().size() > 1) {
1229  // insert first item
1230  addListItem(additional->getDemandElementParents().front());
1231  // insert "spacer"
1232  if (additional->getDemandElementParents().size() > 2) {
1233  addListItem(nullptr, ("..." + toString((int)additional->getDemandElementParents().size() - 2) + " demand elements...").c_str(), 0, false);
1234  }
1235  }
1236  // return last inserted item
1237  root = addListItem(additional->getDemandElementParents().back());
1238  }
1239  // check if there is edge parents
1240  if (additional->getEdgeParents().size() > 0) {
1241  // check if we have more than one edge
1242  if (additional->getEdgeParents().size() > 1) {
1243  // insert first item
1244  addListItem(additional->getEdgeParents().front());
1245  // insert "spacer"
1246  if (additional->getEdgeParents().size() > 2) {
1247  addListItem(nullptr, ("..." + toString((int)additional->getEdgeParents().size() - 2) + " edges...").c_str(), 0, false);
1248  }
1249  }
1250  // return last inserted item
1251  root = addListItem(additional->getEdgeParents().back());
1252  }
1253  // check if there is lane parents
1254  if (additional->getLaneParents().size() > 0) {
1255  // check if we have more than one lane parent
1256  if (additional->getLaneParents().size() > 1) {
1257  // insert first item
1258  addListItem(additional->getLaneParents().front());
1259  // insert "spacer"
1260  if (additional->getLaneParents().size() > 2) {
1261  addListItem(nullptr, ("..." + toString((int)additional->getLaneParents().size() - 2) + " lanes...").c_str(), 0, false);
1262  }
1263  }
1264  // return last inserted item
1265  root = addListItem(additional->getLaneParents().back());
1266  }
1267  // return last inserted list item
1268  return root;
1269  }
1270  } else if (myAC->getTagProperty().isDemandElement()) {
1271  // Obtain DemandElement
1273  if (demandElement) {
1274  // declare auxiliar FXTreeItem, due a demand element can have multiple "roots"
1275  FXTreeItem* root = nullptr;
1276  // check if there is demand elements parents
1277  if (demandElement->getAdditionalParents().size() > 0) {
1278  // check if we have more than one edge
1279  if (demandElement->getAdditionalParents().size() > 1) {
1280  // insert first item
1281  addListItem(demandElement->getAdditionalParents().front());
1282  // insert "spacer"
1283  if (demandElement->getAdditionalParents().size() > 2) {
1284  addListItem(nullptr, ("..." + toString((int)demandElement->getAdditionalParents().size() - 2) + " additionals...").c_str(), 0, false);
1285  }
1286  }
1287  // return last inserted item
1288  root = addListItem(demandElement->getAdditionalParents().back());
1289  }
1290  // check if there is demand element parents
1291  if (demandElement->getDemandElementParents().size() > 0) {
1292  // check if we have more than one demand element
1293  if (demandElement->getDemandElementParents().size() > 1) {
1294  // insert first item
1295  addListItem(demandElement->getDemandElementParents().front());
1296  // insert "spacer"
1297  if (demandElement->getDemandElementParents().size() > 2) {
1298  addListItem(nullptr, ("..." + toString((int)demandElement->getDemandElementParents().size() - 2) + " demand elements...").c_str(), 0, false);
1299  }
1300  }
1301  // return last inserted item
1302  root = addListItem(demandElement->getDemandElementParents().back());
1303  }
1304  // check if there is edge parents
1305  if (demandElement->getEdgeParents().size() > 0) {
1306  // check if we have more than one edge
1307  if (demandElement->getEdgeParents().size() > 1) {
1308  // insert first item
1309  addListItem(demandElement->getEdgeParents().front());
1310  // insert "spacer"
1311  if (demandElement->getEdgeParents().size() > 2) {
1312  addListItem(nullptr, ("..." + toString((int)demandElement->getEdgeParents().size() - 2) + " edges...").c_str(), 0, false);
1313  }
1314  }
1315  // return last inserted item
1316  root = addListItem(demandElement->getEdgeParents().back());
1317  }
1318  // check if there is lane parents
1319  if (demandElement->getLaneParents().size() > 0) {
1320  // check if we have more than one lane parent
1321  if (demandElement->getLaneParents().size() > 1) {
1322  // insert first item
1323  addListItem(demandElement->getLaneParents().front());
1324  // insert "spacer"
1325  if (demandElement->getLaneParents().size() > 2) {
1326  addListItem(nullptr, ("..." + toString((int)demandElement->getLaneParents().size() - 2) + " lanes...").c_str(), 0, false);
1327  }
1328  }
1329  // return last inserted item
1330  root = addListItem(demandElement->getLaneParents().back());
1331  }
1332  // return last inserted list item
1333  return root;
1334  }
1335  }
1336  // there aren't parents
1337  return nullptr;
1338 }
1339 
1340 
1341 void
1343  if (AC->getTagProperty().isNetElement()) {
1344  // Switch gl type of ac
1345  switch (AC->getTagProperty().getTag()) {
1346  case SUMO_TAG_JUNCTION: {
1347  // retrieve junction
1348  GNEJunction* junction = myFrameParent->myViewNet->getNet()->retrieveJunction(AC->getID(), false);
1349  if (junction) {
1350  // insert junction item
1351  FXTreeItem* junctionItem = addListItem(AC, itemParent);
1352  // insert edges
1353  for (auto i : junction->getGNEEdges()) {
1354  showAttributeCarrierChildren(i, junctionItem);
1355  }
1356  // insert crossings
1357  for (auto i : junction->getGNECrossings()) {
1358  showAttributeCarrierChildren(i, junctionItem);
1359  }
1360  }
1361  break;
1362  }
1363  case SUMO_TAG_EDGE: {
1364  // retrieve edge
1365  GNEEdge* edge = myFrameParent->myViewNet->getNet()->retrieveEdge(AC->getID(), false);
1366  if (edge) {
1367  // insert edge item
1368  FXTreeItem* edgeItem = addListItem(AC, itemParent);
1369  // insert lanes
1370  for (const auto& i : edge->getLanes()) {
1371  showAttributeCarrierChildren(i, edgeItem);
1372  }
1373  // insert shape children
1374  for (const auto& i : edge->getShapeChildren()) {
1375  showAttributeCarrierChildren(i, edgeItem);
1376  }
1377  // insert additional children
1378  for (const auto& i : edge->getAdditionalChildren()) {
1379  showAttributeCarrierChildren(i, edgeItem);
1380  }
1381  // insert demand elements children (note: use getSortedDemandElementChildrenByType to avoid duplicated elements)
1382  for (const auto& i : edge->getSortedDemandElementChildrenByType(SUMO_TAG_ROUTE)) {
1383  showAttributeCarrierChildren(i, edgeItem);
1384  }
1385  for (const auto& i : edge->getSortedDemandElementChildrenByType(SUMO_TAG_TRIP)) {
1386  showAttributeCarrierChildren(i, edgeItem);
1387  }
1388  for (const auto& i : edge->getSortedDemandElementChildrenByType(SUMO_TAG_FLOW)) {
1389  showAttributeCarrierChildren(i, edgeItem);
1390  }
1391  }
1392  break;
1393  }
1394  case SUMO_TAG_LANE: {
1395  // retrieve lane
1396  GNELane* lane = myFrameParent->myViewNet->getNet()->retrieveLane(AC->getID(), false);
1397  if (lane) {
1398  // insert lane item
1399  FXTreeItem* laneItem = addListItem(AC, itemParent);
1400  // insert shape children
1401  for (const auto& i : lane->getShapeChildren()) {
1402  showAttributeCarrierChildren(i, laneItem);
1403  }
1404  // insert additional children
1405  for (const auto& i : lane->getAdditionalChildren()) {
1406  showAttributeCarrierChildren(i, laneItem);
1407  }
1408  // insert demand elements children
1409  for (const auto& i : lane->getDemandElementChildren()) {
1410  showAttributeCarrierChildren(i, laneItem);
1411  }
1412  // insert incoming connections of lanes (by default isn't expanded)
1413  if (lane->getGNEIncomingConnections().size() > 0) {
1414  std::vector<GNEConnection*> incomingLaneConnections = lane->getGNEIncomingConnections();
1415  // insert intermediate list item
1416  FXTreeItem* incomingConnections = addListItem(laneItem, "Incomings", incomingLaneConnections.front()->getIcon(), false);
1417  // insert incoming connections
1418  for (auto i : incomingLaneConnections) {
1419  showAttributeCarrierChildren(i, incomingConnections);
1420  }
1421  }
1422  // insert outcoming connections of lanes (by default isn't expanded)
1423  if (lane->getGNEOutcomingConnections().size() > 0) {
1424  std::vector<GNEConnection*> outcomingLaneConnections = lane->getGNEOutcomingConnections();
1425  // insert intermediate list item
1426  FXTreeItem* outgoingConnections = addListItem(laneItem, "Outgoing", outcomingLaneConnections.front()->getIcon(), false);
1427  // insert outcoming connections
1428  for (auto i : outcomingLaneConnections) {
1429  showAttributeCarrierChildren(i, outgoingConnections);
1430  }
1431  }
1432  }
1433  break;
1434  }
1435  case SUMO_TAG_CROSSING:
1436  case SUMO_TAG_CONNECTION: {
1437  // insert connection item
1438  addListItem(AC, itemParent);
1439  break;
1440  }
1441  default:
1442  break;
1443  }
1444  } else if (AC->getTagProperty().isShape()) {
1445  // insert shape item
1446  addListItem(AC, itemParent);
1447  } else if (AC->getTagProperty().isAdditional() || AC->getTagProperty().isTAZ()) {
1448  // retrieve additional
1449  GNEAdditional* additional = myFrameParent->myViewNet->getNet()->retrieveAdditional(AC->getTagProperty().getTag(), AC->getID(), false);
1450  if (additional) {
1451  // insert additional item
1452  FXTreeItem* additionalItem = addListItem(AC, itemParent);
1453  // insert edge children
1454  for (const auto& i : additional->getEdgeChildren()) {
1455  showAttributeCarrierChildren(i, additionalItem);
1456  }
1457  // insert lane children
1458  for (const auto& i : additional->getLaneChildren()) {
1459  showAttributeCarrierChildren(i, additionalItem);
1460  }
1461  // insert shape children
1462  for (const auto& i : additional->getShapeChildren()) {
1463  showAttributeCarrierChildren(i, additionalItem);
1464  }
1465  // insert additionals children
1466  for (const auto& i : additional->getAdditionalChildren()) {
1467  showAttributeCarrierChildren(i, additionalItem);
1468  }
1469  // insert demand element children
1470  for (const auto& i : additional->getDemandElementChildren()) {
1471  showAttributeCarrierChildren(i, additionalItem);
1472  }
1473  }
1474  } else if (AC->getTagProperty().isDemandElement()) {
1475  // retrieve demandElement
1476  GNEDemandElement* demandElement = myFrameParent->myViewNet->getNet()->retrieveDemandElement(AC->getTagProperty().getTag(), AC->getID(), false);
1477  if (demandElement) {
1478  // insert demandElement item
1479  FXTreeItem* demandElementItem = addListItem(AC, itemParent);
1480  // insert edge children
1481  for (const auto& i : demandElement->getEdgeChildren()) {
1482  showAttributeCarrierChildren(i, demandElementItem);
1483  }
1484  // insert lane children
1485  for (const auto& i : demandElement->getLaneChildren()) {
1486  showAttributeCarrierChildren(i, demandElementItem);
1487  }
1488  // insert shape children
1489  for (const auto& i : demandElement->getShapeChildren()) {
1490  showAttributeCarrierChildren(i, demandElementItem);
1491  }
1492  // insert additionals children
1493  for (const auto& i : demandElement->getAdditionalChildren()) {
1494  showAttributeCarrierChildren(i, demandElementItem);
1495  }
1496  // insert demand element children
1497  for (const auto& i : demandElement->getDemandElementChildren()) {
1498  showAttributeCarrierChildren(i, demandElementItem);
1499  }
1500  }
1501  }
1502 }
1503 
1504 
1505 FXTreeItem*
1506 GNEFrameModuls::AttributeCarrierHierarchy::addListItem(GNEAttributeCarrier* AC, FXTreeItem* itemParent, std::string prefix, std::string sufix) {
1507  // insert item in Tree list
1508  FXTreeItem* item = myTreelist->insertItem(nullptr, itemParent, (prefix + AC->getHierarchyName() + sufix).c_str(), AC->getIcon(), AC->getIcon());
1509  // insert item in map
1510  myTreeItemToACMap[item] = AC;
1511  // by default item is expanded
1512  item->setExpanded(true);
1513  // return created FXTreeItem
1514  return item;
1515 }
1516 
1517 
1518 FXTreeItem*
1519 GNEFrameModuls::AttributeCarrierHierarchy::addListItem(FXTreeItem* itemParent, const std::string& text, FXIcon* icon, bool expanded) {
1520  // insert item in Tree list
1521  FXTreeItem* item = myTreelist->insertItem(nullptr, itemParent, text.c_str(), icon, icon);
1522  // expand item depending of flag expanded
1523  item->setExpanded(expanded);
1524  // return created FXTreeItem
1525  return item;
1526 }
1527 
1528 // ---------------------------------------------------------------------------
1529 // GNEFrameModuls::DrawingShape - methods
1530 // ---------------------------------------------------------------------------
1531 
1533  FXGroupBox(frameParent->myContentFrame, "Drawing", GUIDesignGroupBoxFrame),
1534  myFrameParent(frameParent),
1535  myDeleteLastCreatedPoint(false) {
1536  // create start and stop buttons
1537  myStartDrawingButton = new FXButton(this, "Start drawing", 0, this, MID_GNE_STARTDRAWING, GUIDesignButton);
1538  myStopDrawingButton = new FXButton(this, "Stop drawing", 0, this, MID_GNE_STOPDRAWING, GUIDesignButton);
1539  myAbortDrawingButton = new FXButton(this, "Abort drawing", 0, this, MID_GNE_ABORTDRAWING, GUIDesignButton);
1540 
1541  // create information label
1542  std::ostringstream information;
1543  information
1544  << "- 'Start drawing' or ENTER\n"
1545  << " draws shape boundary.\n"
1546  << "- 'Stop drawing' or ENTER\n"
1547  << " creates shape.\n"
1548  << "- 'Shift + Click'\n"
1549  << " removes last created point.\n"
1550  << "- 'Abort drawing' or ESC\n"
1551  << " removes drawed shape.";
1552  myInformationLabel = new FXLabel(this, information.str().c_str(), 0, GUIDesignLabelFrameInformation);
1553  // disable stop and abort functions as init
1554  myStopDrawingButton->disable();
1555  myAbortDrawingButton->disable();
1556 }
1557 
1558 
1560 
1561 
1563  // abort current drawing before show
1564  abortDrawing();
1565  // show FXGroupBox
1566  FXGroupBox::show();
1567 }
1568 
1569 
1571  // abort current drawing before hide
1572  abortDrawing();
1573  // show FXGroupBox
1574  FXGroupBox::hide();
1575 }
1576 
1577 
1578 void
1580  // Only start drawing if DrawingShape modul is shown
1581  if (shown()) {
1582  // change buttons
1583  myStartDrawingButton->disable();
1584  myStopDrawingButton->enable();
1585  myAbortDrawingButton->enable();
1586  }
1587 }
1588 
1589 
1590 void
1592  // try to build shape
1593  if (myFrameParent->shapeDrawed()) {
1594  // clear created points
1595  myTemporalShapeShape.clear();
1597  // change buttons
1598  myStartDrawingButton->enable();
1599  myStopDrawingButton->disable();
1600  myAbortDrawingButton->disable();
1601  } else {
1602  // abort drawing if shape cannot be created
1603  abortDrawing();
1604  }
1605 }
1606 
1607 
1608 void
1610  // clear created points
1611  myTemporalShapeShape.clear();
1613  // change buttons
1614  myStartDrawingButton->enable();
1615  myStopDrawingButton->disable();
1616  myAbortDrawingButton->disable();
1617 }
1618 
1619 
1620 void
1622  if (myStopDrawingButton->isEnabled()) {
1623  myTemporalShapeShape.push_back(P);
1624  } else {
1625  throw ProcessError("A new point cannot be added if drawing wasn't started");
1626  }
1627 }
1628 
1629 
1630 void
1632 
1633 }
1634 
1635 
1636 const PositionVector&
1638  return myTemporalShapeShape;
1639 }
1640 
1641 
1642 bool
1644  return myStopDrawingButton->isEnabled();
1645 }
1646 
1647 
1648 void
1650  myDeleteLastCreatedPoint = value;
1651 }
1652 
1653 
1654 bool
1656  return myDeleteLastCreatedPoint;
1657 }
1658 
1659 
1660 long
1662  startDrawing();
1663  return 0;
1664 }
1665 
1666 
1667 long
1668 GNEFrameModuls::DrawingShape::onCmdStopDrawing(FXObject*, FXSelector, void*) {
1669  stopDrawing();
1670  return 0;
1671 }
1672 
1673 
1674 long
1676  abortDrawing();
1677  return 0;
1678 }
1679 
1680 // ---------------------------------------------------------------------------
1681 // GNEFrameModuls::SelectorParent - methods
1682 // ---------------------------------------------------------------------------
1683 
1685  FXGroupBox(frameParent->myContentFrame, "Parent selector", GUIDesignGroupBoxFrame),
1686  myFrameParent(frameParent),
1687  myParentTag(SUMO_TAG_NOTHING) {
1688  // Create label with the type of SelectorParent
1689  myParentsLabel = new FXLabel(this, "No additional selected", nullptr, GUIDesignLabelLeftThick);
1690  // Create list
1692  // Hide List
1694 }
1695 
1696 
1698 
1699 
1700 std::string
1702  for (int i = 0; i < myParentsList->getNumItems(); i++) {
1703  if (myParentsList->isItemSelected(i)) {
1704  return myParentsList->getItem(i)->getText().text();
1705  }
1706  }
1707  return "";
1708 }
1709 
1710 
1711 void
1713  // first unselect all
1714  for (int i = 0; i < myParentsList->getNumItems(); i++) {
1715  myParentsList->getItem(i)->setSelected(false);
1716  }
1717  // select element if correspond to given ID
1718  for (int i = 0; i < myParentsList->getNumItems(); i++) {
1719  if (myParentsList->getItem(i)->getText().text() == id) {
1720  myParentsList->getItem(i)->setSelected(true);
1721  }
1722  }
1723  // recalc myFirstParentsList
1724  myParentsList->recalc();
1725 }
1726 
1727 
1728 bool
1730  // make sure that we're editing an additional tag
1731  auto listOfTags = GNEAttributeCarrier::allowedTagsByCategory(GNEAttributeCarrier::TagType::TAGTYPE_ADDITIONAL, false);
1732  for (auto i : listOfTags) {
1733  if (i == additionalType) {
1734  myParentTag = additionalType;
1735  myParentsLabel->setText(("Parent type: " + toString(additionalType)).c_str());
1737  show();
1738  return true;
1739  }
1740  }
1741  return false;
1742 }
1743 
1744 
1745 void
1748  hide();
1749 }
1750 
1751 
1752 void
1754  myParentsList->clearItems();
1755  if (myParentTag != SUMO_TAG_NOTHING) {
1756  // fill list with IDs of additionals
1757  for (const auto& i : myFrameParent->getViewNet()->getNet()->getAttributeCarriers().additionals.at(myParentTag)) {
1758  myParentsList->appendItem(i.first.c_str());
1759  }
1760  }
1761 }
1762 
1763 /****************************************************************************/
int myEdgePathCreatorModes
current edge path creator modes
const AttributeCarriers & getAttributeCarriers() const
retrieve all attribute carriers of Net
Definition: GNENet.cpp:1014
long onCmdRemoveLastInsertedElement(FXObject *, FXSelector, void *)
Called when the user click over button "Remove las inserted edge/busStop".
virtual void tagSelected()
Tag selected in TagSelector.
Definition: GNEFrame.cpp:160
bool isPersonStop() const
return true if tag correspond to a person stop element
FXButton * myStopDrawingButton
button for stop drawing
static const TagProperties & getTagProperties(SumoXMLTag tag)
get Tag Properties
void removeLastInsertedElement()
remove last added element (either a BusStop or an edge)
std::vector< GNEEdge * > calculateDijkstraRoute(SUMOVehicleClass vClass, const std::vector< GNEEdge *> &partialEdges) const
calculate Dijkstra route between a list of partial edges
SumoXMLTag
Numbers representing SUMO-XML - element names.
GNEInspectorFrame * getInspectorFrame() const
get frame for GNE_NMODE_INSPECT
#define GUIDesignComboBoxNCol
number of column of every combo box
Definition: GUIDesigns.h:233
GNEFrame * myFrameParent
pointer to frame Parent
GNEEdge * retrieveEdge(const std::string &id, bool failHard=true)
get edge by id
Definition: GNENet.cpp:1020
FXComboBox * myDemandElementsMatchBox
comboBox with the list of elements type
long onCmdAbortRouteCreation(FXObject *, FXSelector, void *)
FXLabel * myInformationLabel
Label with information.
description of a vehicle type
void setDemandElement(GNEDemandElement *demandElement)
set current demand element
stop drawing polygon
Definition: GUIAppEnum.h:667
bool isDemandElementSelectorShown() const
check if demand element selector is shown
void showTagSelector()
show item selector
void createPopUpMenu(int X, int Y, GNEAttributeCarrier *clickedAC)
GNEAttributeCarrier * myClickedAC
pointer to current clicked Attribute Carrier
begin/end of the description of a junction
begin/end of the description of a single lane
void finishEdgePathCreation()
finish edge path creation
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
void update() const
Mark the entire GNEViewNet to be repainted later.
Definition: GNEViewNet.cpp:292
abort edge path creation
Definition: GUIAppEnum.h:649
a flow definitio nusing a from-to edges instead of a route (used by router)
void refreshDemandElementSelector()
refresh demand element selector
void setVClass(SUMOVehicleClass vClass)
set SUMOVehicleClass
In AttributeCarrierHierarchy list, move element to down.
Definition: GUIAppEnum.h:659
center element
Definition: GUIAppEnum.h:629
delete element
Definition: GUIAppEnum.h:623
In AttributeCarrierHierarchy list, move element to up.
Definition: GUIAppEnum.h:657
bool showSelectorParentModul(SumoXMLTag additionalTypeParent)
Show list of SelectorParent Modul.
bool isDrawing() const
return true if currently a shape is drawed
bool isDemandElement() const
return true if tag correspond to a demand element
long onCmdShowChildMenu(FXObject *, FXSelector, void *data)
bool getDeleteLastCreatedPoint()
get flag delete last created point
void deleteDemandElement(GNEDemandElement *demandElement, GNEUndoList *undoList)
remove demand element
Definition: GNENet.cpp:638
std::map< SumoXMLTag, std::map< std::string, GNEAdditional * > > additionals
map with the name and pointer to additional elements of net
Definition: GNENet.h:102
Definition: GNEPOI.h:45
connectio between two lanes
const std::vector< GNEEdge * > & getEdgeChildren() const
get edge chidls
GNEViewParent * getViewParent() const
get the net object
Definition: GNEViewNet.cpp:921
GNEConnection * retrieveConnection(const std::string &id, bool failHard=true) const
get Connection by id
Definition: GNENet.cpp:1079
struct with the attribute Properties
GNEDemandElement * myClickedDemandElement
demand element (casted from myClickedAC)
void showEdgePathCreator()
show EdgePathCreator
void showDrawingShape()
show Drawing mode
std::vector< GNEEdge * > myClickedEdges
current clicked edges
GNEPOI * retrievePOI(const std::string &id, bool failHard=true) const
get POI by id
Definition: GNENet.cpp:1066
void inspectSingleElement(GNEAttributeCarrier *AC)
Inspect a single element.
GNELane * myClickedLane
lane (casted from myClickedAC)
std::map< FXTreeItem *, GNEAttributeCarrier * > myTreeItemToACMap
map used to save the Tree items with their AC
FXButton * myStartDrawingButton
button for start drawing
const RGBColor & getEdgeCandidateSelectedColor() const
get selected color
Definition: GNEFrame.cpp:270
const std::vector< GNELane * > & getLaneChildren() const
get lanes of VSS
void addNewPoint(const Position &P)
add new point to temporal shape
long onCmdInspectItem(FXObject *, FXSelector, void *)
called when user click over option "inspect" of child menu
void setIDSelected(const std::string &id)
select manually a element of the list
const std::string & getTagStr() const
get Tag vinculated with this attribute Property in String Format (used to avoid multiple calls to toS...
bool myDeleteLastCreatedPoint
flag to enable/disable delete point mode
void deleteShape(GNEShape *shape, GNEUndoList *undoList)
remove shape
Definition: GNENet.cpp:616
static std::vector< SumoXMLTag > allowedTagsByCategory(int tagPropertyCategory, bool onlyDrawables)
get tags of all editable element types using TagProperty Type (TAGTYPE_NETELEMENT, TAGTYPE_ADDITIONAL, etc.)
static const RGBColor ORANGE
Definition: RGBColor.h:196
FXIcon * getIcon() const
get FXIcon associated to this AC
void deleteConnection(GNEConnection *connection, GNEUndoList *undoList)
remove connection
Definition: GNENet.cpp:584
void removeLastPoint()
remove last added point
void showDemandElementSelector()
show demand element selector
This lane is powered by an underlying GNEEdge and basically knows how to draw itself.
Definition: GNELane.h:46
void p_begin(const std::string &description)
Begin undo command sub-group. This begins a new group of commands that are treated as a single comman...
Definition: GNEUndoList.cpp:73
const std::vector< NBEdge::Lane > & getLanes() const
Returns the lane definitions.
Definition: NBEdge.h:644
GNEFrame * myFrameParent
pointer to Frame Parent
const std::string DEFAULT_BIKETYPE_ID
bool addBusStop(GNEAdditional *busStop)
add busStop to route
remove last inserted element in path
Definition: GUIAppEnum.h:653
PositionVector myTemporalShapeShape
current drawed shape
bool isNetElement() const
return true if tag correspond to a netElement
bool addEdge(GNEEdge *edge)
add edge to route
#define GUIDesignTreeListFrame
Tree list used in frames to represent elements children.
Definition: GUIDesigns.h:523
In AttributeCarrierHierarchy list, show child menu.
Definition: GUIAppEnum.h:655
std::vector< std::pair< std::string, GNEAttributeCarrier::TagType > > myListOfTagTypes
list of tags types that will be shown in Match Box
const std::string DEFAULT_VTYPE_ID
const std::vector< GNEEdge * > & getGNEEdges() const
Returns all GNEEdges vinculated with this Junction.
long onCmdCenterItem(FXObject *, FXSelector, void *)
called when user click over option "center" of child Menu
GNEShape * myClickedShape
shape (casted from myClickedAC)
SumoXMLTag myParentTag
current additional parent tag
const AdditionalGeometry & getAdditionalGeometry() const
obtain AdditionalGeometry
const std::vector< GNEAdditional * > & getAdditionalChildren() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
long onCmdMoveItemDown(FXObject *, FXSelector, void *)
called when user click over option "Move down" of child menu
GNEViewNet * getViewNet() const
get view net
Definition: GNEFrame.cpp:133
long onCmdDeleteItem(FXObject *, FXSelector, void *)
called when user click over option "delete" of child menu
static RouteCalculator * getRouteCalculatorInstance()
obtain instance of RouteCalculator
begin/end of the description of a route
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:239
void enableUndoRedo()
disable undo-redo
Position getLineCenter() const
get line center
GNEEdge * getEdgeTo() const
get the name of the edge the vehicles may reach when leaving "from"
const std::vector< GNEEdge * > & getEdgeParents() const
get edge parents
const std::vector< GNEDemandElement * > & getDemandElementChildren() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
const std::vector< GNEShape * > & getShapeChildren() const
get shapes of VSS
void disableUndoRedo(const std::string &reason)
disable undo-redo giving a string with the reason
#define GUIDesignComboBox
Definition: GUIDesigns.h:221
GNEViewNet * myViewNet
View Net.
Definition: GNEFrame.h:120
void refreshAttributeCarrierHierarchy()
refresh AttributeCarrierHierarchy
void hideDrawingShape()
hide Drawing mode
GNEAdditional * retrieveAdditional(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named additional.
Definition: GNENet.cpp:2133
NBEdge * getNBEdge() const
returns the internal NBEdge
Definition: GNEEdge.cpp:625
const std::vector< GNECrossing * > & getGNECrossings() const
Returns GNECrossings.
long onCmdStartDrawing(FXObject *, FXSelector, void *)
GNEUndoList * getUndoList() const
get the undoList object
Definition: GNEViewNet.cpp:933
std::set< FXTreeItem * > myTreeItemsConnections
set used to save tree items without AC assigned, the Incoming/Outcoming connections ...
void hideTagSelector()
hide item selector
virtual std::string getPopUpID() const =0
get PopPup ID (Used in AC Hierarchy)
GNEDemandElement * getCurrentDemandElement() const
get current demand element
FXTreeList * myTreelist
tree list to show the children of the element to erase
start drawing polygon
Definition: GUIAppEnum.h:665
void setEdgePathCreatorModes(int edgePathCreatorModes)
set EdgePathCreatorModes
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
SumoXMLTag getTag() const
get Tag vinculated with this attribute Property
void deleteAdditional(GNEAdditional *additional, GNEUndoList *undoList)
remove additional
Definition: GNENet.cpp:625
static void setColor(const RGBColor &c)
Sets the gl-color to this value.
Definition: GLHelper.cpp:616
This object is responsible for drawing a shape and for supplying a a popup menu. Messages are routete...
Definition: GNECrossing.h:45
GNEEdge & getParentEdge()
Returns underlying parent edge.
Definition: GNELane.cpp:1292
void deleteLane(GNELane *lane, GNEUndoList *undoList, bool recomputeConnections)
removes lane
Definition: GNENet.cpp:546
std::string getHierarchyName() const
get Hierarchy Name (Used in AC Hierarchy)
void setCurrentTagType(GNEAttributeCarrier::TagType tagType)
set current type manually
long onCmdSelectTag(FXObject *, FXSelector, void *)
Called when the user select an elementin ComboBox.
GNEFrame * myFrameParent
pointer to frame parent
GNEDemandElement * retrieveDemandElement(SumoXMLTag type, const std::string &id, bool hardFail=true) const
Returns the named demand element.
Definition: GNENet.cpp:2266
const std::set< GNEDemandElement * > & getSortedDemandElementChildrenByType(SumoXMLTag tag) const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
const std::vector< SumoXMLTag > & getAllowedTags() const
GNEConnection * myClickedConnection
junction (casted from myClickedAC)
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
void p_end()
End undo command sub-group. If the sub-group is still empty, it will be deleted; otherwise, the sub-group will be added as a new command into parent group. A matching begin() must have been called previously.
Definition: GNEUndoList.cpp:80
PositionVector shape
The shape of the additional element.
Definition: GNEAdditional.h:68
GNEJunction * retrieveJunction(const std::string &id, bool failHard=true)
get junction by id
Definition: GNENet.cpp:1001
A list of positions.
Supermode currentSupermode
the current supermode
GNEEdge * getEdgeFrom() const
get the name of the edge the vehicles leave
std::string getIdSelected() const
get currently additional parent selected
void hideEdgePathCreator()
show EdgePathCreator
GNEFrameAttributesModuls::AttributesEditor * getAttributesEditor() const
get AttributesEditor
bool canBeSortedManually() const
return true if Tag correspond to an element that can be sorted within their parent ...
long onCmdAbortDrawing(FXObject *, FXSelector, void *)
Called when the user press abort drawing button.
void edgePathCreatorName(const std::string &name)
update EdgePathCreator name
GNEJunction * myClickedJunction
junction (casted from myClickedAC)
FXTreeItem * showAttributeCarrierParents()
show child of current attributeCarrier
void refreshTagProperties()
due myCurrentTagProperties is a Reference, we need to refresh it when frameParent is show ...
virtual void centerTo(GUIGlID id, bool applyZoom, double zoomDist=20)
centers to the chosen artifact
GNEDemandElement * myCurrentDemandElement
current demand element
void drawTemporalRoute() const
draw temporal route
const std::vector< GNELane * > & getLaneParents() const
get lanes of VSS
std::vector< GNEConnection * > getGNEIncomingConnections()
returns a vector with the incoming GNEConnections of this lane
Definition: GNELane.cpp:1304
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
GNEJunction * getGNEJunctionDestiny() const
returns the destination-junction
Definition: GNEEdge.cpp:505
void showAttributeCarrierChildren(GNEAttributeCarrier *AC, FXTreeItem *itemParent)
show child of current attributeCarrier
void showAttributeCarrierHierarchy(GNEAttributeCarrier *AC)
show AttributeCarrierHierarchy
inspect element
Definition: GUIAppEnum.h:625
const std::vector< GNELane * > & getLanes() const
returns a reference to the lane vector
Definition: GNEEdge.cpp:840
const std::vector< GNEAdditional * > & getAdditionalParents() const
return vector of additionals that have as Parent this edge (For example, Calibrators) ...
finish edge path creation
Definition: GUIAppEnum.h:651
tag selected in ComboBox
Definition: GUIAppEnum.h:639
FXFont * getBoldFont()
GNEFrame * myFrameParent
pointer to GNEFrame Parent
bool isShape() const
return true if tag correspond to a shape
GUIMainWindow * getGUIMainWindow() const
get GUIMainWindow App
std::map< SumoXMLTag, std::map< std::string, GNEDemandElement * > > demandElements
map with the name and pointer to demand elements of net
Definition: GNENet.h:105
FXLabel * myParentsLabel
Label with parent name.
bool isAdditional() const
return true if tag correspond to an additional
void deleteCrossing(GNECrossing *crossing, GNEUndoList *undoList)
remove crossing
Definition: GNENet.cpp:599
const std::string getID() const
function to support debugging
SelectorParent(GNEFrame *frameParent)
constructor
bool isTAZ() const
return true if tag correspond to a TAZ
static void drawLine(const Position &beg, double rot, double visLength)
Draws a thin line.
Definition: GLHelper.cpp:274
tag type selected in ComboBox
Definition: GUIAppEnum.h:637
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:246
virtual bool shapeDrawed()
build a shaped element using the drawed shape (can be reimplemented in frame children) ...
Definition: GNEFrame.cpp:178
std::vector< GNEConnection * > getGNEOutcomingConnections()
returns a vector with the outgoing GNEConnections of this lane
Definition: GNELane.cpp:1325
void setSpecialColor(const RGBColor *color)
set special color
FXComboBox * myTagTypesMatchBox
comboBox with tag type
#define GUIDesignLabelFrameInformation
label extended over frame without thick and with text justify to left, used to show information in fr...
Definition: GUIDesigns.h:210
GNEJunction * getGNEJunctionSource() const
returns the source-junction
Definition: GNEEdge.cpp:499
std::vector< SumoXMLTag > myListOfTags
list of tags that will be shown in Match Box
abort drawing polygon
Definition: GUIAppEnum.h:669
void restoreEdgeColor(const GNEEdge *edge)
restore colors of given edge
SUMOVehicleClass myVClass
VClass used for this trip.
vehicle is a passenger car (a "normal" car)
FXComboBox * myTagsMatchBox
comboBox with the list of tags
const PositionVector & getTemporalShape() const
get Temporal shape
void refreshSelectorParentModul()
Refresh list of Additional Parents Modul.
begin/end of the description of an edge
void startDrawing()
start drawing
DrawingShape()
FOX needs this.
long onCmdSelectDemandElement(FXObject *, FXSelector, void *)
A road/street connecting two junctions (netedit-version)
Definition: GNEEdge.h:50
const std::vector< GNEDemandElement * > & getDemandElementParents() const
return vector of demand elements that have as Parent this edge (For example, Calibrators) ...
FXButton * myRemoveLastInsertedEdge
button for removing last inserted edge
void clearEdges()
clear edges (and restore colors)
GNECrossing * retrieveCrossing(const std::string &id, bool failHard=true) const
get Crossing by id
Definition: GNENet.cpp:1115
#define GUIDesignButton
Definition: GUIDesigns.h:66
void hideAttributeCarrierHierarchy()
hide AttributeCarrierHierarchy
GNEAttributeCarrier::TagProperties myInvalidTagProperty
dummy tag properties used if user select an invalid tag
GNEAdditional * mySelectedBusStop
pointer to selected busStop
void deleteEdge(GNEEdge *edge, GNEUndoList *undoList, bool recomputeConnections)
removes edge
Definition: GNENet.cpp:429
Flag to check if VType is a default VType.
long onCmdMoveItemUp(FXObject *, FXSelector, void *)
called when user click over option "Move up" of child menu
GNEFrame * myFrameParent
pointer to Frame Parent
std::vector< GNEEdge * > myTemporalRoute
vector with temporal route edges
bool isVehicleType() const
return true if tag correspond to a vehicle type element
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
Definition: GNEAdditional.h:47
#define GUIDesignGroupBoxFrame
Group box design extended over frame.
Definition: GUIDesigns.h:255
const std::string DEFAULT_PEDTYPE_ID
const std::string & getTagStr() const
get tag assigned to this object in string format
Demanding mode (Routes, Vehicles etc..)
const GNEAttributeCarrier::TagProperties & getCurrentTagProperties() const
get current type tag
crossing between edges for pedestrians
void deleteJunction(GNEJunction *junction, GNEUndoList *undoList)
removes junction and all incident edges
Definition: GNENet.cpp:384
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:927
GUIGlID getGlID() const
Returns the numerical id of the object.
virtual GUIGlID getGlID() const =0
Returns the numerical id of the object.
GNEEdge * myClickedEdge
edge (casted from myClickedAC)
void setStatusBarText(const std::string &text)
set staturBar text
Definition: GNEViewNet.cpp:482
FXButton * myAbortDrawingButton
button for abort drawing
GNECrossing * myClickedCrossing
crossing (casted from myClickedAC)
virtual std::string getHierarchyName() const =0
get Hierarchy Name (Used in AC Hierarchy)
void inspectChild(GNEAttributeCarrier *AC, GNEAttributeCarrier *previousElement)
inspect child of already inspected element
void abortDrawing()
abort drawing
const TagProperties & getTagProperty() const
get Tag Property assigned to this object
FXDEFMAP(GNEFrameModuls::TagSelector) TagSelectorMap[]
description of a person type (used in NETEDIT)
a single trip definition (used by router)
empty max
long onCmdFinishRouteCreation(FXObject *, FXSelector, void *)
Called when the user click over button "Finish route creation".
used to select a type of element in a combo box
Definition: GUIAppEnum.h:635
void abortEdgePathCreation()
abort edge path creation
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 setCurrentTag(SumoXMLTag newTag)
set current type manually
GNEAdditional * myClickedAdditional
additional (casted from myClickedAC)
FXTreeItem * addListItem(GNEAttributeCarrier *AC, FXTreeItem *itemParent=nullptr, std::string prefix="", std::string sufix="")
add item into list
FXButton * myAbortCreationButton
button for abort route creation
void hideSelectorParentModul()
hide SelectorParent Modul
GNEAttributeCarrier::TagProperties myCurrentTagProperties
current tag properties
virtual void edgePathCreated()
finish edge path creation
Definition: GNEFrame.cpp:172
long onCmdSelectTagType(FXObject *, FXSelector, void *)
GNEAdditional * getClickedBusStop() const
get current clicked edges
#define GUIDesignListSingleElementFixedHeight
design for FXLists that only allow a single selected elements selected and height fixed ...
Definition: GUIDesigns.h:535
const GNEViewNetHelper::EditModes & getEditModes() const
get edit modes
Definition: GNEViewNet.cpp:399
begin/end of the description of a Point of interest over Lane (used by Netedit)
std::vector< GNEEdge * > getClickedEdges() const
get current clicked edges
Network mode (Edges, junctions, etc..)
const std::vector< GNEAttributeCarrier * > & getEditedACs() const
get current edited ACs
GNELane * retrieveLane(const std::string &id, bool failHard=true, bool checkVolatileChange=false)
get lane by id
Definition: GNENet.cpp:1179
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void setDeleteLastCreatedPoint(bool value)
enable or disable delete last created point
virtual void demandElementSelected()
selected demand element in DemandElementSelector
Definition: GNEFrame.cpp:166
virtual std::string getAttribute(SumoXMLAttr key) const =0
#define GUIDesignLabelLeftThick
label extended over frame with thick and with text justify to left and height of 23 ...
Definition: GUIDesigns.h:177
FXButton * myFinishCreationButton
button for finish route creation
FXList * myParentsList
List of parents.
An Element which don&#39;t belongs to GNENet but has influency in the simulation.
void stopDrawing()
stop drawing and check if shape can be created
GNEAttributeCarrier * myAC
Attribute carrier.
GNEJunction * getParentJunction() const
get parent Junction
Definition: GNECrossing.cpp:82