Eclipse SUMO - Simulation of Urban MObility
GNEViewParent.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
18 // A single child window which contains a view of the edited network (adapted
19 // from GUISUMOViewParent)
20 // While we don't actually need MDI for netedit it is easier to adapt existing
21 // structures than to write everything from scratch.
22 /****************************************************************************/
23 
51 
52 #include "GNEApplicationWindow.h"
53 #include "GNEViewNet.h"
54 #include "GNENet.h"
55 #include "GNEViewParent.h"
56 #include "GNEUndoList.h"
57 
58 
59 // ===========================================================================
60 // FOX callback mapping
61 // ===========================================================================
62 
63 FXDEFMAP(GNEViewParent) GNEViewParentMap[] = {
64  FXMAPFUNC(SEL_COMMAND, MID_MAKESNAPSHOT, GNEViewParent::onCmdMakeSnapshot),
65  FXMAPFUNC(SEL_COMMAND, MID_LOCATEJUNCTION, GNEViewParent::onCmdLocate),
66  FXMAPFUNC(SEL_COMMAND, MID_LOCATEEDGE, GNEViewParent::onCmdLocate),
67  FXMAPFUNC(SEL_COMMAND, MID_LOCATEVEHICLE, GNEViewParent::onCmdLocate),
68  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPERSON, GNEViewParent::onCmdLocate),
69  FXMAPFUNC(SEL_COMMAND, MID_LOCATEROUTE, GNEViewParent::onCmdLocate),
70  FXMAPFUNC(SEL_COMMAND, MID_LOCATESTOP, GNEViewParent::onCmdLocate),
71  FXMAPFUNC(SEL_COMMAND, MID_LOCATETLS, GNEViewParent::onCmdLocate),
72  FXMAPFUNC(SEL_COMMAND, MID_LOCATEADD, GNEViewParent::onCmdLocate),
73  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPOI, GNEViewParent::onCmdLocate),
74  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPOLY, GNEViewParent::onCmdLocate),
75  FXMAPFUNC(SEL_COMMAND, FXMDIChild::ID_MDI_MENUCLOSE, GNEViewParent::onCmdClose),
77 };
78 
79 // Object implementation
80 FXIMPLEMENT(GNEViewParent, GUIGlChildWindow, GNEViewParentMap, ARRAYNUMBER(GNEViewParentMap))
81 
82 
83 // ===========================================================================
84 // member method definitions
85 // ===========================================================================
86 
87 GNEViewParent::GNEViewParent(FXMDIClient* p, FXMDIMenu* mdimenu, const FXString& name, GNEApplicationWindow* parentWindow,
88  FXGLCanvas* share, GNENet* net, GNEUndoList* undoList, FXIcon* ic, FXuint opts, FXint x, FXint y, FXint w, FXint h) :
89  GUIGlChildWindow(p, parentWindow, mdimenu, name, parentWindow->getToolbarsGrip().navigation, ic, opts, x, y, w, h),
90  myGNEAppWindows(parentWindow) {
91  // Add child to parent
92  myParent->addGLChild(this);
93 
94  // Create Vertical separator
95  new FXVerticalSeparator(myGripNavigationToolbar, GUIDesignVerticalSeparator);
96 
97  // Create undo/redo buttons
98  myUndoButton = new FXButton(myGripNavigationToolbar, "\tUndo\tUndo the last change. (Ctrl+Z)", GUIIconSubSys::getIcon(GUIIcon::UNDO), parentWindow, MID_HOTKEY_CTRL_Z_UNDO, GUIDesignButtonToolbar);
99  myRedoButton = new FXButton(myGripNavigationToolbar, "\tRedo\tRedo the last change. (Ctrl+Y)", GUIIconSubSys::getIcon(GUIIcon::REDO), parentWindow, MID_HOTKEY_CTRL_Y_REDO, GUIDesignButtonToolbar);
100 
101  // Create Frame Splitter
102  myFramesSplitter = new FXSplitter(myContentFrame, this, MID_GNE_VIEWPARENT_FRAMEAREAWIDTH, GUIDesignSplitter | SPLITTER_HORIZONTAL);
103 
104  // Create frames Area
105  myFramesArea = new FXHorizontalFrame(myFramesSplitter, GUIDesignFrameArea);
106 
107  // Set default width of frames area
108  myFramesArea->setWidth(220);
109 
110  // Create view area
111  myViewArea = new FXHorizontalFrame(myFramesSplitter, GUIDesignViewnArea);
112 
113  // Add the view to a temporary parent so that we can add items to myViewArea in the desired order
114  FXComposite* tmp = new FXComposite(this);
115 
116  // Create view net
117  GNEViewNet* viewNet = new GNEViewNet(tmp, myViewArea, *myParent, this, net, undoList, myParent->getGLVisual(), share);
118 
119  // show toolbar grips
120  myGNEAppWindows->getToolbarsGrip().buildMenuToolbarsGrip();
121 
122  // Set pointer myView with the created view net
123  myView = viewNet;
124 
125  // build frames
126  myCommonFrames.buildCommonFrames(this, viewNet);
127  myNetworkFrames.buildNetworkFrames(this, viewNet);
128  myDemandFrames.buildDemandFrames(this, viewNet);
129  myDataFrames.buildDataFrames(this, viewNet);
130 
131  // Update frame areas after creation
132  onCmdUpdateFrameAreaWidth(nullptr, 0, nullptr);
133 
134  // Hidde all Frames Area
135  hideFramesArea();
136 
137  // Build view toolBars
138  myView->buildViewToolBars(this);
139 
140  // create windows
142 }
143 
144 
146  // delete toolbar grips
148  // Remove child before remove
149  myParent->removeGLChild(this);
150 }
151 
152 
153 void
159 }
160 
161 
162 GNEFrame*
166  } else if (myNetworkFrames.isNetworkFrameShown()) {
168  } else if (myDemandFrames.isDemandFrameShown()) {
170  } else if (myDataFrames.isDataFrameShown()) {
172  } else {
173  return nullptr;
174  }
175 }
176 
177 
181 }
182 
183 
187 }
188 
189 
193 }
194 
195 
198  return myCommonFrames.moveFrame;
199 }
200 
201 
205 }
206 
207 
211 }
212 
213 
217 }
218 
219 
223 }
224 
225 
228  return myNetworkFrames.TAZFrame;
229 }
230 
231 
235 }
236 
237 
241 }
242 
243 
247 }
248 
249 
252  return myDemandFrames.routeFrame;
253 }
254 
255 
259 }
260 
261 
265 }
266 
267 
270  return myDemandFrames.stopFrame;
271 }
272 
273 
277 }
278 
279 
283 }
284 
285 
289 }
290 
291 
295 }
296 
297 
301 }
302 
303 
307 }
308 
309 
310 void
312  const bool frameShown = myCommonFrames.isCommonFrameShown() ||
316  // show and recalc framesArea if at least there is a frame shown
317  if (frameShown) {
318  myFramesArea->recalc();
319  myFramesArea->show();
320  }
321 }
322 
323 
324 void
326  const bool frameShown = myCommonFrames.isCommonFrameShown() ||
330  // hide and recalc frames Area if all frames are hidden is enabled
331  if (!frameShown) {
332  myFramesArea->hide();
333  myFramesArea->recalc();
334  }
335 }
336 
337 
340  return myParent;
341 }
342 
343 
346  return myGNEAppWindows;
347 }
348 
349 
350 void
352  if (chooserDialog == nullptr) {
353  throw ProcessError("ChooserDialog already deleted");
354  } else if (chooserDialog == myACChoosers.ACChooserJunction) {
356  } else if (chooserDialog == myACChoosers.ACChooserEdges) {
357  myACChoosers.ACChooserEdges = nullptr;
358  } else if (chooserDialog == myACChoosers.ACChooserVehicles) {
360  } else if (chooserDialog == myACChoosers.ACChooserPersons) {
361  myACChoosers.ACChooserPersons = nullptr;
362  } else if (chooserDialog == myACChoosers.ACChooserRoutes) {
363  myACChoosers.ACChooserRoutes = nullptr;
364  } else if (chooserDialog == myACChoosers.ACChooserStops) {
365  myACChoosers.ACChooserStops = nullptr;
366  } else if (chooserDialog == myACChoosers.ACChooserTLS) {
367  myACChoosers.ACChooserTLS = nullptr;
368  } else if (chooserDialog == myACChoosers.ACChooserAdditional) {
370  } else if (chooserDialog == myACChoosers.ACChooserPOI) {
371  myACChoosers.ACChooserPOI = nullptr;
372  } else if (chooserDialog == myACChoosers.ACChooserPolygon) {
373  myACChoosers.ACChooserPolygon = nullptr;
374  } else if (chooserDialog == myACChoosers.ACChooserProhibition) {
376  } else {
377  throw ProcessError("Unregistered chooserDialog");
378  }
379 }
380 
381 
382 void
386 }
387 
388 
389 long
390 GNEViewParent::onCmdMakeSnapshot(FXObject*, FXSelector, void*) {
391  // get the new file name
392  FXFileDialog opendialog(this, "Save Snapshot");
393  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::CAMERA));
394  opendialog.setSelectMode(SELECTFILE_ANY);
395  opendialog.setPatternList("All Image Files (*.gif, *.bmp, *.xpm, *.pcx, *.ico, *.rgb, *.xbm, *.tga, *.png, *.jpg, *.jpeg, *.tif, *.tiff, *.ps, *.eps, *.pdf, *.svg, *.tex, *.pgf)\n"
396  "GIF Image (*.gif)\nBMP Image (*.bmp)\nXPM Image (*.xpm)\nPCX Image (*.pcx)\nICO Image (*.ico)\n"
397  "RGB Image (*.rgb)\nXBM Image (*.xbm)\nTARGA Image (*.tga)\nPNG Image (*.png)\n"
398  "JPEG Image (*.jpg, *.jpeg)\nTIFF Image (*.tif, *.tiff)\n"
399  "Postscript (*.ps)\nEncapsulated Postscript (*.eps)\nPortable Document Format (*.pdf)\n"
400  "Scalable Vector Graphics (*.svg)\nLATEX text strings (*.tex)\nPortable LaTeX Graphics (*.pgf)\n"
401  "All Files (*)");
402  if (gCurrentFolder.length() != 0) {
403  opendialog.setDirectory(gCurrentFolder);
404  }
405  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
406  return 1;
407  }
408  gCurrentFolder = opendialog.getDirectory();
409  std::string file = opendialog.getFilename().text();
410  std::string error = myView->makeSnapshot(file);
411  if (error != "") {
412  // write warning if netedit is running in testing mode
413  WRITE_DEBUG("Opening FXMessageBox 'error saving snapshot'");
414  // open message box
415  FXMessageBox::error(this, MBOX_OK, "Saving failed.", "%s", error.c_str());
416  // write warning if netedit is running in testing mode
417  WRITE_DEBUG("Closed FXMessageBox 'error saving snapshot' with 'OK'");
418  }
419  return 1;
420 }
421 
422 
423 long
424 GNEViewParent::onCmdClose(FXObject*, FXSelector /* sel */, void*) {
425  myParent->handle(this, FXSEL(SEL_COMMAND, MID_HOTKEY_CTRL_W_CLOSESIMULATION), nullptr);
426  return 1;
427 }
428 
429 
430 long
431 GNEViewParent::onCmdLocate(FXObject*, FXSelector sel, void*) {
432  GNEViewNet* viewNet = dynamic_cast<GNEViewNet*>(myView);
433  // check that viewNet exist
434  if (viewNet) {
435  // declare a vector in which save attribute carriers to locate
436  std::vector<GNEAttributeCarrier*> ACsToLocate;
437  switch (FXSELID(sel)) {
438  case MID_LOCATEJUNCTION: {
440  // restore focus in the existent chooser dialog
441  myACChoosers.ACChooserJunction->restore();
442  myACChoosers.ACChooserJunction->setFocus();
443  } else {
444  // fill ACsToLocate with junctions
445  std::vector<GNEJunction*> junctions = viewNet->getNet()->retrieveJunctions();
446  ACsToLocate.reserve(junctions.size());
447  for (const auto& junction : junctions) {
448  ACsToLocate.push_back(junction);
449  }
451  }
452  break;
453  }
454  case MID_LOCATEEDGE: {
456  // restore focus in the existent chooser dialog
457  myACChoosers.ACChooserEdges->restore();
458  myACChoosers.ACChooserEdges->setFocus();
459  } else {
460  // fill ACsToLocate with edges
461  std::vector<GNEEdge*> edges = viewNet->getNet()->retrieveEdges();
462  ACsToLocate.reserve(edges.size());
463  for (const auto& edge : edges) {
464  ACsToLocate.push_back(edge);
465  }
467  }
468  break;
469  }
470  case MID_LOCATEVEHICLE: {
472  // restore focus in the existent chooser dialog
473  myACChoosers.ACChooserVehicles->restore();
474  myACChoosers.ACChooserVehicles->setFocus();
475  } else {
476  // reserve memory
477  ACsToLocate.reserve(viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_VEHICLE).size() +
478  viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_TRIP).size() +
480  viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_FLOW).size());
481  // fill ACsToLocate with vehicles
482  for (const auto& vehicle : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_VEHICLE)) {
483  ACsToLocate.push_back(vehicle.second);
484  }
485  // fill ACsToLocate with vehicles
486  for (const auto& trip : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_TRIP)) {
487  ACsToLocate.push_back(trip.second);
488  }
489  // fill ACsToLocate with routeFlows
490  for (const auto& flowRoute : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(GNE_TAG_FLOW_ROUTE)) {
491  ACsToLocate.push_back(flowRoute.second);
492  }
493  // fill ACsToLocate with routeFlowsFromTo
494  for (const auto& flow : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_FLOW)) {
495  ACsToLocate.push_back(flow.second);
496  }
498  }
499  break;
500  }
501  case MID_LOCATEPERSON: {
503  // restore focus in the existent chooser dialog
504  myACChoosers.ACChooserPersons->restore();
505  myACChoosers.ACChooserPersons->setFocus();
506  } else {
507  // reserve memory
508  ACsToLocate.reserve(viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_PERSON).size() +
510  // fill ACsToLocate with persons
511  for (const auto& person : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_PERSON)) {
512  ACsToLocate.push_back(person.second);
513  }
514  // fill ACsToLocate with personFlows
515  for (const auto& personFlow : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_PERSONFLOW)) {
516  ACsToLocate.push_back(personFlow.second);
517  }
519  }
520  break;
521  }
522  case MID_LOCATEROUTE: {
524  // restore focus in the existent chooser dialog
525  myACChoosers.ACChooserRoutes->restore();
526  myACChoosers.ACChooserRoutes->setFocus();
527  } else {
528  // reserve memory
529  ACsToLocate.reserve(viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_ROUTE).size());
530  // fill ACsToLocate with routes
531  for (const auto& route : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_ROUTE)) {
532  ACsToLocate.push_back(route.second);
533  }
535  }
536  break;
537  }
538  case MID_LOCATESTOP: {
540  // restore focus in the existent chooser dialog
541  myACChoosers.ACChooserStops->restore();
542  myACChoosers.ACChooserStops->setFocus();
543  } else {
544  // reserve memory
545  ACsToLocate.reserve(viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_STOP_LANE).size() +
550  // fill ACsToLocate with stop over lanes
551  for (const auto& stopLane : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_STOP_LANE)) {
552  ACsToLocate.push_back(stopLane.second);
553  }
554  // fill ACsToLocate with stop over busstops
555  for (const auto& stopBusStop : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_STOP_BUSSTOP)) {
556  ACsToLocate.push_back(stopBusStop.second);
557  }
558  // fill ACsToLocate with stop over container stops
559  for (const auto& stopContainerStop : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_STOP_CONTAINERSTOP)) {
560  ACsToLocate.push_back(stopContainerStop.second);
561  }
562  // fill ACsToLocate with stop over charging stations
563  for (const auto& stopChargingStation : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_STOP_CHARGINGSTATION)) {
564  ACsToLocate.push_back(stopChargingStation.second);
565  }
566  // fill ACsToLocate with stop over parking areas
567  for (const auto& stopParkingArea : viewNet->getNet()->getAttributeCarriers()->getDemandElements().at(SUMO_TAG_STOP_PARKINGAREA)) {
568  ACsToLocate.push_back(stopParkingArea.second);
569  }
571  }
572  break;
573  }
574  case MID_LOCATETLS: {
576  // restore focus in the existent chooser dialog
577  myACChoosers.ACChooserTLS->restore();
578  myACChoosers.ACChooserTLS->setFocus();
579  } else {
580  // fill ACsToLocate with junctions that haven TLS
581  std::vector<GNEJunction*> junctions = viewNet->getNet()->retrieveJunctions();
582  ACsToLocate.reserve(junctions.size());
583  for (const auto& junction : junctions) {
584  if (junction->getNBNode()->getControllingTLS().size() > 0) {
585  ACsToLocate.push_back(junction);
586  }
587  }
589  }
590  break;
591  }
592  case MID_LOCATEADD: {
594  // restore focus in the existent chooser dialog
596  myACChoosers.ACChooserAdditional->setFocus();
597  } else {
598  // fill ACsToLocate with additionals
599  for (const auto& additionalTag : viewNet->getNet()->getAttributeCarriers()->getAdditionals()) {
600  for (const auto& additional : additionalTag.second) {
601  ACsToLocate.push_back(additional.second);
602  }
603  }
604  myACChoosers.ACChooserAdditional = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(GUIIcon::LOCATEADD), "Additional Chooser", ACsToLocate);
605  }
606  break;
607  }
608  case MID_LOCATEPOI: {
610  // restore focus in the existent chooser dialog
611  myACChoosers.ACChooserPOI->restore();
612  myACChoosers.ACChooserPOI->setFocus();
613  } else {
614  // fill ACsToLocate with POIs
615  for (const auto& POI : viewNet->getNet()->getAttributeCarriers()->getShapes().at(SUMO_TAG_POI)) {
616  ACsToLocate.push_back(POI.second);
617  }
618  for (const auto& POILane : viewNet->getNet()->getAttributeCarriers()->getShapes().at(SUMO_TAG_POILANE)) {
619  ACsToLocate.push_back(POILane.second);
620  }
622  }
623  break;
624  }
625  case MID_LOCATEPOLY: {
627  // restore focus in the existent chooser dialog
628  myACChoosers.ACChooserPolygon->restore();
629  myACChoosers.ACChooserPolygon->setFocus();
630  } else {
631  // fill ACsToLocate with polys
632  for (const auto& polygon : viewNet->getNet()->getAttributeCarriers()->getShapes().at(SUMO_TAG_POLY)) {
633  ACsToLocate.push_back(polygon.second);
634  }
636  }
637  break;
638  }
639  default:
640  throw ProcessError("Unknown Message ID in onCmdLocate");
641  }
642  // update locator popup
643  myLocatorPopup->popdown();
644  myLocatorButton->killFocus();
645  myLocatorPopup->update();
646  }
647  return 1;
648 }
649 
650 
651 long
652 GNEViewParent::onKeyPress(FXObject* o, FXSelector sel, void* eventData) {
653  myView->onKeyPress(o, sel, eventData);
654  return 0;
655 }
656 
657 
658 long
659 GNEViewParent::onKeyRelease(FXObject* o, FXSelector sel, void* eventData) {
660  myView->onKeyRelease(o, sel, eventData);
661  return 0;
662 }
663 
664 
665 long
666 GNEViewParent::onCmdUpdateFrameAreaWidth(FXObject*, FXSelector, void*) {
667  const int framesAreaWidth = myFramesArea->getWidth();
668  // set width of FramesArea in all frames
669  myCommonFrames.setCommonFramesWidth(framesAreaWidth);
670  myNetworkFrames.setNetworkFramesWidth(framesAreaWidth);
671  myDemandFrames.setDemandFramesWidth(framesAreaWidth);
672  myDataFrames.setDataFramesWidth(framesAreaWidth);
673  return 0;
674 }
675 
676 // ---------------------------------------------------------------------------
677 // GNEViewParent::CommonFrames - methods
678 // ---------------------------------------------------------------------------
679 
681  inspectorFrame(nullptr),
682  deleteFrame(nullptr),
683  selectorFrame(nullptr),
684  moveFrame(nullptr) {
685 }
686 
687 
688 void
690  inspectorFrame = new GNEInspectorFrame(viewParent->myFramesArea, viewNet);
691  selectorFrame = new GNESelectorFrame(viewParent->myFramesArea, viewNet);
692  moveFrame = new GNEMoveFrame(viewParent->myFramesArea, viewNet);
693  deleteFrame = new GNEDeleteFrame(viewParent->myFramesArea, viewNet);
694 }
695 
696 
697 void
699  inspectorFrame->hide();
700  deleteFrame->hide();
701  selectorFrame->hide();
702  moveFrame->hide();
703 }
704 
705 
706 void
708  // set width in all frames
709  inspectorFrame->setFrameWidth(frameWidth);
710  deleteFrame->setFrameWidth(frameWidth);
711  selectorFrame->setFrameWidth(frameWidth);
712  moveFrame->setFrameWidth(frameWidth);
713 }
714 
715 
716 bool
718  // check all frames
719  if (inspectorFrame->shown()) {
720  return true;
721  } else if (deleteFrame->shown()) {
722  return true;
723  } else if (selectorFrame->shown()) {
724  return true;
725  } else if (moveFrame->shown()) {
726  return true;
727  } else {
728  return false;
729  }
730 }
731 
732 
733 GNEFrame*
735  // check all frames
736  if (inspectorFrame->shown()) {
737  return inspectorFrame;
738  } else if (deleteFrame->shown()) {
739  return deleteFrame;
740  } else if (selectorFrame->shown()) {
741  return selectorFrame;
742  } else if (moveFrame->shown()) {
743  return moveFrame;
744  } else {
745  return nullptr;
746  }
747 }
748 
749 // ---------------------------------------------------------------------------
750 // GNEViewParent::NetworkFrames - methods
751 // ---------------------------------------------------------------------------
752 
754  connectorFrame(nullptr),
755  TLSEditorFrame(nullptr),
756  additionalFrame(nullptr),
757  crossingFrame(nullptr),
758  TAZFrame(nullptr),
759  polygonFrame(nullptr),
760  prohibitionFrame(nullptr),
761  createEdgeFrame(nullptr) {
762 }
763 
764 
765 void
767  connectorFrame = new GNEConnectorFrame(viewParent->myFramesArea, viewNet);
768  prohibitionFrame = new GNEProhibitionFrame(viewParent->myFramesArea, viewNet);
769  TLSEditorFrame = new GNETLSEditorFrame(viewParent->myFramesArea, viewNet);
770  additionalFrame = new GNEAdditionalFrame(viewParent->myFramesArea, viewNet);
771  crossingFrame = new GNECrossingFrame(viewParent->myFramesArea, viewNet);
772  TAZFrame = new GNETAZFrame(viewParent->myFramesArea, viewNet);
773  polygonFrame = new GNEPolygonFrame(viewParent->myFramesArea, viewNet);
774  createEdgeFrame = new GNECreateEdgeFrame(viewParent->myFramesArea, viewNet);
775 }
776 
777 
778 void
780  connectorFrame->hide();
781  TLSEditorFrame->hide();
782  additionalFrame->hide();
783  crossingFrame->hide();
784  TAZFrame->hide();
785  polygonFrame->hide();
786  prohibitionFrame->hide();
787  createEdgeFrame->hide();
788 }
789 
790 
791 void
793  // set width in all frames
794  connectorFrame->setFrameWidth(frameWidth);
795  TLSEditorFrame->setFrameWidth(frameWidth);
796  additionalFrame->setFrameWidth(frameWidth);
797  crossingFrame->setFrameWidth(frameWidth);
798  TAZFrame->setFrameWidth(frameWidth);
799  polygonFrame->setFrameWidth(frameWidth);
800  prohibitionFrame->setFrameWidth(frameWidth);
801  createEdgeFrame->setFrameWidth(frameWidth);
802 }
803 
804 
805 bool
807  // check all frames
808  if (connectorFrame->shown()) {
809  return true;
810  } else if (TLSEditorFrame->shown()) {
811  return true;
812  } else if (additionalFrame->shown()) {
813  return true;
814  } else if (crossingFrame->shown()) {
815  return true;
816  } else if (TAZFrame->shown()) {
817  return true;
818  } else if (polygonFrame->shown()) {
819  return true;
820  } else if (prohibitionFrame->shown()) {
821  return true;
822  } else if (createEdgeFrame->shown()) {
823  return true;
824  } else {
825  return false;
826  }
827 }
828 
829 
830 GNEFrame*
832  // check all frames
833  if (connectorFrame->shown()) {
834  return connectorFrame;
835  } else if (TLSEditorFrame->shown()) {
836  return TLSEditorFrame;
837  } else if (additionalFrame->shown()) {
838  return additionalFrame;
839  } else if (crossingFrame->shown()) {
840  return crossingFrame;
841  } else if (TAZFrame->shown()) {
842  return TAZFrame;
843  } else if (polygonFrame->shown()) {
844  return polygonFrame;
845  } else if (prohibitionFrame->shown()) {
846  return prohibitionFrame;
847  } else if (createEdgeFrame->shown()) {
848  return createEdgeFrame;
849  } else {
850  return nullptr;
851  }
852 }
853 
854 // ---------------------------------------------------------------------------
855 // GNEViewParent::DemandFrames - methods
856 // ---------------------------------------------------------------------------
857 
859  routeFrame(nullptr),
860  vehicleFrame(nullptr),
861  vehicleTypeFrame(nullptr),
862  stopFrame(nullptr),
863  personFrame(nullptr),
864  personTypeFrame(nullptr),
865  personPlanFrame(nullptr) {
866 }
867 
868 
869 void
871  routeFrame = new GNERouteFrame(viewParent->myFramesArea, viewNet);
872  vehicleFrame = new GNEVehicleFrame(viewParent->myFramesArea, viewNet);
873  vehicleTypeFrame = new GNEVehicleTypeFrame(viewParent->myFramesArea, viewNet);
874  stopFrame = new GNEStopFrame(viewParent->myFramesArea, viewNet);
875  personTypeFrame = new GNEPersonTypeFrame(viewParent->myFramesArea, viewNet);
876  personFrame = new GNEPersonFrame(viewParent->myFramesArea, viewNet);
877  personPlanFrame = new GNEPersonPlanFrame(viewParent->myFramesArea, viewNet);
878 }
879 
880 
881 void
883  routeFrame->hide();
884  vehicleFrame->hide();
885  vehicleTypeFrame->hide();
886  stopFrame->hide();
887  personTypeFrame->hide();
888  personFrame->hide();
889  personPlanFrame->hide();
890 }
891 
892 
893 void
895  // set width in all frames
896  routeFrame->setFrameWidth(frameWidth);
897  vehicleFrame->setFrameWidth(frameWidth);
898  vehicleTypeFrame->setFrameWidth(frameWidth);
899  stopFrame->setFrameWidth(frameWidth);
900  personTypeFrame->setFrameWidth(frameWidth);
901  personFrame->setFrameWidth(frameWidth);
902  personPlanFrame->setFrameWidth(frameWidth);
903 }
904 
905 
906 bool
908  // check all frames
909  if (routeFrame->shown()) {
910  return true;
911  } else if (vehicleFrame->shown()) {
912  return true;
913  } else if (vehicleTypeFrame->shown()) {
914  return true;
915  } else if (stopFrame->shown()) {
916  return true;
917  } else if (personTypeFrame->shown()) {
918  return true;
919  } else if (personFrame->shown()) {
920  return true;
921  } else if (personPlanFrame->shown()) {
922  return true;
923  } else {
924  return false;
925  }
926 }
927 
928 
929 GNEFrame*
931  // check all frames
932  if (routeFrame->shown()) {
933  return routeFrame;
934  } else if (vehicleFrame->shown()) {
935  return vehicleFrame;
936  } else if (vehicleTypeFrame->shown()) {
937  return vehicleTypeFrame;
938  } else if (personTypeFrame->shown()) {
939  return personTypeFrame;
940  } else if (stopFrame->shown()) {
941  return stopFrame;
942  } else if (personFrame->shown()) {
943  return personFrame;
944  } else if (personPlanFrame->shown()) {
945  return personPlanFrame;
946  } else {
947  return nullptr;
948  }
949 }
950 
951 // ---------------------------------------------------------------------------
952 // GNEViewParent::DataFrames - methods
953 // ---------------------------------------------------------------------------
954 
956  edgeDataFrame(nullptr),
957  edgeRelDataFrame(nullptr),
958  TAZRelDataFrame(nullptr) {
959 }
960 
961 
962 void
964  edgeDataFrame = new GNEEdgeDataFrame(viewParent->myFramesArea, viewNet);
965  edgeRelDataFrame = new GNEEdgeRelDataFrame(viewParent->myFramesArea, viewNet);
966  TAZRelDataFrame = new GNETAZRelDataFrame(viewParent->myFramesArea, viewNet);
967 }
968 
969 
970 void
972  edgeDataFrame->hide();
973  edgeRelDataFrame->hide();
974  TAZRelDataFrame->hide();
975 }
976 
977 
978 void
980  // set width in all frames
981  edgeDataFrame->setFrameWidth(frameWidth);
982  edgeRelDataFrame->setFrameWidth(frameWidth);
983  TAZRelDataFrame->setFrameWidth(frameWidth);
984 }
985 
986 
987 bool
989  // check all frames
990  if (edgeDataFrame->shown()) {
991  return true;
992  } else if (edgeRelDataFrame->shown()) {
993  return true;
994  } else if (TAZRelDataFrame->shown()) {
995  return true;
996  } else {
997  return false;
998  }
999 }
1000 
1001 
1002 GNEFrame*
1004  // check all frames
1005  if (edgeDataFrame->shown()) {
1006  return edgeDataFrame;
1007  } else if (edgeRelDataFrame->shown()) {
1008  return edgeRelDataFrame;
1009  } else if (TAZRelDataFrame->shown()) {
1010  return TAZRelDataFrame;
1011  } else {
1012  return nullptr;
1013  }
1014 }
1015 
1016 // ---------------------------------------------------------------------------
1017 // GNEViewParent::ACChoosers - methods
1018 // ---------------------------------------------------------------------------
1019 
1021  ACChooserJunction(nullptr),
1022  ACChooserEdges(nullptr),
1023  ACChooserVehicles(nullptr),
1024  ACChooserPersons(nullptr),
1025  ACChooserRoutes(nullptr),
1026  ACChooserStops(nullptr),
1027  ACChooserTLS(nullptr),
1028  ACChooserAdditional(nullptr),
1029  ACChooserPOI(nullptr),
1030  ACChooserPolygon(nullptr),
1031  ACChooserProhibition(nullptr) {
1032 }
1033 
1034 
1036  // remove all dialogs if are active
1037  if (ACChooserJunction) {
1038  delete ACChooserJunction;
1039  }
1040  if (ACChooserEdges) {
1041  delete ACChooserEdges;
1042  }
1043  if (ACChooserRoutes) {
1044  delete ACChooserRoutes;
1045  }
1046  if (ACChooserStops) {
1047  delete ACChooserStops;
1048  }
1049  if (ACChooserVehicles) {
1050  delete ACChooserVehicles;
1051  }
1052  if (ACChooserPersons) {
1053  delete ACChooserPersons;
1054  }
1055  if (ACChooserTLS) {
1056  delete ACChooserTLS;
1057  }
1058  if (ACChooserAdditional) {
1059  delete ACChooserAdditional;
1060  }
1061  if (ACChooserPOI) {
1062  delete ACChooserPOI;
1063  }
1064  if (ACChooserPolygon) {
1065  delete ACChooserPolygon;
1066  }
1067  if (ACChooserProhibition) {
1068  delete ACChooserProhibition;
1069  }
1070 }
1071 
1072 
1073 /****************************************************************************/
FXDEFMAP(GNEViewParent) GNEViewParentMap[]
@ MID_MAKESNAPSHOT
Make snapshot - button.
Definition: GUIAppEnum.h:363
@ MID_LOCATEPERSON
Locate person - button.
Definition: GUIAppEnum.h:349
@ MID_HOTKEY_CTRL_Y_REDO
Undo.
Definition: GUIAppEnum.h:113
@ MID_LOCATEJUNCTION
Locate junction - button.
Definition: GUIAppEnum.h:339
@ MID_HOTKEY_CTRL_W_CLOSESIMULATION
Close simulation - ID.
Definition: GUIAppEnum.h:109
@ MID_LOCATEPOLY
Locate polygons - button.
Definition: GUIAppEnum.h:359
@ MID_LOCATEADD
Locate addtional structure - button.
Definition: GUIAppEnum.h:355
@ MID_LOCATEPOI
Locate poi - button.
Definition: GUIAppEnum.h:357
@ MID_LOCATESTOP
Locate stop - button.
Definition: GUIAppEnum.h:347
@ MID_GNE_VIEWPARENT_FRAMEAREAWIDTH
Size of frame area updated.
Definition: GUIAppEnum.h:624
@ MID_LOCATEEDGE
Locate edge - button.
Definition: GUIAppEnum.h:341
@ MID_LOCATEVEHICLE
Locate vehicle - button.
Definition: GUIAppEnum.h:343
@ MID_LOCATETLS
Locate TLS - button.
Definition: GUIAppEnum.h:353
@ MID_HOTKEY_CTRL_Z_UNDO
Redo.
Definition: GUIAppEnum.h:115
@ MID_LOCATEROUTE
Locate route - button.
Definition: GUIAppEnum.h:345
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition: GUIDesigns.h:91
#define GUIDesignFrameArea
Definition: GUIDesigns.h:301
#define GUIDesignVerticalSeparator
vertical separator
Definition: GUIDesigns.h:365
#define GUIDesignSplitter
Definition: GUIDesigns.h:373
#define GUIDesignViewnArea
design for viewn area
Definition: GUIDesigns.h:304
FXString gCurrentFolder
The folder used as last.
@ LOCATEVEHICLE
@ LOCATEPERSON
@ LOCATEJUNCTION
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:286
@ SUMO_TAG_STOP_CONTAINERSTOP
stop placed over a containerStop (used in netedit)
@ SUMO_TAG_STOP_CHARGINGSTATION
stop placed over a charging station (used in netedit)
@ SUMO_TAG_STOP_LANE
stop placed over a lane (used in netedit)
@ SUMO_TAG_POI
begin/end of the description of a Point of interest
@ SUMO_TAG_VEHICLE
description of a vehicle
@ GNE_TAG_FLOW_ROUTE
a flow definition using a route instead of a from-to edges route (used in NETEDIT)
@ SUMO_TAG_FLOW
a flow definitio nusing a from-to edges instead of a route (used by router)
@ SUMO_TAG_ROUTE
begin/end of the description of a route
@ SUMO_TAG_POLY
begin/end of the description of a polygon
@ SUMO_TAG_STOP_BUSSTOP
stop placed over a busStop (used in netedit)
@ SUMO_TAG_POILANE
begin/end of the description of a Point of interest over Lane (used by Netedit)
@ SUMO_TAG_PERSON
@ SUMO_TAG_STOP_PARKINGAREA
stop placed over a parking area (used in netedit)
@ SUMO_TAG_PERSONFLOW
@ SUMO_TAG_TRIP
a single trip definition (used by router)
The main window of the Netedit.
GNEUndoList * getUndoList()
get pointer to undoList
GNEApplicationWindowHelper::ToolbarsGrip & getToolbarsGrip()
get ToolbarsGrip
const std::map< SumoXMLTag, std::map< std::string, GNEAdditional * > > & getAdditionals() const
const std::map< SumoXMLTag, std::map< std::string, GNEDemandElement * > > & getDemandElements() const
const std::map< SumoXMLTag, std::map< std::string, GNEShape * > > & getShapes() const
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:40
GNENetHelper::AttributeCarriers * getAttributeCarriers() const
retrieve all attribute carriers of Net
Definition: GNENet.cpp:130
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
Definition: GNENet.cpp:1370
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:1249
long p_onUpdUndo(FXObject *, FXSelector, void *)
long p_onUpdRedo(FXObject *, FXSelector, void *)
event after Redo
GNENet * getNet() const
get the net object
GNEDialogACChooser * ACChooserStops
pointer to ACChooser dialog used for locate stops
GNEDialogACChooser * ACChooserEdges
pointer to ACChooser dialog used for locate edges
GNEDialogACChooser * ACChooserPolygon
pointer to ACChooser dialog used for locate Polygons
GNEDialogACChooser * ACChooserPOI
pointer to ACChooser dialog used for locate POIs
GNEDialogACChooser * ACChooserRoutes
pointer to ACChooser dialog used for locate routes
GNEDialogACChooser * ACChooserJunction
pointer to ACChooser dialog used for locate junctions
GNEDialogACChooser * ACChooserVehicles
pointer to ACChooser dialog used for locate vehicles
GNEDialogACChooser * ACChooserTLS
pointer to ACChooser dialog used for locate TLSs
GNEDialogACChooser * ACChooserProhibition
pointer to ACChooser dialog used for locate Prohibitions
GNEDialogACChooser * ACChooserPersons
pointer to ACChooser dialog used for locate persons
GNEDialogACChooser * ACChooserAdditional
pointer to ACChooser dialog used for locate additional
GNEMoveFrame * moveFrame
frame for move elements
GNEFrame * getCurrentShownFrame() const
get current common frame show
bool isCommonFrameShown() const
return true if at least there is a common frame shown
GNEDeleteFrame * deleteFrame
frame for delete elemetns
void buildCommonFrames(GNEViewParent *viewParent, GNEViewNet *viewNet)
build common frames
GNESelectorFrame * selectorFrame
frame for select elements
void hideCommonFrames()
hide common frames
GNEInspectorFrame * inspectorFrame
frame for inspect elements
void setCommonFramesWidth(int frameWidth)
set new width in all common frames
GNEEdgeDataFrame * edgeDataFrame
frame for DATA_EDGEDATA
void setDataFramesWidth(int frameWidth)
set new width in all data frames
GNEFrame * getCurrentShownFrame() const
get current data frame show
GNETAZRelDataFrame * TAZRelDataFrame
frame for DATA_TAZRELDATA
GNEEdgeRelDataFrame * edgeRelDataFrame
frame for DATA_EDGERELDATA
bool isDataFrameShown() const
return true if at least there is a data frame shown
void hideDataFrames()
hide data frames
void buildDataFrames(GNEViewParent *viewParent, GNEViewNet *viewNet)
build data frames
GNEPersonFrame * personFrame
frame for DEMAND_PERSON
GNEStopFrame * stopFrame
frame for DEMAND_STOP
GNERouteFrame * routeFrame
frame for DEMAND_ROUTE
GNEVehicleTypeFrame * vehicleTypeFrame
frame for DEMAND_VEHICLETYPE
GNEVehicleFrame * vehicleFrame
frame for DEMAND_VEHICLE
GNEFrame * getCurrentShownFrame() const
get current demand frame show
void setDemandFramesWidth(int frameWidth)
set new width in all demand frames
void buildDemandFrames(GNEViewParent *viewParent, GNEViewNet *viewNet)
build demand frames
GNEPersonPlanFrame * personPlanFrame
frame for DEMAND_PERSONPLAN
bool isDemandFrameShown() const
return true if at least there is a demand frame shown
GNEPersonTypeFrame * personTypeFrame
frame for DEMAND_PERSONTYPE
void hideDemandFrames()
hide demand frames
GNEAdditionalFrame * additionalFrame
frame for NETWORK_ADDITIONAL
bool isNetworkFrameShown() const
return true if at least there is a network frame shown
GNEPolygonFrame * polygonFrame
frame for NETWORK_POLYGON
GNECrossingFrame * crossingFrame
frame for NETWORK_CROSSING
GNEConnectorFrame * connectorFrame
frame for NETWORK_CONNECT
GNECreateEdgeFrame * createEdgeFrame
frame for NETWORK_CREATEDGE
GNEProhibitionFrame * prohibitionFrame
frame for NETWORK_PROHIBITION
GNETAZFrame * TAZFrame
frame for NETWORK_TAZ
GNETLSEditorFrame * TLSEditorFrame
frame for NETWORK_TLS
GNEFrame * getCurrentShownFrame() const
get current network frame show
void hideNetworkFrames()
hide network frames
void setNetworkFramesWidth(int frameWidth)
set new width in all network frames
void buildNetworkFrames(GNEViewParent *viewParent, GNEViewNet *viewNet)
build network frames
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:81
long onCmdMakeSnapshot(FXObject *sender, FXSelector, void *)
GNECrossingFrame * getCrossingFrame() const
get frame for NETWORK_CROSSING
GUIMainWindow * getGUIMainWindow() const
get GUIMainWindow App
GNEConnectorFrame * getConnectorFrame() const
get frame for NETWORK_CONNECT
GNEStopFrame * getStopFrame() const
get frame for DEMAND_STOP
void updateUndoRedoButtons()
update toolbar undo/redo buttons (called when user press Ctrl+Z/Y)
long onCmdUpdateFrameAreaWidth(FXObject *, FXSelector, void *)
Called when user change the splitter between FrameArea and ViewNet.
GNEProhibitionFrame * getProhibitionFrame() const
get frame for NETWORK_PROHIBITION
long onKeyPress(FXObject *o, FXSelector sel, void *data)
Called when user press a key.
GNEPersonPlanFrame * getPersonPlanFrame() const
get frame for DEMAND_PERSONFRAME
DemandFrames myDemandFrames
struct for demand frames
GNEPolygonFrame * getPolygonFrame() const
get frame for NETWORK_POLYGON
GNETAZRelDataFrame * getTAZRelDataFrame() const
get frame for DATA_TAZRELDATA
GNEMoveFrame * getMoveFrame() const
get frame for move elements
long onCmdClose(FXObject *, FXSelector, void *)
Called when the user hits the close button (x)
GNESelectorFrame * getSelectorFrame() const
get frame for select elements
void hideFramesArea()
hide frames area if all GNEFrames are hidden
FXButton * myRedoButton
toolbar redo button
GNEEdgeDataFrame * getEdgeDataFrame() const
get frame for DATA_EDGEDATA
GNEDeleteFrame * getDeleteFrame() const
get frame for delete elements
NetworkFrames myNetworkFrames
struct for network frames
ACChoosers myACChoosers
struct for ACChoosers
GNEVehicleFrame * getVehicleFrame() const
get frame for DEMAND_VEHICLE
void showFramesArea()
show frames area if at least a GNEFrame is showed
FXButton * myUndoButton
toolbar undo button
void hideAllFrames()
hide all frames
GNETAZFrame * getTAZFrame() const
get frame for NETWORK_TAZ
GNETLSEditorFrame * getTLSEditorFrame() const
get frame for NETWORK_TLS
CommonFrames myCommonFrames
struct for common frames
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
DataFrames myDataFrames
struct for data frames
GNEAdditionalFrame * getAdditionalFrame() const
get frame for NETWORK_ADDITIONAL
FXHorizontalFrame * myFramesArea
frame to hold GNEFrames
GNEPersonFrame * getPersonFrame() const
get frame for DEMAND_PERSON
void eraseACChooserDialog(GNEDialogACChooser *chooserDialog)
remove created chooser dialog
GNEInspectorFrame * getInspectorFrame() const
get frame for inspect elements
GNEVehicleTypeFrame * getVehicleTypeFrame() const
get frame for DEMAND_VEHICLETYPE
GNEApplicationWindow * myGNEAppWindows
pointer to GNEApplicationWindow
GNEEdgeRelDataFrame * getEdgeRelDataFrame() const
get frame for DATA_EDGERELDATA
GNEPersonTypeFrame * getPersonTypeFrame() const
get frame for DEMAND_PERSONTYPE
GNECreateEdgeFrame * getCreateEdgeFrame() const
get frame for NETWORK_CREATEEDGE
GNERouteFrame * getRouteFrame() const
get frame for DEMAND_ROUTE
GNEFrame * getCurrentShownFrame() const
get current frame (note: it can be null)
long onCmdLocate(FXObject *, FXSelector, void *)
locator-callback
~GNEViewParent()
Destructor.
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
Called when user releases a key.
virtual void create()
create GUIGlChildWindow
GUISUMOAbstractView * myView
The view.
FXMenuButton * myLocatorButton
The locator button.
FXPopup * myLocatorPopup
The locator menu.
GUIMainWindow * myParent
The parent window.
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
void removeGLChild(GUIGlChildWindow *child)
removes the given child window from the list (GUIGlChildWindow)
std::string makeSnapshot(const std::string &destFile, const int w=-1, const int h=-1)
Takes a snapshots and writes it into the given file.
virtual long onKeyPress(FXObject *o, FXSelector sel, void *data)
keyboard functions
virtual long onKeyRelease(FXObject *o, FXSelector sel, void *data)
static FXbool userPermitsOverwritingWhenFileExists(FXWindow *const parent, const FXString &file)
Returns true if either the file given by its name does not exist or the user allows overwriting it.
Definition: MFXUtils.cpp:39
C++ TraCI client API implementation.