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.org/sumo
3 // Copyright (C) 2001-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
21 // The main window of the SUMO-gui.
22 /****************************************************************************/
23 #include <config.h>
24 
25 #ifdef HAVE_VERSION_H
26 #include <version.h>
27 #endif
28 
29 #include <string>
30 #include <sstream>
31 #include <algorithm>
32 #include <iomanip>
33 
34 #include <guisim/GUINet.h>
35 #include <guisim/GUILane.h>
36 #include <netload/NLHandler.h>
38 #include <microsim/MSGlobals.h>
39 #include <microsim/MSEdge.h>
40 #include <microsim/MSVehicle.h>
43 #include <microsim/MSEdgeControl.h>
46 
47 #include "GUISUMOViewParent.h"
48 #include "GUILoadThread.h"
49 #include "GUIRunThread.h"
50 #include "GUIApplicationWindow.h"
53 
54 #include <utils/common/ToString.h>
60 
61 #include <utils/xml/XMLSubSys.h>
74 #include <utils/gui/div/GLHelper.h>
85 #include "GUIGlobals.h"
90 
91 
92 //#define HAVE_DANGEROUS_SOUNDS
93 
94 // ===========================================================================
95 // FOX-declarations
96 // ===========================================================================
97 FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[] = {
101  FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GUIApplicationWindow::onCmdQuit),
102 
107  FXMAPFUNC(SEL_COMMAND, MID_RECENTFILE, GUIApplicationWindow::onCmdOpenRecent),
111  FXMAPFUNC(SEL_COMMAND, MID_EDITCHOSEN, GUIApplicationWindow::onCmdEditChosen),
115  FXMAPFUNC(SEL_COMMAND, MID_NETEDIT, GUIApplicationWindow::onCmdNetedit),
116 
125  FXMAPFUNC(SEL_COMMAND, MID_NEW_MICROVIEW, GUIApplicationWindow::onCmdNewView),
126 #ifdef HAVE_OSG
127  FXMAPFUNC(SEL_COMMAND, MID_NEW_OSGVIEW, GUIApplicationWindow::onCmdNewOSG),
128 #endif
132  FXMAPFUNC(SEL_COMMAND, MID_SIMSAVE, GUIApplicationWindow::onCmdSaveState),
137 
141 
142  FXMAPFUNC(SEL_UPDATE, MID_OPEN_CONFIG, GUIApplicationWindow::onUpdOpen),
143  FXMAPFUNC(SEL_UPDATE, MID_OPEN_NETWORK, GUIApplicationWindow::onUpdOpen),
144  FXMAPFUNC(SEL_UPDATE, MID_OPEN_NETWORK, GUIApplicationWindow::onUpdOpen),
150 #ifdef HAVE_OSG
151  FXMAPFUNC(SEL_UPDATE, MID_NEW_OSGVIEW, GUIApplicationWindow::onUpdAddView),
152 #endif
167 
168  // forward requests to the active view
169  FXMAPFUNC(SEL_COMMAND, MID_LOCATEJUNCTION, GUIApplicationWindow::onCmdLocate),
170  FXMAPFUNC(SEL_COMMAND, MID_LOCATEEDGE, GUIApplicationWindow::onCmdLocate),
171  FXMAPFUNC(SEL_COMMAND, MID_LOCATEVEHICLE, GUIApplicationWindow::onCmdLocate),
172  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPERSON, GUIApplicationWindow::onCmdLocate),
174  FXMAPFUNC(SEL_COMMAND, MID_LOCATETLS, GUIApplicationWindow::onCmdLocate),
175  FXMAPFUNC(SEL_COMMAND, MID_LOCATEADD, GUIApplicationWindow::onCmdLocate),
176  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPOI, GUIApplicationWindow::onCmdLocate),
177  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPOLY, GUIApplicationWindow::onCmdLocate),
187  FXMAPFUNC(SEL_KEYPRESS, 0, GUIApplicationWindow::onKeyPress),
188  FXMAPFUNC(SEL_KEYRELEASE, 0, GUIApplicationWindow::onKeyRelease),
189 
190  FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GUIApplicationWindow::onClipboardRequest),
191 
196 };
197 
198 // Object implementation
199 FXIMPLEMENT(GUIApplicationWindow, FXMainWindow, GUIApplicationWindowMap, ARRAYNUMBER(GUIApplicationWindowMap))
200 
201 // ===========================================================================
202 // static members
203 // ===========================================================================
205 
206 // ===========================================================================
207 // member method definitions
208 // ===========================================================================
209 GUIApplicationWindow::GUIApplicationWindow(FXApp* a, const std::string& configPattern) :
210  GUIMainWindow(a),
211  myLoadThread(nullptr), myRunThread(nullptr),
212  myAmLoading(false),
213  myAlternateSimDelay(0.),
214  myRecentFiles(a, "files"),
215  myConfigPattern(configPattern),
216  hadDependentBuild(false),
217  myShowTimeAsHMS(false),
218  myHaveNotifiedAboutSimEnd(false),
219  // game specific
220  myJamSoundTime(60),
221  myPreviousCollisionNumber(0),
222  myWaitingTime(0),
223  myTimeLoss(0),
224  myEmergencyVehicleCount(0),
225  myTotalDistance(0) {
226  // init icons
228  // init cursors
230 }
231 
232 
233 void
235  // don't do this twice
236  if (hadDependentBuild) {
237  return;
238  }
239  hadDependentBuild = true;
240 
241  setTarget(this);
242  setSelector(MID_WINDOW);
243 
244  // build menu bar
245  myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBar);
247  new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
248  buildToolBars();
249  // build the thread - io
252 
253  // build the status bar
254  myStatusbar = new FXStatusBar(this, GUIDesignStatusBar);
255  {
256  myGeoFrame = new FXHorizontalFrame(myStatusbar, GUIDesignHorizontalFrameStatusBar);
257  myGeoCoordinate = new FXLabel(myGeoFrame, "N/A\t\tOriginal coordinate (before coordinate transformation in netconvert)", nullptr, LAYOUT_CENTER_Y);
259  myCartesianCoordinate = new FXLabel(myCartesianFrame, "N/A\t\tNetwork coordinate", nullptr, LAYOUT_CENTER_Y);
262  myStatButtons.back()->hide();
264  myStatButtons.back()->hide();
265  }
266 
267  // make the window a mdi-window
268  myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
269  myMDIClient = new FXMDIClient(myMainSplitter, GUIDesignSplitterMDI);
270  myMDIMenu = new FXMDIMenu(this, myMDIClient);
271  new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
272  new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
273  new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
274  new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
275 
276  // build the message window
278  // fill menu and tool bar
279  fillMenuBar();
280  myToolBar6->hide();
281  myToolBar7->hide();
282  myToolBar9->hide();
283  myToolBar10->hide();
284  // build additional threads
285  myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent);
287  // set the status bar
288  myStatusbar->getStatusLine()->setText("Ready.");
289  // set the caption
290  setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
291 
292  // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
293  myRunThread->start();
296 }
297 
298 
299 void
302  gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
303  FXMainWindow::create();
304  myMenuBarDrag->create();
305  myToolBarDrag1->create();
306  myToolBarDrag2->create();
307  myToolBarDrag3->create();
308  myToolBarDrag4->create();
309  myToolBarDrag5->create();
310  myToolBarDrag6->create();
311  myToolBarDrag7->create();
312  myFileMenu->create();
313  mySelectByPermissions->create();
314  myEditMenu->create();
315  mySettingsMenu->create();
316  myLocatorMenu->create();
317  myControlMenu->create();
318  myWindowsMenu->create();
319  myHelpMenu->create();
320 
321  FXint textWidth = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
322  myCartesianFrame->setWidth(textWidth);
323  myGeoFrame->setWidth(textWidth);
324 
325  show(PLACEMENT_DEFAULT);
326  if (!OptionsCont::getOptions().isSet("window-size")) {
327  if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
328  maximize();
329  }
330  }
331  myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
332  myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
333 }
334 
335 
338  myRunThread->join();
339  closeAllWindows();
340  //
342  delete myGLVisual;
343  // delete some non-parented windows
344  delete myToolBarDrag1;
345  //
346  delete myRunThread;
347  delete myFileMenu;
348  delete myEditMenu;
349  delete mySelectByPermissions;
350  delete mySettingsMenu;
351  delete myLocatorMenu;
352  delete myControlMenu;
353  delete myWindowsMenu;
354  delete myHelpMenu;
355 
356  delete myLoadThread;
357 
358  while (!myEvents.empty()) {
359  // get the next event
360  GUIEvent* e = myEvents.top();
361  myEvents.pop();
362  delete e;
363  }
364 }
365 
366 
367 void
369  FXMainWindow::detach();
370  myMenuBarDrag->detach();
371  myToolBarDrag1->detach();
372 }
373 
374 
375 void
377  // build file menu
378  myFileMenu = new FXMenuPane(this);
381  "&Open Simulation...", "Ctrl+O", "Open a simulation (Configuration file).",
384  "Open &Network...", "Ctrl+N", "Open a network.",
387  "Open Shapes ", "Ctrl+P", "Load POIs and Polygons for visualization.",
390  "Open EdgeData ", "Ctrl+U", "Load edge related data for visualization.",
393  "&Reload", "Ctrl+R", "Reloads the simulation / the network.",
395  new FXMenuSeparator(myFileMenu);
397  "Save Configuration", "Ctrl+Shift+S", "Save current options as a configuration file.",
400  "Close", "Ctrl+W", "Close the simulation.",
402  // Recent files
403  FXMenuSeparator* sep1 = new FXMenuSeparator(myFileMenu);
404  sep1->setTarget(&myRecentFiles);
405  sep1->setSelector(FXRecentFiles::ID_ANYFILES);
406  GUIDesigns::buildFXMenuCommandRecentFile(myFileMenu, "", &myRecentFiles, FXRecentFiles::ID_FILE_1);
407  GUIDesigns::buildFXMenuCommandRecentFile(myFileMenu, "", &myRecentFiles, FXRecentFiles::ID_FILE_2);
408  GUIDesigns::buildFXMenuCommandRecentFile(myFileMenu, "", &myRecentFiles, FXRecentFiles::ID_FILE_3);
409  GUIDesigns::buildFXMenuCommandRecentFile(myFileMenu, "", &myRecentFiles, FXRecentFiles::ID_FILE_4);
410  GUIDesigns::buildFXMenuCommandRecentFile(myFileMenu, "", &myRecentFiles, FXRecentFiles::ID_FILE_5);
411  GUIDesigns::buildFXMenuCommandRecentFile(myFileMenu, "", &myRecentFiles, FXRecentFiles::ID_FILE_6);
412  GUIDesigns::buildFXMenuCommandRecentFile(myFileMenu, "", &myRecentFiles, FXRecentFiles::ID_FILE_7);
413  GUIDesigns::buildFXMenuCommandRecentFile(myFileMenu, "", &myRecentFiles, FXRecentFiles::ID_FILE_8);
414  GUIDesigns::buildFXMenuCommandRecentFile(myFileMenu, "", &myRecentFiles, FXRecentFiles::ID_FILE_9);
415  GUIDesigns::buildFXMenuCommandRecentFile(myFileMenu, "", &myRecentFiles, FXRecentFiles::ID_FILE_10);
416  GUIDesigns::buildFXMenuCommand(myFileMenu, "C&lear Recent Files", nullptr, &myRecentFiles, FXRecentFiles::ID_CLEAR);
417  myRecentFiles.setTarget(this);
418  myRecentFiles.setSelector(MID_RECENTFILE);
419  new FXMenuSeparator(myFileMenu);
421  "&Quit", "Ctrl+Q", "Quit the Application.",
422  nullptr, this, MID_HOTKEY_CTRL_Q_CLOSE);
423 
424  // build edit menu
425  mySelectByPermissions = new FXMenuPane(this);
426  std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
427  for (const auto& vehicleClass : vehicleClasses) {
429  }
430 
431  myEditMenu = new FXMenuPane(this);
434  "Edit Selected...", "Ctrl+E", "Opens a dialog for editing the list of selected items.",
436  mySelectLanesMenuCascade = new FXMenuCascade(myEditMenu,
437  "Select lanes which allow...\t\tOpens a menu for selecting a vehicle class by which to selected lanes.",
439  new FXMenuSeparator(myEditMenu);
441  "Edit Breakpoints", "Ctrl+B", "Opens a dialog for editing breakpoints.",
444  "Edit Visualisation", "F9", "Opens a dialog for editing visualization settings.",
445  nullptr, this, MID_HOTKEY_F9_EDIT_VIEWSCHEME);
447  "Edit Viewport", "Ctrl+I", "Opens a dialog for editing viewing area, zoom and rotation.",
448  nullptr, this, MID_HOTKEY_CTRL_I_EDITVIEWPORT);
449  new FXMenuSeparator(myEditMenu);
451  "Open in netedit", "Ctrl+T", "Opens the netedit application with the current network.",
453 
454  // build settings menu
455  mySettingsMenu = new FXMenuPane(this);
456  GUIDesigns::buildFXMenuTitle(myMenuBar, "&Settings", nullptr, mySettingsMenu);
458  "Application Settings...", "", "Open a Dialog for Application Settings editing.",
459  nullptr, this, MID_APPSETTINGS);
460  new FXMenuCheck(mySettingsMenu,
461  "Gaming Mode\tCtrl+G\tToggle gaming mode on/off.",
463  new FXMenuCheck(mySettingsMenu,
464  "Full Screen Mode\tCtrl+F\tToggle full screen mode on/off.",
466  // build Locate menu
467  myLocatorMenu = new FXMenuPane(this);
470  "Locate &Junctions", "Shift+J", "Open a Dialog for Locating a Junction.",
473  "Locate &Edges", "Shift+E", "Open a Dialog for Locating an Edge.",
475  if (!MSGlobals::gUseMesoSim) { // there are no gui-vehicles in mesosim
477  "Locate &Vehicles", "Shift+V", "Open a Dialog for Locating a Vehicle.",
479  }
481  "Locate &Persons", "Shift+P", "Open a Dialog for Locating a Person.",
484  "Locate &Container", "Shift+C", "Open a Dialog for Locating a Container.",
487  "Locate &TLS", "Shift+T", "Open a Dialog for Locating a Traffic Light.",
490  "Locate &Additional", "Shift+A", "Open a Dialog for Locating an Additional Structure.",
493  "Locate P&oI", "Shift+O", "Open a Dialog for Locating a Point of Interest.",
496  "Locate Po&lygon", "Shift+L", "Open a Dialog for Locating a Polygon.",
498  new FXMenuSeparator(myLocatorMenu);
499  new FXMenuCheck(myLocatorMenu,
500  "Show Internal Structures\t\tShow internal junctions and streets in locator dialog.",
501  this, MID_LISTINTERNAL);
502  FXMenuCheck* listParking = new FXMenuCheck(myLocatorMenu,
503  "Show Parking Vehicles\t\tShow parking vehicles in locator dialog.",
504  this, MID_LISTPARKING);
505  listParking->setCheck(myListParking);
506  new FXMenuCheck(myLocatorMenu,
507  "Show vehicles outside the road network\t\tShow vehicles that are teleporting or driving remote-controlled outside the road network in locator dialog.",
508  this, MID_LISTTELEPORTING);
509  // build control menu
510  myControlMenu = new FXMenuPane(this);
511  GUIDesigns::buildFXMenuTitle(myMenuBar, "Simulation", nullptr, myControlMenu);
513  "Run", "Ctrl+A", "Start running the simulation.",
516  "Stop", "Ctrl+S", "Stop running the simulation.",
519  "Step", "Ctrl+D", "Perform one simulation step.",
522  "Save", "", "Save the current simulation state to a file.",
524 
525  // build windows menu
526  myWindowsMenu = new FXMenuPane(this);
528  new FXMenuCheck(myWindowsMenu,
529  "Show Status Line\t\tToggle the Status Bar on/off.",
530  myStatusbar, FXWindow::ID_TOGGLESHOWN);
531  new FXMenuCheck(myWindowsMenu,
532  "Show Message Window\t\tToggle the Message Window on/off.",
533  myMessageWindow, FXWindow::ID_TOGGLESHOWN);
534  new FXMenuCheck(myWindowsMenu,
535  "Show Simulation Time\t\tToggle the Simulation Time on/off.",
536  myToolBar3, FXWindow::ID_TOGGLESHOWN);
537  new FXMenuCheck(myWindowsMenu,
538  "Show Simulation Delay\t\tToggle the Simulation Delay Entry on/off.",
539  myToolBar4, FXWindow::ID_TOGGLESHOWN);
541  new FXMenuSeparator(myWindowsMenu);
543  "Tile &Horizontally", "", "",
544  GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_HORI), myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
546  "Tile &Vertically", "", "",
547  GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_VERT), myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
549  "Cascade", "", "",
551  myMDIClient, FXMDIClient::ID_MDI_CASCADE);
553  "&Close", "", "",
554  nullptr, myMDIClient, FXMDIClient::ID_MDI_CLOSE);
555  sep1 = new FXMenuSeparator(myWindowsMenu);
556  sep1->setTarget(myMDIClient);
557  sep1->setSelector(FXMDIClient::ID_MDI_ANY);
558  GUIDesigns::buildFXMenuCommand(myWindowsMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_1);
559  GUIDesigns::buildFXMenuCommand(myWindowsMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_2);
560  GUIDesigns::buildFXMenuCommand(myWindowsMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_3);
561  GUIDesigns::buildFXMenuCommand(myWindowsMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_4);
562  GUIDesigns::buildFXMenuCommand(myWindowsMenu, "&Others...", nullptr, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
563  new FXMenuSeparator(myWindowsMenu);
565  "Clear Message Window", "", "Clear the message window.",
566  nullptr, this, MID_CLEARMESSAGEWINDOW);
567  // build help menu
568  myHelpMenu = new FXMenuPane(this);
570  "&Help",
571  nullptr, myHelpMenu);
573  "&Online Documentation", "F1", "Open Online documentation.",
574  nullptr, this, MID_HOTKEY_F1_ONLINEDOCUMENTATION);
576  "&About", "F12", "About sumo-gui.",
578  //new FXButton(myMenuBar, "\t\tShows TraCI status", GUIIconSubSys::getIcon(GUIIcon::ADD), this, MID_TRACI_STATUS, 0, 0, 0, 14, 14, 0, 0, 0, 0);
579  // build SUMO Accelerators (hotkeys)
581 }
582 
583 
584 void
586  // build tool bars
587  {
588  // file and simulation tool bar
589  myToolBarDrag1 = new FXToolBarShell(this, GUIDesignToolBar);
591  new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
592  // build file tools
593  new FXButton(myToolBar1, "\t\tOpen a simulation (Configuration file).", GUIIconSubSys::getIcon(GUIIcon::OPEN_CONFIG), this, MID_OPEN_CONFIG, GUIDesignButtonToolbar);
594  new FXButton(myToolBar1, "\t\tOpen a network.", GUIIconSubSys::getIcon(GUIIcon::OPEN_NET), this, MID_OPEN_NETWORK, GUIDesignButtonToolbar);
595  new FXButton(myToolBar1, "\t\tReloads the simulation / the network.", GUIIconSubSys::getIcon(GUIIcon::RELOAD), this, MID_HOTKEY_CTRL_R_RELOAD, GUIDesignButtonToolbar);
596  }
597  {
598  // simulation toolbar
599  myToolBarDrag2 = new FXToolBarShell(this, GUIDesignToolBar);
601  new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
602  // build simulation tools
606  }
607  {
608  // Simulation Step Display
609  myToolBarDrag3 = new FXToolBarShell(this, GUIDesignToolBar);
611  new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
612  new FXButton(myToolBar3, "Time:\t\tToggle between seconds and hour:minute:seconds display", nullptr, this, MID_TIME_TOOGLE, GUIDesignButtonToolbarText);
613 
614  myLCDLabel = new FXEX::FXLCDLabel(myToolBar3, 16, nullptr, 0, JUSTIFY_RIGHT);
618  myLCDLabel->setGroove(2);
619  myLCDLabel->setText("----------------");
620  }
621  {
622  // Simulation Delay
623  myToolBarDrag4 = new FXToolBarShell(this, GUIDesignToolBar);
625  new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
626  new FXButton(myToolBar4, "Delay (ms):\t\tDelay per simulated second. Click to toggle between the last two delay values", nullptr, this, MID_DELAY_TOOGLE, GUIDesignButtonToolbarText);
627  // create spinner for delay
628  mySimDelay = 0;
629  mySimDelayTarget = new FXDataTarget(mySimDelay);
630  mySimDelaySpinner = new FXRealSpinner(myToolBar4, 7, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSpinDial);
631  // create slider
632  mySimDelaySlider = new FXSlider(myToolBar4, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSlider);
633  mySimDelaySlider->setRange(0, 1000);
634  mySimDelaySlider->setHeadSize(10);
635  mySimDelaySlider->setIncrement(50);
636  mySimDelaySlider->setTickDelta(100);
637  mySimDelaySlider->setValue((int)mySimDelay);
638  //mySimDelayTarget->setNumberFormat(0);
639  //mySimDelayTarget->setIncrements(1, 10, 10);
640  mySimDelaySpinner->setIncrement(10);
641  mySimDelaySpinner->setRange(0, 10000);
642  mySimDelaySpinner->setValue(mySimDelay);
643  }
644  {
645  // Scale traffic (flows and incrementally loaded vehicles)
646  myToolBarDrag8 = new FXToolBarShell(this, GUIDesignToolBar);
648  new FXToolBarGrip(myToolBar8, myToolBar8, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
649  new FXLabel(myToolBar8, "Scale Traffic:\t\tScale traffic from flows and vehicles that are loaded incrementally from route files", nullptr, LAYOUT_TOP | LAYOUT_LEFT);
650  myDemandScaleSpinner = new FXRealSpinner(myToolBar8, 7, this, MID_DEMAND_SCALE, GUIDesignSpinDial);
651  myDemandScaleSpinner->setIncrement(0.5);
652  myDemandScaleSpinner->setRange(0, 1000);
653  myDemandScaleSpinner->setValue(1);
654  }
655  {
656  // Views
657  myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBar);
659  new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
660  // build view tools
661  new FXButton(myToolBar5, "\t\tOpen a new microscopic view.",
663 #ifdef HAVE_OSG
664  new FXButton(myToolBar5, "\t\tOpen a new 3D view.",
666 #endif
667  }
668  {
670  // total waitingTime
671  myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBar);
673  new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
674  new FXLabel(myToolBar6, "Waiting Time:\t\tTime spent waiting accumulated for all vehicles", nullptr, LAYOUT_TOP | LAYOUT_LEFT);
675  myWaitingTimeLabel = new FXEX::FXLCDLabel(myToolBar6, 13, nullptr, 0, JUSTIFY_RIGHT);
680  myWaitingTimeLabel->setText("-------------");
681 
682  // idealistic time loss
683  myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBar);
685  new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
686  new FXLabel(myToolBar7, "Time Loss:\t\tTime lost due to being unable to drive with maximum speed for all vehicles", nullptr, LAYOUT_TOP | LAYOUT_LEFT);
687  myTimeLossLabel = new FXEX::FXLCDLabel(myToolBar7, 13, nullptr, 0, JUSTIFY_RIGHT);
692  myTimeLossLabel->setText("-------------");
693 
694  // total driving distance
695  myToolBarDrag9 = new FXToolBarShell(this, GUIDesignToolBar);
697  new FXToolBarGrip(myToolBar9, myToolBar9, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
698  new FXLabel(myToolBar9, "Distance (km):\t\tTotal distance driven by DRT vehicles", nullptr, LAYOUT_TOP | LAYOUT_LEFT);
699  myTotalDistanceLabel = new FXEX::FXLCDLabel(myToolBar9, 13, nullptr, 0, JUSTIFY_RIGHT);
704  myTotalDistanceLabel->setText("-------------");
705 
706  // emergency vehicle counts
707  myToolBarDrag10 = new FXToolBarShell(this, GUIDesignToolBar);
709  new FXToolBarGrip(myToolBar10, myToolBar10, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
710  new FXLabel(myToolBar10, "Emergency Vehicle waiting time:\t\tTime spent waiting accumulated for emergency vehicles", nullptr, LAYOUT_TOP | LAYOUT_LEFT);
711  myEmergencyVehicleLabel = new FXEX::FXLCDLabel(myToolBar10, 13, nullptr, 0, JUSTIFY_RIGHT);
716  myEmergencyVehicleLabel->setText("-------------");
717  }
718 }
719 
720 
721 long
722 GUIApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
724  getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
725  getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
726  getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
727  getApp()->reg().writeIntEntry("gui", "alternateSimDelay", (int)myAlternateSimDelay);
728  getApp()->exit(0);
729  return 1;
730 }
731 
732 
733 long
734 GUIApplicationWindow::onCmdEditChosen(FXObject* menu, FXSelector, void*) {
735  FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
736  if (mc->getText() == "Edit Selected...") {
737  GUIDialog_GLChosenEditor* chooser =
739  chooser->create();
740  chooser->show();
741  } else {
743  const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
744  for (MSEdgeVector::const_iterator i = MSEdge::getAllEdges().begin(); i != MSEdge::getAllEdges().end(); ++i) {
745  const std::vector<MSLane*>& lanes = (*i)->getLanes();
746  for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
747  GUILane* lane = dynamic_cast<GUILane*>(*it);
748  assert(lane != 0);
749  if ((lane->getPermissions() & svc) != 0) {
750  gSelected.select(lane->getGlID());
751  }
752  }
753  }
754  if (myMDIClient->numChildren() > 0) {
755  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
756  if (w != nullptr) {
757  // color by selection
759  }
760  }
761  }
762  updateChildren();
763  }
764  return 1;
765 }
766 
767 
768 long
769 GUIApplicationWindow::onCmdEditBreakpoints(FXObject*, FXSelector, void*) {
771  chooser->create();
772  chooser->show();
773  return 1;
774 }
775 
776 long
777 GUIApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
778  if (!myGLWindows.empty()) {
779  myGLWindows[0]->getView()->showViewportEditor();
780  }
781  return 1;
782 }
783 
784 
785 long
786 GUIApplicationWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
787  if (!myGLWindows.empty()) {
788  myGLWindows[0]->getView()->showViewschemeEditor();
789  }
790  return 1;
791 }
792 
793 
794 long
795 GUIApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
796  FXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html");
797  return 1;
798 }
799 
800 
801 long
802 GUIApplicationWindow::onCmdNetedit(FXObject*, FXSelector, void*) {
803  if (myGLWindows.empty()) {
804  return 1;
805  }
806  FXRegistry reg("SUMO netedit", "Eclipse");
807  reg.read();
808  const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
809  reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
810  reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
811  reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
812  reg.write();
813  std::string netedit = "netedit";
814  const char* sumoPath = getenv("SUMO_HOME");
815  if (sumoPath != nullptr) {
816  std::string newPath = std::string(sumoPath) + "/bin/netedit";
817  if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
818  netedit = "\"" + newPath + "\"";
819  }
820  }
821  std::string cmd = netedit + " --registry-viewport -s " + "\"" + OptionsCont::getOptions().getString("net-file") + "\"";
822  // start in background
823 #ifndef WIN32
824  cmd = cmd + " &";
825 #else
826  // see "help start" for the parameters
827  cmd = "start /B \"\" " + cmd;
828 #endif
829  WRITE_MESSAGE("Running " + cmd + ".");
830  // yay! fun with dangerous commands... Never use this over the internet
832  return 1;
833 }
834 
835 
836 long
837 GUIApplicationWindow::onCmdOpenConfiguration(FXObject*, FXSelector, void*) {
838  // get the new file name
839  FXFileDialog opendialog(this, "Open Simulation Configuration");
840  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_CONFIG));
841  opendialog.setSelectMode(SELECTFILE_EXISTING);
842  opendialog.setPatternList(myConfigPattern.c_str());
843  if (gCurrentFolder.length() != 0) {
844  opendialog.setDirectory(gCurrentFolder);
845  }
846  if (opendialog.execute()) {
847  gCurrentFolder = opendialog.getDirectory();
848  std::string file = opendialog.getFilename().text();
849  loadConfigOrNet(file);
850  myRecentFiles.appendFile(file.c_str());
851  }
852  return 1;
853 }
854 
855 
856 long
857 GUIApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
858  // get the new file name
859  FXFileDialog opendialog(this, "Open Network");
860  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
861  opendialog.setSelectMode(SELECTFILE_EXISTING);
862  opendialog.setPatternList("SUMO nets (*.net.xml)\nAll files (*)");
863  if (gCurrentFolder.length() != 0) {
864  opendialog.setDirectory(gCurrentFolder);
865  }
866  if (opendialog.execute()) {
867  gCurrentFolder = opendialog.getDirectory();
868  std::string file = opendialog.getFilename().text();
869  loadConfigOrNet(file);
870  myRecentFiles.appendFile(file.c_str());
871  }
872  return 1;
873 }
874 
875 
876 long
877 GUIApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
878  // get the shape file name
879  FXFileDialog opendialog(this, "Open Shapes");
880  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_SHAPES));
881  opendialog.setSelectMode(SELECTFILE_EXISTING);
882  opendialog.setPatternList("Additional files (*.xml)\nAll files (*)");
883  if (gCurrentFolder.length() != 0) {
884  opendialog.setDirectory(gCurrentFolder);
885  }
886  if (opendialog.execute()) {
887  gCurrentFolder = opendialog.getDirectory();
888  std::string file = opendialog.getFilename().text();
889 
890  dynamic_cast<GUIShapeContainer&>(myRunThread->getNet().getShapeContainer()).allowReplacement();
892  if (!XMLSubSys::runParser(handler, file, false)) {
893  WRITE_MESSAGE("Loading of " + file + " failed.");
894  }
895  update();
896  if (myMDIClient->numChildren() > 0) {
897  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
898  if (w != nullptr) {
899  w->getView()->update();
900  }
901  }
902  }
903  return 1;
904 }
905 
906 long
907 GUIApplicationWindow::onCmdOpenEdgeData(FXObject*, FXSelector, void*) {
908  // get the shape file name
909  FXFileDialog opendialog(this, "Open EdgeData");
910  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
911  opendialog.setSelectMode(SELECTFILE_EXISTING);
912  opendialog.setPatternList("EdgeData files (*.xml)\nAll files (*)");
913  if (gCurrentFolder.length() != 0) {
914  opendialog.setDirectory(gCurrentFolder);
915  }
916  if (opendialog.execute()) {
917  gCurrentFolder = opendialog.getDirectory();
918  std::string file = opendialog.getFilename().text();
919  if (!GUINet::getGUIInstance()->loadEdgeData(file)) {
920  WRITE_MESSAGE("Loading of " + file + " failed.");
921  }
922  update();
923  if (myMDIClient->numChildren() > 0) {
924  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
925  if (w != nullptr) {
926  w->getView()->update();
927  }
928  }
929  }
930  return 1;
931 }
932 
933 long
934 GUIApplicationWindow::onCmdReload(FXObject*, FXSelector, void*) {
935  if (!myAmLoading) {
937  getApp()->beginWaitCursor();
938  myAmLoading = true;
939  closeAllWindows();
940  myLoadThread->start();
941  setStatusBarText("Reloading.");
942  update();
943  }
944  return 1;
945 }
946 
947 
948 long
949 GUIApplicationWindow::onCmdOpenRecent(FXObject* /* sender */, FXSelector, void* ptr) {
950  if (myAmLoading) {
951  myStatusbar->getStatusLine()->setText("Already loading!");
952  return 1;
953  }
954  std::string file((const char*)ptr);
955  loadConfigOrNet(file);
956  return 1;
957 }
958 
959 
960 long
961 GUIApplicationWindow::onCmdSaveConfig(FXObject*, FXSelector, void*) {
962  // get the new file name
963  FXFileDialog opendialog(this, "Save SUMO Configuration");
964  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
965  opendialog.setSelectMode(SELECTFILE_ANY);
966  opendialog.setPatternList("Config (*.sumocfg)");
967  if (gCurrentFolder.length() != 0) {
968  opendialog.setDirectory(gCurrentFolder);
969  }
970  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
971  return 1;
972  }
973  std::string file = MFXUtils::assureExtension(opendialog.getFilename(),
974  opendialog.getPatternText(opendialog.getCurrentPattern()).after('.').before(')')).text();
975  std::ofstream out(file);
976  if (out.good()) {
977  OptionsCont::getOptions().writeConfiguration(out, true, false, false);
978  setStatusBarText("Configuration saved to " + file);
979  } else {
980  setStatusBarText("Could not save onfiguration to " + file);
981  }
982  out.close();
983  return 1;
984 }
985 
986 
987 long
988 GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
989  closeAllWindows();
990  return 1;
991 }
992 
993 
994 long
995 GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
996  sender->handle(this,
997  myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
998  ptr);
999  return 1;
1000 }
1001 
1002 
1003 long
1004 GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
1005  sender->handle(this,
1006  myAmLoading || myLoadThread->getFileName() == "" || TraCIServer::getInstance() != nullptr
1007  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1008  ptr);
1009  return 1;
1010 }
1011 
1012 
1013 long
1014 GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
1015  sender->handle(this,
1016  myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1017  ptr);
1018  return 1;
1019 }
1020 
1021 
1022 long
1023 GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
1024  sender->handle(this,
1026  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1027  ptr);
1028  return 1;
1029 }
1030 
1031 
1032 long
1033 GUIApplicationWindow::onCmdStart(FXObject*, FXSelector, void*) {
1034  // check whether a net was loaded successfully
1035  if (!myRunThread->simulationAvailable()) {
1036  myStatusbar->getStatusLine()->setText("No simulation loaded!");
1037  return 1;
1038  }
1039  // check whether it was started before and paused;
1040  if (!myWasStarted) {
1041  myRunThread->begin();
1042  myWasStarted = true;
1043  }
1044  myRunThread->resume();
1045  getApp()->forceRefresh(); // only callking myToolBar2->forceRefresh somehow loses keyboard focus
1046  return 1;
1047 }
1048 
1049 
1050 long
1051 GUIApplicationWindow::onCmdStop(FXObject*, FXSelector, void*) {
1052  myRunThread->stop();
1053  getApp()->forceRefresh(); // only callking myToolBar2->forceRefresh somehow loses keyboard focus
1054  return 1;
1055 }
1056 
1057 
1058 long
1059 GUIApplicationWindow::onCmdStep(FXObject*, FXSelector, void*) {
1060  // check whether a net was loaded successfully
1061  if (!myRunThread->simulationAvailable()) {
1062  myStatusbar->getStatusLine()->setText("No simulation loaded!");
1063  return 1;
1064  }
1065  // check whether it was started before and paused;
1066  if (!myWasStarted) {
1067  myRunThread->begin();
1068  myWasStarted = true;
1069  }
1071  return 1;
1072 }
1073 
1074 
1075 long
1076 GUIApplicationWindow::onCmdSaveState(FXObject*, FXSelector, void*) {
1077  // get the new file name
1078  FXFileDialog opendialog(this, "Save Simulation State");
1079  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1080  opendialog.setSelectMode(SELECTFILE_ANY);
1081  opendialog.setPatternList("GZipped State (*.xml.gz)\nXML State (*.xml)");
1082  if (gCurrentFolder.length() != 0) {
1083  opendialog.setDirectory(gCurrentFolder);
1084  }
1085  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1086  return 1;
1087  }
1088 
1089  const std::string file = MFXUtils::assureExtension(opendialog.getFilename(),
1090  opendialog.getPatternText(opendialog.getCurrentPattern()).after('.').before(')')).text();
1091  MSStateHandler::saveState(file, MSNet::getInstance()->getCurrentTimeStep());
1092  setStatusBarText("Simulation saved to " + file);
1093  return 1;
1094 }
1095 
1096 
1097 long
1098 GUIApplicationWindow::onCmdTimeToggle(FXObject*, FXSelector, void*) {
1102  }
1103  return 1;
1104 }
1105 
1106 
1107 long
1108 GUIApplicationWindow::onCmdDelayToggle(FXObject*, FXSelector, void*) {
1109  const double tmp = myAlternateSimDelay;
1111  mySimDelay = tmp;
1112  return 1;
1113 }
1114 
1115 
1116 long
1117 GUIApplicationWindow::onCmdDemandScale(FXObject*, FXSelector, void*) {
1120  }
1121  return 1;
1122 }
1123 
1124 
1125 long
1126 GUIApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
1128  return 1;
1129 }
1130 
1131 
1132 long
1133 GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
1134  sender->handle(this,
1136  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1137  ptr);
1138  return 1;
1139 }
1140 
1141 
1142 long
1143 GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
1144  sender->handle(this,
1146  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1147  ptr);
1148  return 1;
1149 }
1150 
1151 
1152 long
1153 GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
1154  sender->handle(this,
1156  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1157  ptr);
1158  return 1;
1159 }
1160 
1161 
1162 long
1163 GUIApplicationWindow::onUpdNeedsSimulation(FXObject* sender, FXSelector, void* ptr) {
1164  bool disable = !myRunThread->simulationAvailable() || myAmLoading;
1165  sender->handle(this, disable ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1166  // mySelectLanesMenuCascade has to be disabled manually
1167  if (disable) {
1168  mySelectLanesMenuCascade->disable();
1169  } else {
1170  mySelectLanesMenuCascade->enable();
1171  }
1172  return 1;
1173 }
1174 
1175 long
1176 GUIApplicationWindow::onUpdTraCIStatus(FXObject* sender, FXSelector, void* ptr) {
1177  sender->handle(this, TraCIServer::getInstance() == nullptr ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1178  return 1;
1179 }
1180 
1181 
1182 long
1183 GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
1184  if (myMDIClient->numChildren() > 0) {
1185  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1186  if (w != nullptr) {
1187  w->onCmdLocate(nullptr, sel, nullptr);
1188  }
1189  }
1190  return 1;
1191 }
1192 
1193 
1194 long
1195 GUIApplicationWindow::onCmdShowStats(FXObject*, FXSelector, void*) {
1196  if (myMDIClient->numChildren() > 0) {
1197  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1199  }
1200  return 1;
1201 }
1202 
1203 
1204 long
1205 GUIApplicationWindow::onCmdAppSettings(FXObject*, FXSelector, void*) {
1207  d->create();
1208  d->show(PLACEMENT_OWNER);
1209  return 1;
1210 }
1211 
1212 
1213 long
1214 GUIApplicationWindow::onCmdGaming(FXObject*, FXSelector, void*) {
1215  if (myGLWindows.empty()) {
1216  return 1;
1217  }
1219  myGLWindows[0]->getView()->getVisualisationSettings().gaming = myAmGaming;
1220  if (myAmGaming) {
1221  myMenuBar->hide();
1222  myStatusbar->hide();
1223  myToolBar1->hide();
1224  myToolBar2->hide();
1225  myToolBar4->hide();
1226  myToolBar5->hide();
1227  myToolBar6->show();
1228  myToolBar8->hide();
1229  myToolBar10->show();
1230  if (myTLSGame) {
1231  myToolBar7->show();
1232  } else {
1233  myToolBar9->show();
1234  }
1235  myMessageWindow->hide();
1241  } else {
1242  myMenuBar->show();
1243  myStatusbar->show();
1244  myToolBar1->show();
1245  myToolBar2->show();
1246  myToolBar4->show();
1247  myToolBar5->show();
1248  myToolBar6->hide();
1249  myToolBar7->hide();
1250  myToolBar8->show();
1251  myToolBar9->hide();
1252  myToolBar10->hide();
1253  myMessageWindow->show();
1255  }
1256  if (myMDIClient->numChildren() > 0) {
1257  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1258  if (w != nullptr) {
1260  }
1261  }
1262  update();
1263  return 1;
1264 }
1265 
1266 
1267 long
1268 GUIApplicationWindow::onCmdFullScreen(FXObject*, FXSelector, void*) {
1269  if (myGLWindows.empty()) {
1270  return 1;
1271  }
1273  if (myAmFullScreen) {
1274  getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1275  getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1276  getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1277  getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1278  maximize();
1279  setDecorations(DECOR_NONE);
1280  place(PLACEMENT_MAXIMIZED);
1281  myMenuBar->hide();
1282  myStatusbar->hide();
1283  myToolBar1->hide();
1284  myToolBar2->hide();
1285  myToolBar3->hide();
1286  myToolBar4->hide();
1287  myToolBar5->hide();
1288  myToolBar6->hide();
1289  myToolBar7->hide();
1290  myToolBar8->hide();
1291  myMessageWindow->hide();
1292  if (myMDIClient->numChildren() > 0) {
1293  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1294  if (w != nullptr) {
1295  w->setToolBarVisibility(false);
1296  }
1297  }
1298  update();
1299  } else {
1300  place(PLACEMENT_VISIBLE);
1301  setDecorations(DECOR_ALL);
1302  restore();
1303  myToolBar3->show();
1305  onCmdGaming(nullptr, 0, nullptr);
1306  setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
1307  setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1308  setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
1309  setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
1310  }
1311  return 1;
1312 }
1313 
1314 
1315 long
1316 GUIApplicationWindow::onCmdListInternal(FXObject*, FXSelector, void*) {
1318  return 1;
1319 }
1320 
1321 
1322 long
1323 GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) {
1325  return 1;
1326 }
1327 
1328 long
1329 GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) {
1331  return 1;
1332 }
1333 
1334 
1335 long
1336 GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) {
1338  return 1;
1339 }
1340 
1341 
1342 #ifdef HAVE_OSG
1343 long
1344 GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1346  return 1;
1347 }
1348 #endif
1349 
1350 
1351 long
1352 GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
1353  GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this);
1354  about->create();
1355  about->show(PLACEMENT_OWNER);
1356  return 1;
1357 }
1358 
1359 long
1360 GUIApplicationWindow::onCmdHallOfFame(FXObject*, FXSelector, void*) {
1361  GUIDialog_HallOfFame* hall = new GUIDialog_HallOfFame(this);
1362  hall->create();
1363  hall->show(PLACEMENT_OWNER);
1364  return 1;
1365 }
1366 
1367 
1368 long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1369  FXEvent* event = (FXEvent*)ptr;
1370  FXString string = GUIUserIO::clipped.c_str();
1371  setDNDData(FROM_CLIPBOARD, event->target, string);
1372  return 1;
1373 }
1374 
1375 
1376 long
1377 GUIApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
1378  eventOccurred();
1379  return 1;
1380 }
1381 
1382 
1383 long
1384 GUIApplicationWindow::onRunThreadEvent(FXObject*, FXSelector, void*) {
1385  eventOccurred();
1386  return 1;
1387 }
1388 
1389 
1390 void
1392  while (!myEvents.empty()) {
1393  // get the next event
1394  GUIEvent* e = myEvents.top();
1395  myEvents.pop();
1396  // process
1397  switch (e->getOwnType()) {
1400  break;
1401  case EVENT_SIMULATION_STEP:
1402  if (myRunThread->simulationAvailable()) { // avoid race-condition related crash if reload was pressed
1404  }
1405  break;
1408  case EVENT_ERROR_OCCURRED:
1409  case EVENT_DEBUG_OCCURRED:
1411  case EVENT_STATUS_OCCURRED:
1413  break;
1416  break;
1417  default:
1418  break;
1419  }
1420  delete e;
1421  }
1422  myToolBar2->forceRefresh();
1423  myToolBar3->forceRefresh();
1424 }
1425 
1426 
1427 void
1429  myAmLoading = false;
1431  // check whether the loading was successfull
1432  if (ec->myNet == nullptr) {
1433  // report failure
1434  setStatusBarText("Loading of '" + ec->myFile + "' failed!");
1435  if (GUIGlobals::gQuitOnEnd) {
1436  closeAllWindows();
1437  getApp()->exit(1);
1438  }
1439  } else {
1440  // initialise simulation thread
1441  if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1442  if (GUIGlobals::gQuitOnEnd) {
1443  closeAllWindows();
1444  getApp()->exit(1);
1445  }
1446  } else {
1447  // report success
1448  setStatusBarText("'" + ec->myFile + "' loaded.");
1450  myWasStarted = false;
1451  myHaveNotifiedAboutSimEnd = false;
1452  // initialise views
1453  myViewNumber = 0;
1455  if (ec->mySettingsFiles.size() > 0) {
1456  // open a view for each file and apply settings
1457  for (std::vector<std::string>::const_iterator it = ec->mySettingsFiles.begin(); it != ec->mySettingsFiles.end(); ++it) {
1458  GUISettingsHandler settings(*it);
1459  GUISUMOViewParent::ViewType vt = defaultType;
1460  if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
1462  }
1463  if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
1465  }
1466  GUISUMOAbstractView* view = openNewView(vt);
1467  if (view == nullptr) {
1468  break;
1469  }
1470  std::string settingsName = settings.addSettings(view);
1471  view->addDecals(settings.getDecals());
1472  settings.applyViewport(view);
1473  settings.setSnapshots(view);
1474  if (settings.getDelay() > 0.) {
1475  mySimDelay = settings.getDelay();
1476  }
1477  if (settings.getBreakpoints().size() > 0) {
1478  myRunThread->getBreakpointLock().lock();
1479  myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
1480  myRunThread->getBreakpointLock().unlock();
1481  }
1482  if (!OptionsCont::getOptions().isDefault("breakpoints")) {
1483  std::vector<SUMOTime> breakpoints;
1484  for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
1485  breakpoints.push_back(string2time(val));
1486  }
1487  std::sort(breakpoints.begin(), breakpoints.end());
1488  myRunThread->getBreakpointLock().lock();
1489  myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1490  myRunThread->getBreakpointLock().unlock();
1491  }
1492  myJamSounds = settings.getEventDistribution("jam");
1493  myCollisionSounds = settings.getEventDistribution("collision");
1494  if (settings.getJamSoundTime() > 0) {
1495  myJamSoundTime = settings.getJamSoundTime();
1496  }
1497  }
1498  } else {
1499  openNewView(defaultType);
1500  }
1501 
1502  if (!OptionsCont::getOptions().isDefault("delay")) {
1503  setDelay(OptionsCont::getOptions().getFloat("delay"));
1504  mySimDelaySlider->setValue((int)mySimDelay);
1505  mySimDelaySpinner->setValue(mySimDelay);
1506  }
1507 
1508  if (!OptionsCont::getOptions().isDefault("breakpoints")) {
1509  std::vector<SUMOTime> breakpoints;
1510  for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
1511  breakpoints.push_back(string2time(val));
1512  }
1513  std::sort(breakpoints.begin(), breakpoints.end());
1514  myRunThread->getBreakpointLock().lock();
1515  myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1516  myRunThread->getBreakpointLock().unlock();
1517  }
1518 
1519  if (OptionsCont::getOptions().getBool("game")) {
1520  if (OptionsCont::getOptions().getString("game.mode") == "tls") {
1521  myTLSGame = true;
1522  setTitle("SUMO Interactive Traffic Light");
1523  } else {
1524  myTLSGame = false;
1525  setTitle("SUMO Interactive Demand-Responsive-Transport");
1526  }
1527  onCmdGaming(nullptr, 0, nullptr);
1528  } else {
1529  // set simulation name on the caption
1530  setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str()));
1531  }
1532  if (ec->myViewportFromRegistry) {
1533  Position off;
1534  off.set(getApp()->reg().readRealEntry("viewport", "x"),
1535  getApp()->reg().readRealEntry("viewport", "y"),
1536  getApp()->reg().readRealEntry("viewport", "z"));
1537  Position p(off.x(), off.y(), 0);
1538  GUISUMOAbstractView* view = myGLWindows[0]->getView();
1539  view->setViewportFromToRot(off, p, 0);
1540  }
1541  // set simulation step begin information
1542  myLCDLabel->setText("----------------");
1543  for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
1544  (*it)->setText("-");
1545  }
1546  // initialize scale from options unless already set in the UI
1547  if (myDemandScaleSpinner->getValue() == 1 || !OptionsCont::getOptions().isDefault("scale")) {
1548  myDemandScaleSpinner->setValue(OptionsCont::getOptions().getFloat("scale"));
1549  }
1550  }
1551  }
1552  getApp()->endWaitCursor();
1553  // start if wished
1554  if (GUIGlobals::gRunAfterLoad && ec->myNet != nullptr && myRunThread->simulationIsStartable()) {
1555  onCmdStart(nullptr, 0, nullptr);
1556  }
1557  update();
1558 }
1559 
1560 
1561 void
1564  const int running = myRunThread->getNet().getVehicleControl().getRunningVehicleNo();
1565  const int backlog = myRunThread->getNet().getInsertionControl().getWaitingVehicleNo();
1566  if (backlog > running) {
1567  if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::GREENVEHICLE)) {
1569  }
1570  } else {
1571  if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::YELLOWVEHICLE)) {
1573  }
1574  }
1575  myStatButtons.front()->setText(toString(running).c_str());
1576  if (myRunThread->getNet().hasPersons()) {
1577  if (!myStatButtons[1]->shown()) {
1578  myStatButtons[1]->show();
1579  }
1581  }
1582  if (myRunThread->getNet().hasContainers()) {
1583  if (!myStatButtons[2]->shown()) {
1584  myStatButtons[2]->show();
1585  }
1587  }
1588  if (myAmGaming) {
1589  if (myTLSGame) {
1591  } else {
1593  }
1594  }
1596  getApp()->forceRefresh(); // restores keyboard focus
1597  }
1598  updateChildren();
1599  update();
1600 }
1601 
1602 
1603 void
1605  GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
1606  if (ec->getOwnType() == EVENT_STATUS_OCCURRED) {
1607  setStatusBarText(ec->getMsg());
1608  } else {
1609  myMessageWindow->appendMsg(ec->getOwnType(), ec->getMsg());
1610  }
1611 }
1612 
1613 
1614 void
1616  GUIEvent_SimulationEnded* ec = static_cast<GUIEvent_SimulationEnded*>(e);
1617  onCmdStop(nullptr, 0, nullptr);
1618  if (ec->getReason() == MSNet::SIMSTATE_LOADING) {
1619  onCmdReload(nullptr, 0, nullptr);
1620  } else if (GUIGlobals::gQuitOnEnd) {
1621  closeAllWindows();
1622  getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
1623  } else if (GUIGlobals::gDemoAutoReload) {
1624  onCmdReload(nullptr, 0, nullptr);
1625  } else if (!myHaveNotifiedAboutSimEnd) {
1626  // build the text
1627  const std::string text = "Simulation ended at time: " + time2string(ec->getTimeStep()) +
1628  ".\nReason: " + MSNet::getStateMessage(ec->getReason()) +
1629  "\nDo you want to close all open files and views?";
1630  FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, "Simulation ended", "%s", text.c_str());
1631  if (answer == 1) { //1:yes, 2:no, 4:esc
1632  closeAllWindows();
1633  }
1635  }
1636 }
1637 
1638 
1639 void
1644 #ifdef HAVE_DANGEROUS_SOUNDS // disable user-configurable command execution for public build
1645  if (myJamSounds.getOverallProb() > 0) {
1646  // play honking sound if some vehicle is waiting too long
1647  for (; it != end; ++it) {
1648  // XXX use impatience instead of waiting time ?
1649  if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
1650  const std::string cmd = myJamSounds.get(&myGamingRNG);
1651  if (cmd != "") {
1652  // yay! fun with dangerous commands... Never use this over the internet
1654  // one sound per simulation step is enough
1655  break;
1656  }
1657  }
1658  }
1659  }
1660  if (myCollisionSounds.getOverallProb() > 0) {
1661  int collisions = MSNet::getInstance()->getVehicleControl().getCollisionCount();
1662  if (myPreviousCollisionNumber != collisions) {
1663  const std::string cmd = myCollisionSounds.get(&myGamingRNG);
1664  if (cmd != "") {
1665  // yay! fun with dangerous commands... Never use this over the internet
1667  }
1668  myPreviousCollisionNumber = collisions;
1669  }
1670  }
1671 #endif
1672 
1673  // update performance indicators
1674  for (it = vc.loadedVehBegin(); it != end; ++it) {
1675  const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
1676  assert(veh != 0);
1677  if (veh->isOnRoad() && !veh->isStopped()) {
1678  const double vmax = MIN2(veh->getVehicleType().getMaxSpeed(), veh->getEdge()->getSpeedLimit());
1679  if (veh->getSpeed() < SUMO_const_haltingSpeed) {
1681  if (veh->getID().rfind("emergency", 0) == 0) {
1683  }
1684  }
1685  myTimeLoss += TIME2STEPS(TS * (vmax - veh->getSpeed()) / vmax); // may be negative with speedFactor > 1
1686  }
1687 
1688  }
1692 }
1693 
1694 void
1696  // update performance indicators
1700 
1703  for (auto it = vc.loadedVehBegin(); it != end; ++it) {
1704  const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
1705  assert(veh != 0);
1706  if (veh->isOnRoad() && !veh->isStopped()) {
1707  myTotalDistance += SPEED2DIST(veh->getSpeed());
1708  }
1709  }
1711 }
1712 
1713 void
1714 GUIApplicationWindow::loadConfigOrNet(const std::string& file) {
1715  if (!myAmLoading) {
1717  getApp()->beginWaitCursor();
1718  myAmLoading = true;
1719  closeAllWindows();
1720  gSchemeStorage.saveViewport(0, 0, -1, 0); // recenter view
1722  setStatusBarText("Loading '" + file + "'.");
1723  update();
1724  }
1725 }
1726 
1727 
1730  if (!myRunThread->simulationAvailable()) {
1731  myStatusbar->getStatusLine()->setText("No simulation loaded!");
1732  return nullptr;
1733  }
1734  GUISUMOAbstractView* oldView = nullptr;
1735  if (myMDIClient->numChildren() > 0) {
1736  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1737  if (w != nullptr) {
1738  oldView = w->getView();
1739  }
1740  }
1741  std::string caption = "View #" + toString(myViewNumber++);
1742  FXuint opts = MDI_TRACKING;
1743  GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
1744  this, GUIIconSubSys::getIcon(GUIIcon::SUMO_MINI), opts, 10, 10, 200);
1746  if (oldView != nullptr) {
1747  // copy viewport
1748  oldView->copyViewportTo(v);
1749  }
1750  w->create();
1751  if (myMDIClient->numChildren() == 1) {
1752  w->maximize();
1753  } else {
1754  myMDIClient->vertical(true);
1755  }
1756  myMDIClient->setActiveChild(w);
1757 
1758  return v;
1759 }
1760 
1761 
1762 FXGLCanvas*
1764  if (myMDIClient->numChildren() == 0) {
1765  return nullptr;
1766  }
1767  GUISUMOViewParent* share_tmp1 =
1768  static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
1769  return share_tmp1->getBuildGLCanvas();
1770 }
1771 
1772 
1773 void
1775  myTrackerLock.lock();
1776  myLCDLabel->setText("----------------");
1777  for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
1778  (*it)->setText("-");
1779  if (it != myStatButtons.begin()) {
1780  (*it)->hide();
1781  }
1782  }
1783  // delete the simulation
1785  // reset the caption
1786  setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
1787  // remove trackers and other external windows (must be delayed until deleteSim)
1788  while (!myGLWindows.empty()) {
1789  delete myGLWindows.front();
1790  }
1791  // make a copy because deleting modifyes the vector;
1792  std::vector<FXMainWindow*> trackerWindows = myTrackerWindows;;
1793  for (FXMainWindow* const window : trackerWindows) {
1794  delete window;
1795  }
1796  myTrackerWindows.clear();
1797  // clear selected items
1798  gSelected.clear();
1799  // add a separator to the log
1801  myTrackerLock.unlock();
1802  // remove coordinate information
1803  myGeoCoordinate->setText("N/A");
1804  myCartesianCoordinate->setText("N/A");
1805  //
1808  update();
1809 }
1810 
1811 
1812 FXCursor*
1814  return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
1815 }
1816 
1817 
1818 SUMOTime
1821 }
1822 
1823 
1824 double
1827 }
1828 
1829 
1830 void
1832  loadConfigOrNet("");
1833 }
1834 
1835 
1836 void
1837 GUIApplicationWindow::setStatusBarText(const std::string& text) {
1838  myStatusbar->getStatusLine()->setText(text.c_str());
1839  myStatusbar->getStatusLine()->setNormalText(text.c_str());
1840 }
1841 
1842 
1843 void
1844 GUIApplicationWindow::addRecentFile(const FX::FXString& f) {
1845  myRecentFiles.appendFile(f);
1846 }
1847 
1848 
1849 void
1851  time -= DELTA_T; // synchronize displayed time with netstate output
1852  if (time < 0) {
1853  myLCDLabel->setText("----------------");
1854  return;
1855  }
1856  if (myAmGaming) {
1857  // show time counting backwards
1858  time = myRunThread->getSimEndTime() - time;
1859  }
1860  std::ostringstream str;
1861  str << std::setfill('0');
1862  const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0;
1863  if (myShowTimeAsHMS) {
1864  SUMOTime day = time / 86400000;
1865  if (day > 0) {
1866  str << day << '-';
1867  time %= 86400000;
1868  }
1869  str << std::setw(2);
1870  str << time / 3600000 << '-';
1871  time %= 3600000;
1872  str << std::setw(2) << time / 60000 << '-';
1873  time %= 60000;
1874  }
1875  str << std::setw(2) << time / 1000;
1876  if (!hideFraction) {
1877  str << '.' << std::setw(3) << time % 1000;
1878  }
1879  myLCDLabel->setText(str.str().c_str());
1880 }
1881 
1882 
1883 long
1884 GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* ptr) {
1885  const long handled = FXMainWindow::onKeyPress(o, sel, ptr);
1886  if (handled == 0 && myMDIClient->numChildren() > 0) {
1887  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1888  if (w != nullptr) {
1889  w->onKeyPress(nullptr, sel, ptr);
1890  }
1891  }
1892  return 0;
1893 }
1894 
1895 
1896 long
1897 GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* ptr) {
1898  const long handled = FXMainWindow::onKeyRelease(o, sel, ptr);
1899  if (handled == 0 && myMDIClient->numChildren() > 0) {
1900  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1901  if (w != nullptr) {
1902  w->onKeyRelease(nullptr, sel, ptr);
1903  }
1904  }
1905  return 0;
1906 }
1907 
1908 
1909 void
1911  myEventMutex.lock();
1912  myEvents.push_back(event);
1915  myEventMutex.unlock();
1916 }
1917 
1918 void
1919 GUIApplicationWindow::setBreakpoints(const std::vector<SUMOTime>& breakpoints) {
1920  if (myRunThread != nullptr) {
1921  myRunThread->getBreakpointLock().lock();
1922  myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1923  myRunThread->getBreakpointLock().unlock();
1924  }
1925 }
1926 
1927 const std::vector<SUMOTime>
1929  myRunThread->getBreakpointLock().lock();
1930  std::vector<SUMOTime> result = myRunThread->getBreakpoints();
1931  myRunThread->getBreakpointLock().unlock();
1932  return result;
1933 }
1934 
1935 
1936 /****************************************************************************/
@ MID_HOTKEY_CTRL_Q_CLOSE
Main window closes.
Definition: GUIAppEnum.h:99
@ ID_RUNTHREAD_EVENT
The Simulation execution thread.
Definition: GUIAppEnum.h:290
@ MID_LOCATEPERSON
Locate person - button.
Definition: GUIAppEnum.h:349
@ MID_LISTINTERNAL
Locator configuration - menu entry.
Definition: GUIAppEnum.h:312
@ MID_NEW_MICROVIEW
Open a new microscopic view.
Definition: GUIAppEnum.h:278
@ MID_LOCATEJUNCTION
Locate junction - button.
Definition: GUIAppEnum.h:339
@ MID_OPEN_CONFIG
Open configuration - ID.
Definition: GUIAppEnum.h:254
@ MID_HOTKEY_CTRL_W_CLOSESIMULATION
Close simulation - ID.
Definition: GUIAppEnum.h:109
@ MID_HOTKEY_CTRL_D_SINGLESIMULATIONSTEP_OPENDEMANDELEMENTS
Perform a single simulation step in SUMO and open Demand Elements in NETEDIT.
Definition: GUIAppEnum.h:81
@ MID_HOTKEY_F9_EDIT_VIEWSCHEME
open edit scheme menu
Definition: GUIAppEnum.h:193
@ MID_LOCATEPOLY
Locate polygons - button.
Definition: GUIAppEnum.h:359
@ MID_TRACI_STATUS
update traci status
Definition: GUIAppEnum.h:329
@ MID_HOTKEY_CTRL_SHIFT_S_SAVENETWORK_AS
save network as
Definition: GUIAppEnum.h:161
@ MID_HOTKEY_CTRL_B_EDITBREAKPOINT_OPENDATAELEMENTS
Edit simulation breakpoints in SUMO and open Data Elements in NETEDIT.
Definition: GUIAppEnum.h:77
@ MID_HOTKEY_F1_ONLINEDOCUMENTATION
open online documentation
Definition: GUIAppEnum.h:177
@ MID_HOTKEY_CTRL_R_RELOAD
Reload the previously loaded simulation.
Definition: GUIAppEnum.h:103
@ MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK
Stop the simulation in SUMO and save network in NETEDIT.
Definition: GUIAppEnum.h:101
@ MID_LOCATEADD
Locate addtional structure - button.
Definition: GUIAppEnum.h:355
@ MID_LOCATEPOI
Locate poi - button.
Definition: GUIAppEnum.h:357
@ MID_OPEN_NETWORK
Open network - ID.
Definition: GUIAppEnum.h:256
@ MID_DELAY_TOOGLE
toogle delay between alternative value
Definition: GUIAppEnum.h:369
@ MID_DEMAND_SCALE
scale traffic
Definition: GUIAppEnum.h:371
@ MID_HOTKEY_CTRL_I_EDITVIEWPORT
Open viewport editor.
Definition: GUIAppEnum.h:87
@ MID_RECENTFILE
Loads a file previously loaded.
Definition: GUIAppEnum.h:262
@ MID_APPSETTINGS
Application settings - menu entry.
Definition: GUIAppEnum.h:310
@ MID_HOTKEY_SHIFT_F11_HALLOFFAME
show the hall of fame dialog
Definition: GUIAppEnum.h:199
@ MID_NETEDIT
Open in netedit.
Definition: GUIAppEnum.h:302
@ MID_CLEARMESSAGEWINDOW
Clear simulation output.
Definition: GUIAppEnum.h:321
@ MID_OPEN_EDGEDATA
Load edge data for visualization.
Definition: GUIAppEnum.h:260
@ MID_HOTKEY_CTRL_F_FULSCREENMODE
Fullscreen mode - menu entry.
Definition: GUIAppEnum.h:89
@ MID_SIMSAVE
Save state to file.
Definition: GUIAppEnum.h:270
@ MID_LISTTELEPORTING
Definition: GUIAppEnum.h:314
@ MID_SHOWNETSTATS
Show network statistics.
Definition: GUIAppEnum.h:323
@ ID_LOADTHREAD_EVENT
The loading thread.
Definition: GUIAppEnum.h:288
@ MID_EDITCHOSEN
Open editor for selections.
Definition: GUIAppEnum.h:300
@ MID_SHOWPERSONSTATS
Show person statistics.
Definition: GUIAppEnum.h:327
@ MID_HOTKEY_ALT_F4_CLOSE
Main window closes.
Definition: GUIAppEnum.h:143
@ MID_TIME_TOOGLE
toogle time display mode
Definition: GUIAppEnum.h:367
@ MID_LOCATEEDGE
Locate edge - button.
Definition: GUIAppEnum.h:341
@ MID_HOTKEY_CTRL_A_STARTSIMULATION_OPENADDITIONALS
Start the simulation in SUMO and open Additionals Elemements in NETEDIT.
Definition: GUIAppEnum.h:75
@ MID_LOCATEVEHICLE
Locate vehicle - button.
Definition: GUIAppEnum.h:343
@ MID_LOCATETLS
Locate TLS - button.
Definition: GUIAppEnum.h:353
@ MID_LISTPARKING
Definition: GUIAppEnum.h:313
@ MID_NEW_OSGVIEW
Open a new microscopic 3D view.
Definition: GUIAppEnum.h:280
@ MID_HOTKEY_F12_ABOUT
open about dialog
Definition: GUIAppEnum.h:201
@ MID_HOTKEY_CTRL_G_GAMINGMODE_TOOGLEGRID
Toogle Gaming mode in SUMO and grid in NETEDIT.
Definition: GUIAppEnum.h:83
@ MID_SHOWVEHSTATS
Show vehicle statistics.
Definition: GUIAppEnum.h:325
@ MID_HOTKEY_CTRL_P
Load additional file with poi and polygons.
Definition: GUIAppEnum.h:258
@ MID_WINDOW
Main window-ID.
Definition: GUIAppEnum.h:237
@ MID_LOCATECONTAINER
Locate container - button.
Definition: GUIAppEnum.h:351
FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[]
GUICompleteSchemeStorage gSchemeStorage
#define GUIDesignSlider
Definition: GUIDesigns.h:401
#define GUIDesignSpinDial
Definition: GUIDesigns.h:384
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
Definition: GUIDesigns.h:348
#define GUIDesignMDIButtonLeft
Definition: GUIDesigns.h:153
#define GUIDesignToolBarRaisedSameTop
design for first toolbar shell positioned in the same position of dock
Definition: GUIDesigns.h:354
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition: GUIDesigns.h:91
#define GUIDesignHorizontalFrameStatusBar
Horizontal frame used in status bar.
Definition: GUIDesigns.h:272
#define GUIDesignToolBar
design for default toolbar
Definition: GUIDesigns.h:336
#define GUIDesignSplitter
Definition: GUIDesigns.h:373
#define GUIDesignSplitterMDI
MDI Splitter.
Definition: GUIDesigns.h:376
#define GUIDesignToolbarMenuBar
Definition: GUIDesigns.h:330
#define GUIDesignToolBarRaisedNextTop
design for first toolbar shell positioned in the next-top position of dock
Definition: GUIDesigns.h:351
#define GUIDesignButtonToolbarText
Definition: GUIDesigns.h:88
#define GUIDesignMDIButtonRight
MDIButton oriented to right.
Definition: GUIDesigns.h:156
#define GUIDesignStatusBar
design used in status bar
Definition: GUIDesigns.h:345
@ EVENT_GLDEBUG_OCCURRED
send when a gldebug occured
Definition: GUIEvent.h:52
@ EVENT_SIMULATION_ENDED
Send when the simulation is over;.
Definition: GUIEvent.h:60
@ EVENT_ERROR_OCCURRED
send when a error occured
Definition: GUIEvent.h:46
@ EVENT_SIMULATION_LOADED
send when a simulation has been loaded
Definition: GUIEvent.h:34
@ EVENT_STATUS_OCCURRED
send when a status change occured
Definition: GUIEvent.h:55
@ EVENT_SIMULATION_STEP
send when a simulation step has been performed
Definition: GUIEvent.h:37
@ EVENT_DEBUG_OCCURRED
send when a debug occured
Definition: GUIEvent.h:49
@ EVENT_MESSAGE_OCCURRED
send when a message occured
Definition: GUIEvent.h:40
@ EVENT_WARNING_OCCURRED
send when a warning occured
Definition: GUIEvent.h:43
GUISelectedStorage gSelected
A global holder of selected objects.
FXString gCurrentFolder
The folder used as last.
@ NETEDIT_MINI
@ GREENVEHICLE
@ LOCATEVEHICLE
@ LOCATEPERSON
@ WINDOWS_TILE_VERT
@ WINDOWS_CASCADE
@ LOCATECONTAINER
@ LOCATEJUNCTION
@ WINDOWS_TILE_HORI
@ YELLOWVEHICLE
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:278
SUMOTime DELTA_T
Definition: SUMOTime.cpp:37
std::string time2string(SUMOTime t)
convert SUMOTime to string
Definition: SUMOTime.cpp:68
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition: SUMOTime.cpp:45
#define SPEED2DIST(x)
Definition: SUMOTime.h:43
#define TS
Definition: SUMOTime.h:40
#define TIME2STEPS(x)
Definition: SUMOTime.h:55
long long int SUMOTime
Definition: SUMOTime.h:31
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
T MIN2(T a, T b)
Definition: StdDefs.h:73
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:60
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:44
void setTarget(FXObject *tgt)
set the target
Definition: FXBaseObject.h:128
void setSelector(FXSelector sel)
set the selector
Definition: FXBaseObject.h:138
void setGroove(const FXint width)
set/get groove width - must be less than segment width
Definition: FXLCDLabel.cpp:218
void setHorizontal(const FXint len)
set/get segment horizontal length - must be more than twice the segment width
Definition: FXLCDLabel.cpp:164
void setThickness(const FXint width)
set/get segment width - must be less than half the segment length
Definition: FXLCDLabel.cpp:200
void setText(FXString lbl)
manipulate text in LCD label
Definition: FXLCDLabel.cpp:149
void setVertical(const FXint len)
set/get segment vertical length - must be more than twice the segment width
Definition: FXLCDLabel.cpp:182
void setFgColor(FXColor clr)
set/get forground color
Definition: FXLCDLabel.cpp:123
bool empty()
Definition: FXSynchQue.h:128
void push_back(T what)
Definition: FXSynchQue.h:114
void pop()
Definition: FXSynchQue.h:65
static bool isReadable(std::string path)
Checks whether the given file is readable.
Definition: FileHelpers.cpp:48
static void resetFont()
to be called when the font context is invalidated
Definition: GLHelper.cpp:463
The main window of the SUMO-gui.
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.
void handleEvent_Message(GUIEvent *e)
GUILoadThread * myLoadThread
the thread that loads simulations
FXEX::FXLCDLabel * myTimeLossLabel
void handleEvent_SimulationEnded(GUIEvent *e)
int myViewNumber
The current view number.
FXEX::FXLCDLabel * myTotalDistanceLabel
FXToolBarShell * myToolBarDrag4
long onCmdAbout(FXObject *, FXSelector, void *)
Shows the about 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)
handle keys
void handleEvent_SimulationLoaded(GUIEvent *e)
FXToolBarShell * myToolBarDrag9
FXRealSpinner * mySimDelaySpinner
void handleEvent_SimulationStep(GUIEvent *e)
bool myHaveNotifiedAboutSimEnd
whether the simulation end was already announced
void setStatusBarText(const std::string &text)
get status bar text (can be implemented in children)
FXToolBarShell * myToolBarDrag10
void addRecentFile(const FX::FXString &f)
long onCmdStop(FXObject *, FXSelector, void *)
Called on "stop".
virtual void setDelay(double delay)
Sets the delay of the parent application.
double myJamSoundTime
waiting time after which vehicles trigger jam sounds
FXEX::FXLCDLabel * myWaitingTimeLabel
performance indicators
FXRealSpinner * myDemandScaleSpinner
the demand scale
FXSynchQue< GUIEvent * > myEvents
List of got requests.
FXToolBarShell * myToolBarDrag7
double mySimDelay
the simulation delay in milliseconds
SUMOTime getCurrentSimTime() const
get current sim time (must be implemented in all children)
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.
FXMDIMenu * myMDIMenu
The menu used for the MDI-windows.
long onCmdListTeleporting(FXObject *, FXSelector, void *)
Toggle listing of teleporting vehicles.
long onCmdStep(FXObject *, FXSelector, void *)
Called on "step".
FXMutex myEventMutex
the mutex for the waiting semaphore
FXMenuPane * mySelectByPermissions
double getTrackerInterval() const
get tracker interval (must be implemented in all children)
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".
FXMenuPane * myFileMenu
the submenus
long onCmdStart(FXObject *, FXSelector, void *)
Called on "play".
GUIMessageWindow * myMessageWindow
A window to display messages, warnings and error in.
void loadConfigOrNet(const std::string &file)
FXToolBar * myToolBar1
The application tool bar.
bool myWasStarted
the information whether the simulation was started before
virtual void addToWindowsMenu(FXMenuPane *)
FXSplitter * myMainSplitter
The splitter that divides the main window into views and the log window.
FXEX::FXLCDLabel * myEmergencyVehicleLabel
long onCmdListParking(FXObject *, FXSelector, void *)
Toggle listing of parking vehicles.
long onCmdListInternal(FXObject *, FXSelector, void *)
Toggle listing of internal structures.
bool myTLSGame
current game mode
long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
GUIApplicationWindow(FXApp *a, const std::string &configPattern)
Constructor.
GUISUMOAbstractView * openNewView(GUISUMOViewParent::ViewType vt=GUISUMOViewParent::VIEW_2D_OPENGL)
FXEX::FXLCDLabel * myLCDLabel
the simulation step display
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 breakpoints if provided by the application
long onCmdQuit(FXObject *, FXSelector, void *)
Called by FOX if the application shall be closed.
FXToolBarShell * myToolBarDrag8
long onUpdStart(FXObject *sender, FXSelector, void *ptr)
Determines whether "play" is enabled.
FXGLCanvas * getBuildGLCanvas() const
get build GL Canvas (must be implemented in all children)
FXRecentFiles myRecentFiles
List of recent files.
RandomDistributor< std::string > myJamSounds
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 onCmdNetedit(FXObject *, FXSelector, void *)
Called on menu Edit->Netedit.
virtual void create()
Creates the main window (required by FOX)
FXEX::FXThreadEvent myRunThreadEvent
io-event with the run-thread
FXEX::FXThreadEvent myLoadThreadEvent
io-event with the load-thread
FXToolBarShell * myToolBarDrag5
long onCmdDemandScale(FXObject *, FXSelector, void *)
Called on "demand scale".
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
RandomDistributor< std::string > myCollisionSounds
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 onCmdEditChosen(FXObject *, FXSelector, void *)
Called on menu Edit->Edit Chosen.
virtual void detach()
Detaches the tool/menu bar.
long onCmdOpenRecent(FXObject *, FXSelector, void *)
Called on opening a recent file.
long onUpdOpenRecent(FXObject *, FXSelector, void *)
Determines whether opening a recent file is enabled.
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
long onCmdSaveConfig(FXObject *, FXSelector, void *)
Called on menu File->Close.
void updateTimeLCD(SUMOTime time)
updates the simulation time display
long onCmdSaveState(FXObject *, FXSelector, void *)
Called on "save state".
FXToolBarShell * myToolBarDrag3
long onLoadThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the loading thread.
long onCmdReload(FXObject *, FXSelector, void *)
Called on reload.
long onUpdNeedsSimulation(FXObject *, FXSelector, void *)
Determines whether some buttons which require an active simulation may be shown.
long onUpdOpen(FXObject *, FXSelector, void *)
Determines whether opening is enabled.
long onCmdHallOfFame(FXObject *, FXSelector, void *)
Shows the Hall of Fame dialog.
long onCmdLocate(FXObject *, FXSelector, void *)
Called on menu commands from the Locator menu.
FXToolBarShell * myToolBarDrag6
long onCmdOpenConfiguration(FXObject *, FXSelector, void *)
Called on menu File->Open Configuration.
long onCmdOpenEdgeData(FXObject *, FXSelector, void *)
Called on menu File->Load EdgeData.
FXCondition myEventCondition
the semaphore when waiting for event completion
long onCmdEditViewport(FXObject *, FXSelector, void *)
Called on menu Edit->Viewport.
FXMenuBar * myMenuBar
The application menu bar.
static std::mt19937 myGamingRNG
A random number generator used to choose a gaming sound.
virtual ~GUIApplicationWindow()
Destructor.
long onCmdHelp(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Documentation
virtual void fillMenuBar()
Builds the menu bar.
std::vector< FXButton * > myStatButtons
Buttons showing and running values and triggering statistic windows.
void checkGamingEvents()
handles additional game-related events
long onCmdGaming(FXObject *, FXSelector, void *)
Toggle gaming mode.
void saveViewport(const double x, const double y, const double z, const double rot)
Makes the given viewport the default.
static void initCursors(FXApp *a)
Initiate GUICursorSubSys.
static FXMenuTitle * buildFXMenuTitle(FXComposite *p, const std::string &text, FXIcon *icon, FXMenuPane *menuPane)
build menu title
Definition: GUIDesigns.cpp:29
static FXMenuCommand * buildFXMenuCommandRecentFile(FXComposite *p, const std::string &text, FXObject *tgt, FXSelector sel)
build menu command (for recent files)
Definition: GUIDesigns.cpp:62
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
Definition: GUIDesigns.cpp:40
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:51
The application's "About" - dialog.
void create()
Creates the widget.
The dialog to change the application (gui) settings.
Editor for simulation breakpoints.
void show()
sets the focus after the window is created
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 & 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:77
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.
static double gTrackerInterval
the aggregation period for tracker windows in seconds
Definition: GUIGlobals.h:51
static bool gRunAfterLoad
the simulation shall start direct after loading
Definition: GUIGlobals.h:42
static bool gQuitOnEnd
the window shall be closed when the simulation has ended
Definition: GUIGlobals.h:45
static bool gDemoAutoReload
the simulation shall reload when it has ended (demo)
Definition: GUIGlobals.h:48
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:59
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
std::vector< FXMainWindow * > myTrackerWindows
bool myListTeleporting
information whether the locator should list teleporting vehicles
FXLabel * myCartesianCoordinate
Labels for the current cartesian and geo-coordinate.
FXMDIClient * myMDIClient
The multi view panel.
FXHorizontalFrame * myGeoFrame
FXLabel * myGeoCoordinate
bool listParking() const
return whether to list parking vehicles
void updateChildren()
update childrens
FXHorizontalFrame * myCartesianFrame
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
FXDockSite * myTopDock
bool myListInternal
information whether the locator should list internal structures
void storeWindowSizeAndPos()
record window position and size in registry
bool myAmFullScreen
fox need this
FXStatusBar * myStatusbar
The status bar.
FXGLVisual * myGLVisual
The gl-visual used.
bool myAmGaming
information whether the gui is currently in gaming mode
std::vector< GUIGlChildWindow * > myGLWindows
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.
MSTransportableControl & getPersonControl() override
Returns the person control.
Definition: GUINet.cpp:125
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition: GUINet.cpp:434
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:526
MSTransportableControl & getContainerControl() override
Returns the container control.
Definition: GUINet.cpp:134
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.
FXMutex & getBreakpointLock()
Definition: GUIRunThread.h:110
GUINet & getNet() const
virtual void begin()
std::vector< SUMOTime > & getBreakpoints()
Definition: GUIRunThread.h:106
virtual bool simulationIsStartable() const
virtual bool simulationIsStepable() const
virtual bool init(GUINet *net, SUMOTime start, SUMOTime end)
initialises the thread with the new simulation
SUMOTime getSimEndTime() const
Definition: GUIRunThread.h:102
virtual bool simulationIsStopable() const
bool simulationAvailable() const
virtual void deleteSim()
void prepareDestruction()
void addDecals(const std::vector< Decal > &decals)
add decals
GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings
GUIPerspectiveChanger & getChanger() const
get changer
virtual void setViewportFromToRot(const Position &lookFrom, const Position &lookAt, double rotation)
applies the given viewport settings
virtual void copyViewportTo(GUISUMOAbstractView *view)
copy the viewport to the given view
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.
std::string addSettings(GUISUMOAbstractView *view=0) const
Adds the parsed settings to the global list of settings.
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 buildSUMOAccelerators(GUIApplicationWindow *GUIApp)
build SUMO Accelerators
static void clearTextures()
clears loaded textures
static std::string clipped
Definition: GUIUserIO.h:58
GUIColorer laneColorer
The lane colorer.
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 dependance 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
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
const MSVehicleType & getVehicleType() const
Returns the vehicle's type definition.
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:847
double getSpeedLimit() const
Returns the speed limit of the edge @caution The speed limit of the first lane is retured; should pro...
Definition: MSEdge.cpp:919
static bool gUseMesoSim
Definition: MSGlobals.h:88
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition: MSLane.h:547
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:171
@ 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:371
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition: MSNet.cpp:718
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition: MSNet.h:494
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:313
bool hasContainers() const
Returns whether containers are simulated.
Definition: MSNet.h:404
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:424
bool hasPersons() const
Returns whether persons are simulated.
Definition: MSNet.h:388
static void saveState(const std::string &file, SUMOTime step)
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:580
double getSpeed() const
Returns the vehicle's current speed.
Definition: MSVehicle.h:458
double getMaxSpeed() const
Get vehicle's maximum speed [m/s].
The XML-Handler for shapes loading network loading.
Definition: NLHandler.h:55
const std::string & getID() const
Returns the id.
Definition: Named.h:73
void writeConfiguration(std::ostream &os, const bool filled, const bool complete, const bool addComments, const bool inComment=false) const
Writes the configuration.
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.
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:36
void set(double x, double y)
set positions x and y
Definition: Position.h:84
double x() const
Returns the x-position.
Definition: Position.h:54
double y() const
Returns the y-position.
Definition: Position.h:59
static const RGBColor GREEN
Definition: RGBColor.h:181
static const RGBColor RED
named colors
Definition: RGBColor.h:180
double getOverallProb() const
Return the sum of the probabilites assigned to the members.
T get(std::mt19937 *which=0) const
Draw a sample of the distribution.
static unsigned long runHiddenCommand(const std::string &cmd)
run a shell command without popping up any windows (particuarly on win32)
Definition: SysUtils.cpp:64
static TraCIServer * getInstance()
Definition: TraCIServer.h:68
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false)
Runs the given handler on the given file; returns if everything's ok.
Definition: XMLSubSys.cpp:148
@ SEL_THREAD_EVENT
Definition: fxexdefs.h:187
@ SEL_THREAD
Definition: fxexdefs.h:169