Eclipse SUMO - Simulation of Urban MObility
GUIApplicationWindow.cpp
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 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 /****************************************************************************/
22 // The main window of the SUMO-gui.
23 /****************************************************************************/
24 #include <config.h>
25 
26 #ifdef HAVE_VERSION_H
27 #include <version.h>
28 #endif
29 
30 #include <fxkeys.h>
31 
32 #include <guisim/GUILane.h>
33 #include <guisim/GUINet.h>
34 #include <microsim/MSEdgeControl.h>
38 #include <netload/NLHandler.h>
48 #include <utils/gui/div/GLHelper.h>
65 #include <utils/xml/XMLSubSys.h>
66 
67 #include "GUIApplicationWindow.h"
70 #include "GUIGlobals.h"
71 #include "GUILoadThread.h"
72 #include "GUIRunThread.h"
78 
79 
80 #define MIN_DRAW_DELAY 20
81 //#define HAVE_DANGEROUS_SOUNDS
82 
83 // ===========================================================================
84 // FOX-declarations
85 // ===========================================================================
86 FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[] = {
87  // close
91  FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GUIApplicationWindow::onCmdQuit),
92  // toolbar
108  // gaming
117  FXMAPFUNC(SEL_COMMAND, MID_NEW_MICROVIEW, GUIApplicationWindow::onCmdNewView),
118  // OSG
119 #ifdef HAVE_OSG
120  FXMAPFUNC(SEL_COMMAND, MID_NEW_OSGVIEW, GUIApplicationWindow::onCmdNewOSG),
121  FXMAPFUNC(SEL_UPDATE, MID_NEW_OSGVIEW, GUIApplicationWindow::onUpdAddView),
122 
123 #endif
124  // Time
131  FXMAPFUNC(SEL_COMMAND, MID_DELAY_INC, GUIApplicationWindow::onCmdDelayInc),
132  FXMAPFUNC(SEL_COMMAND, MID_DELAY_DEC, GUIApplicationWindow::onCmdDelayDec),
133  FXMAPFUNC(SEL_COMMAND, MID_SIMSAVE, GUIApplicationWindow::onCmdSaveState),
134  FXMAPFUNC(SEL_COMMAND, MID_SIMLOAD, GUIApplicationWindow::onCmdLoadState),
141  // Stats
145  // these functions do not assign shortcut keys to commands, but rather affect the button enable status upon other events (e.g. simulation loaded)
146  // since those events are invoked through pseudo key events (?), the same key shortcuts as in cmd must be supplied as well
174  FXMAPFUNC(SEL_COMMAND, MID_CHANGELOG, GUIApplicationWindow::onCmdChangelog),
175  FXMAPFUNC(SEL_COMMAND, MID_HOTKEYS, GUIApplicationWindow::onCmdHotkeys),
176  FXMAPFUNC(SEL_COMMAND, MID_TUTORIAL, GUIApplicationWindow::onCmdTutorial),
178  FXMAPFUNC(SEL_COMMAND, MID_FEEDBACK, GUIApplicationWindow::onCmdFeedback),
180  // forward requests to the active view
199  // languages
218  // keys
219  FXMAPFUNC(SEL_KEYPRESS, 0, GUIApplicationWindow::onKeyPress),
220  FXMAPFUNC(SEL_KEYRELEASE, 0, GUIApplicationWindow::onKeyRelease),
221  // clipboard
222  FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GUIApplicationWindow::onClipboardRequest),
223  // events
228 };
229 
230 // Object implementation
231 FXIMPLEMENT(GUIApplicationWindow, FXMainWindow, GUIApplicationWindowMap, ARRAYNUMBER(GUIApplicationWindowMap))
232 
233 // ===========================================================================
234 // static members
235 // ===========================================================================
236 
238 
239 // ===========================================================================
240 // member method definitions
241 // ===========================================================================
242 GUIApplicationWindow::GUIApplicationWindow(FXApp* a, const std::string& configPattern) :
243  GUIMainWindow(a),
244  myFileMenuRecentNetworks(new FXMenuPane(this)),
245  myFileMenuRecentConfigs(new FXMenuPane(this)),
246  myRecentNetworks(a, "networks"),
247  myRecentConfigs(a, "configs"),
248  myConfigPattern(configPattern),
249  myLastStepEventMillis(SysUtils::getCurrentMillis() - MIN_DRAW_DELAY) {
250  // init icons
252  // init Textures
254  // init cursors
256  // disable tooltips
257  a->setTooltipTime(1000000000);
258  a->setTooltipPause(1000000000);
259 }
260 
261 
264  return myRunThread;
265 }
266 
267 
268 void
270  // don't do this twice
271  if (hadDependentBuild) {
272  return;
273  }
274  hadDependentBuild = true;
275  setTarget(this);
276  setSelector(MID_WINDOW);
277  // build menu bar
278  myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBar);
280  new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
281  buildToolBars();
282  // build the thread - io
287  // build the status bar
288  myStatusbar = new FXStatusBar(this, GUIDesignStatusBar);
289  {
290  // build TraCi info
292  auto button = GUIDesigns::buildFXButton(myTraCiFrame, "TraCI", "", "", nullptr, this, MID_TRACI_STATUS, GUIDesignButtonStatusBarFixed);
293  button->setBackColor(FXRGBA(253, 255, 206, 255));
294  if (TraCIServer::getInstance() == nullptr) {
295  myTraCiFrame->hide();
296  }
297  // build geo coordiantes
298  myGeoFrame = new FXHorizontalFrame(myStatusbar, GUIDesignHorizontalFrameStatusBar);
299  myGeoCoordinate = GUIDesigns::buildFXLabel(myGeoFrame, TL("N/A"), "", TL("Original coordinate (before coordinate transformation in netconvert)"), nullptr, LAYOUT_CENTER_Y);
300  // build cartesian coordinates
302  myCartesianCoordinate = GUIDesigns::buildFXLabel(myCartesianFrame, TL("N/A"), "", TL("Network coordinate"), nullptr, LAYOUT_CENTER_Y);
303  // build buttons
306  myStatButtons.back()->hide();
308  myStatButtons.back()->hide();
309  }
310  // make the window a mdi-window
311  myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
312  myMDIClient = new FXMDIClient(myMainSplitter, GUIDesignSplitterMDI);
313  myMDIMenu = new FXMDIMenu(this, myMDIClient);
314  new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
315  new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
316  new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
317  new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
318  // build the message window
320  // fill menu and tool bar
321  fillMenuBar();
322  myToolBar6->hide();
323  myToolBar7->hide();
324  myToolBar9->hide();
325  myToolBar10->hide();
326  // build additional threads
327  myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent, isLibsumo);
329  // set the status bar
330  setStatusBarText(TL("Ready."));
331  // set the caption
332  setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
333  // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
334  myRunThread->start();
337 }
338 
339 
340 void
343  gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
344  FXMainWindow::create();
345  myMenuBarDrag->create();
346  myToolBarDrag1->create();
347  myToolBarDrag2->create();
348  myToolBarDrag3->create();
349  myToolBarDrag4->create();
350  myToolBarDrag5->create();
351  myToolBarDrag6->create();
352  myToolBarDrag7->create();
353  myFileMenu->create();
354  mySelectByPermissions->create();
355  myEditMenu->create();
356  mySettingsMenu->create();
357  myLocatorMenu->create();
358  myControlMenu->create();
359  myWindowMenu->create();
360  myLanguageMenu->create();
361  myHelpMenu->create();
362  FXint textWidth = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
363  myCartesianFrame->setWidth(textWidth);
364  myGeoFrame->setWidth(textWidth);
365  if (myTestFrame) {
366  myTestFrame->setWidth(textWidth);
367  }
368 
369  show(PLACEMENT_DEFAULT);
370  if (!OptionsCont::getOptions().isSet("window-size")) {
371  if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
372  maximize();
373  }
374  }
375  myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
376  myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
377  const std::string& onlineMaps = getApp()->reg().readStringEntry("gui", "onlineMaps", "");
378  for (const std::string& entry : StringTokenizer(onlineMaps, "\n").getVector()) {
379  const std::vector<std::string> split = StringTokenizer(entry, "\t").getVector();
380  if (split.size() == 2) {
381  myOnlineMaps[split[0]] = split[1];
382  }
383  }
384  if (myOnlineMaps.empty()) {
385  myOnlineMaps["GeoHack"] = "https://geohack.toolforge.org/geohack.php?params=%lat;%lon_scale:1000";
386  myOnlineMaps["Google Maps"] = "https://www.google.com/maps?ll=%lat,%lon&t=h&z=18";
387  myOnlineMaps["OSM"] = "https://www.openstreetmap.org/?mlat=%lat&mlon=%lon&zoom=18&layers=M";
388  }
390 }
391 
392 
395  myRunThread->join();
396  closeAllWindows();
397  // close icons
400  // delete visual
401  delete myGLVisual;
402  // delete some non-parented windows
403  delete myToolBarDrag1;
404  delete mySimDelayTarget;
405  // delete rest of elements
408  delete myRunThread;
409  delete myFileMenu;
410  delete myEditMenu;
411  delete mySelectByPermissions;
412  delete mySettingsMenu;
413  delete myLocatorMenu;
414  delete myControlMenu;
415  delete myLanguageMenu;
416  delete myWindowMenu;
417  delete myHelpMenu;
418  delete myLoadThread;
419 
420  while (!myEvents.empty()) {
421  // get the next event
422  GUIEvent* e = myEvents.top();
423  myEvents.pop();
424  delete e;
425  }
426  for (auto item : myHotkeyPress) {
427  delete item.second;
428  }
429  for (auto item : myHotkeyRelease) {
430  delete item.second;
431  }
432 }
433 
434 
435 void
437  FXMainWindow::detach();
438  myMenuBarDrag->detach();
439  myToolBarDrag1->detach();
440 }
441 
442 
443 void
444 GUIApplicationWindow::addToWindowsMenu(FXMenuPane* /*menuPane*/) {
445  // unused, implement in children
446 }
447 
448 
449 void
451  // build file menu
452  myFileMenu = new FXMenuPane(this);
455  TL("New Window"), "Ctrl+Shift+N", TL("Open a new sumo-gui window."),
456  nullptr, this, MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW);
457  new FXMenuSeparator(myFileMenu);
459  TL("&Open Simulation..."), "Ctrl+O", TL("Open a simulation (Configuration file)."),
462  TL("Open &Network..."), "Ctrl+N", TL("Open a network."),
465  TL("Open Shapes "), "Ctrl+P", TL("Load POIs and Polygons for visualization."),
468  TL("Open EdgeData "), "Ctrl+U", TL("Load edge related data for visualization."),
471  TL("&Reload"), "Ctrl+R", TL("Reloads the simulation / the network."),
474  TL("Quick-Reload"), "Ctrl+0", TL("Reloads the simulation (but not network)."),
476  new FXMenuSeparator(myFileMenu);
478  TL("Save Configuration"), "Ctrl+Shift+S", TL("Save current options as a configuration file."),
481  TL("Close"), "Ctrl+W", TL("Close the simulation."),
483  new FXMenuSeparator(myFileMenu);
484  // build recent files
487  new FXMenuSeparator(myFileMenu);
489  TL("&Quit"), "Ctrl+Q", TL("Quit the Application."),
490  nullptr, this, MID_HOTKEY_CTRL_Q_CLOSE);
491  // build edit menu
492  mySelectByPermissions = new FXMenuPane(this);
493  std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
494  for (const auto& vehicleClass : vehicleClasses) {
496  }
497  myEditMenu = new FXMenuPane(this);
500  TL("Edit Selected..."), "Ctrl+E", TL("Opens a dialog for editing the list of selected items."),
502  mySelectLanesMenuCascade = new FXMenuCascade(myEditMenu, TL("Select lanes which allow..."), GUIIconSubSys::getIcon(GUIIcon::FLAG), mySelectByPermissions);
503  mySelectLanesMenuCascade->setHelpText(TL("Opens a menu for selecting a vehicle class by which to selected lanes."));
504  new FXMenuSeparator(myEditMenu);
506  TL("Set Breakpoint"), "B", TL("Sets a breakpoint at the current simulation step"),
509  TL("Set Breakpoint with offset"), "Alt+B", TL("Sets a breakpoint at the current simulation step + offset configured in application settings"),
512  TL("Edit Breakpoints"), "Ctrl+B", TL("Opens a dialog for editing breakpoints."),
515  TL("Edit Visualisation"), "F9", TL("Opens a dialog for editing visualization settings."),
518  TL("Edit Viewport"), "Ctrl+I", TL("Opens a dialog for editing viewing area, zoom and rotation."),
520  new FXMenuSeparator(myEditMenu);
521  // add open in sumo options
522  myLoadAdditionalsInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load additionals in netedit"), TL("Load additionals in netedit."), this, MID_TOOLBAREDIT_LOADADDITIONALS);
523  myLoadAdditionalsInNetedit->setCheck(TRUE);
524  myLoadDemandInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load demand in netedit"), TL("Load demand in netedit."), this, MID_TOOLBAREDIT_LOADDEMAND);
525  myLoadDemandInNetedit->setCheck(FALSE);
527  TL("Open in netedit"), "Ctrl+T", TL("Opens current simulation in NETEDIT."),
529  // build settings menu
530  mySettingsMenu = new FXMenuPane(this);
531  GUIDesigns::buildFXMenuTitle(myMenuBar, TL("&Settings"), nullptr, mySettingsMenu);
533  TL("Application Settings"), "Ctrl+H", TL("Open a Dialog for Application Settings editing."),
535  myGamingModeCheckbox = new FXMenuCheck(mySettingsMenu,
536  TL("Gaming Mode\tCtrl+G\tToggle gaming mode on/off."),
539  TL("Full Screen Mode"), "Ctrl+F", TL("Toggle full screen mode on/off."),
541  // build Locate menu
542  myLocatorMenu = new FXMenuPane(this);
545  TL("&Junctions"), "Shift+J", TL("Open a dialog for locating a Junction."),
548  TL("&Edges"), "Shift+E", TL("Open a dialog for locating an Edge."),
551  TL("&Vehicles"), "Shift+V", TL("Open a dialog for locating a Vehicle."),
554  TL("&Persons"), "Shift+P", TL("Open a dialog for locating a Person."),
557  TL("&Container"), "Shift+C", TL("Open a dialog for locating a Container."),
560  TL("&TLS"), "Shift+T", TL("Open a dialog for locating a Traffic Light."),
563  TL("&Additional"), "Shift+A", TL("Open a dialog for locating an Additional Structure."),
566  TL("P&oI"), "Shift+O", TL("Open a dialog for locating a Point of Interest."),
569  TL("Po&lygon"), "Shift+L", TL("Open a dialog for locating a Polygon."),
571  new FXMenuSeparator(myLocatorMenu);
572  GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Internal Structures"), TL("Show internal junctions and streets in locator dialog."), this, MID_LISTINTERNAL);
573  FXMenuCheck* listParking = GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Parking Vehicles"), TL("Show parking vehicles in locator dialog."), this, MID_LISTPARKING);
574  listParking->setCheck(myListParking);
575  GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show vehicles outside the road network"), TL("Show vehicles that are teleporting or driving remote-controlled outside the road network in locator dialog."), this, MID_LISTTELEPORTING);
576  // build control menu
577  // the shortcut designator is not only at text in the submenu but also defines the real shortcut key assigned with it!
578  // secondary shortcuts (ctrl+A, ctrl+S, ctrl+D) are defined in GUIShortcutsSubSys::buildSUMOAccelerators
579  myControlMenu = new FXMenuPane(this);
580  GUIDesigns::buildFXMenuTitle(myMenuBar, TL("Simulation"), nullptr, myControlMenu);
582  TL("Run"), "A,space", TL("Start/ Resume the simulation."),
585  TLC("Simulation", "Stop"), "S,space", TL("Halt the simulation."),
588  TL("Step"), "D", TL("Perform one simulation step."),
591  TL("Delay+"), "PgUp", TL("Increase simulation step delay."), nullptr, this, MID_DELAY_INC);
593  TL("Delay-"), "PgDn", TL("Decrease simulation step delay."), nullptr, this, MID_DELAY_DEC);
595  TL("Save"), "", TL("Save the current simulation state to a file."),
598  TL("Load"), "", TL("Load simulation state for the current network from file."),
600  // build windows menu
601  myWindowMenu = new FXMenuPane(this);
602  GUIDesigns::buildFXMenuTitle(myMenuBar, TL("&Window"), nullptr, myWindowMenu);
603  GUIDesigns::buildFXMenuCommandShortcut(myWindowMenu, TL("Open new view"), "", TL("Open a new microscopic view."), GUIIconSubSys::getIcon(GUIIcon::MICROVIEW), this, MID_NEW_MICROVIEW);
604 #ifdef HAVE_OSG
605  GUIDesigns::buildFXMenuCommandShortcut(myWindowMenu, TL("Open new 3D view"), "", TL("Open a new 3D view."), GUIIconSubSys::getIcon(GUIIcon::OSGVIEW), this, MID_NEW_OSGVIEW);
606 #endif
608  TL("Tile &Horizontally"), "", TL("Tile the views horizontally."),
609  GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_HORI), myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
611  TL("Tile &Vertically"), "", TL("Tile the views vertically."),
612  GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_VERT), myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
614  TL("Cascade"), "", TL("Cascade the views."),
616  myMDIClient, FXMDIClient::ID_MDI_CASCADE);
618  TL("&Close"), "", TL("Close the selected view."),
619  nullptr, myMDIClient, FXMDIClient::ID_MDI_CLOSE);
620  FXMenuSeparator* sep2 = new FXMenuSeparator(myWindowMenu);
621  sep2->setTarget(myMDIClient);
622  sep2->setSelector(FXMDIClient::ID_MDI_ANY);
623  // for whatever reason, sonar complains in the next line that sep2 may leak, but fox does the cleanup
624  GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_1); // NOSONAR
625  GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_2);
626  GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_3);
627  GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_4);
628  GUIDesigns::buildFXMenuCommand(myWindowMenu, TL("&Others..."), nullptr, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
629 
630  new FXMenuSeparator(myWindowMenu);
631  GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Status Line"), TL("Toggle the Status Bar on/off."), myStatusbar, FXWindow::ID_TOGGLESHOWN);
632  GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Message Window"), TL("Toggle the Message Window on/off."), myMessageWindow, FXWindow::ID_TOGGLESHOWN);
633  GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Time"), TL("Toggle the Simulation Time on/off."), myToolBar3, FXWindow::ID_TOGGLESHOWN);
634  GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Delay"), TL("Toggle the Simulation Delay Entry on/off."), myToolBar4, FXWindow::ID_TOGGLESHOWN);
636 
637  new FXMenuSeparator(myWindowMenu);
639  TL("Clear Message Window"), "", TL("Clear the message window."),
641  // build windows menu
643  // build help menu
644  myHelpMenu = new FXMenuPane(this);
646  TL("&Help"),
647  nullptr, myHelpMenu);
648  GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Online Documentation"), "F1", TL("Open Online documentation."),
649  nullptr, this, MID_HOTKEY_F1_ONLINEDOCUMENTATION);
650  new FXMenuSeparator(myHelpMenu);
651  GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Changelog"), "", TL("Open Changelog."),
652  nullptr, this, MID_CHANGELOG);
653  GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Hotkeys"), "", TL("Open Hotkeys."),
654  nullptr, this, MID_HOTKEYS);
655  GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Tutorial"), "", TL("Open Tutorial."),
656  nullptr, this, MID_TUTORIAL);
657  GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Feedback"), "", TL("Open feedback dialog."),
658  nullptr, this, MID_FEEDBACK);
659  new FXMenuSeparator(myHelpMenu);
660  GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&About"), "F12", TL("About sumo-gui."),
662  // build SUMO Accelerators (hotkeys)
663  GUIShortcutsSubSys::buildAccelerators(getAccelTable(), this, true);
664 }
665 
666 
667 void
669  // file and simulation tool bar
670  {
671  myToolBarDrag1 = new FXToolBarShell(this, GUIDesignToolBar);
673  new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
674  // build file tools
675  new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen simulation\tOpen a simulation (Configuration file)."),
677  new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen network\tOpen a network."),
679  new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tReload\tReloads the simulation / the network."),
681  }
682  // simulation toolbar
683  {
684  myToolBarDrag2 = new FXToolBarShell(this, GUIDesignToolBar);
686  new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
687  // build simulation tools
688  new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tRun\tStart/Resume the loaded simulation."),
690  new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStop\tHalt the running simulation."),
692  new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStep\tPerform a single simulation step."),
694  }
695  // Simulation Step Display
696  {
697  myToolBarDrag3 = new FXToolBarShell(this, GUIDesignToolBar);
699  new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
700  new MFXButtonTooltip(myToolBar3, myStaticTooltipMenu, TL("Time:\tToggle between time formats\tToggle between seconds and hour:minute:seconds display."), nullptr, this, MID_TIME_TOGGLE, GUIDesignButtonToolbarText);
701 
702  myLCDLabel = new MFXLCDLabel(myToolBar3, myStaticTooltipMenu, 16, nullptr, 0, JUSTIFY_RIGHT);
706  myLCDLabel->setGroove(2);
707  myLCDLabel->setText("----------------");
708  }
709  // Simulation Delay
710  {
711  myToolBarDrag4 = new FXToolBarShell(this, GUIDesignToolBar);
713  new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
714  new MFXButtonTooltip(myToolBar4, myStaticTooltipMenu, TL("Delay (ms):\tDelay per simulated second\tDelay per simulated second. Click to toggle between the last two delay values."), nullptr, this, MID_DELAY_TOGGLE, GUIDesignButtonToolbarText);
715  // create spinner for delay
716  mySimDelay = 0;
717  mySimDelayTarget = new FXDataTarget(mySimDelay);
719  // create slider
720  mySimDelaySlider = new FXSlider(myToolBar4, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSlider);
721  mySimDelaySlider->setRange(0, 1000);
722  mySimDelaySlider->setHeadSize(10);
723  mySimDelaySlider->setIncrement(50);
724  mySimDelaySlider->setTickDelta(100);
725  mySimDelaySlider->setValue((int)mySimDelay);
726  //mySimDelayTarget->setNumberFormat(0);
727  //mySimDelayTarget->setIncrements(1, 10, 10);
728  mySimDelaySpinner->setIncrement(10);
729  mySimDelaySpinner->setRange(0, 10000);
730  mySimDelaySpinner->setValue(mySimDelay);
731  }
732  // Scale traffic (flows and incrementally loaded vehicles)
733  {
734  myToolBarDrag8 = new FXToolBarShell(this, GUIDesignToolBar);
736  new FXToolBarGrip(myToolBar8, myToolBar8, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
737  myScaleTrafficTooltip = new MFXLabelTooltip(myToolBar8, myStaticTooltipMenu, TL("Scale Traffic:"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
738  myScaleTrafficTooltip->setHelpText(TL("Scale traffic volume from running flows and from vehicles that are loaded incrementally from route files."));
740  myDemandScaleSpinner->setIncrement(0.5);
741  myDemandScaleSpinner->setRange(0, 1000);
742  myDemandScaleSpinner->setValue(1);
743  }
744  // Views
745  {
746  myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBar);
748  new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
749  // build view tools
750  new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new view") + std::string("\t") + TL("Open a new microscopic view.")).c_str(),
752 #ifdef HAVE_OSG
753  new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new 3D view") + std::string("\t") + TL("Open a new 3D view.")).c_str(),
755 #endif
756  }
758  {
759  // total waitingTime
760  myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBar);
762  new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
763  GUIDesigns::buildFXLabel(myToolBar6, TL("Waiting Time:"), "", TL("Time spent waiting accumulated for all vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
764  myWaitingTimeLabel = new MFXLCDLabel(myToolBar6, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
769  myWaitingTimeLabel->setText("-------------");
770  // idealistic time loss
771  myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBar);
773  new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
774  GUIDesigns::buildFXLabel(myToolBar7, TL("Time Loss:"), "", TL("Time lost due to being unable to drive with maximum speed for all vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
775  myTimeLossLabel = new MFXLCDLabel(myToolBar7, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
780  myTimeLossLabel->setText("-------------");
781  // total driving distance
782  myToolBarDrag9 = new FXToolBarShell(this, GUIDesignToolBar);
784  new FXToolBarGrip(myToolBar9, myToolBar9, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
785  GUIDesigns::buildFXLabel(myToolBar9, TL("Distance (km):"), "", TL("Total distance driven by DRT vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
786  myTotalDistanceLabel = new MFXLCDLabel(myToolBar9, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
791  myTotalDistanceLabel->setText("-------------");
792  // emergency vehicle counts
793  myToolBarDrag10 = new FXToolBarShell(this, GUIDesignToolBar);
795  new FXToolBarGrip(myToolBar10, myToolBar10, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
796  GUIDesigns::buildFXLabel(myToolBar10, TL("Emergency Vehicle waiting time:"), "", TL("Time spent waiting accumulated for emergency vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
797  myEmergencyVehicleLabel = new MFXLCDLabel(myToolBar10, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
802  myEmergencyVehicleLabel->setText("-------------");
803  }
804 }
805 
806 
807 void
808 GUIApplicationWindow::buildRecentNetworks(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentNetworks) {
809  // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
810  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_1);
811  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_2);
812  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_3);
813  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_4);
814  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_5);
815  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_6);
816  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_7);
817  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_8);
818  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_9);
819  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_10);
820  new FXMenuSeparator(fileMenuRecentNetworks); // NOSONAR, Fox does the cleanup
821  GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("Cl&ear Recent Networks"), nullptr, &myRecentNetworks, FXRecentFiles::ID_CLEAR);
822  GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("No Recent Networks"), nullptr, &myRecentNetworks, MFXRecentNetworks::ID_NOFILES);
823  // set target
824  myRecentNetworks.setTarget(this);
825  myRecentNetworks.setSelector(MID_RECENTFILE);
826  new FXMenuCascade(fileMenu, TL("Recent Networks"), nullptr, fileMenuRecentNetworks);
827 }
828 
829 
830 void
831 GUIApplicationWindow::buildRecentConfigs(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentConfigs) {
832  // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
833  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_1);
834  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_2);
835  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_3);
836  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_4);
837  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_5);
838  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_6);
839  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_7);
840  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_8);
841  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_9);
842  GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_10);
843  new FXMenuSeparator(fileMenuRecentConfigs); // NOSONAR, Fox does the cleanup
844  GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("Cl&ear Recent Configs"), nullptr, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
845  GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("No Recent Configs"), nullptr, &myRecentConfigs, MFXRecentNetworks::ID_NOFILES);
846  // set target
847  myRecentConfigs.setTarget(this);
848  myRecentConfigs.setSelector(MID_RECENTFILE);
849  new FXMenuCascade(fileMenu, TL("Recent Configs"), nullptr, fileMenuRecentConfigs);
850 }
851 
852 
853 long
854 GUIApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
856  getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
857  getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
858  getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
859  getApp()->reg().writeIntEntry("gui", "alternateSimDelay", (int)myAlternateSimDelay);
860  closeAllWindows();
861  getApp()->exit(0);
862  return 1;
863 }
864 
865 
866 long
867 GUIApplicationWindow::onCmdEditChosen(FXObject* menu, FXSelector, void*) {
868  FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
869  if (mc->getText() == StringUtils::replace(TL("Edit Selected..."), "&", "").c_str()) {
870  GUIDialog_GLChosenEditor* chooser =
872  chooser->create();
873  chooser->show();
874  } else {
876  const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
877  for (MSEdgeVector::const_iterator i = MSEdge::getAllEdges().begin(); i != MSEdge::getAllEdges().end(); ++i) {
878  const std::vector<MSLane*>& lanes = (*i)->getLanes();
879  for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
880  GUILane* lane = dynamic_cast<GUILane*>(*it);
881  assert(lane != 0);
882  if ((lane->getPermissions() & svc) != 0) {
883  gSelected.select(lane->getGlID());
884  }
885  }
886  }
887  if (myMDIClient->numChildren() > 0) {
888  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
889  if (w != nullptr) {
890  // color by selection
892  }
893  }
894  }
895  updateChildren();
896  }
897  return 1;
898 }
899 
900 
901 long
902 GUIApplicationWindow::onCmdEditBreakpoints(FXObject*, FXSelector, void*) {
903  if (myBreakpointDialog == nullptr) {
905  } else {
906  myBreakpointDialog->restore();
907  myBreakpointDialog->setFocus();
908  myBreakpointDialog->raise();
909  }
910  return 1;
911 }
912 
913 
914 long
915 GUIApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
916  if (!myGLWindows.empty()) {
917  myGLWindows[0]->getView()->showViewportEditor();
918  }
919  return 1;
920 }
921 
922 
923 long
924 GUIApplicationWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
925  if (!myGLWindows.empty()) {
926  myGLWindows[0]->getView()->showViewschemeEditor();
927  }
928  return 1;
929 }
930 
931 
932 long
933 GUIApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
934  MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html");
935  return 1;
936 }
937 
938 
939 long
940 GUIApplicationWindow::onCmdChangelog(FXObject*, FXSelector, void*) {
941  // update in every version
942  MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/ChangeLog.html");
943  return 1;
944 }
945 
946 
947 long
948 GUIApplicationWindow::onCmdHotkeys(FXObject*, FXSelector, void*) {
949  MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html#keyboard_shortcuts");
950  return 1;
951 }
952 
953 
954 long
955 GUIApplicationWindow::onCmdTutorial(FXObject*, FXSelector, void*) {
956  MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/Tutorials/index.html");
957  return 1;
958 }
959 
960 
961 long
962 GUIApplicationWindow::onCmdOpenInNetedit(FXObject*, FXSelector, void*) {
963  if (myGLWindows.empty()) {
964  return 1;
965  }
966  FXRegistry reg("SUMO netedit", "netedit");
967  reg.read();
968  const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
969  reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
970  reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
971  reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
972  reg.write();
973  std::string netedit = "netedit";
974  const char* sumoPath = getenv("SUMO_HOME");
975  if (sumoPath != nullptr) {
976  std::string newPath = std::string(sumoPath) + "/bin/netedit";
977  if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
978  netedit = "\"" + newPath + "\"";
979  }
980  }
981  // declare command for calling netedit using the viewport saved in registry
982  std::string cmd = netedit + " --registry-viewport";
983  // continue depending if we're loading only a network or the entire sumo config
984  if (myLoadAdditionalsInNetedit->shown()) {
985  cmd += " --sumocfg-file \"" + OptionsCont::getOptions().getString("configuration-file") + "\"";
986  // check if ignore additional or demand elements
987  if (myLoadAdditionalsInNetedit->getCheck() == FALSE) {
988  cmd += " --ignore.additionalelements";
989  }
990  if (myLoadDemandInNetedit->getCheck() == FALSE) {
991  cmd += " --ignore.routeelements";
992  }
993  } else {
994  cmd += " -s \"" + OptionsCont::getOptions().getString("net-file") + "\"";
995  }
996  // start in background
997 #ifndef WIN32
998  cmd = cmd + " &";
999 #else
1000  // see "help start" for the parameters
1001  cmd = "start /B \"\" " + cmd;
1002 #endif
1003  WRITE_MESSAGEF(TL("Running %."), cmd);
1004  // yay! fun with dangerous commands... Never use this over the internet
1006  return 1;
1007 }
1008 
1009 
1010 long
1011 GUIApplicationWindow::onCmdNewWindow(FXObject*, FXSelector, void*) {
1012  FXRegistry reg("SUMO sumo-gui", "sumo-gui");
1013  std::string sumo_gui = "sumo-gui";
1014  const char* sumoPath = getenv("SUMO_HOME");
1015  if (sumoPath != nullptr) {
1016  std::string newPath = std::string(sumoPath) + "/bin/sumo_gui";
1017  if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1018  sumo_gui = "\"" + newPath + "\"";
1019  }
1020  }
1021  std::string cmd = sumo_gui;
1022  // start in background
1023 #ifndef WIN32
1024  cmd = cmd + " &";
1025 #else
1026  // see "help start" for the parameters
1027  cmd = "start /B \"\" " + cmd;
1028 #endif
1029  WRITE_MESSAGEF(TL("Running %."), cmd);
1030  // yay! fun with dangerous commands... Never use this over the internet
1032  return 1;
1033 }
1034 
1035 
1036 long
1037 GUIApplicationWindow::onCmdOpenConfiguration(FXObject*, FXSelector, void*) {
1038  // get the new file name
1039  FXFileDialog opendialog(this, TL("Open Simulation Configuration"));
1040  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_SUMOCONFIG));
1041  opendialog.setSelectMode(SELECTFILE_EXISTING);
1042  opendialog.setPatternList(myConfigPattern.c_str());
1043  if (gCurrentFolder.length() != 0) {
1044  opendialog.setDirectory(gCurrentFolder);
1045  }
1046  if (opendialog.execute()) {
1047  gCurrentFolder = opendialog.getDirectory();
1048  std::string file = opendialog.getFilename().text();
1049  loadConfigOrNet(file);
1050  myRecentConfigs.appendFile(file.c_str());
1051  }
1052  return 1;
1053 }
1054 
1055 
1056 long
1057 GUIApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
1058  // get the new file name
1059  FXFileDialog opendialog(this, TL("Open Network"));
1060  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1061  opendialog.setSelectMode(SELECTFILE_EXISTING);
1062  opendialog.setPatternList("SUMO nets (*.net.xml,*.net.xml.gz)\nAll files (*)");
1063  if (gCurrentFolder.length() != 0) {
1064  opendialog.setDirectory(gCurrentFolder);
1065  }
1066  if (opendialog.execute()) {
1067  gCurrentFolder = opendialog.getDirectory();
1068  std::string file = opendialog.getFilename().text();
1069  loadConfigOrNet(file);
1070  myRecentNetworks.appendFile(file.c_str());
1071  }
1072  return 1;
1073 }
1074 
1075 
1076 long
1077 GUIApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
1078  // get the shape file name
1079  FXFileDialog opendialog(this, TL("Open Shapes"));
1080  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_SHAPES));
1081  opendialog.setSelectMode(SELECTFILE_EXISTING);
1082  opendialog.setPatternList("Additional files (*.xml,*.xml.gz)\nAll files (*)");
1083  if (gCurrentFolder.length() != 0) {
1084  opendialog.setDirectory(gCurrentFolder);
1085  }
1086  if (opendialog.execute()) {
1087  gCurrentFolder = opendialog.getDirectory();
1088  std::string file = opendialog.getFilename().text();
1089 
1090  dynamic_cast<GUIShapeContainer&>(myRunThread->getNet().getShapeContainer()).allowReplacement();
1091  NLShapeHandler handler(file, myRunThread->getNet().getShapeContainer());
1092  if (!XMLSubSys::runParser(handler, file, false)) {
1093  WRITE_MESSAGEF(TL("Loading of % failed."), file);
1094  }
1095  update();
1096  if (myMDIClient->numChildren() > 0) {
1097  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1098  if (w != nullptr) {
1099  w->getView()->update();
1100  }
1101  }
1102  }
1103  return 1;
1104 }
1105 
1106 
1107 long
1108 GUIApplicationWindow::onCmdOpenEdgeData(FXObject*, FXSelector, void*) {
1109  // get the shape file name
1110  FXFileDialog opendialog(this, TL("Open EdgeData"));
1111  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1112  opendialog.setSelectMode(SELECTFILE_EXISTING);
1113  opendialog.setPatternList("EdgeData files (*.xml,*.xml.gz)\nAll files (*)");
1114  if (gCurrentFolder.length() != 0) {
1115  opendialog.setDirectory(gCurrentFolder);
1116  }
1117  if (opendialog.execute()) {
1118  gCurrentFolder = opendialog.getDirectory();
1119  std::string file = opendialog.getFilename().text();
1120  if (!GUINet::getGUIInstance()->loadEdgeData(file)) {
1121  WRITE_MESSAGEF(TL("Loading of % failed."), file);
1122  }
1123  update();
1124  if (myMDIClient->numChildren() > 0) {
1125  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1126  if (w != nullptr) {
1127  w->getView()->update();
1128  }
1129  }
1130  }
1131  return 1;
1132 }
1133 
1134 
1135 long
1136 GUIApplicationWindow::onCmdReload(FXObject* sender, FXSelector sel, void*) {
1137  if (!myAmLoading && (sender == nullptr || TraCIServer::getInstance() == nullptr)) {
1139  getApp()->beginWaitCursor();
1140  myAmLoading = true;
1141  myIsReload = sender != nullptr || sel == 1;
1142  closeAllWindows();
1143  myLoadThread->start();
1144  if (sender == nullptr) {
1145  setStatusBarText(sel == 1 ? TL("Auto-Reloading.") : TL("TraCI-Loading."));
1146  } else {
1147  setStatusBarText(TL("Reloading."));
1148  }
1149  update();
1150  }
1151  return 1;
1152 }
1153 
1154 
1155 long
1156 GUIApplicationWindow::onCmdQuickReload(FXObject*, FXSelector, void*) {
1157  if (!myAmLoading) {
1158  setStatusBarText(TL("Quick-Reloading."));
1160  }
1161  return 1;
1162 }
1163 
1164 
1165 long
1166 GUIApplicationWindow::onCmdOpenRecent(FXObject* /* sender */, FXSelector, void* ptr) {
1167  if (myAmLoading) {
1168  myStatusbar->getStatusLine()->setText(TL("Already loading!"));
1169  return 1;
1170  }
1171  std::string file((const char*)ptr);
1172  loadConfigOrNet(file);
1173  return 1;
1174 }
1175 
1176 
1177 long
1178 GUIApplicationWindow::onCmdSaveConfig(FXObject*, FXSelector, void*) {
1179  // get the new file name
1180  FXFileDialog opendialog(this, TL("Save SUMO Configuration"));
1181  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1182  opendialog.setSelectMode(SELECTFILE_ANY);
1183  opendialog.setPatternList("Config (*.sumocfg)");
1184  if (gCurrentFolder.length() != 0) {
1185  opendialog.setDirectory(gCurrentFolder);
1186  }
1187  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1188  return 1;
1189  }
1190  std::string file = MFXUtils::assureExtension(opendialog.getFilename(),
1191  opendialog.getPatternText(opendialog.getCurrentPattern()).after('.').before(')')).text();
1192  std::ofstream out(StringUtils::transcodeToLocal(file));
1193  if (out.good()) {
1194  OptionsCont::getOptions().writeConfiguration(out, true, false, false, file, true);
1195  setStatusBarText(TLF("Configuration saved to %.", file));
1196  } else {
1197  setStatusBarText(TLF("Could not save configuration to %.", file));
1198  }
1199  out.close();
1200  return 1;
1201 }
1202 
1203 
1204 long
1205 GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
1206  closeAllWindows();
1207  return 1;
1208 }
1209 
1210 
1211 long
1212 GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
1213  sender->handle(this,
1214  myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1215  ptr);
1216  return 1;
1217 }
1218 
1219 
1220 long
1221 GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
1222  sender->handle(this,
1223  myAmLoading || myLoadThread->getFileName() == "" || TraCIServer::getInstance() != nullptr
1224  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1225  ptr);
1226  return 1;
1227 }
1228 
1229 
1230 long
1231 GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
1232  sender->handle(this,
1233  myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1234  ptr);
1235  return 1;
1236 }
1237 
1238 
1239 long
1240 GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
1241  sender->handle(this,
1243  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1244  ptr);
1245  return 1;
1246 }
1247 
1248 
1249 long
1250 GUIApplicationWindow::onCmdStart(FXObject*, FXSelector, void*) {
1251  // check whether a net was loaded successfully
1252  if (!myRunThread->networkAvailable()) {
1253  myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1254  return 1;
1255  }
1256  // check whether it was started before and paused;
1257  if (!myWasStarted) {
1258  myRunThread->begin();
1259  myWasStarted = true;
1260  }
1261  myRunThread->resume();
1262  getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1263  return 1;
1264 }
1265 
1266 
1267 long
1268 GUIApplicationWindow::onCmdStop(FXObject*, FXSelector, void*) {
1269  myRunThread->stop();
1270  getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1271  return 1;
1272 }
1273 
1274 
1275 long
1276 GUIApplicationWindow::onCmdStep(FXObject*, FXSelector, void*) {
1277  // check whether a net was loaded successfully
1278  if (!myRunThread->networkAvailable()) {
1279  myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1280  return 1;
1281  }
1282  // check whether it was started before and paused;
1283  if (!myWasStarted) {
1284  myRunThread->begin();
1285  myWasStarted = true;
1286  }
1288  return 1;
1289 }
1290 
1291 
1292 long
1293 GUIApplicationWindow::onCmdSaveState(FXObject*, FXSelector, void*) {
1294  // get the new file name
1295  FXFileDialog opendialog(this, TL("Save Simulation State"));
1296  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1297  opendialog.setSelectMode(SELECTFILE_ANY);
1298  opendialog.setPatternList("GZipped State (*.xml.gz)\nXML State (*.xml)");
1299  if (gCurrentFolder.length() != 0) {
1300  opendialog.setDirectory(gCurrentFolder);
1301  }
1302  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1303  return 1;
1304  }
1305 
1306  const std::string file = MFXUtils::assureExtension(opendialog.getFilename(),
1307  opendialog.getPatternText(opendialog.getCurrentPattern()).after('.').before(')')).text();
1308  MSStateHandler::saveState(file, MSNet::getInstance()->getCurrentTimeStep(), false);
1309  setStatusBarText(TLF("Simulation state saved to '%'.", file));
1310  return 1;
1311 }
1312 
1313 
1314 long
1315 GUIApplicationWindow::onCmdLoadState(FXObject*, FXSelector, void*) {
1316  // get the new file name
1317  FXFileDialog opendialog(this, TL("Load Simulation State"));
1318  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN));
1319  opendialog.setSelectMode(SELECTFILE_ANY);
1320  opendialog.setPatternList("GZipped State (*.xml.gz)\nXML State (*.xml)");
1321  if (gCurrentFolder.length() != 0) {
1322  opendialog.setDirectory(gCurrentFolder);
1323  }
1324  if (opendialog.execute() && FXStat::exists(opendialog.getFilename())) {
1325  gCurrentFolder = opendialog.getDirectory();
1326  const std::string file = opendialog.getFilename().text();
1327  try {
1328  MSNet::getInstance()->loadState(file, true);
1329  setStatusBarText(TLF("State loaded from '%'.", file));
1330  } catch (ProcessError& e) {
1331  setStatusBarText(TLF("Failed to load state from '%' (%).", file, e.what()));
1332  }
1333  }
1334  return 1;
1335 }
1336 
1337 
1338 long
1339 GUIApplicationWindow::onCmdTimeToggle(FXObject*, FXSelector, void*) {
1340  // toggle show time as HMS
1343  if (myRunThread->networkAvailable()) {
1345  }
1346  return 1;
1347 }
1348 
1349 
1350 long
1351 GUIApplicationWindow::onCmdDelayInc(FXObject*, FXSelector, void*) {
1352  if (mySimDelay < 10) {
1353  mySimDelay = 10;
1354  } else if (mySimDelay >= 20 && mySimDelay < 50) {
1355  mySimDelay = 50;
1356  } else if (mySimDelay >= 200 && mySimDelay < 500) {
1357  mySimDelay = 500;
1358  } else {
1359  mySimDelay *= 2;
1360  }
1361  if (mySimDelay > 1000) {
1362  // setting high delay by pressing the key too often is hard to recover from
1363  mySimDelay = 1000;
1364  }
1365  mySimDelaySlider->setValue((int)mySimDelay);
1366  mySimDelaySpinner->setValue(mySimDelay);
1367  return 1;
1368 }
1369 
1370 
1371 long
1372 GUIApplicationWindow::onCmdDelayDec(FXObject*, FXSelector, void*) {
1373  if (mySimDelay <= 10) {
1374  mySimDelay = 0;
1375  } else if (mySimDelay > 20 && mySimDelay <= 50) {
1376  mySimDelay = 20;
1377  } else if (mySimDelay > 200 && mySimDelay <= 500) {
1378  mySimDelay = 200;
1379  } else {
1380  mySimDelay /= 2;
1381  }
1382  mySimDelaySlider->setValue((int)mySimDelay);
1383  mySimDelaySpinner->setValue(mySimDelay);
1384  return 1;
1385 }
1386 
1387 
1388 long
1389 GUIApplicationWindow::onCmdDelayToggle(FXObject*, FXSelector, void*) {
1390  const double tmp = myAlternateSimDelay;
1392  mySimDelay = tmp;
1393  return 1;
1394 }
1395 
1396 
1397 long
1398 GUIApplicationWindow::onCmdDemandScale(FXObject*, FXSelector, void*) {
1399  if (myRunThread->networkAvailable()) {
1401  }
1402  return 1;
1403 }
1404 
1405 
1406 long
1407 GUIApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
1409  return 1;
1410 }
1411 
1412 
1413 long
1414 GUIApplicationWindow::onCmdBreakpoint(FXObject*, FXSelector, void*) {
1415  // see updateTimeLCD for the DELTA_T
1416  if (myRunThread->networkAvailable()) {
1418  }
1419  return 1;
1420 }
1421 
1422 
1423 long
1424 GUIApplicationWindow::onCmdBreakpointEarly(FXObject*, FXSelector, void*) {
1425  // see updateTimeLCD for the DELTA_T
1426  if (myRunThread->networkAvailable()) {
1428  }
1429  return 1;
1430 }
1431 
1432 
1433 long
1434 GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
1435  sender->handle(this,
1437  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1438  ptr);
1440  // bind start simulation with space key
1442  }
1443  return 1;
1444 }
1445 
1446 
1447 long
1448 GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
1449  sender->handle(this,
1451  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1452  ptr);
1454  // bind stop simulation with space key
1456  }
1457  return 1;
1458 }
1459 
1460 
1461 long
1462 GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
1463  sender->handle(this,
1465  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1466  ptr);
1467  return 1;
1468 }
1469 
1470 
1471 long
1472 GUIApplicationWindow::onUpdNeedsNetwork(FXObject* sender, FXSelector, void* ptr) {
1473  // check if there is a loaded network and gui isn't loading
1475  sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1476  // enable certain elements manually
1477  mySelectLanesMenuCascade->enable();
1478  myScaleTrafficTooltip->setTipText(TL("Scale number of vehicles in simulation"));
1479  } else {
1480  sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1481  // disable certain elements manually
1482  mySelectLanesMenuCascade->disable();
1483  myScaleTrafficTooltip->setTipText("");
1484  }
1485  return 1;
1486 }
1487 
1488 
1489 long
1490 GUIApplicationWindow::onUpdNeedsSumoConfig(FXObject* sender, FXSelector, void* ptr) {
1491  // check if there is a loaded network and gui isn't loading
1492  if (myRunThread->networkAvailable() && !myAmLoading && OptionsCont::getOptions().isSet("configuration-file")) {
1493  sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1494  sender->handle(this, FXSEL(SEL_COMMAND, ID_SHOW), ptr);
1495  myOpenInNetedit->setText(TL("Open sumo config in netedit"));
1496  } else {
1497  sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1498  sender->handle(this, FXSEL(SEL_COMMAND, ID_HIDE), ptr);
1499  myOpenInNetedit->setText(TL("Open network in netedit"));
1500  }
1501  return 1;
1502 }
1503 
1504 
1505 long
1506 GUIApplicationWindow::onUpdTraCIStatus(FXObject* /*sender*/, FXSelector, void* /*ptr*/) {
1507  if (TraCIServer::getInstance()) {
1508  myTraCiFrame->show();
1509  } else {
1510  myTraCiFrame->hide();
1511  }
1512  return 1;
1513 }
1514 
1515 
1516 long
1517 GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
1518  if (myMDIClient->numChildren() > 0) {
1519  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1520  if (w != nullptr) {
1521  w->onCmdLocate(nullptr, sel, nullptr);
1522  }
1523  }
1524  return 1;
1525 }
1526 
1527 
1528 long
1529 GUIApplicationWindow::onCmdShowStats(FXObject*, FXSelector, void*) {
1530  if (myMDIClient->numChildren() > 0) {
1531  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1533  }
1534  return 1;
1535 }
1536 
1537 
1538 long
1539 GUIApplicationWindow::onCmdAppSettings(FXObject*, FXSelector, void*) {
1541  d->create();
1542  d->show(PLACEMENT_OWNER);
1543  return 1;
1544 }
1545 
1546 
1547 long
1548 GUIApplicationWindow::onCmdGaming(FXObject*, FXSelector, void*) {
1549  if (myGLWindows.empty()) {
1550  return 1;
1551  }
1553  myGLWindows[0]->getView()->editVisualisationSettings()->gaming = myAmGaming;
1554  if (myAmGaming) {
1555  myGamingModeCheckbox->setCheck(TRUE);
1556  myMenuBar->hide();
1557  myStatusbar->hide();
1558  myToolBar1->hide();
1559  myToolBar2->hide();
1560  myToolBar4->hide();
1561  myToolBar5->hide();
1562  myToolBar6->show();
1563  myToolBar8->hide();
1564  myToolBar10->show();
1565  if (myTLSGame) {
1566  myToolBar7->show();
1567  } else {
1568  myToolBar9->show();
1569  }
1570  myMessageWindow->hide();
1576  } else {
1577  myGamingModeCheckbox->setCheck(FALSE);
1578  myMenuBar->show();
1579  myStatusbar->show();
1580  myToolBar1->show();
1581  myToolBar2->show();
1582  myToolBar4->show();
1583  myToolBar5->show();
1584  myToolBar6->hide();
1585  myToolBar7->hide();
1586  myToolBar8->show();
1587  myToolBar9->hide();
1588  myToolBar10->hide();
1589  myMessageWindow->show();
1591  }
1592  if (myMDIClient->numChildren() > 0) {
1593  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1594  if (w != nullptr) {
1596  }
1597  }
1598  update();
1599  return 1;
1600 }
1601 
1602 
1603 long
1605  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1606  if (w != nullptr) {
1607  // show or hide grid depending of myNetworkViewOptions.menuCheckToggleGrid
1610  } else {
1612  }
1613  w->getView()->update();
1614  }
1615  return 1;
1616 }
1617 
1618 
1619 long
1621  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1622  if (w != nullptr) {
1623  // toggle secondary shape visualization
1625  w->getView()->update();
1626  }
1627  return 1;
1628 }
1629 
1630 
1631 long
1632 GUIApplicationWindow::onCmdFullScreen(FXObject*, FXSelector, void*) {
1633  if (myGLWindows.empty()) {
1634  return 1;
1635  }
1637  if (myAmFullScreen) {
1638  getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1639  getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1640  getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1641  getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1642  maximize();
1643  setDecorations(DECOR_NONE);
1644  place(PLACEMENT_MAXIMIZED);
1645  myMenuBar->hide();
1646  myStatusbar->hide();
1647  myToolBar1->hide();
1648  myToolBar2->hide();
1649  myToolBar3->hide();
1650  myToolBar4->hide();
1651  myToolBar5->hide();
1652  myToolBar6->hide();
1653  myToolBar7->hide();
1654  myToolBar8->hide();
1655  myMessageWindow->hide();
1656  if (myMDIClient->numChildren() > 0) {
1657  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1658  if (w != nullptr) {
1659  w->setToolBarVisibility(false);
1660  }
1661  }
1662  update();
1663  } else {
1664  place(PLACEMENT_VISIBLE);
1665  setDecorations(DECOR_ALL);
1666  restore();
1667  myToolBar3->show();
1669  onCmdGaming(nullptr, 0, nullptr);
1670  setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
1671  setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1672  setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
1673  setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
1674  }
1675  return 1;
1676 }
1677 
1678 
1679 long
1680 GUIApplicationWindow::onCmdListInternal(FXObject*, FXSelector, void*) {
1682  return 1;
1683 }
1684 
1685 
1686 long
1687 GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) {
1689  return 1;
1690 }
1691 
1692 long
1693 GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) {
1695  return 1;
1696 }
1697 
1698 
1699 long
1700 GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) {
1702  return 1;
1703 }
1704 
1705 
1706 #ifdef HAVE_OSG
1707 long
1708 GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1710  return 1;
1711 }
1712 #endif
1713 
1714 
1715 long
1716 GUIApplicationWindow::onCmdFeedback(FXObject*, FXSelector, void*) {
1717  // create and open feedback dialog
1718  GUIDialog_Feedback* feedback = new GUIDialog_Feedback(this);
1719  feedback->create();
1720  feedback->show(PLACEMENT_OWNER);
1721  return 1;
1722 }
1723 
1724 
1725 long
1726 GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
1727  GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this);
1728  about->create();
1729  about->show(PLACEMENT_OWNER);
1730  return 1;
1731 }
1732 
1733 
1734 long
1735 GUIApplicationWindow::onCmdHallOfFame(FXObject*, FXSelector, void*) {
1736  GUIDialog_HallOfFame* hall = new GUIDialog_HallOfFame(this);
1737  hall->create();
1738  hall->show(PLACEMENT_OWNER);
1739  return 1;
1740 }
1741 
1742 
1743 long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1744  FXEvent* event = (FXEvent*)ptr;
1745  FXString string = GUIUserIO::clipped.c_str();
1746  setDNDData(FROM_CLIPBOARD, event->target, string);
1747  return 1;
1748 }
1749 
1750 
1751 long
1752 GUIApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
1753  eventOccurred();
1754  return 1;
1755 }
1756 
1757 
1758 long
1759 GUIApplicationWindow::onRunThreadEvent(FXObject*, FXSelector, void*) {
1760  eventOccurred();
1761  return 1;
1762 }
1763 
1764 
1765 void
1767  while (!myEvents.empty()) {
1768  // get the next event
1769  GUIEvent* e = myEvents.top();
1770  myEvents.pop();
1771  // process
1772  switch (e->getOwnType()) {
1775  setFocus();
1776  break;
1778  if (myRunThread->networkAvailable()) { // avoid race-condition related crash if reload was pressed
1780  }
1781  break;
1789  break;
1790  case GUIEventType::ADD_VIEW: {
1791  GUIEvent_AddView* ave = dynamic_cast<GUIEvent_AddView*>(e);
1793  if (ave->getSchemeName() != "") {
1794  MFXComboBoxIcon* sCombo = v->getColoringSchemesCombo();
1795  int index = sCombo->findItem(ave->getSchemeName().c_str());
1796  if (index >= 0) {
1797  sCombo->setCurrentItem(index);
1798  }
1799  v->setColorScheme(ave->getSchemeName());
1800  }
1801  break;
1802  }
1803  case GUIEventType::CLOSE_VIEW: {
1804  GUIEvent_CloseView* ave = dynamic_cast<GUIEvent_CloseView*>(e);
1805  removeViewByID(ave->getCaption());
1806  break;
1807  }
1810  break;
1811  default:
1812  break;
1813  }
1814  delete e;
1815  }
1816  myToolBar2->forceRefresh();
1817  myToolBar3->forceRefresh();
1818 }
1819 
1820 
1821 void
1823  myAmLoading = false;
1825  // check whether the loading was successfull
1826  if (ec->myNet == nullptr) {
1827  // report failure
1828  setStatusBarText(TLF("Loading of '%' failed!", ec->myFile));
1829  if (GUIGlobals::gQuitOnEnd) {
1830  closeAllWindows();
1831  getApp()->exit(1);
1832  }
1833  } else {
1834  // initialise simulation thread
1835  if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1836  if (GUIGlobals::gQuitOnEnd) {
1837  closeAllWindows();
1838  getApp()->exit(1);
1839  }
1840  } else {
1841  // report success
1842  setStatusBarText(TLF("'%' loaded.", ec->myFile));
1844  myWasStarted = false;
1845  myHaveNotifiedAboutSimEnd = false;
1846  // initialise views
1847  myViewNumber = 0;
1849  // check/record settings file modification time
1850  long long mTime = myGuiSettingsFileMTime;
1851  if (ec->mySettingsFiles.size() > 0) {
1852  for (std::string fname : ec->mySettingsFiles) {
1853  mTime = MAX2(mTime, SysUtils::getModifiedTime(fname));
1854  }
1855  }
1856  // always reload if settings were modified or to restore multiple views
1857  if (!myIsReload) {
1859  }
1860  if (ec->mySettingsFiles.size() > 0 && (!myIsReload || myGuiSettingsFileMTime < mTime || ec->mySettingsFiles.size() > 1)) {
1861  // open a view for each file and apply settings
1862  for (std::string fname : ec->mySettingsFiles) {
1863  GUISettingsHandler settings(fname);
1864  GUISUMOViewParent::ViewType vt = defaultType;
1865  if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
1867  }
1868  if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
1870  }
1871  GUISUMOAbstractView* view = openNewView(vt);
1872  if (view == nullptr) {
1873  break;
1874  }
1875  if (settings.getSettingName() != "") {
1876  view->setColorScheme(settings.getSettingName());
1877  MFXComboBoxIcon* sCombo = view->getColoringSchemesCombo();
1878  int index = sCombo->findItem(settings.getSettingName().c_str());
1879  if (index >= 0) {
1880  sCombo->setCurrentItem(index);
1881  }
1882  }
1883  view->addDecals(settings.getDecals());
1884  settings.applyViewport(view);
1885  settings.setSnapshots(view);
1886  if (settings.getDelay() > 0.) {
1887  mySimDelay = settings.getDelay();
1888  }
1889  if (settings.getBreakpoints().size() > 0) {
1890  myRunThread->getBreakpointLock().lock();
1891  myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
1892  myRunThread->getBreakpointLock().unlock();
1893  }
1894  myJamSounds = settings.getEventDistribution("jam");
1895  myCollisionSounds = settings.getEventDistribution("collision");
1896  if (settings.getJamSoundTime() > 0) {
1897  myJamSoundTime = settings.getJamSoundTime();
1898  }
1899  }
1900  } else {
1901  openNewView(defaultType);
1902  }
1903  myGuiSettingsFileMTime = mTime;
1904  if (!OptionsCont::getOptions().isDefault("delay")) {
1905  setDelay(OptionsCont::getOptions().getFloat("delay"));
1906  mySimDelaySlider->setValue((int)mySimDelay);
1907  mySimDelaySpinner->setValue(mySimDelay);
1908  }
1909  if (!OptionsCont::getOptions().isDefault("breakpoints") && !myIsReload) {
1910  std::vector<SUMOTime> breakpoints;
1911  for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
1912  SUMOTime t = string2time(val);
1913  // round down to nearest reachable time step
1914  t -= t % DELTA_T;
1915  breakpoints.push_back(t);
1916  }
1917  std::sort(breakpoints.begin(), breakpoints.end());
1918  myRunThread->getBreakpointLock().lock();
1919  myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1920  myRunThread->getBreakpointLock().unlock();
1921  }
1922  myTLSGame = OptionsCont::getOptions().getString("game.mode") == "tls";
1923  if (OptionsCont::getOptions().getBool("game")) {
1924  if (myTLSGame) {
1925  setTitle("SUMO Interactive Traffic Light");
1926  } else {
1927  setTitle("SUMO Interactive Demand-Responsive-Transport");
1928  }
1929  onCmdGaming(nullptr, 0, nullptr);
1930  } else {
1931  // set simulation name on the caption
1932  setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str()));
1933  }
1934  if (ec->myViewportFromRegistry) {
1935  Position off;
1936  off.set(getApp()->reg().readRealEntry("viewport", "x"),
1937  getApp()->reg().readRealEntry("viewport", "y"),
1938  getApp()->reg().readRealEntry("viewport", "z"));
1939  Position p(off.x(), off.y(), 0);
1940  GUISUMOAbstractView* view = myGLWindows[0]->getView();
1941  view->setViewportFromToRot(off, p, 0);
1942  }
1943  // set simulation step begin information
1944  myLCDLabel->setText("----------------");
1945  for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
1946  (*it)->setText("-");
1947  }
1948  // initialize scale from options unless already set in the UI
1949  if (myDemandScaleSpinner->getValue() == 1 || !OptionsCont::getOptions().isDefault("scale")) {
1950  myDemandScaleSpinner->setValue(OptionsCont::getOptions().getFloat("scale"));
1951  }
1953  }
1954  }
1955  getApp()->endWaitCursor();
1956  // start if wished
1957  if (GUIGlobals::gRunAfterLoad && ec->myNet != nullptr && myRunThread->simulationIsStartable()) {
1958  onCmdStart(nullptr, 0, nullptr);
1959  }
1960  update();
1961 }
1962 
1963 
1964 void
1966 #ifdef WIN32
1967  long t = SysUtils::getCurrentMillis();
1968  // only skip if the simulation is running
1969  if (t - myLastStepEventMillis < MIN_DRAW_DELAY && myRunThread->simulationIsStopable()) {
1970  // do not try to redraw with more than 50FPS (#6371)
1971  return;
1972  }
1974 #endif
1976  const int running = myRunThread->getNet().getVehicleControl().getRunningVehicleNo();
1977  const int backlog = myRunThread->getNet().getInsertionControl().getWaitingVehicleNo();
1978  if (backlog > running) {
1979  if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::GREENVEHICLE)) {
1981  }
1982  } else {
1983  if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::YELLOWVEHICLE)) {
1985  }
1986  }
1987  myStatButtons.front()->setText(toString(running).c_str());
1988  if (myRunThread->getNet().hasPersons()) {
1989  if (!myStatButtons[1]->shown()) {
1990  myStatButtons[1]->show();
1991  }
1993  }
1994  if (myRunThread->getNet().hasContainers()) {
1995  if (!myStatButtons[2]->shown()) {
1996  myStatButtons[2]->show();
1997  }
1999  }
2000  if (myAmGaming) {
2001  if (myTLSGame) {
2003  } else {
2005  }
2006  }
2008  getApp()->forceRefresh(); // restores keyboard focus
2009  }
2010  updateChildren();
2011  update();
2012 }
2013 
2014 
2015 void
2017  GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
2019  setStatusBarText(ec->getMsg());
2020  } else {
2021  myMessageWindow->appendMsg(ec->getOwnType(), ec->getMsg());
2022  }
2023 }
2024 
2025 
2026 void
2028  GUIEvent_SimulationEnded* ec = static_cast<GUIEvent_SimulationEnded*>(e);
2029  onCmdStop(nullptr, 0, nullptr);
2030  if (ec->getReason() == MSNet::SIMSTATE_LOADING) {
2031  onCmdReload(nullptr, 0, nullptr);
2032  } else if (GUIGlobals::gQuitOnEnd) {
2033  closeAllWindows();
2034  getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
2035  } else if (GUIGlobals::gDemoAutoReload) {
2036  onCmdReload(nullptr, 1, nullptr);
2037  } else if (!myHaveNotifiedAboutSimEnd) {
2038  // GUIRunThread::deleteSim() triggers the final message to the log file
2039  // (this will never reach the GUI but we cannot use WRITE_MESSAGE here
2040  // to avoid a duplicate log entry)
2042  TLF("Simulation ended at time: %. (%)",
2044  // build the text
2045  const std::string text = "Simulation ended at time: " + time2string(ec->getTimeStep()) +
2046  ".\nReason: " + MSNet::getStateMessage(ec->getReason()) +
2047  "\nDo you want to close all open files and views?";
2048  FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, TL("Simulation ended"), "%s", text.c_str());
2049  if (answer == 1) { //1:yes, 2:no, 4:esc
2050  closeAllWindows();
2051  } else {
2053  updateChildren();
2054  update();
2055  }
2057  }
2058 }
2059 
2060 
2061 void
2066 #ifdef HAVE_DANGEROUS_SOUNDS // disable user-configurable command execution for public build
2067  if (myJamSounds.getOverallProb() > 0) {
2068  // play honking sound if some vehicle is waiting too long
2069  for (; it != end; ++it) {
2070  // XXX use impatience instead of waiting time ?
2071  if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
2072  const std::string cmd = myJamSounds.get(&myGamingRNG);
2073  if (cmd != "") {
2074  // yay! fun with dangerous commands... Never use this over the internet
2076  // one sound per simulation step is enough
2077  break;
2078  }
2079  }
2080  }
2081  }
2082  if (myCollisionSounds.getOverallProb() > 0) {
2083  int collisions = MSNet::getInstance()->getVehicleControl().getCollisionCount();
2084  if (myPreviousCollisionNumber != collisions) {
2085  const std::string cmd = myCollisionSounds.get(&myGamingRNG);
2086  if (cmd != "") {
2087  // yay! fun with dangerous commands... Never use this over the internet
2089  }
2090  myPreviousCollisionNumber = collisions;
2091  }
2092  }
2093 #endif
2094  // update performance indicators
2095  for (it = vc.loadedVehBegin(); it != end; ++it) {
2096  const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2097  assert(veh != 0);
2098  if (veh->isOnRoad() && !veh->isStopped()) {
2099  const double vmax = veh->getLane()->getVehicleMaxSpeed(veh);
2100  if (veh->getSpeed() < SUMO_const_haltingSpeed) {
2102  if (veh->getVClass() == SVC_EMERGENCY) {
2104  }
2105  }
2106  myTimeLoss += TIME2STEPS(TS * (vmax - veh->getSpeed()) / vmax); // may be negative with speedFactor > 1
2107  }
2108 
2109  }
2113 }
2114 
2115 
2116 void
2118  // update performance indicators
2122 
2125  for (auto it = vc.loadedVehBegin(); it != end; ++it) {
2126  const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2127  assert(veh != 0);
2128  if (veh->isOnRoad() && !veh->isStopped()) {
2129  myTotalDistance += SPEED2DIST(veh->getSpeed());
2130  }
2131  }
2133 }
2134 
2135 
2136 void
2137 GUIApplicationWindow::loadConfigOrNet(const std::string& file) {
2138  if (!myAmLoading) {
2140  getApp()->beginWaitCursor();
2141  myAmLoading = true;
2142  myIsReload = false;
2143  closeAllWindows();
2144  gSchemeStorage.saveViewport(0, 0, -1, 0); // recenter view
2146  setStatusBarText(TLF("Loading '%'.", file));
2147  update();
2148  }
2149 }
2150 
2151 
2154  if (!myRunThread->networkAvailable()) {
2155  myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
2156  return nullptr;
2157  }
2158  GUISUMOAbstractView* oldView = nullptr;
2159  if (myMDIClient->numChildren() > 0) {
2160  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2161  if (w != nullptr) {
2162  oldView = w->getView();
2163  }
2164  }
2165  if (caption == "") {
2166  caption = "View #" + toString(myViewNumber++);
2167  }
2168  FXuint opts = MDI_TRACKING;
2169  GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
2170  this, GUIIconSubSys::getIcon(GUIIcon::SUMO_MINI), opts, 10, 10, 200, 100);
2172  if (oldView != nullptr) {
2173  // copy viewport
2174  oldView->copyViewportTo(v);
2175  }
2176  w->create();
2177  if (myMDIClient->numChildren() == 1) {
2178  w->maximize();
2179  } else {
2180  myMDIClient->vertical(true);
2181  }
2182  myMDIClient->setActiveChild(w);
2183 
2184  return v;
2185 }
2186 
2187 
2188 FXGLCanvas*
2190  if (myMDIClient->numChildren() == 0) {
2191  return nullptr;
2192  }
2193  GUISUMOViewParent* share_tmp1 =
2194  static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
2195  return share_tmp1->getBuildGLCanvas();
2196 }
2197 
2198 
2199 void
2201  myTrackerLock.lock();
2202  myLCDLabel->setText("----------------");
2203  for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2204  (*it)->setText("-");
2205  if (it != myStatButtons.begin()) {
2206  (*it)->hide();
2207  }
2208  }
2209  // delete the simulation
2211  // reset the caption
2212  setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
2213  // remove trackers and other external windows (must be delayed until deleteSim)
2214  while (!myGLWindows.empty()) {
2215  delete myGLWindows.front();
2216  }
2217  // make a copy because deleting modifyes the vector;
2218  std::vector<FXMainWindow*> trackerWindows = myTrackerWindows;
2219  for (FXMainWindow* const window : trackerWindows) {
2220  delete window;
2221  }
2222  myTrackerWindows.clear();
2223  // clear selected items
2224  gSelected.clear();
2225  // add a separator to the log
2227  myTrackerLock.unlock();
2228  // remove coordinate information
2229  myGeoCoordinate->setText(TL("N/A"));
2230  myCartesianCoordinate->setText(TL("N/A"));
2231  if (myTestCoordinate) {
2232  myTestCoordinate->setText(TL("N/A"));
2233  }
2234  //
2237  update();
2238 }
2239 
2240 
2241 FXCursor*
2243  return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
2244 }
2245 
2246 
2247 SUMOTime
2250 }
2251 
2252 
2253 double
2256 }
2257 
2258 
2259 void
2261  loadConfigOrNet("");
2262  if (wait) {
2263  while (myAmLoading) {
2264  myRunThread->sleep(50);
2265  }
2266  }
2267 }
2268 
2269 
2270 void
2271 GUIApplicationWindow::setStatusBarText(const std::string& text) {
2272  myStatusbar->getStatusLine()->setText(text.c_str());
2273  myStatusbar->getStatusLine()->setNormalText(text.c_str());
2274 }
2275 
2276 
2277 void
2279  myRecentNetworks.appendFile(f);
2280 }
2281 
2282 
2283 void
2285  myRecentConfigs.appendFile(f);
2286 }
2287 
2288 
2289 void
2291  if (myShowTimeAsHMS) {
2292  myLCDLabel->setToolTipText("HH:MM:SS");
2293  if (myAmGaming) {
2294  myWaitingTimeLabel->setToolTipText("HH:MM:SS");
2295  myTimeLossLabel->setToolTipText("HH:MM:SS");
2297  }
2298  } else {
2299  myLCDLabel->setToolTipText(TL("seconds"));
2300  if (myAmGaming) {
2301  myWaitingTimeLabel->setToolTipText(TL("seconds"));
2302  myTimeLossLabel->setToolTipText(TL("seconds"));
2304  }
2305  }
2306 }
2307 
2308 
2309 void
2311  time -= DELTA_T; // synchronize displayed time with netstate output
2312  if (time < 0) {
2313  myLCDLabel->setText("----------------");
2314  return;
2315  }
2316  if (myAmGaming) {
2317  // show time counting backwards
2318  time = myRunThread->getSimEndTime() - time;
2319  }
2320  std::ostringstream str;
2321  str << std::setfill('0');
2322  const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0;
2323  if (myShowTimeAsHMS) {
2324  SUMOTime day = time / 86400000;
2325  if (day > 0) {
2326  str << day << '-';
2327  time %= 86400000;
2328  }
2329  str << std::setw(2);
2330  str << time / 3600000 << '-';
2331  time %= 3600000;
2332  str << std::setw(2) << time / 60000 << '-';
2333  time %= 60000;
2334  }
2335  str << std::setw(2) << time / 1000;
2336  if (!hideFraction) {
2337  str << '.' << std::setw(3) << time % 1000;
2338  }
2339  myLCDLabel->setText(str.str().c_str());
2340 }
2341 
2342 
2343 void
2345  if (press != nullptr) {
2346  myHotkeyPress[key] = press;
2347  }
2348  if (release != nullptr) {
2349  myHotkeyRelease[key] = release;
2350  }
2351 }
2352 
2353 
2354 long
2355 GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* ptr) {
2356  FXEvent* e = (FXEvent*) ptr;
2357  // PgUp and PgDown switch between widgets by default and binding them via menu shortcuts does not work reliably
2358  // so we must intercept them before FXMainWindow can handle it
2359  if (e->code == FX::KEY_Page_Up) {
2360  onCmdDelayInc(nullptr, 0, nullptr);
2361  } else if (e->code == FX::KEY_Page_Down) {
2362  onCmdDelayDec(nullptr, 0, nullptr);
2363  } else {
2364  // disable hotkeys without modifiers for the game
2365  const bool ignoreSimple = myAmGaming && (e->state & (CONTROLMASK | SHIFTMASK | ALTMASK)) == 0;
2366  const long handled = ignoreSimple ? 0 : FXMainWindow::onKeyPress(o, sel, ptr);
2367  if (handled == 0 && myMDIClient->numChildren() > 0) {
2368  auto it = myHotkeyPress.find(e->code);
2369  if (it != myHotkeyPress.end()) {
2370  it->second->execute(SIMSTEP);
2371  }
2372  if (!ignoreSimple) {
2373  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2374  if (w != nullptr) {
2375  w->onKeyPress(nullptr, sel, ptr);
2376  }
2377  }
2378  }
2379  }
2380  return 0;
2381 }
2382 
2383 
2384 long
2385 GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* ptr) {
2386  const long handled = FXMainWindow::onKeyRelease(o, sel, ptr);
2387  if (handled == 0 && myMDIClient->numChildren() > 0) {
2388  FXEvent* e = (FXEvent*) ptr;
2389  auto it = myHotkeyRelease.find(e->code);
2390  if (it != myHotkeyRelease.end()) {
2391  it->second->execute(SIMSTEP);
2392  }
2393  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2394  if (w != nullptr) {
2395  w->onKeyRelease(nullptr, sel, ptr);
2396  }
2397  }
2398  return 0;
2399 }
2400 
2401 
2402 double
2404  return mySimDelay;
2405 }
2406 
2407 
2408 void
2410  mySimDelay = delay;
2411 }
2412 
2413 
2414 void
2416  myEventMutex.lock();
2417  myEvents.push_back(event);
2419  //myEventCondition.wait(myEventMutex);
2420  myEventMutex.unlock();
2421 }
2422 
2423 
2424 void
2425 GUIApplicationWindow::setBreakpoints(const std::vector<SUMOTime>& breakpoints) {
2426  if (myRunThread != nullptr) {
2427  myRunThread->getBreakpointLock().lock();
2428  myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
2429  myRunThread->getBreakpointLock().unlock();
2431  }
2432 }
2433 
2434 
2435 void
2437  std::vector<SUMOTime> breakpoints = retrieveBreakpoints();
2438  if (std::find(breakpoints.begin(), breakpoints.end(), time) == breakpoints.end()) {
2439  breakpoints.push_back(time);
2440  std::sort(breakpoints.begin(), breakpoints.end());
2441  setBreakpoints(breakpoints);
2442  setStatusBarText(TLF("Set breakpoint at %", time2string(time)));
2443  }
2444 }
2445 
2446 
2447 const std::vector<SUMOTime>
2449  myRunThread->getBreakpointLock().lock();
2450  std::vector<SUMOTime> result = myRunThread->getBreakpoints();
2451  myRunThread->getBreakpointLock().unlock();
2452  return result;
2453 }
2454 
2455 
2456 void
2458  myBreakpointDialog = nullptr;
2459 }
2460 
2461 /****************************************************************************/
long long int SUMOTime
Definition: GUI.h:35
@ MID_HOTKEY_CTRL_Q_CLOSE
Main window closes.
Definition: GUIAppEnum.h:115
@ ID_RUNTHREAD_EVENT
The Simulation execution thread.
Definition: GUIAppEnum.h:346
@ MID_HOTKEY_CTRL_T_OPENNETEDIT_OPENSUMO
Open current SUMO simulation/network in netedit, or current netedit simulation/network in SUMO.
Definition: GUIAppEnum.h:123
@ MID_LISTINTERNAL
Locator configuration - menu entry.
Definition: GUIAppEnum.h:356
@ MID_TOOLBAREDIT_LOADADDITIONALS
load additionals in sumo-gui/netedit after press ctrl+T
Definition: GUIAppEnum.h:677
@ MID_NEW_MICROVIEW
Open a new microscopic view.
Definition: GUIAppEnum.h:334
@ MID_HOTKEY_CTRL_W_CLOSESIMULATION
Close simulation - ID.
Definition: GUIAppEnum.h:129
@ MID_HOTKEY_CTRL_D_SINGLESIMULATIONSTEP_OPENDEMANDELEMENTS
Perform a single simulation step in SUMO and open Demand Elements in netedit.
Definition: GUIAppEnum.h:89
@ MID_HOTKEY_CTRL_O_OPENSIMULATION_OPENNETWORK
Open simulation in SUMO and open network in netedit.
Definition: GUIAppEnum.h:111
@ MID_HOTKEY_F9_EDIT_VIEWSCHEME
open edit scheme menu
Definition: GUIAppEnum.h:246
@ MID_HOTKEY_CTRL_J_TOGGLEDRAWJUNCTIONSHAPE
toggle draw junction shape
Definition: GUIAppEnum.h:101
@ MID_HOTKEY_A_MODE_STARTSIMULATION_ADDITIONALS_STOPS
hotkey for start simulation in SUMO and set editing mode additionals AND stops in netedit
Definition: GUIAppEnum.h:43
@ MID_TRACI_STATUS
update traci status
Definition: GUIAppEnum.h:373
@ MID_LANGUAGE_TR
change language to turkish
Definition: GUIAppEnum.h:1617
@ MID_CHANGELOG
changelog button
Definition: GUIAppEnum.h:651
@ MID_HOTKEY_CTRL_B_EDITBREAKPOINT_OPENDATAELEMENTS
Edit simulation breakpoints in SUMO and open Data Elements in netedit.
Definition: GUIAppEnum.h:85
@ MID_TOOLBAREDIT_LOADDEMAND
load demand in sumo-gui/netedit after press ctrl+T
Definition: GUIAppEnum.h:679
@ MID_HOTKEY_F1_ONLINEDOCUMENTATION
open online documentation
Definition: GUIAppEnum.h:230
@ MID_HOTKEY_CTRL_U_OPENEDGEDATA
Load edge data for visualization.
Definition: GUIAppEnum.h:125
@ MID_HOTKEY_CTRL_R_RELOAD
Reload the previously loaded simulation.
Definition: GUIAppEnum.h:119
@ MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK
Stop the simulation in SUMO and save network in netedit.
Definition: GUIAppEnum.h:117
@ MID_HOTKEY_D_MODE_SINGLESIMULATIONSTEP_DELETE
hotkey for perform a single simulation step in SUMO and set delete mode in netedit
Definition: GUIAppEnum.h:49
@ MID_HOTKEY_SHIFT_O_LOCATEPOI
Locate poi - button.
Definition: GUIAppEnum.h:182
@ MID_LANGUAGE_ZHT
change language to chinese (traditional)
Definition: GUIAppEnum.h:1615
@ MID_LANGUAGE_ES
change language to spanish
Definition: GUIAppEnum.h:1607
@ MID_HOTKEY_SHIFT_A_LOCATEADDITIONAL
Locate additional structure - button.
Definition: GUIAppEnum.h:172
@ MID_SIMLOAD
(quick)-load state from file
Definition: GUIAppEnum.h:326
@ MID_DEMAND_SCALE
scale traffic
Definition: GUIAppEnum.h:399
@ MID_HOTKEY_CTRL_I_EDITVIEWPORT
Open viewport editor.
Definition: GUIAppEnum.h:99
@ MID_RECENTFILE
Loads a file previously loaded.
Definition: GUIAppEnum.h:316
@ MID_HOTKEY_S_MODE_STOPSIMULATION_SELECT
hotkey for stop simulation in SUMO and set select mode in netedit
Definition: GUIAppEnum.h:63
@ MID_HOTKEY_SHIFT_C_LOCATECONTAINER
Locate container - button.
Definition: GUIAppEnum.h:174
@ MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW
open a new window (SUMO AND netedit)
Definition: GUIAppEnum.h:218
@ MID_HOTKEY_SHIFT_V_LOCATEVEHICLE
Locate vehicle - button.
Definition: GUIAppEnum.h:192
@ MID_HOTKEY_SHIFT_F11_HALLOFFAME
show the hall of fame dialog
Definition: GUIAppEnum.h:252
@ MID_LANGUAGE_HU
change language to hungarian
Definition: GUIAppEnum.h:1619
@ MID_HOTKEY_SHIFT_L_LOCATEPOLY
Locate polygons - button.
Definition: GUIAppEnum.h:180
@ MID_HOTKEY_CTRL_K_OPENTLSPROGRAMS
Load file with TLS Programs.
Definition: GUIAppEnum.h:103
@ MID_LANGUAGE_IT
change language to italian
Definition: GUIAppEnum.h:1611
@ MID_HOTKEY_SHIFT_E_LOCATEEDGE
Locate edge - button.
Definition: GUIAppEnum.h:176
@ MID_HOTKEY_ALT_B_BREAKPOINT_EARLY
hotkey for setting a breakpoint ahead of the current time
Definition: GUIAppEnum.h:165
@ MID_CLEARMESSAGEWINDOW
Clear simulation output.
Definition: GUIAppEnum.h:365
@ MID_HOTKEY_CTRL_F_FULSCREENMODE
Fullscreen mode - menu entry.
Definition: GUIAppEnum.h:93
@ MID_SIMSAVE
Save state to file.
Definition: GUIAppEnum.h:324
@ MID_TUTORIAL
tutorial button
Definition: GUIAppEnum.h:655
@ MID_LISTTELEPORTING
Definition: GUIAppEnum.h:358
@ MID_HOTKEY_CTRL_G_GAMINGMODE_TOGGLEGRID
Toggle Gaming mode in SUMO and grid in netedit.
Definition: GUIAppEnum.h:95
@ MID_SHOWNETSTATS
Show network statistics.
Definition: GUIAppEnum.h:367
@ ID_LOADTHREAD_EVENT
The loading thread.
Definition: GUIAppEnum.h:344
@ MID_HOTKEY_SHIFT_P_LOCATEPERSON
Locate person - button.
Definition: GUIAppEnum.h:184
@ MID_HOTKEY_CTRL_P_OPENSHAPES
Load additional file with poi and polygons.
Definition: GUIAppEnum.h:113
@ MID_LANGUAGE_EN
change language to english
Definition: GUIAppEnum.h:1603
@ MID_HOTKEY_SHIFT_J_LOCATEJUNCTION
Locate junction - button.
Definition: GUIAppEnum.h:178
@ MID_SHOWPERSONSTATS
Show person statistics.
Definition: GUIAppEnum.h:371
@ MID_DELAY_TOGGLE
toggle delay between alternative value
Definition: GUIAppEnum.h:397
@ MID_HOTKEYS
hotkeys button
Definition: GUIAppEnum.h:653
@ MID_TIMELINK_BREAKPOINT
Set breakpionts from messages - Option.
Definition: GUIAppEnum.h:567
@ MID_HOTKEY_B_BREAKPOINT
hotkey for setting a breakpoint
Definition: GUIAppEnum.h:47
@ MID_LANGUAGE_DE
change language to german
Definition: GUIAppEnum.h:1605
@ MID_HOTKEY_ALT_F4_CLOSE
Main window closes.
Definition: GUIAppEnum.h:163
@ MID_TIME_TOGGLE
toggle time display mode
Definition: GUIAppEnum.h:391
@ MID_HOTKEY_CTRL_A_STARTSIMULATION_OPENADDITIONALS
Start the simulation in SUMO and open Additionals Elements in netedit.
Definition: GUIAppEnum.h:83
@ MID_DELAY_DEC
decrease sim delay
Definition: GUIAppEnum.h:395
@ MID_LISTPARKING
Definition: GUIAppEnum.h:357
@ MID_NEW_OSGVIEW
Open a new microscopic 3D view.
Definition: GUIAppEnum.h:336
@ MID_FEEDBACK
feedback button
Definition: GUIAppEnum.h:657
@ MID_HOTKEY_CTRL_H_APPSETTINGS_OPENEDGETYPES
open app setting dialog in SUMO and open edge type files in netedit
Definition: GUIAppEnum.h:97
@ MID_HOTKEY_CTRL_SHIFT_S_SAVESUMOCONFIG
save SUMOConfig (SUMO AND netedit)
Definition: GUIAppEnum.h:222
@ MID_HOTKEY_F12_ABOUT
open about dialog
Definition: GUIAppEnum.h:254
@ MID_HOTKEY_CTRL_E_EDITSELECTION_LOADNETEDITCONFIG
Edit selection in SUMO and load neteditConfig in netedit.
Definition: GUIAppEnum.h:91
@ MID_HOTKEY_SHIFT_T_LOCATETLS
Locate TLS - button.
Definition: GUIAppEnum.h:190
@ MID_DELAY_INC
increase sim delay
Definition: GUIAppEnum.h:393
@ MID_HOTKEY_CTRL_N_OPENNETWORK_NEWNETWORK
open network in SUMO and create new empty network in netedit
Definition: GUIAppEnum.h:109
@ MID_HOTKEY_CTRL_QUICK_RELOAD
Quick-Reload the previously loaded simulation (keep the net)
Definition: GUIAppEnum.h:121
@ MID_LANGUAGE_ZH
change language to chinese (simplified)
Definition: GUIAppEnum.h:1613
@ MID_SHOWVEHSTATS
Show vehicle statistics.
Definition: GUIAppEnum.h:369
@ MID_LANGUAGE_FR
change language to french
Definition: GUIAppEnum.h:1609
@ MID_WINDOW
Main window-ID.
Definition: GUIAppEnum.h:296
FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[]
#define MIN_DRAW_DELAY
GUICompleteSchemeStorage gSchemeStorage
#define GUIDesignSlider
Definition: GUIDesigns.h:508
#define GUIDesignSpinDial
Definition: GUIDesigns.h:488
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
Definition: GUIDesigns.h:452
#define GUIDesignButtonStatusBarFixed
button rectangular with thick and raise frame with a width of 100
Definition: GUIDesigns.h:112
#define GUIDesignMDIButtonLeft
Definition: GUIDesigns.h:224
#define GUIDesignToolBarRaisedSameTop
design for first toolbar shell positioned in the same position of dock
Definition: GUIDesigns.h:458
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition: GUIDesigns.h:129
#define GUIDesignHorizontalFrameStatusBar
Horizontal frame used in status bar.
Definition: GUIDesigns.h:346
#define GUIDesignToolBar
design for default toolbar
Definition: GUIDesigns.h:437
#define GUIDesignSplitter
Definition: GUIDesigns.h:477
#define GUIDesignSplitterMDI
MDI Splitter.
Definition: GUIDesigns.h:480
#define GUIDesignToolbarMenuBar
Definition: GUIDesigns.h:431
#define GUIDesignToolBarRaisedNextTop
design for first toolbar shell positioned in the next-top position of dock
Definition: GUIDesigns.h:455
#define GUIDesignButtonToolbarText
Definition: GUIDesigns.h:126
#define GUIDesignMDIButtonRight
MDIButton oriented to right.
Definition: GUIDesigns.h:227
#define GUIDesignStatusBar
design used in status bar
Definition: GUIDesigns.h:449
@ SIMULATION_ENDED
Send when the simulation is over;.
@ MESSAGE_OCCURRED
send when a message occured
@ GLDEBUG_OCCURRED
send when a gldebug occured
@ ERROR_OCCURRED
send when a error occured
@ SIMULATION_STEP
send when a simulation step has been performed
@ ADD_VIEW
Send when a new should be opened (via TraCI)
@ CLOSE_VIEW
Send when a view should be closed (via TraCI)
@ SIMULATION_LOADED
send when a simulation has been loaded
@ STATUS_OCCURRED
send when a status change occured
@ DEBUG_OCCURRED
send when a debug occured
@ WARNING_OCCURRED
send when a warning occured
GUISelectedStorage gSelected
A global holder of selected objects.
FXString gCurrentFolder
The folder used as last.
@ EDITVIEWPORT
@ CLEARMESSAGEWINDOW
@ NETEDIT_MINI
@ GREENVEHICLE
@ LOCATEVEHICLE
@ LOCATEPERSON
@ WINDOWS_TILE_VERT
@ GREENCONTAINER
@ WINDOWS_CASCADE
@ OPEN
open icons
@ LOCATECONTAINER
@ LOCATEJUNCTION
@ APP_BREAKPOINTS
@ SAVE_SUMOCONFIG
@ WINDOWS_TILE_HORI
@ YELLOWVEHICLE
@ OPEN_SUMOCONFIG
@ SAVE
save icons
@ KEY_SPACE
Definition: GUIShortcuts.h:97
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
#define WRITE_MESSAGEF(...)
Definition: MsgHandler.h:298
#define TL(string)
Definition: MsgHandler.h:315
#define TLF(string,...)
Definition: MsgHandler.h:317
SUMOTime DELTA_T
Definition: SUMOTime.cpp:38
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition: SUMOTime.cpp:69
#define SPEED2DIST(x)
Definition: SUMOTime.h:45
#define SIMSTEP
Definition: SUMOTime.h:61
#define TS
Definition: SUMOTime.h:42
#define TIME2STEPS(x)
Definition: SUMOTime.h:57
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_EMERGENCY
public emergency vehicles
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:58
T MAX2(T a, T b)
Definition: StdDefs.h:82
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
#define TLC(context, string)
Definition: Translation.h:47
Base (microsim) event class.
Definition: Command.h:50
void setSelector(FXSelector sel)
set the selector
void setTarget(FXObject *tgt)
set the target
static bool isReadable(std::string path)
Checks whether the given file is readable.
Definition: FileHelpers.cpp:51
static void resetFont()
to be called when the font context is invalidated
Definition: GLHelper.cpp:671
The main window of the SUMO-gui.
long onCmdDelayInc(FXObject *, FXSelector, void *)
Called on "delay inc".
long onUpdReload(FXObject *, FXSelector, void *)
Determines whether reloading is enabled.
long onCmdShowStats(FXObject *, FXSelector, void *)
Called on commands from the statistic buttons.
FXToolBarShell * myToolBarDrag2
long onCmdTimeToggle(FXObject *, FXSelector, void *)
Called on "time toggle".
virtual void sendBlockingEvent(GUIEvent *event)
Sends an event from the application thread to the GUI and waits until it is handled.
GUIDialog_Breakpoints * myBreakpointDialog
breakpoint dialog
FXEX::MFXThreadEvent myLoadThreadEvent
io-event with the load-thread
void handleEvent_Message(GUIEvent *e)
called when event "message" ocurred
GUILoadThread * myLoadThread
the thread that loads simulations
MFXLabelTooltip * myScaleTrafficTooltip
the demand scale label
void handleEvent_SimulationEnded(GUIEvent *e)
called when event "simulation ended" ocurred
FXMenuCheck * myGamingModeCheckbox
menu checkbox to activate game mode
int myViewNumber
The current view number.
FXToolBarShell * myToolBarDrag4
long onCmdAbout(FXObject *, FXSelector, void *)
Shows the about dialog.
SUMOTime myWaitingTime
waiting time
long onCmdFeedback(FXObject *, FXSelector, void *)
Shows the feedback dialog.
long onClipboardRequest(FXObject *sender, FXSelector sel, void *ptr)
Somebody wants our clipped text.
long onUpdTraCIStatus(FXObject *, FXSelector, void *)
Determines whether traci is active.
long onUpdStep(FXObject *, FXSelector, void *)
Determines whether "step" is enabled.
bool myAmLoading
information whether the gui is currently loading and the load-options shall be greyed out
long onCmdAppSettings(FXObject *, FXSelector, void *)
Opens the application settings menu (Settings->Application Settings...)
long onKeyPress(FXObject *o, FXSelector sel, void *data)
called when a key is pressed
void handleEvent_SimulationLoaded(GUIEvent *e)
called when event "simulation loaded" ocurred
long onCmdBreakpoint(FXObject *, FXSelector, void *)
Called to set a breakpoint via hotkey.
FXToolBarShell * myToolBarDrag9
FXRealSpinner * mySimDelaySpinner
Simulation delay spinner.
long onCmdBreakpointEarly(FXObject *, FXSelector, void *)
Called to set an early breakpoint via hotkey.
long onCmdChangelog(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Changelog
long onCmdOpenInNetedit(FXObject *, FXSelector, void *)
Called on menu Edit->open in Netedit.
void handleEvent_SimulationStep(GUIEvent *e)
called when event "simulation step" ocurred
bool myHaveNotifiedAboutSimEnd
whether the simulation end was already announced
void setStatusBarText(const std::string &text)
set status bar text
FXToolBarShell * myToolBarDrag10
FXMenuPane * myFileMenuRecentConfigs
FXMenu pane for recent configs.
long onCmdStop(FXObject *, FXSelector, void *)
Called on "stop".
MFXRecentNetworks myRecentNetworks
List of recent networks.
MFXLCDLabel * myTimeLossLabel
time loss label
double myJamSoundTime
waiting time after which vehicles trigger jam sounds
FXRealSpinner * myDemandScaleSpinner
the demand scale
long onCmdTutorial(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Tutorial
virtual void setDelay(double delay)
Sets the delay of the parent application in milliseconds.
MFXLCDLabel * myEmergencyVehicleLabel
emergency vehicle label
FXToolBarShell * myToolBarDrag7
double mySimDelay
the simulation delay in milliseconds
void addRecentConfig(const FX::FXString &f)
add recent config to recent file list
SUMOTime getCurrentSimTime() const
get current simulation time
long onUpdAddView(FXObject *, FXSelector, void *)
Determines whether adding a view is enabled.
FXToolBarShell * myToolBarDrag1
for some menu detaching fun
long onCmdEditViewScheme(FXObject *, FXSelector, void *)
Called on menu Edit->Visualization.
long onRunThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the simulation thread.
MFXLCDLabel * myTotalDistanceLabel
total distance label
bool hadDependentBuild
flag to mark if GUIApplicationWIndow has depend build
SUMOTime myEmergencyVehicleCount
emergency vehicle count
FXMenuPane * myFileMenuRecentNetworks
FXMenu pane for recent networks.
FXCursor * getDefaultCursor()
get default cursor
SUMOTime myTimeLoss
time loss
void checkGamingEventsDRT()
handles additional game-related events (DRT)
FXMDIMenu * myMDIMenu
The menu used for the MDI-windows.
void updateTimeLCDTooltip()
update LCD timer tooltip
long onCmdListTeleporting(FXObject *, FXSelector, void *)
Toggle listing of teleporting vehicles.
long onCmdNewWindow(FXObject *, FXSelector, void *)
Called on menu File->New Window.
long onCmdStep(FXObject *, FXSelector, void *)
Called on "step".
FXMutex myEventMutex
the mutex for the waiting semaphore
FXMenuPane * mySelectByPermissions
double getTrackerInterval() const
get tracker interval
long onCmdClose(FXObject *, FXSelector, void *)
Called on menu File->Close.
virtual void buildToolBars()
Builds the tool bar.
long onCmdDelayToggle(FXObject *, FXSelector, void *)
Called on "delay toggle".
FXMenuCheck * myLoadAdditionalsInNetedit
menuCheck for enable/disable load additionals in netedit
void buildRecentNetworks(FXMenuPane *fileMenu, FXMenuPane *fileMenuRecentNetworks)
build recent networks
FXMenuPane * myFileMenu
the submenus
long onCmdToggleSecondaryShape(FXObject *, FXSelector, void *)
Toggle draw junction shape.
virtual double getDelay() const
Returns the simulation delay in miliseconds.
long onCmdStart(FXObject *, FXSelector, void *)
Called on "play".
GUIMessageWindow * myMessageWindow
A window to display messages, warnings and error in.
GUIRunThread * getRunner()
get run thread
void loadConfigOrNet(const std::string &file)
starts to load a simulation
FXToolBar * myToolBar1
The application tool bar.
bool myWasStarted
the information whether the simulation was started before
FXSplitter * myMainSplitter
The splitter that divides the main window into views and the log window.
long onCmdListParking(FXObject *, FXSelector, void *)
Toggle listing of parking vehicles.
long onUpdNeedsSumoConfig(FXObject *, FXSelector, void *)
Determines whether some buttons which require an sumoConfig may be shown.
void loadOnStartup(const bool wait=false)
config or net on startup
void addBreakpoint(SUMOTime time)
Adds the given breakpoint.
long onCmdListInternal(FXObject *, FXSelector, void *)
Toggle listing of internal structures.
bool myTLSGame
flag for enable TLS gameMode
FXEX::MFXThreadEvent myRunThreadEvent
io-event with the run-thread
void dependentBuild(const bool isLibsumo)
build dependt
long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
GUIApplicationWindow(FXApp *a, const std::string &configPattern)
Constructor.
long onCmdEditBreakpoints(FXObject *, FXSelector, void *)
Called on menu Edit->Edit Breakpoints.
long onCmdOpenShapes(FXObject *, FXSelector, void *)
Called on menu File->Load Shapes.
FXToolBarShell * myMenuBarDrag
const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve list of breakpoints
long onCmdQuit(FXObject *, FXSelector, void *)
Called by FOX if the application shall be closed (Called either by FileMenu->Quit,...
FXToolBarShell * myToolBarDrag8
long onUpdStart(FXObject *sender, FXSelector, void *ptr)
Determines whether "play" is enabled.
GUISUMOAbstractView * openNewView(GUISUMOViewParent::ViewType vt=GUISUMOViewParent::VIEW_2D_OPENGL, std::string caption="")
opens a new simulation display
FXGLCanvas * getBuildGLCanvas() const
get build GLCanvas
RandomDistributor< std::string > myJamSounds
random list of jam sounds
long onCmdNewView(FXObject *, FXSelector, void *)
Called if a new view shall be opened (2D view)
GUIRunThread * myRunThread
the thread that runs simulations
long onCmdClearMsgWindow(FXObject *, FXSelector, void *)
Called if the message window shall be cleared.
long onCmdToggleDrawJunctionShape(FXObject *, FXSelector, void *)
Toggle draw junction shape.
virtual void create()
Creates the main window (required by FOX)
std::map< int, Command * > myHotkeyPress
custom hotkeys pressed
FXToolBarShell * myToolBarDrag5
MFXLCDLabel * myWaitingTimeLabel
waiting time label
long onCmdDemandScale(FXObject *, FXSelector, void *)
Called on "demand scale".
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
called when a key is released
RandomDistributor< std::string > myCollisionSounds
random list of collision sounds
FXMenuCascade * mySelectLanesMenuCascade
the menu cascades
long onCmdOpenNetwork(FXObject *, FXSelector, void *)
Called on menu File->Open Network.
std::string myConfigPattern
Input file pattern.
virtual void setBreakpoints(const std::vector< SUMOTime > &breakpoints)
Sets the breakpoints of the parent application.
long onUpdNeedsNetwork(FXObject *, FXSelector, void *)
Determines whether some buttons which require an active network may be shown.
long onCmdLoadState(FXObject *, FXSelector, void *)
Called on "save state".
void eraseBreakpointDialog()
erase current breakpoint dialog
int myPreviousCollisionNumber
previous collision number
long onCmdEditChosen(FXObject *, FXSelector, void *)
Called on menu Edit->Edit Chosen.
virtual void detach()
Detaches the tool/menu bar.
long onCmdDelayDec(FXObject *, FXSelector, void *)
Called on "delay dec".
long onCmdOpenRecent(FXObject *, FXSelector, void *)
Called on opening a recent file.
MFXRecentNetworks myRecentConfigs
List of recent configs.
long onUpdOpenRecent(FXObject *, FXSelector, void *)
Determines whether opening a recent file is enabled.
MFXSynchQue< GUIEvent * > myEvents
List of got requests.
bool myShowTimeAsHMS
whether to show time as hour:minute:second
double myAlternateSimDelay
The alternate simulation delay in milliseconds for toggling.
long onUpdStop(FXObject *, FXSelector, void *)
Determines whether "stop" is enabled.
FXDataTarget * mySimDelayTarget
Simulation delay target.
long onCmdSaveConfig(FXObject *, FXSelector, void *)
Called on menu File->Close.
void closeAllWindows()
this method closes all windows and deletes the current simulation
void updateTimeLCD(SUMOTime time)
updates the simulation time display
long onCmdSaveState(FXObject *, FXSelector, void *)
Called on "save state".
std::map< int, Command * > myHotkeyRelease
custom hotkeys released
FXToolBarShell * myToolBarDrag3
long onLoadThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the loading thread.
long onCmdReload(FXObject *, FXSelector, void *)
Called on reload.
void addRecentNetwork(const FX::FXString &f)
add recent network to recent file list
void buildRecentConfigs(FXMenuPane *fileMenu, FXMenuPane *fileMenuRecentConfigs)
build recent configs
long onUpdOpen(FXObject *, FXSelector, void *)
Determines whether opening is enabled.
long onCmdHallOfFame(FXObject *, FXSelector, void *)
Shows the Hall of Fame dialog.
double myTotalDistance
total distance
long onCmdLocate(FXObject *, FXSelector, void *)
Called on menu commands from the Locator menu.
FXToolBar * myToolBar6
toolbars used in game
FXToolBarShell * myToolBarDrag6
toolbars shell used in game
long long myGuiSettingsFileMTime
last modification time of the gui setting file
FXSlider * mySimDelaySlider
Simulation delay slider.
long onCmdOpenConfiguration(FXObject *, FXSelector, void *)
Called on menu File->Open Configuration.
long onCmdOpenEdgeData(FXObject *, FXSelector, void *)
Called on menu File->Load EdgeData.
FXMenuCheck * myLoadDemandInNetedit
menuCheck for enable/disable load demand elements in netedit
virtual void addToWindowsMenu(FXMenuPane *menuPane)
FOX need this.
long onCmdEditViewport(FXObject *, FXSelector, void *)
Called on menu Edit->Viewport.
MFXLCDLabel * myLCDLabel
the simulation step display
FXMenuBar * myMenuBar
The application menu bar.
static std::mt19937 myGamingRNG
A random number generator used to choose a gaming sound.
long onCmdHotkeys(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Hotkeys
long myLastStepEventMillis
last time the simulation view was redrawn due to a simStep
virtual ~GUIApplicationWindow()
Destructor.
long onCmdHelp(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Documentation
void addHotkey(int key, Command *press, Command *release)
register custom hotkey action
virtual void fillMenuBar()
Builds the menu bar.
bool myIsReload
whether we are reloading the simulation
std::vector< FXButton * > myStatButtons
Buttons showing and running values and triggering statistic windows.
virtual void eventOccurred()
a certain event ocurred
void checkGamingEvents()
handles additional game-related events
long onCmdQuickReload(FXObject *, FXSelector, void *)
Called on quick-reload.
FXMenuCommand * myOpenInNetedit
menuCommand for open simulation/network in netedit
long onCmdGaming(FXObject *, FXSelector, void *)
Toggle gaming mode.
void clearDecals()
Clear the default decals.
void saveViewport(const double x, const double y, const double z, const double rot)
Makes the given viewport the default.
static void close()
close GUICursorSubSys
static void initCursors(FXApp *a)
Initiate GUICursorSubSys.
static FXLabel * buildFXLabel(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXuint opts, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
Construct label with given text and icon.
Definition: GUIDesigns.cpp:118
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
Definition: GUIDesigns.cpp:128
static FXMenuTitle * buildFXMenuTitle(FXComposite *p, const std::string &text, FXIcon *icon, FXMenuPane *menuPane)
build menu title
Definition: GUIDesigns.cpp:31
static FXMenuCommand * buildFXMenuCommandRecentFile(FXComposite *p, const std::string &text, FXObject *tgt, FXSelector sel)
build menu command (for recent files)
Definition: GUIDesigns.cpp:107
static FXMenuCheck * buildFXMenuCheckbox(FXComposite *p, const std::string &text, const std::string &info, FXObject *tgt, FXSelector sel)
build menu checkbox
Definition: GUIDesigns.cpp:85
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
Definition: GUIDesigns.cpp:42
static FXMenuCommand * buildFXMenuCommandShortcut(FXComposite *p, const std::string &text, const std::string &shortcut, const std::string &info, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:74
The application's "About" - dialog.
void create()
Creates the widget.
The dialog to change the application (gui) settings.
Editor for simulation breakpoints.
The application's "Feedback" dialog.
void create()
Creates the widget.
Editor for the list of chosen objects.
The SUMO User Conference "Hall of Fame" - dialog / easter egg.
void create()
Creates the widget.
const std::string & getCaption() const
const std::string & getSchemeName() const
bool in3D() const
const std::string & getCaption() const
const std::string & getMsg() const
Returns the message.
Event sent when the the simulation is over.
MSNet::SimulationState getReason() const
Returns the reason the simulation has ended due.
SUMOTime getTimeStep() const
Returns the time step the simulation has ended at.
const SUMOTime myBegin
the time the simulation shall start with
const std::vector< std::string > mySettingsFiles
the name of the settings file to load
const bool myOsgView
whether to load the OpenSceneGraph view
const SUMOTime myEnd
the time the simulation shall end with
const bool myViewportFromRegistry
whether loading viewport from registry
const std::string myFile
the name of the loaded file
GUIEventType getOwnType() const
returns the event type
Definition: GUIEvent.h:89
virtual void create()
create GUIGlChildWindow
GUISUMOAbstractView * getView() const
return GUISUMOAbstractView
virtual FXGLCanvas * getBuildGLCanvas() const
get build GL Canvas
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:104
static double gTrackerInterval
the aggregation period for tracker windows in seconds
Definition: GUIGlobals.h:46
static bool gRunAfterLoad
the simulation shall start direct after loading
Definition: GUIGlobals.h:37
static bool gQuitOnEnd
the window shall be closed when the simulation has ended
Definition: GUIGlobals.h:40
static bool gDemoAutoReload
the simulation shall reload when it has ended (demo)
Definition: GUIGlobals.h:43
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static void initIcons(FXApp *a)
Initiate GUIIconSubSys.
static void close()
close GUIIconSubSys
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:60
void loadConfigOrNet(const std::string &file)
begins the loading of the given file
const std::string & getFileName() const
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call
bool myListParking
information whether the locator should list parking vehicles
void removeViewByID(const std::string &id)
std::vector< FXMainWindow * > myTrackerWindows
list of tracker windows
FXMenuPane * myLanguageMenu
Language menu common to all applications.
bool myListTeleporting
information whether the locator should list teleporting vehicles
FXLabel * myCartesianCoordinate
Labels for the current cartesian, geo-coordinate and test coordinates.
std::map< std::string, std::string > myOnlineMaps
online mapping services for the context menu
MFXStaticToolTip * myStaticTooltipMenu
static toolTip used in menus
FXMDIClient * myMDIClient
The multi view panel.
FXHorizontalFrame * myTraCiFrame
frames for coordinates
void buildLanguageMenu(FXMenuBar *menuBar)
long onCmdChangeLanguage(FXObject *, FXSelector, void *)
bool listParking() const
return whether to list parking vehicles
FXHorizontalFrame * myGeoFrame
FXHorizontalFrame * myTestFrame
FXHorizontalFrame * myCartesianFrame
FXLabel * myTestCoordinate
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
FXDockSite * myTopDock
dock sites
bool myListInternal
information whether the locator should list internal structures
void storeWindowSizeAndPos()
record window position and size in registry
bool myAmFullScreen
FOX need this.
FXLabel * myGeoCoordinate
FXStatusBar * myStatusbar
The status bar.
void updateChildren(int msg=MID_SIMSTEP)
update childrens
FXGLVisual * myGLVisual
The gl-visual used.
bool myAmGaming
information whether the gui is currently in gaming mode
std::vector< GUIGlChildWindow * > myGLWindows
list of GLWindows
long onUpdChangeLanguage(FXObject *, FXSelector, void *)
A logging window for the gui.
void addSeparator()
Adds a a separator to this log window.
void clear()
Clears the window.
void appendMsg(GUIEventType eType, const std::string &msg)
Adds new text to the window.
static SUMOTime getBreakPointOffset()
ask whether locate links is enabled
MSTransportableControl & getPersonControl() override
Returns the person control.
Definition: GUINet.cpp:130
void flushOutputsAtEnd()
flush outputs once the simulation has reached its end
Definition: GUINet.cpp:786
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition: GUINet.cpp:477
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:572
MSTransportableControl & getContainerControl() override
Returns the container control.
Definition: GUINet.cpp:139
virtual double getXPos() const =0
Returns the x-offset of the field to show stored in this changer.
virtual double getYPos() const =0
Returns the y-offset of the field to show stored in this changer.
virtual double getZPos() const =0
Returns the camera height corresponding to the current zoom factor.
void singleStep()
called when the user presses the "single step"-button
FXMutex & getBreakpointLock()
get breakpoint lock
Definition: GUIRunThread.h:124
GUINet & getNet() const
returns the loaded network
virtual void begin()
starts the simulation (execution of one step after another)
SUMOTime getSimBegin()
get simulation begin time
Definition: GUIRunThread.h:109
std::vector< SUMOTime > & getBreakpoints()
get list of breakpoints
Definition: GUIRunThread.h:119
void resume()
called when the user presses the "resume"-button
virtual bool simulationIsStartable() const
check if simulation is startable
bool networkAvailable() const
returns the information whether a network has been loaded
virtual bool simulationIsStepable() const
check if simulation is stepable
virtual bool init(GUINet *net, SUMOTime start, SUMOTime end)
initialises the thread with the new simulation
SUMOTime getSimEndTime() const
get simulation end time
Definition: GUIRunThread.h:114
virtual bool simulationIsStopable() const
check if simulation is stopableo
virtual void deleteSim()
deletes the existing simulation
void stop()
halts the simulation execution
void prepareDestruction()
halts the thread before it shall be deleted
MFXComboBoxIcon * getColoringSchemesCombo()
get coloring schemes combo
void addDecals(const std::vector< Decal > &decals)
add decals
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
GUIPerspectiveChanger & getChanger() const
get changer
virtual void setViewportFromToRot(const Position &lookFrom, const Position &lookAt, double rotation)
applies the given viewport settings
GUIVisualizationSettings * editVisualisationSettings() const
edit visualization settings (allow modify VisualizationSetings, use carefully)
virtual void copyViewportTo(GUISUMOAbstractView *view)
copy the viewport to the given view
virtual bool setColorScheme(const std::string &)
set color scheme
A single child window which contains a view of the simulation area.
ViewType
Available view types.
@ VIEW_3D_OSG
plain 3D OSG view (
@ VIEW_2D_OPENGL
plain 2D openGL view (
virtual GUISUMOAbstractView * init(FXGLCanvas *share, GUINet &net, ViewType type)
"Initialises" this window by building the contents
long onCmdLocate(FXObject *, FXSelector, void *)
locator-callback
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
void setToolBarVisibility(const bool value)
about toggled gaming status
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
void clear()
Clears the list of selected objects.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
An XML-handler for visualisation schemes.
double getDelay() const
Returns the parsed delay.
const std::string & getViewType() const
Returns the parsed view type.
const std::string & getSettingName() const
const std::vector< SUMOTime > & getBreakpoints() const
Returns the parsed breakpoints.
RandomDistributor< std::string > getEventDistribution(const std::string &id)
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
Storage for geometrical objects extended by mutexes.
static void buildAccelerators(FXAccelTable *accelTable, FXObject *target, const bool sumogui)
build accelerators
static void changeAccelerator(FXAccelTable *accelTable, FXObject *target, GUIShortcut keysym, long msg)
change accelerator (used for toggle dynamically binding space key with start/end simulation)
static void initTextures(FXApp *a)
Initiate GUITextureSubSys for textures.
static void clearTextures()
clears loaded textures
static std::string clipped
Definition: GUIUserIO.h:58
bool drawJunctionShape
whether the shape of the junction should be drawn
bool secondaryShape
whether secondary lane shape shall be drawn
GUIColorer laneColorer
The lane colorer.
ComboBox with icon.
long setCurrentItem(const FXint index, FXbool notify=FALSE)
Set the current item (index is zero-based)
FXint findItem(const FXString &text) const
find item
A widget which has the seven-segment display used as the drawing object for each letter in the label....
Definition: MFXLCDLabel.h:34
void setVertical(const FXint len)
set segment vertical length - must be more than twice the segment width
void setGroove(const FXint w)
set groove width - must be less than segment width
void setThickness(const FXint w)
set segment width - must be less than half the segment length
void setToolTipText(const FXString &text)
set tooltip text
void setText(FXString lbl)
manipulate text in LCD label
void setHorizontal(const FXint len)
set segment horizontal length - must be more than twice the segment width
void setFgColor(FXColor clr)
set forground color
static void sleep(long ms)
void pop()
Definition: MFXSynchQue.h:64
bool empty()
Definition: MFXSynchQue.h:127
void push_back(T what)
Definition: MFXSynchQue.h:113
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:112
static FXString getTitleText(const FXString &appname, FXString filename="")
Returns the title text in dependence to an optional file name.
Definition: MFXUtils.cpp:60
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
static FXString assureExtension(const FXString &filename, const FXString &defaultExtension)
Corrects missing extension.
Definition: MFXUtils.cpp:69
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
bool isStopped() const
Returns whether the vehicle is at a stop.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition: MSEdge.cpp:1022
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition: MSLane.h:606
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition: MSLane.h:566
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
Definition: MSNet.cpp:1654
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:182
@ SIMSTATE_LOADING
The simulation is loading.
Definition: MSNet.h:96
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
Definition: MSNet.h:106
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:378
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition: MSNet.cpp:925
void quickReload()
reset state to the beginning without reloading the network
Definition: MSNet.cpp:1633
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition: MSNet.h:501
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:320
bool hasContainers() const
Returns whether containers are simulated.
Definition: MSNet.h:411
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:431
bool hasPersons() const
Returns whether persons are simulated.
Definition: MSNet.h:395
static void saveState(const std::string &file, SUMOTime step, bool usePrefix=true)
Saves the current state.
int getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
int getWaitingForVehicleNumber() const
Returns the number of transportables waiting for a ride.
The class responsible for building and deletion of vehicles.
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
void setScale(double scale)
sets the demand scaling factor
int getCollisionCount() const
return the number of collisions
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:77
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSVehicle.h:608
double getSpeed() const
Returns the vehicle's current speed.
Definition: MSVehicle.h:493
const MSLane * getLane() const
Returns the lane the vehicle is on.
Definition: MSVehicle.h:584
The XML-Handler for shapes loading network loading.
Definition: NLHandler.h:55
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
void writeConfiguration(std::ostream &os, const bool filled, const bool complete, const bool addComments, const std::string &relativeTo="", const bool forceRelative=false, const bool inComment=false) const
Writes the configuration.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:60
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:37
void set(double x, double y)
set positions x and y
Definition: Position.h:85
double x() const
Returns the x-position.
Definition: Position.h:55
double y() const
Returns the y-position.
Definition: Position.h:60
static const RGBColor GREEN
Definition: RGBColor.h:186
static const RGBColor RED
named colors
Definition: RGBColor.h:185
double getOverallProb() const
Return the sum of the probabilites assigned to the members.
T get(SumoRNG *which=nullptr) const
Draw a sample of the distribution.
std::vector< std::string > getVector()
return vector of strings
static std::string replace(std::string str, const std::string &what, const std::string &by)
Replaces all occurrences of the second string by the third string within the first string.
static std::string transcodeToLocal(const std::string &utf8String)
convert a string from UTF-8 to the local codepage
A few system-specific functions.
Definition: SysUtils.h:30
static unsigned long runHiddenCommand(const std::string &cmd)
run a shell command without popping up any windows (particuarly on win32)
Definition: SysUtils.cpp:69
static long long getModifiedTime(const std::string &fname)
@brie get modified time
Definition: SysUtils.cpp:109
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition: SysUtils.cpp:44
static TraCIServer * getInstance()
Definition: TraCIServer.h:68
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass
Definition: VClassIcons.cpp:35
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.
Definition: XMLSubSys.cpp:148
@ SEL_THREAD_EVENT
Definition: fxexdefs.h:173
@ SEL_THREAD
Definition: fxexdefs.h:155