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-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 // A single child window which contains a view of the edited network (adapted
16 // from GUISUMOViewParent)
17 // While we don't actually need MDI for netedit it is easier to adapt existing
18 // structures than to write everything from scratch.
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
50 
51 #include "GNEApplicationWindow.h"
52 #include "GNEViewNet.h"
53 #include "GNENet.h"
54 #include "GNEViewParent.h"
55 
56 
57 // ===========================================================================
58 // FOX callback mapping
59 // ===========================================================================
60 
61 FXDEFMAP(GNEViewParent) GNEViewParentMap[] = {
62  FXMAPFUNC(SEL_COMMAND, MID_MAKESNAPSHOT, GNEViewParent::onCmdMakeSnapshot),
63  FXMAPFUNC(SEL_COMMAND, MID_LOCATEJUNCTION, GNEViewParent::onCmdLocate),
64  FXMAPFUNC(SEL_COMMAND, MID_LOCATEEDGE, GNEViewParent::onCmdLocate),
65  FXMAPFUNC(SEL_COMMAND, MID_LOCATEVEHICLE, GNEViewParent::onCmdLocate),
66  FXMAPFUNC(SEL_COMMAND, MID_LOCATEROUTE, GNEViewParent::onCmdLocate),
67  FXMAPFUNC(SEL_COMMAND, MID_LOCATESTOP, GNEViewParent::onCmdLocate),
68  FXMAPFUNC(SEL_COMMAND, MID_LOCATETLS, GNEViewParent::onCmdLocate),
69  FXMAPFUNC(SEL_COMMAND, MID_LOCATEADD, GNEViewParent::onCmdLocate),
70  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPOI, GNEViewParent::onCmdLocate),
71  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPOLY, GNEViewParent::onCmdLocate),
72  FXMAPFUNC(SEL_COMMAND, FXMDIChild::ID_MDI_MENUCLOSE, GNEViewParent::onCmdClose),
74 };
75 
76 // Object implementation
77 FXIMPLEMENT(GNEViewParent, GUIGlChildWindow, GNEViewParentMap, ARRAYNUMBER(GNEViewParentMap))
78 
79 
80 // ===========================================================================
81 // member method definitions
82 // ===========================================================================
83 
84 GNEViewParent::GNEViewParent(FXMDIClient* p, FXMDIMenu* mdimenu, const FXString& name, GNEApplicationWindow* parentWindow,
85  FXGLCanvas* share, GNENet* net, GNEUndoList* undoList, FXIcon* ic, FXuint opts, FXint x, FXint y, FXint w, FXint h) :
86  GUIGlChildWindow(p, parentWindow, mdimenu, name, parentWindow->getToolbarsGrip().navigation, ic, opts, x, y, w, h),
87  myGNEAppWindows(parentWindow) {
88  // Add child to parent
89  myParent->addGLChild(this);
90 
91  // Create Vertical separator
92  new FXVerticalSeparator(myGripNavigationToolbar, GUIDesignVerticalSeparator);
93 
94  // add undo/redo buttons
95  new FXButton(myGripNavigationToolbar, "\tUndo\tUndo the last Change.", GUIIconSubSys::getIcon(ICON_UNDO), parentWindow, MID_HOTKEY_CTRL_Z_UNDO, GUIDesignButtonToolbar);
96  new FXButton(myGripNavigationToolbar, "\tRedo\tRedo the last Change.", GUIIconSubSys::getIcon(ICON_REDO), parentWindow, MID_HOTKEY_CTRL_Y_REDO, GUIDesignButtonToolbar);
97 
98  // Create Frame Splitter
99  myFramesSplitter = new FXSplitter(myContentFrame, this, MID_GNE_VIEWPARENT_FRAMEAREAWIDTH, GUIDesignSplitter | SPLITTER_HORIZONTAL);
100 
101  // Create frames Area
102  myFramesArea = new FXHorizontalFrame(myFramesSplitter, GUIDesignFrameArea);
103 
104  // Set default width of frames area
105  myFramesArea->setWidth(220);
106 
107  // Create view area
108  myViewArea = new FXHorizontalFrame(myFramesSplitter, GUIDesignViewnArea);
109 
110  // Add the view to a temporary parent so that we can add items to myViewArea in the desired order
111  FXComposite* tmp = new FXComposite(this);
112 
113  // Create view net
114  GNEViewNet* viewNet = new GNEViewNet(tmp, myViewArea, *myParent, this, net, undoList, myParent->getGLVisual(), share);
115 
116  // show toolbar grips
117  myGNEAppWindows->getToolbarsGrip().buildMenuToolbarsGrip();
118 
119  // Set pointer myView with the created view net
120  myView = viewNet;
121 
122  // Create Network frames
123  myFrames.inspectorFrame = new GNEInspectorFrame(myFramesArea, viewNet);
124  myFrames.selectorFrame = new GNESelectorFrame(myFramesArea, viewNet);
125  myFrames.connectorFrame = new GNEConnectorFrame(myFramesArea, viewNet);
126  myFrames.prohibitionFrame = new GNEProhibitionFrame(myFramesArea, viewNet);
127  myFrames.TLSEditorFrame = new GNETLSEditorFrame(myFramesArea, viewNet);
128  myFrames.additionalFrame = new GNEAdditionalFrame(myFramesArea, viewNet);
129  myFrames.crossingFrame = new GNECrossingFrame(myFramesArea, viewNet);
130  myFrames.TAZFrame = new GNETAZFrame(myFramesArea, viewNet);
131  myFrames.deleteFrame = new GNEDeleteFrame(myFramesArea, viewNet);
132  myFrames.polygonFrame = new GNEPolygonFrame(myFramesArea, viewNet);
133  myFrames.createEdgeFrame = new GNECreateEdgeFrame(myFramesArea, viewNet);
134 
135  // Create Demand frames
136  myFrames.routeFrame = new GNERouteFrame(myFramesArea, viewNet);
137  myFrames.vehicleFrame = new GNEVehicleFrame(myFramesArea, viewNet);
138  myFrames.vehicleTypeFrame = new GNEVehicleTypeFrame(myFramesArea, viewNet);
139  myFrames.stopFrame = new GNEStopFrame(myFramesArea, viewNet);
140  myFrames.personTypeFrame = new GNEPersonTypeFrame(myFramesArea, viewNet);
141  myFrames.personFrame = new GNEPersonFrame(myFramesArea, viewNet);
142  myFrames.personPlanFrame = new GNEPersonPlanFrame(myFramesArea, viewNet);
143 
144  // Update frame areas after creation
145  onCmdUpdateFrameAreaWidth(nullptr, 0, nullptr);
146 
147  // Hidde all Frames Area
148  hideFramesArea();
149 
150  // Buld view toolBars
151  myView->buildViewToolBars(*this);
152 
153  // create windows
155 }
156 
157 
159  // delete toolbar grips
161  // Remove child before remove
162  myParent->removeGLChild(this);
163 }
164 
165 
166 void
169 }
170 
171 
172 GNEFrame*
175 }
176 
177 
180  return myFrames.inspectorFrame;
181 }
182 
183 
186  return myFrames.selectorFrame;
187 }
188 
189 
192  return myFrames.connectorFrame;
193 }
194 
195 
198  return myFrames.TLSEditorFrame;
199 }
200 
201 
204  return myFrames.additionalFrame;
205 }
206 
207 
210  return myFrames.crossingFrame;
211 }
212 
213 
216  return myFrames.TAZFrame;
217 }
218 
219 
222  return myFrames.deleteFrame;
223 }
224 
225 
228  return myFrames.polygonFrame;
229 }
230 
231 
234  return myFrames.prohibitionFrame;
235 }
236 
237 
240  return myFrames.createEdgeFrame;
241 }
242 
243 
246  return myFrames.routeFrame;
247 }
248 
249 
252  return myFrames.vehicleFrame;
253 }
254 
255 
258  return myFrames.vehicleTypeFrame;
259 }
260 
261 
264  return myFrames.stopFrame;
265 }
266 
267 
270  return myFrames.personTypeFrame;
271 }
272 
273 
276  return myFrames.personFrame;
277 }
278 
279 
282  return myFrames.personPlanFrame;
283 }
284 
285 
286 void
288  // show and recalc framesArea if at least there is a frame shown
289  if (myFrames.isFrameShown()) {
290  myFramesArea->recalc();
291  myFramesArea->show();
292  }
293 }
294 
295 
296 void
298  // hide and recalc frames Area if all frames are hidden is enabled
299  if (!myFrames.isFrameShown()) {
300  myFramesArea->hide();
301  myFramesArea->recalc();
302  }
303 }
304 
305 
308  return myParent;
309 }
310 
311 
314  return myGNEAppWindows;
315 }
316 
317 
318 void
320  if (chooserDialog == nullptr) {
321  throw ProcessError("ChooserDialog already deleted");
322  } else if (chooserDialog == myACChoosers.ACChooserJunction) {
324  } else if (chooserDialog == myACChoosers.ACChooserEdges) {
325  myACChoosers.ACChooserEdges = nullptr;
326  } else if (chooserDialog == myACChoosers.ACChooserVehicles) {
328  } else if (chooserDialog == myACChoosers.ACChooserRoutes) {
329  myACChoosers.ACChooserRoutes = nullptr;
330  } else if (chooserDialog == myACChoosers.ACChooserStops) {
331  myACChoosers.ACChooserStops = nullptr;
332  } else if (chooserDialog == myACChoosers.ACChooserTLS) {
333  myACChoosers.ACChooserTLS = nullptr;
334  } else if (chooserDialog == myACChoosers.ACChooserAdditional) {
336  } else if (chooserDialog == myACChoosers.ACChooserPOI) {
337  myACChoosers.ACChooserPOI = nullptr;
338  } else if (chooserDialog == myACChoosers.ACChooserPolygon) {
339  myACChoosers.ACChooserPolygon = nullptr;
340  } else if (chooserDialog == myACChoosers.ACChooserProhibition) {
342  } else {
343  throw ProcessError("Unregistered chooserDialog");
344  }
345 }
346 
347 
348 long
349 GNEViewParent::onCmdMakeSnapshot(FXObject*, FXSelector, void*) {
350  // get the new file name
351  FXFileDialog opendialog(this, "Save Snapshot");
352  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
353  opendialog.setSelectMode(SELECTFILE_ANY);
354  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"
355  "GIF Image (*.gif)\nBMP Image (*.bmp)\nXPM Image (*.xpm)\nPCX Image (*.pcx)\nICO Image (*.ico)\n"
356  "RGB Image (*.rgb)\nXBM Image (*.xbm)\nTARGA Image (*.tga)\nPNG Image (*.png)\n"
357  "JPEG Image (*.jpg, *.jpeg)\nTIFF Image (*.tif, *.tiff)\n"
358  "Postscript (*.ps)\nEncapsulated Postscript (*.eps)\nPortable Document Format (*.pdf)\n"
359  "Scalable Vector Graphics (*.svg)\nLATEX text strings (*.tex)\nPortable LaTeX Graphics (*.pgf)\n"
360  "All Files (*)");
361  if (gCurrentFolder.length() != 0) {
362  opendialog.setDirectory(gCurrentFolder);
363  }
364  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
365  return 1;
366  }
367  gCurrentFolder = opendialog.getDirectory();
368  std::string file = opendialog.getFilename().text();
369  std::string error = myView->makeSnapshot(file);
370  if (error != "") {
371  // write warning if netedit is running in testing mode
372  WRITE_DEBUG("Opening FXMessageBox 'error saving snapshot'");
373  // open message box
374  FXMessageBox::error(this, MBOX_OK, "Saving failed.", "%s", error.c_str());
375  // write warning if netedit is running in testing mode
376  WRITE_DEBUG("Closed FXMessageBox 'error saving snapshot' with 'OK'");
377  }
378  return 1;
379 }
380 
381 
382 long
383 GNEViewParent::onCmdClose(FXObject*, FXSelector /* sel */, void*) {
384  myParent->handle(this, FXSEL(SEL_COMMAND, MID_HOTKEY_CTRL_W_CLOSESIMULATION), nullptr);
385  return 1;
386 }
387 
388 
389 long
390 GNEViewParent::onCmdLocate(FXObject*, FXSelector sel, void*) {
391  GNEViewNet* viewNet = dynamic_cast<GNEViewNet*>(myView);
392  // check that viewNet exist
393  if (viewNet) {
394  // declare a vector in which save attribute carriers to locate
395  std::vector<GNEAttributeCarrier*> ACsToLocate;
396  switch (FXSELID(sel)) {
397  case MID_LOCATEJUNCTION: {
399  // set focus in the existent chooser dialog
400  myACChoosers.ACChooserJunction->setFocus();
401  } else {
402  // fill ACsToLocate with junctions
403  std::vector<GNEJunction*> junctions = viewNet->getNet()->retrieveJunctions();
404  ACsToLocate.reserve(junctions.size());
405  for (auto i : junctions) {
406  ACsToLocate.push_back(i);
407  }
408  myACChoosers.ACChooserJunction = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATEJUNCTION), "Junction Chooser", ACsToLocate);
409  }
410  break;
411  }
412  case MID_LOCATEEDGE: {
414  // set focus in the existent chooser dialog
415  myACChoosers.ACChooserEdges->setFocus();
416  } else {
417  // fill ACsToLocate with edges
418  std::vector<GNEEdge*> edges = viewNet->getNet()->retrieveEdges();
419  ACsToLocate.reserve(edges.size());
420  for (auto i : edges) {
421  ACsToLocate.push_back(i);
422  }
423  myACChoosers.ACChooserEdges = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATEEDGE), "Edge Chooser", ACsToLocate);
424  }
425  break;
426  }
427  case MID_LOCATEVEHICLE: {
429  // set focus in the existent chooser dialog
430  myACChoosers.ACChooserVehicles->setFocus();
431  } else {
432  // reserve memory
433  ACsToLocate.reserve(viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_VEHICLE).size() +
434  viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_TRIP).size() +
436  viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_FLOW).size());
437  // fill ACsToLocate with vehicles
438  for (const auto& i : viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_VEHICLE)) {
439  ACsToLocate.push_back(i.second);
440  }
441  // fill ACsToLocate with vehicles
442  for (const auto& i : viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_TRIP)) {
443  ACsToLocate.push_back(i.second);
444  }
445  // fill ACsToLocate with routeFlows
446  for (const auto& i : viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_ROUTEFLOW)) {
447  ACsToLocate.push_back(i.second);
448  }
449  // fill ACsToLocate with routeFlowsFromTo
450  for (const auto& i : viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_FLOW)) {
451  ACsToLocate.push_back(i.second);
452  }
453  myACChoosers.ACChooserVehicles = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATEVEHICLE), "Vehicle Chooser", ACsToLocate);
454  }
455  break;
456  }
457  case MID_LOCATEROUTE: {
459  // set focus in the existent chooser dialog
460  myACChoosers.ACChooserRoutes->setFocus();
461  } else {
462  // reserve memory
463  ACsToLocate.reserve(viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_ROUTE).size());
464  // fill ACsToLocate with routes
465  for (const auto& i : viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_ROUTE)) {
466  ACsToLocate.push_back(i.second);
467  }
468  myACChoosers.ACChooserRoutes = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATEROUTE), "Route Chooser", ACsToLocate);
469  }
470  break;
471  }
472  case MID_LOCATESTOP: {
474  // set focus in the existent chooser dialog
475  myACChoosers.ACChooserStops->setFocus();
476  } else {
477  // reserve memory
478  ACsToLocate.reserve(viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_STOP_LANE).size() +
483  // fill ACsToLocate with stop over lanes
484  for (const auto& i : viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_STOP_LANE)) {
485  ACsToLocate.push_back(i.second);
486  }
487  // fill ACsToLocate with stop over busstops
488  for (const auto& i : viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_STOP_BUSSTOP)) {
489  ACsToLocate.push_back(i.second);
490  }
491  // fill ACsToLocate with stop over container stops
492  for (const auto& i : viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_STOP_CONTAINERSTOP)) {
493  ACsToLocate.push_back(i.second);
494  }
495  // fill ACsToLocate with stop over charging stations
496  for (const auto& i : viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_STOP_CHARGINGSTATION)) {
497  ACsToLocate.push_back(i.second);
498  }
499  // fill ACsToLocate with stop over parking areas
500  for (const auto& i : viewNet->getNet()->getAttributeCarriers().demandElements.at(SUMO_TAG_STOP_PARKINGAREA)) {
501  ACsToLocate.push_back(i.second);
502  }
503  myACChoosers.ACChooserStops = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATESTOP), "Stop Chooser", ACsToLocate);
504  }
505  break;
506  }
507  case MID_LOCATETLS: {
509  // set focus in the existent chooser dialog
510  myACChoosers.ACChooserTLS->setFocus();
511  } else {
512  // fill ACsToLocate with junctions that haven TLS
513  std::vector<GNEJunction*> junctions = viewNet->getNet()->retrieveJunctions();
514  ACsToLocate.reserve(junctions.size());
515  for (auto i : junctions) {
516  if (i->getNBNode()->getControllingTLS().size() > 0) {
517  ACsToLocate.push_back(i);
518  }
519  }
520  myACChoosers.ACChooserTLS = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATETLS), "TLS Chooser", ACsToLocate);
521  }
522  break;
523  }
524  case MID_LOCATEADD: {
526  // set focus in the existent chooser dialog
527  myACChoosers.ACChooserAdditional->setFocus();
528  } else {
529  // fill ACsToLocate with additionals
530  std::vector<GNEAdditional*> additionals = viewNet->getNet()->retrieveAdditionals();
531  ACsToLocate.reserve(additionals.size());
532  for (auto i : additionals) {
533  ACsToLocate.push_back(i);
534  }
535  myACChoosers.ACChooserAdditional = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATEADD), "Additional Chooser", ACsToLocate);
536  }
537  break;
538  }
539  case MID_LOCATEPOI: {
541  // set focus in the existent chooser dialog
542  myACChoosers.ACChooserPOI->setFocus();
543  } else {
544  // fill ACsToLocate with POIs
545  for (auto i : viewNet->getNet()->getPOIs()) {
546  ACsToLocate.push_back(dynamic_cast<GNEAttributeCarrier*>(i.second));
547  }
548  myACChoosers.ACChooserPOI = new GNEDialogACChooser(this, GUIIconSubSys::getIcon(ICON_LOCATEPOI), "POI Chooser", ACsToLocate);
549  }
550  break;
551  }
552  case MID_LOCATEPOLY: {
554  // set focus in the existent chooser dialog
555  myACChoosers.ACChooserPolygon->setFocus();
556  } else {
557  // fill ACsToLocate with polys
558  for (auto i : viewNet->getNet()->getPolygons()) {
559  ACsToLocate.push_back(dynamic_cast<GNEAttributeCarrier*>(i.second));
560  }
562  }
563  break;
564  }
565  default:
566  throw ProcessError("Unknown Message ID in onCmdLocate");
567  }
568  // update locator popup
569  myLocatorPopup->popdown();
570  myLocatorButton->killFocus();
571  myLocatorPopup->update();
572  }
573  return 1;
574 }
575 
576 
577 long
578 GNEViewParent::onKeyPress(FXObject* o, FXSelector sel, void* eventData) {
579  myView->onKeyPress(o, sel, eventData);
580  return 0;
581 }
582 
583 
584 long
585 GNEViewParent::onKeyRelease(FXObject* o, FXSelector sel, void* eventData) {
586  myView->onKeyRelease(o, sel, eventData);
587  return 0;
588 }
589 
590 
591 long
592 GNEViewParent::onCmdUpdateFrameAreaWidth(FXObject*, FXSelector, void*) {
593  // set width of FramesArea in all frames
594  myFrames.setWidth(myFramesArea->getWidth());
595  return 0;
596 }
597 
598 // ---------------------------------------------------------------------------
599 // GNEViewParent::Frames - methods
600 // ---------------------------------------------------------------------------
601 
603  inspectorFrame(nullptr),
604  selectorFrame(nullptr),
605  connectorFrame(nullptr),
606  TLSEditorFrame(nullptr),
607  additionalFrame(nullptr),
608  crossingFrame(nullptr),
609  TAZFrame(nullptr),
610  deleteFrame(nullptr),
611  polygonFrame(nullptr),
612  prohibitionFrame(nullptr),
613  createEdgeFrame(nullptr),
614  routeFrame(nullptr),
615  vehicleFrame(nullptr),
616  vehicleTypeFrame(nullptr),
617  stopFrame(nullptr),
618  personFrame(nullptr),
619  personTypeFrame(nullptr),
620  personPlanFrame(nullptr) {
621 }
622 
623 
624 void
626  inspectorFrame->hide();
627  selectorFrame->hide();
628  connectorFrame->hide();
629  TLSEditorFrame->hide();
631  crossingFrame->hide();
632  TAZFrame->hide();
633  deleteFrame->hide();
634  polygonFrame->hide();
639  routeFrame->hide();
640  vehicleFrame->hide();
642  stopFrame->hide();
644  personFrame->hide();
646 }
647 
648 
649 void
651  // set width in all frames
652  inspectorFrame->setFrameWidth(frameWidth);
653  selectorFrame->setFrameWidth(frameWidth);
654  connectorFrame->setFrameWidth(frameWidth);
655  TLSEditorFrame->setFrameWidth(frameWidth);
656  additionalFrame->setFrameWidth(frameWidth);
657  crossingFrame->setFrameWidth(frameWidth);
658  TAZFrame->setFrameWidth(frameWidth);
659  deleteFrame->setFrameWidth(frameWidth);
660  polygonFrame->setFrameWidth(frameWidth);
661  prohibitionFrame->setFrameWidth(frameWidth);
665  routeFrame->setFrameWidth(frameWidth);
666  vehicleFrame->setFrameWidth(frameWidth);
667  vehicleTypeFrame->setFrameWidth(frameWidth);
668  stopFrame->setFrameWidth(frameWidth);
669  personTypeFrame->setFrameWidth(frameWidth);
670  personFrame->setFrameWidth(frameWidth);
671  personPlanFrame->setFrameWidth(frameWidth);
672 }
673 
674 
675 bool
677  // check all frames
678  if (inspectorFrame->shown()) {
679  return true;
680  } else if (selectorFrame->shown()) {
681  return true;
682  } else if (connectorFrame->shown()) {
683  return true;
684  } else if (TLSEditorFrame->shown()) {
685  return true;
686  } else if (additionalFrame->shown()) {
687  return true;
688  } else if (crossingFrame->shown()) {
689  return true;
690  } else if (TAZFrame->shown()) {
691  return true;
692  } else if (deleteFrame->shown()) {
693  return true;
694  } else if (polygonFrame->shown()) {
695  return true;
696  } else if (prohibitionFrame->shown()) {
697  return true;
702  } else if (routeFrame->shown()) {
703  return true;
704  } else if (vehicleFrame->shown()) {
705  return true;
706  } else if (vehicleTypeFrame->shown()) {
707  return true;
708  } else if (stopFrame->shown()) {
709  return true;
710  } else if (personTypeFrame->shown()) {
711  return true;
712  } else if (personFrame->shown()) {
713  return true;
714  } else if (personPlanFrame->shown()) {
715  return true;
716  } else {
717  return false;
718  }
719 }
720 
721 
722 GNEFrame*
724  // check all frames
725  if (inspectorFrame->shown()) {
726  return inspectorFrame;
727  } else if (selectorFrame->shown()) {
728  return selectorFrame;
729  } else if (connectorFrame->shown()) {
730  return connectorFrame;
731  } else if (TLSEditorFrame->shown()) {
732  return TLSEditorFrame;
733  } else if (additionalFrame->shown()) {
734  return additionalFrame;
735  } else if (crossingFrame->shown()) {
736  return crossingFrame;
737  } else if (TAZFrame->shown()) {
738  return TAZFrame;
739  } else if (deleteFrame->shown()) {
740  return deleteFrame;
741  } else if (polygonFrame->shown()) {
742  return polygonFrame;
743  } else if (prohibitionFrame->shown()) {
744  return prohibitionFrame;
749  } else if (routeFrame->shown()) {
750  return routeFrame;
751  } else if (vehicleFrame->shown()) {
752  return vehicleFrame;
753  } else if (vehicleTypeFrame->shown()) {
754  return vehicleTypeFrame;
755  } else if (personTypeFrame->shown()) {
756  return personTypeFrame;
757  } else if (stopFrame->shown()) {
758  return stopFrame;
759  } else if (personFrame->shown()) {
760  return personFrame;
761  } else if (personPlanFrame->shown()) {
762  return personPlanFrame;
763  } else {
764  return nullptr;
765  }
766 }
767 
768 // ---------------------------------------------------------------------------
769 // GNEViewParent::ACChoosers - methods
770 // ---------------------------------------------------------------------------
771 
773  ACChooserJunction(nullptr),
774  ACChooserEdges(nullptr),
775  ACChooserVehicles(nullptr),
776  ACChooserRoutes(nullptr),
777  ACChooserStops(nullptr),
778  ACChooserTLS(nullptr),
779  ACChooserAdditional(nullptr),
780  ACChooserPOI(nullptr),
781  ACChooserPolygon(nullptr),
782  ACChooserProhibition(nullptr) {
783 }
784 
785 
787  // remove all dialogs if are active
788  if (ACChooserJunction) {
789  delete ACChooserJunction;
790  }
791  if (ACChooserEdges) {
792  delete ACChooserEdges;
793  }
794  if (ACChooserRoutes) {
795  delete ACChooserRoutes;
796  }
797  if (ACChooserStops) {
798  delete ACChooserStops;
799  }
800  if (ACChooserVehicles) {
801  delete ACChooserVehicles;
802  }
803  if (ACChooserTLS) {
804  delete ACChooserTLS;
805  }
806  if (ACChooserAdditional) {
807  delete ACChooserAdditional;
808  }
809  if (ACChooserPOI) {
810  delete ACChooserPOI;
811  }
812  if (ACChooserPolygon) {
813  delete ACChooserPolygon;
814  }
815  if (ACChooserProhibition) {
816  delete ACChooserProhibition;
817  }
818 }
819 
820 /****************************************************************************/
821 
Locate junction - button.
Definition: GUIAppEnum.h:307
const AttributeCarriers & getAttributeCarriers() const
retrieve all attribute carriers of Net
Definition: GNENet.cpp:1014
stop placed over a parking area (used in netedit)
std::vector< GNEJunction * > retrieveJunctions(bool onlySelected=false)
return all junctions
Definition: GNENet.cpp:1212
GNETAZFrame * getTAZFrame() const
get frame for GNE_NMODE_TAZ
GNEConnectorFrame * connectorFrame
frame for GNE_NMODE_CONNECT
GNEInspectorFrame * getInspectorFrame() const
get frame for GNE_NMODE_INSPECT
GNEApplicationWindow * myGNEAppWindows
pointer to GNEApplicationWindow
long onKeyPress(FXObject *o, FXSelector sel, void *data)
Called when user press a key.
void hideFramesArea()
hide frames area if all GNEFrames are hidden
Locate route - button.
Definition: GUIAppEnum.h:313
~GNEViewParent()
Destructor.
Frames myFrames
struct for frames
void hide()
hide delete frame
void hide()
hide TAZ frame
GNETLSEditorFrame * TLSEditorFrame
frame for GNE_NMODE_TLS
GNEVehicleFrame * vehicleFrame
frame for GNE_DMODE_VEHICLE
The main window of the Netedit.
a flow definitio nusing a from-to edges instead of a route (used by router)
void hide()
hide Frame
#define GUIDesignVerticalSeparator
vertical separator
Definition: GUIDesigns.h:340
const Polygons & getPolygons() const
Returns all polygons.
Locate stop - button.
Definition: GUIAppEnum.h:315
Locate addtional structure - button.
Definition: GUIAppEnum.h:321
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition: GUIDesigns.h:95
GNEVehicleTypeFrame * getVehicleTypeFrame() const
get frame for GNE_DMODE_VEHICLETYPE
a flow definition nusing a route instead of a from-to edges route (used in NETEDIT) ...
GNEAdditionalFrame * additionalFrame
frame for GNE_NMODE_ADDITIONAL
void destroyParentToolbarsGrips()
build toolbars grips
GNEProhibitionFrame * prohibitionFrame
frame for GNE_NMODE_PROHIBITION
GNEPersonFrame * getPersonFrame() const
get frame for GNE_DMODE_PERSON
bool isFrameShown() const
return true if at least there is a frame shown
GNEPersonFrame * personFrame
frame for GNE_DMODE_PERSON
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:41
void showFramesArea()
show frames area if at least a GNEFrame is showed
GNEStopFrame * getStopFrame() const
get frame for GNE_DMODE_STOP
stop placed over a lane (used in netedit)
long onCmdLocate(FXObject *, FXSelector, void *)
locator-callback
#define GUIDesignSplitter
Definition: GUIDesigns.h:347
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
Called when user releases a key.
Close simulation - ID.
Definition: GUIAppEnum.h:104
A NBNetBuilder extended by visualisation and editing capabilities.
Definition: GNENet.h:78
virtual long onKeyRelease(FXObject *o, FXSelector sel, void *data)
FXString gCurrentFolder
The folder used as last.
GNEVehicleTypeFrame * vehicleTypeFrame
frame for GNE_DMODE_VEHICLETYPE
GNEProhibitionFrame * getProhibitionFrame() const
get frame for GNE_NMODE_PROHIBITION
FXPopup * myLocatorPopup
The locator menu.
#define GUIDesignFrameArea
Definition: GUIDesigns.h:277
GNEPersonTypeFrame * getPersonTypeFrame() const
get frame for GNE_DMODE_PERSONTYPE
GNEPersonTypeFrame * personTypeFrame
frame for GNE_DMODE_PERSONTYPE
#define GUIDesignViewnArea
design for viewn area
Definition: GUIDesigns.h:280
GNEPersonPlanFrame * personPlanFrame
frame for GNE_DMODE_PERSONPLAN
GNEPolygonFrame * getPolygonFrame() const
get frame for GNE_NMODE_POLYGON
GNECreateEdgeFrame * createEdgeFrame
frame for GNE_NMODE_CREATEDGE
begin/end of the description of a route
A single child window which contains a view of the simulation area.
Definition: GNEViewParent.h:72
GNETLSEditorFrame * getTLSEditorFrame() const
get frame for GNE_NMODE_TLS
void hide()
hide crossing frame
ACChoosers myACChoosers
struct for ACChoosers
GNEAdditionalFrame * getAdditionalFrame() const
get frame for GNE_NMODE_ADDITIONAL
void hide()
hide inspector frame
GUIMainWindow * myParent
The parent window.
Locate polygons - button.
Definition: GUIAppEnum.h:325
stop placed over a charging station (used in netedit)
virtual long onKeyPress(FXObject *o, FXSelector sel, void *data)
keyboard functions
long onCmdUpdateFrameAreaWidth(FXObject *, FXSelector, void *)
Called when user change the splitter between FrameArea and ViewNet.
GNEStopFrame * stopFrame
frame for GNE_DMODE_STOP
std::string makeSnapshot(const std::string &destFile, const int width=-1, const int height=-1)
Takes a snapshots and writes it into the given file.
GNEDialogACChooser * ACChooserRoutes
pointer to ACChooser dialog used for locate routes
GNEDialogACChooser * ACChooserStops
pointer to ACChooser dialog used for locate stops
GNEFrame * getCurrentShownFrame() const
get current frame (note: it can be null)
ToolbarsGrip & getToolbarsGrip()
get ToolbarsGrip
GNEApplicationWindow * getGNEAppWindows() const
get GNE Application Windows
GNEVehicleFrame * getVehicleFrame() const
get frame for GNE_DMODE_VEHICLE
Locate vehicle - button.
Definition: GUIAppEnum.h:311
stop placed over a containerStop (used in netedit)
stop placed over a busStop (used in netedit)
GNEDialogACChooser * ACChooserProhibition
pointer to ACChooser dialog used for locate Prohibitions
GNEDialogACChooser * ACChooserEdges
pointer to ACChooser dialog used for locate edges
FXDEFMAP(GNEViewParent) GNEViewParentMap[]
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
GNESelectorFrame * getSelectorFrame() const
get frame for GNE_NMODE_SELECT
Locate edge - button.
Definition: GUIAppEnum.h:309
GNEPersonPlanFrame * getPersonPlanFrame() const
get frame for GNE_DMODE_PERSONFRAME
void setFrameWidth(int newWidth)
set width of GNEFrame
Definition: GNEFrame.cpp:126
Make snapshot - button.
Definition: GUIAppEnum.h:333
#define WRITE_DEBUG(msg)
Definition: MsgHandler.h:246
GNECreateEdgeFrame * getCreateEdgeFrame() const
get frame for GNE_NMODE_CREATEEDGE
GNEDialogACChooser * ACChooserPolygon
pointer to ACChooser dialog used for locate Polygons
GNECrossingFrame * crossingFrame
frame for GNE_NMODE_CROSSING
GNEPolygonFrame * polygonFrame
frame for GNE_NMODE_POLYGON
FXHorizontalFrame * myFramesArea
frame to hold GNEFrames
long onCmdClose(FXObject *, FXSelector, void *)
Called when the user hits the close button (x)
GNEFrame * getCurrentShownFrame() const
get current frame show
Locate TLS - button.
Definition: GUIAppEnum.h:319
GNEInspectorFrame * inspectorFrame
frame for GNE_NMODE_INSPECT
std::vector< GNEEdge * > retrieveEdges(bool onlySelected=false)
return all edges
Definition: GNENet.cpp:1151
FXMenuButton * myLocatorButton
The locator button.
std::vector< GNEAdditional * > retrieveAdditionals(bool onlySelected=false) const
return all additionals
Definition: GNENet.cpp:2145
GNEConnectorFrame * getConnectorFrame() const
get frame for GNE_NMODE_CONNECT
GNECrossingFrame * getCrossingFrame() const
get frame for GNE_NMODE_CROSSING
GUISUMOAbstractView * myView
The view.
GNERouteFrame * routeFrame
frame for GNE_DMODE_ROUTE
GNEDialogACChooser * ACChooserJunction
pointer to ACChooser dialog used for locate junctions
virtual void hide()
hide Frame
Definition: GNEFrame.cpp:117
GNEDeleteFrame * getDeleteFrame() const
get frame for GNE_NMODE_DELETE
GNENet * getNet() const
get the net object
Definition: GNEViewNet.cpp:927
description of a vehicle
void hideAllFrames()
hide all frames
GNEDialogACChooser * ACChooserVehicles
pointer to ACChooser dialog used for locate vehicles
GNEDialogACChooser * ACChooserTLS
pointer to ACChooser dialog used for locate TLSs
a single trip definition (used by router)
void hide()
hide Frame
GNERouteFrame * getRouteFrame() const
get frame for GNE_DMODE_ROUTE
void eraseACChooserDialog(GNEDialogACChooser *chooserDialog)
remove created chooser dialog
Locate poi - button.
Definition: GUIAppEnum.h:323
virtual void create()
create GUIGlChildWindow
GNESelectorFrame * selectorFrame
frame for GNE_NMODE_SELECT
GNETAZFrame * TAZFrame
frame for GNE_NMODE_TAZ
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
GNEDialogACChooser * ACChooserPOI
pointer to ACChooser dialog used for locate POIs
Size of frame area updated.
Definition: GUIAppEnum.h:568
void hide()
hide prohibition frame
GNEDeleteFrame * deleteFrame
frame for GNE_NMODE_DELETE
void removeGLChild(GUIGlChildWindow *child)
removes the given child window from the list
void setWidth(int frameWidth)
set new width in all frames
long onCmdMakeSnapshot(FXObject *sender, FXSelector, void *)
void hideFrames()
hide frames
void hide()
hide delete frame
GNEDialogACChooser * ACChooserAdditional
pointer to ACChooser dialog used for locate additional
const POIs & getPOIs() const
Returns all pois.