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-2022 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 MIN_DRAW_DELAY 20
93 //#define HAVE_DANGEROUS_SOUNDS
94 
95 // ===========================================================================
96 // FOX-declarations
97 // ===========================================================================
98 FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[] = {
102  FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GUIApplicationWindow::onCmdQuit),
103 
109  FXMAPFUNC(SEL_COMMAND, MID_RECENTFILE, GUIApplicationWindow::onCmdOpenRecent),
113  FXMAPFUNC(SEL_COMMAND, MID_EDITCHOSEN, GUIApplicationWindow::onCmdEditChosen),
117  FXMAPFUNC(SEL_COMMAND, MID_NETEDIT, GUIApplicationWindow::onCmdNetedit),
118 
127  FXMAPFUNC(SEL_COMMAND, MID_NEW_MICROVIEW, GUIApplicationWindow::onCmdNewView),
128 #ifdef HAVE_OSG
129  FXMAPFUNC(SEL_COMMAND, MID_NEW_OSGVIEW, GUIApplicationWindow::onCmdNewOSG),
130 #endif
134  FXMAPFUNC(SEL_COMMAND, MID_SIMSAVE, GUIApplicationWindow::onCmdSaveState),
139 
143 
144  FXMAPFUNC(SEL_UPDATE, MID_OPEN_CONFIG, GUIApplicationWindow::onUpdOpen),
145  FXMAPFUNC(SEL_UPDATE, MID_OPEN_NETWORK, GUIApplicationWindow::onUpdOpen),
146  FXMAPFUNC(SEL_UPDATE, MID_OPEN_NETWORK, GUIApplicationWindow::onUpdOpen),
152 #ifdef HAVE_OSG
153  FXMAPFUNC(SEL_UPDATE, MID_NEW_OSGVIEW, GUIApplicationWindow::onUpdAddView),
154 #endif
169 
170  // forward requests to the active view
171  FXMAPFUNC(SEL_COMMAND, MID_LOCATEJUNCTION, GUIApplicationWindow::onCmdLocate),
172  FXMAPFUNC(SEL_COMMAND, MID_LOCATEEDGE, GUIApplicationWindow::onCmdLocate),
173  FXMAPFUNC(SEL_COMMAND, MID_LOCATEVEHICLE, GUIApplicationWindow::onCmdLocate),
174  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPERSON, GUIApplicationWindow::onCmdLocate),
176  FXMAPFUNC(SEL_COMMAND, MID_LOCATETLS, GUIApplicationWindow::onCmdLocate),
177  FXMAPFUNC(SEL_COMMAND, MID_LOCATEADD, GUIApplicationWindow::onCmdLocate),
178  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPOI, GUIApplicationWindow::onCmdLocate),
179  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPOLY, GUIApplicationWindow::onCmdLocate),
189  FXMAPFUNC(SEL_KEYPRESS, 0, GUIApplicationWindow::onKeyPress),
190  FXMAPFUNC(SEL_KEYRELEASE, 0, GUIApplicationWindow::onKeyRelease),
191 
192  FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GUIApplicationWindow::onClipboardRequest),
193 
198 };
199 
200 // Object implementation
201 FXIMPLEMENT(GUIApplicationWindow, FXMainWindow, GUIApplicationWindowMap, ARRAYNUMBER(GUIApplicationWindowMap))
202 
203 // ===========================================================================
204 // static members
205 // ===========================================================================
207 
208 // ===========================================================================
209 // member method definitions
210 // ===========================================================================
211 GUIApplicationWindow::GUIApplicationWindow(FXApp* a, const std::string& configPattern) :
212  GUIMainWindow(a),
213  myLoadThread(nullptr), myRunThread(nullptr),
214  myAmLoading(false),
215  myAlternateSimDelay(0.),
216  myRecentNetworksAndConfigs(a, "files"),
217  myConfigPattern(configPattern),
218  hadDependentBuild(false),
219  myShowTimeAsHMS(false),
220  myHaveNotifiedAboutSimEnd(false),
221  // game specific
222  myJamSoundTime(60),
223  myPreviousCollisionNumber(0),
224  myWaitingTime(0),
225  myTimeLoss(0),
226  myEmergencyVehicleCount(0),
227  myTotalDistance(0),
228  myLastStepEventMillis(SysUtils::getCurrentMillis() - MIN_DRAW_DELAY) {
229  // init icons
231  // init cursors
233 }
234 
235 
236 void
238  // don't do this twice
239  if (hadDependentBuild) {
240  return;
241  }
242  hadDependentBuild = true;
243 
244  setTarget(this);
245  setSelector(MID_WINDOW);
246 
247  // build menu bar
248  myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBar);
250  new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
251  buildToolBars();
252  // build the thread - io
257 
258  // build the status bar
259  myStatusbar = new FXStatusBar(this, GUIDesignStatusBar);
260  {
261  myGeoFrame = new FXHorizontalFrame(myStatusbar, GUIDesignHorizontalFrameStatusBar);
262  myGeoCoordinate = new FXLabel(myGeoFrame, "N/A\t\tOriginal coordinate (before coordinate transformation in netconvert)", nullptr, LAYOUT_CENTER_Y);
264  myCartesianCoordinate = new FXLabel(myCartesianFrame, "N/A\t\tNetwork coordinate", nullptr, LAYOUT_CENTER_Y);
267  myStatButtons.back()->hide();
269  myStatButtons.back()->hide();
270  }
271 
272  // make the window a mdi-window
273  myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
274  myMDIClient = new FXMDIClient(myMainSplitter, GUIDesignSplitterMDI);
275  myMDIMenu = new FXMDIMenu(this, myMDIClient);
276  new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
277  new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
278  new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
279  new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
280 
281  // build the message window
283  // fill menu and tool bar
284  fillMenuBar();
285  myToolBar6->hide();
286  myToolBar7->hide();
287  myToolBar9->hide();
288  myToolBar10->hide();
289  // build additional threads
290  myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent);
292  // set the status bar
293  myStatusbar->getStatusLine()->setText("Ready.");
294  // set the caption
295  setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
296 
297  // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
298  myRunThread->start();
301 }
302 
303 
304 void
307  gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
308  FXMainWindow::create();
309  myMenuBarDrag->create();
310  myToolBarDrag1->create();
311  myToolBarDrag2->create();
312  myToolBarDrag3->create();
313  myToolBarDrag4->create();
314  myToolBarDrag5->create();
315  myToolBarDrag6->create();
316  myToolBarDrag7->create();
317  myFileMenu->create();
318  mySelectByPermissions->create();
319  myEditMenu->create();
320  mySettingsMenu->create();
321  myLocatorMenu->create();
322  myControlMenu->create();
323  myWindowsMenu->create();
324  myHelpMenu->create();
325 
326  FXint textWidth = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
327  myCartesianFrame->setWidth(textWidth);
328  myGeoFrame->setWidth(textWidth);
329 
330  show(PLACEMENT_DEFAULT);
331  if (!OptionsCont::getOptions().isSet("window-size")) {
332  if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
333  maximize();
334  }
335  }
336  myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
337  myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
338 }
339 
340 
343  myRunThread->join();
344  closeAllWindows();
345  //
347  delete myGLVisual;
348  // delete some non-parented windows
349  delete myToolBarDrag1;
350  //
351  delete myRunThread;
352  delete myFileMenu;
353  delete myEditMenu;
354  delete mySelectByPermissions;
355  delete mySettingsMenu;
356  delete myLocatorMenu;
357  delete myControlMenu;
358  delete myWindowsMenu;
359  delete myHelpMenu;
360 
361  delete myLoadThread;
362 
363  while (!myEvents.empty()) {
364  // get the next event
365  GUIEvent* e = myEvents.top();
366  myEvents.pop();
367  delete e;
368  }
369 }
370 
371 
372 void
374  FXMainWindow::detach();
375  myMenuBarDrag->detach();
376  myToolBarDrag1->detach();
377 }
378 
379 
380 void
382  // build file menu
383  myFileMenu = new FXMenuPane(this);
386  "New Window", "Ctrl+Shift+N", "Open a new sumo-gui window.",
387  nullptr, this, MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW);
388  new FXMenuSeparator(myFileMenu);
390  "&Open Simulation...", "Ctrl+O", "Open a simulation (Configuration file).",
393  "Open &Network...", "Ctrl+N", "Open a network.",
396  "Open Shapes ", "Ctrl+P", "Load POIs and Polygons for visualization.",
399  "Open EdgeData ", "Ctrl+U", "Load edge related data for visualization.",
402  "&Reload", "Ctrl+R", "Reloads the simulation / the network.",
404  new FXMenuSeparator(myFileMenu);
406  "Save Configuration", "Ctrl+Shift+S", "Save current options as a configuration file.",
409  "Close", "Ctrl+W", "Close the simulation.",
411  // Recent files
412  FXMenuSeparator* sep1 = new FXMenuSeparator(myFileMenu);
413  sep1->setSelector(FXRecentFiles::ID_ANYFILES);
424  GUIDesigns::buildFXMenuCommand(myFileMenu, "C&lear Recent Files", nullptr, &myRecentNetworksAndConfigs, FXRecentFiles::ID_CLEAR);
426  myRecentNetworksAndConfigs.setTarget(this);
428  new FXMenuSeparator(myFileMenu);
430  "&Quit", "Ctrl+Q", "Quit the Application.",
431  nullptr, this, MID_HOTKEY_CTRL_Q_CLOSE);
432 
433  // build edit menu
434  mySelectByPermissions = new FXMenuPane(this);
435  std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
436  for (const auto& vehicleClass : vehicleClasses) {
438  }
439 
440  myEditMenu = new FXMenuPane(this);
443  "Edit Selected...", "Ctrl+E", "Opens a dialog for editing the list of selected items.",
445  mySelectLanesMenuCascade = new FXMenuCascade(myEditMenu,
446  "Select lanes which allow...\t\tOpens a menu for selecting a vehicle class by which to selected lanes.",
448  new FXMenuSeparator(myEditMenu);
450  "Edit Breakpoints", "Ctrl+B", "Opens a dialog for editing breakpoints.",
453  "Edit Visualisation", "F9", "Opens a dialog for editing visualization settings.",
456  "Edit Viewport", "Ctrl+I", "Opens a dialog for editing viewing area, zoom and rotation.",
458  new FXMenuSeparator(myEditMenu);
460  "Open in netedit", "Ctrl+T", "Opens the netedit application with the current network.",
462 
463  // build settings menu
464  mySettingsMenu = new FXMenuPane(this);
465  GUIDesigns::buildFXMenuTitle(myMenuBar, "&Settings", nullptr, mySettingsMenu);
467  "Application Settings", "Ctrl+H", "Open a Dialog for Application Settings editing.",
468  nullptr, this, MID_APPSETTINGS);
469  myGamingModeCheckbox = new FXMenuCheck(mySettingsMenu,
470  "Gaming Mode\tCtrl+G\tToggle gaming mode on/off.",
473  "Full Screen Mode", "Ctrl+F", "Toggle full screen mode on/off.",
475 
476  // build Locate menu
477  myLocatorMenu = new FXMenuPane(this);
480  "Locate &Junctions", "Shift+J", "Open a Dialog for Locating a Junction.",
483  "Locate &Edges", "Shift+E", "Open a Dialog for Locating an Edge.",
485  if (!MSGlobals::gUseMesoSim) { // there are no gui-vehicles in mesosim
487  "Locate &Vehicles", "Shift+V", "Open a Dialog for Locating a Vehicle.",
489  }
491  "Locate &Persons", "Shift+P", "Open a Dialog for Locating a Person.",
494  "Locate &Container", "Shift+C", "Open a Dialog for Locating a Container.",
497  "Locate &TLS", "Shift+T", "Open a Dialog for Locating a Traffic Light.",
500  "Locate &Additional", "Shift+A", "Open a Dialog for Locating an Additional Structure.",
503  "Locate P&oI", "Shift+O", "Open a Dialog for Locating a Point of Interest.",
506  "Locate Po&lygon", "Shift+L", "Open a Dialog for Locating a Polygon.",
508  new FXMenuSeparator(myLocatorMenu);
509  new FXMenuCheck(myLocatorMenu,
510  "Show Internal Structures\t\tShow internal junctions and streets in locator dialog.",
511  this, MID_LISTINTERNAL);
512  FXMenuCheck* listParking = new FXMenuCheck(myLocatorMenu,
513  "Show Parking Vehicles\t\tShow parking vehicles in locator dialog.",
514  this, MID_LISTPARKING);
515  listParking->setCheck(myListParking);
516  new FXMenuCheck(myLocatorMenu,
517  "Show vehicles outside the road network\t\tShow vehicles that are teleporting or driving remote-controlled outside the road network in locator dialog.",
518  this, MID_LISTTELEPORTING);
519 
520  // build control menu
521  myControlMenu = new FXMenuPane(this);
522  GUIDesigns::buildFXMenuTitle(myMenuBar, "Simulation", nullptr, myControlMenu);
524  "Run", "Ctrl+A", "Start running the simulation.",
527  "Stop", "Ctrl+S", "Stop running the simulation.",
530  "Step", "Ctrl+D", "Perform one simulation step.",
533  "Save", "", "Save the current simulation state to a file.",
535 
536  // build windows menu
537  myWindowsMenu = new FXMenuPane(this);
539  new FXMenuCheck(myWindowsMenu,
540  "Show Status Line\t\tToggle the Status Bar on/off.",
541  myStatusbar, FXWindow::ID_TOGGLESHOWN);
542  new FXMenuCheck(myWindowsMenu,
543  "Show Message Window\t\tToggle the Message Window on/off.",
544  myMessageWindow, FXWindow::ID_TOGGLESHOWN);
545  new FXMenuCheck(myWindowsMenu,
546  "Show Simulation Time\t\tToggle the Simulation Time on/off.",
547  myToolBar3, FXWindow::ID_TOGGLESHOWN);
548  new FXMenuCheck(myWindowsMenu,
549  "Show Simulation Delay\t\tToggle the Simulation Delay Entry on/off.",
550  myToolBar4, FXWindow::ID_TOGGLESHOWN);
552  new FXMenuSeparator(myWindowsMenu);
554  "Tile &Horizontally", "", "",
555  GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_HORI), myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
557  "Tile &Vertically", "", "",
558  GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_VERT), myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
560  "Cascade", "", "",
562  myMDIClient, FXMDIClient::ID_MDI_CASCADE);
564  "&Close", "", "",
565  nullptr, myMDIClient, FXMDIClient::ID_MDI_CLOSE);
566  sep1 = new FXMenuSeparator(myWindowsMenu);
567  sep1->setTarget(myMDIClient);
568  sep1->setSelector(FXMDIClient::ID_MDI_ANY);
569  GUIDesigns::buildFXMenuCommand(myWindowsMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_1);
570  GUIDesigns::buildFXMenuCommand(myWindowsMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_2);
571  GUIDesigns::buildFXMenuCommand(myWindowsMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_3);
572  GUIDesigns::buildFXMenuCommand(myWindowsMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_4);
573  GUIDesigns::buildFXMenuCommand(myWindowsMenu, "&Others...", nullptr, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
574  new FXMenuSeparator(myWindowsMenu);
576  "Clear Message Window", "", "Clear the message window.",
578  // build help menu
579  myHelpMenu = new FXMenuPane(this);
581  "&Help",
582  nullptr, myHelpMenu);
584  "&Online Documentation", "F1", "Open Online documentation.",
585  nullptr, this, MID_HOTKEY_F1_ONLINEDOCUMENTATION);
587  "&About", "F12", "About sumo-gui.",
589  //new FXButton(myMenuBar, "\t\tShows TraCI status", GUIIconSubSys::getIcon(GUIIcon::ADD), this, MID_TRACI_STATUS, 0, 0, 0, 14, 14, 0, 0, 0, 0);
590  // build SUMO Accelerators (hotkeys)
592 }
593 
594 
595 void
597  // build tool bars
598  {
599  // file and simulation tool bar
600  myToolBarDrag1 = new FXToolBarShell(this, GUIDesignToolBar);
602  new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
603  // build file tools
604  new FXButton(myToolBar1, "\t\tOpen a simulation (Configuration file).", GUIIconSubSys::getIcon(GUIIcon::OPEN_CONFIG), this, MID_OPEN_CONFIG, GUIDesignButtonToolbar);
605  new FXButton(myToolBar1, "\t\tOpen a network.", GUIIconSubSys::getIcon(GUIIcon::OPEN_NET), this, MID_OPEN_NETWORK, GUIDesignButtonToolbar);
606  new FXButton(myToolBar1, "\t\tReloads the simulation / the network.", GUIIconSubSys::getIcon(GUIIcon::RELOAD), this, MID_HOTKEY_CTRL_R_RELOAD, GUIDesignButtonToolbar);
607  }
608  {
609  // simulation toolbar
610  myToolBarDrag2 = new FXToolBarShell(this, GUIDesignToolBar);
612  new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
613  // build simulation tools
617  }
618  {
619  // Simulation Step Display
620  myToolBarDrag3 = new FXToolBarShell(this, GUIDesignToolBar);
622  new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
623  new FXButton(myToolBar3, "Time:\t\tToggle between seconds and hour:minute:seconds display", nullptr, this, MID_TIME_TOGGLE, GUIDesignButtonToolbarText);
624 
625  myLCDLabel = new FXEX::FXLCDLabel(myToolBar3, 16, nullptr, 0, JUSTIFY_RIGHT);
629  myLCDLabel->setGroove(2);
630  myLCDLabel->setText("----------------");
631  }
632  {
633  // Simulation Delay
634  myToolBarDrag4 = new FXToolBarShell(this, GUIDesignToolBar);
636  new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
637  new FXButton(myToolBar4, "Delay (ms):\t\tDelay per simulated second. Click to toggle between the last two delay values", nullptr, this, MID_DELAY_TOGGLE, GUIDesignButtonToolbarText);
638  // create spinner for delay
639  mySimDelay = 0;
640  mySimDelayTarget = new FXDataTarget(mySimDelay);
641  mySimDelaySpinner = new FXRealSpinner(myToolBar4, 7, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSpinDial);
642  // create slider
643  mySimDelaySlider = new FXSlider(myToolBar4, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSlider);
644  mySimDelaySlider->setRange(0, 1000);
645  mySimDelaySlider->setHeadSize(10);
646  mySimDelaySlider->setIncrement(50);
647  mySimDelaySlider->setTickDelta(100);
648  mySimDelaySlider->setValue((int)mySimDelay);
649  //mySimDelayTarget->setNumberFormat(0);
650  //mySimDelayTarget->setIncrements(1, 10, 10);
651  mySimDelaySpinner->setIncrement(10);
652  mySimDelaySpinner->setRange(0, 10000);
653  mySimDelaySpinner->setValue(mySimDelay);
654  }
655  {
656  // Scale traffic (flows and incrementally loaded vehicles)
657  myToolBarDrag8 = new FXToolBarShell(this, GUIDesignToolBar);
659  new FXToolBarGrip(myToolBar8, myToolBar8, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
660  new FXLabel(myToolBar8, "Scale Traffic:\t\tScale traffic from flows and vehicles that are loaded incrementally from route files", nullptr, LAYOUT_TOP | LAYOUT_LEFT);
661  myDemandScaleSpinner = new FXRealSpinner(myToolBar8, 7, this, MID_DEMAND_SCALE, GUIDesignSpinDial);
662  myDemandScaleSpinner->setIncrement(0.5);
663  myDemandScaleSpinner->setRange(0, 1000);
664  myDemandScaleSpinner->setValue(1);
665  }
666  {
667  // Views
668  myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBar);
670  new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
671  // build view tools
672  new FXButton(myToolBar5, "\t\tOpen a new microscopic view.",
674 #ifdef HAVE_OSG
675  new FXButton(myToolBar5, "\t\tOpen a new 3D view.",
677 #endif
678  }
679  {
681  // total waitingTime
682  myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBar);
684  new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
685  new FXLabel(myToolBar6, "Waiting Time:\t\tTime spent waiting accumulated for all vehicles", nullptr, LAYOUT_TOP | LAYOUT_LEFT);
686  myWaitingTimeLabel = new FXEX::FXLCDLabel(myToolBar6, 13, nullptr, 0, JUSTIFY_RIGHT);
691  myWaitingTimeLabel->setText("-------------");
692 
693  // idealistic time loss
694  myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBar);
696  new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
697  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);
698  myTimeLossLabel = new FXEX::FXLCDLabel(myToolBar7, 13, nullptr, 0, JUSTIFY_RIGHT);
703  myTimeLossLabel->setText("-------------");
704 
705  // total driving distance
706  myToolBarDrag9 = new FXToolBarShell(this, GUIDesignToolBar);
708  new FXToolBarGrip(myToolBar9, myToolBar9, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
709  new FXLabel(myToolBar9, "Distance (km):\t\tTotal distance driven by DRT vehicles", nullptr, LAYOUT_TOP | LAYOUT_LEFT);
710  myTotalDistanceLabel = new FXEX::FXLCDLabel(myToolBar9, 13, nullptr, 0, JUSTIFY_RIGHT);
715  myTotalDistanceLabel->setText("-------------");
716 
717  // emergency vehicle counts
718  myToolBarDrag10 = new FXToolBarShell(this, GUIDesignToolBar);
720  new FXToolBarGrip(myToolBar10, myToolBar10, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
721  new FXLabel(myToolBar10, "Emergency Vehicle waiting time:\t\tTime spent waiting accumulated for emergency vehicles", nullptr, LAYOUT_TOP | LAYOUT_LEFT);
722  myEmergencyVehicleLabel = new FXEX::FXLCDLabel(myToolBar10, 13, nullptr, 0, JUSTIFY_RIGHT);
727  myEmergencyVehicleLabel->setText("-------------");
728  }
729 }
730 
731 
732 long
733 GUIApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
735  getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
736  getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
737  getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
738  getApp()->reg().writeIntEntry("gui", "alternateSimDelay", (int)myAlternateSimDelay);
739  getApp()->exit(0);
740  return 1;
741 }
742 
743 
744 long
745 GUIApplicationWindow::onCmdEditChosen(FXObject* menu, FXSelector, void*) {
746  FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
747  if (mc->getText() == "Edit Selected...") {
748  GUIDialog_GLChosenEditor* chooser =
750  chooser->create();
751  chooser->show();
752  } else {
754  const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
755  for (MSEdgeVector::const_iterator i = MSEdge::getAllEdges().begin(); i != MSEdge::getAllEdges().end(); ++i) {
756  const std::vector<MSLane*>& lanes = (*i)->getLanes();
757  for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
758  GUILane* lane = dynamic_cast<GUILane*>(*it);
759  assert(lane != 0);
760  if ((lane->getPermissions() & svc) != 0) {
761  gSelected.select(lane->getGlID());
762  }
763  }
764  }
765  if (myMDIClient->numChildren() > 0) {
766  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
767  if (w != nullptr) {
768  // color by selection
770  }
771  }
772  }
773  updateChildren();
774  }
775  return 1;
776 }
777 
778 
779 long
780 GUIApplicationWindow::onCmdEditBreakpoints(FXObject*, FXSelector, void*) {
782  chooser->create();
783  chooser->show();
784  return 1;
785 }
786 
787 long
788 GUIApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
789  if (!myGLWindows.empty()) {
790  myGLWindows[0]->getView()->showViewportEditor();
791  }
792  return 1;
793 }
794 
795 
796 long
797 GUIApplicationWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
798  if (!myGLWindows.empty()) {
799  myGLWindows[0]->getView()->showViewschemeEditor();
800  }
801  return 1;
802 }
803 
804 
805 long
806 GUIApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
807  FXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html");
808  return 1;
809 }
810 
811 
812 long
813 GUIApplicationWindow::onCmdNetedit(FXObject*, FXSelector, void*) {
814  if (myGLWindows.empty()) {
815  return 1;
816  }
817  FXRegistry reg("SUMO netedit", "netedit");
818  reg.read();
819  const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
820  reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
821  reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
822  reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
823  reg.write();
824  std::string netedit = "netedit";
825  const char* sumoPath = getenv("SUMO_HOME");
826  if (sumoPath != nullptr) {
827  std::string newPath = std::string(sumoPath) + "/bin/netedit";
828  if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
829  netedit = "\"" + newPath + "\"";
830  }
831  }
832  std::string cmd = netedit + " --registry-viewport -s " + "\"" + OptionsCont::getOptions().getString("net-file") + "\"";
833  // start in background
834 #ifndef WIN32
835  cmd = cmd + " &";
836 #else
837  // see "help start" for the parameters
838  cmd = "start /B \"\" " + cmd;
839 #endif
840  WRITE_MESSAGE("Running " + cmd + ".");
841  // yay! fun with dangerous commands... Never use this over the internet
843  return 1;
844 }
845 
846 
847 long
848 GUIApplicationWindow::onCmdNewWindow(FXObject*, FXSelector, void*) {
849  FXRegistry reg("SUMO sumo-gui", "sumo-gui");
850  std::string sumo_gui = "sumo-gui";
851  const char* sumoPath = getenv("SUMO_HOME");
852  if (sumoPath != nullptr) {
853  std::string newPath = std::string(sumoPath) + "/bin/sumo_gui";
854  if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
855  sumo_gui = "\"" + newPath + "\"";
856  }
857  }
858  std::string cmd = sumo_gui;
859  // start in background
860 #ifndef WIN32
861  cmd = cmd + " &";
862 #else
863  // see "help start" for the parameters
864  cmd = "start /B \"\" " + cmd;
865 #endif
866  WRITE_MESSAGE("Running " + cmd + ".");
867  // yay! fun with dangerous commands... Never use this over the internet
869  return 1;
870 }
871 
872 
873 long
874 GUIApplicationWindow::onCmdOpenConfiguration(FXObject*, FXSelector, void*) {
875  // get the new file name
876  FXFileDialog opendialog(this, "Open Simulation Configuration");
877  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_CONFIG));
878  opendialog.setSelectMode(SELECTFILE_EXISTING);
879  opendialog.setPatternList(myConfigPattern.c_str());
880  if (gCurrentFolder.length() != 0) {
881  opendialog.setDirectory(gCurrentFolder);
882  }
883  if (opendialog.execute()) {
884  gCurrentFolder = opendialog.getDirectory();
885  std::string file = opendialog.getFilename().text();
886  loadConfigOrNet(file);
887  myRecentNetworksAndConfigs.appendFile(file.c_str());
888  }
889  return 1;
890 }
891 
892 
893 long
894 GUIApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
895  // get the new file name
896  FXFileDialog opendialog(this, "Open Network");
897  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
898  opendialog.setSelectMode(SELECTFILE_EXISTING);
899  opendialog.setPatternList("SUMO nets (*.net.xml)\nAll files (*)");
900  if (gCurrentFolder.length() != 0) {
901  opendialog.setDirectory(gCurrentFolder);
902  }
903  if (opendialog.execute()) {
904  gCurrentFolder = opendialog.getDirectory();
905  std::string file = opendialog.getFilename().text();
906  loadConfigOrNet(file);
907  myRecentNetworksAndConfigs.appendFile(file.c_str());
908  }
909  return 1;
910 }
911 
912 
913 long
914 GUIApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
915  // get the shape file name
916  FXFileDialog opendialog(this, "Open Shapes");
917  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_SHAPES));
918  opendialog.setSelectMode(SELECTFILE_EXISTING);
919  opendialog.setPatternList("Additional files (*.xml)\nAll files (*)");
920  if (gCurrentFolder.length() != 0) {
921  opendialog.setDirectory(gCurrentFolder);
922  }
923  if (opendialog.execute()) {
924  gCurrentFolder = opendialog.getDirectory();
925  std::string file = opendialog.getFilename().text();
926 
927  dynamic_cast<GUIShapeContainer&>(myRunThread->getNet().getShapeContainer()).allowReplacement();
929  if (!XMLSubSys::runParser(handler, file, false)) {
930  WRITE_MESSAGE("Loading of " + file + " failed.");
931  }
932  update();
933  if (myMDIClient->numChildren() > 0) {
934  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
935  if (w != nullptr) {
936  w->getView()->update();
937  }
938  }
939  }
940  return 1;
941 }
942 
943 long
944 GUIApplicationWindow::onCmdOpenEdgeData(FXObject*, FXSelector, void*) {
945  // get the shape file name
946  FXFileDialog opendialog(this, "Open EdgeData");
947  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
948  opendialog.setSelectMode(SELECTFILE_EXISTING);
949  opendialog.setPatternList("EdgeData files (*.xml)\nAll files (*)");
950  if (gCurrentFolder.length() != 0) {
951  opendialog.setDirectory(gCurrentFolder);
952  }
953  if (opendialog.execute()) {
954  gCurrentFolder = opendialog.getDirectory();
955  std::string file = opendialog.getFilename().text();
956  if (!GUINet::getGUIInstance()->loadEdgeData(file)) {
957  WRITE_MESSAGE("Loading of " + file + " failed.");
958  }
959  update();
960  if (myMDIClient->numChildren() > 0) {
961  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
962  if (w != nullptr) {
963  w->getView()->update();
964  }
965  }
966  }
967  return 1;
968 }
969 
970 long
971 GUIApplicationWindow::onCmdReload(FXObject*, FXSelector, void*) {
972  if (!myAmLoading) {
974  getApp()->beginWaitCursor();
975  myAmLoading = true;
976  closeAllWindows();
977  myLoadThread->start();
978  setStatusBarText("Reloading.");
979  update();
980  }
981  return 1;
982 }
983 
984 
985 long
986 GUIApplicationWindow::onCmdOpenRecent(FXObject* /* sender */, FXSelector, void* ptr) {
987  if (myAmLoading) {
988  myStatusbar->getStatusLine()->setText("Already loading!");
989  return 1;
990  }
991  std::string file((const char*)ptr);
992  loadConfigOrNet(file);
993  return 1;
994 }
995 
996 
997 long
998 GUIApplicationWindow::onCmdSaveConfig(FXObject*, FXSelector, void*) {
999  // get the new file name
1000  FXFileDialog opendialog(this, "Save SUMO Configuration");
1001  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1002  opendialog.setSelectMode(SELECTFILE_ANY);
1003  opendialog.setPatternList("Config (*.sumocfg)");
1004  if (gCurrentFolder.length() != 0) {
1005  opendialog.setDirectory(gCurrentFolder);
1006  }
1007  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1008  return 1;
1009  }
1010  std::string file = MFXUtils::assureExtension(opendialog.getFilename(),
1011  opendialog.getPatternText(opendialog.getCurrentPattern()).after('.').before(')')).text();
1012  std::ofstream out(StringUtils::transcodeToLocal(file));
1013  if (out.good()) {
1014  OptionsCont::getOptions().writeConfiguration(out, true, false, false);
1015  setStatusBarText("Configuration saved to " + file);
1016  } else {
1017  setStatusBarText("Could not save onfiguration to " + file);
1018  }
1019  out.close();
1020  return 1;
1021 }
1022 
1023 
1024 long
1025 GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
1026  closeAllWindows();
1027  return 1;
1028 }
1029 
1030 
1031 long
1032 GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
1033  sender->handle(this,
1034  myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1035  ptr);
1036  return 1;
1037 }
1038 
1039 
1040 long
1041 GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
1042  sender->handle(this,
1043  myAmLoading || myLoadThread->getFileName() == "" || TraCIServer::getInstance() != nullptr
1044  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1045  ptr);
1046  return 1;
1047 }
1048 
1049 
1050 long
1051 GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
1052  sender->handle(this,
1053  myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1054  ptr);
1055  return 1;
1056 }
1057 
1058 
1059 long
1060 GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
1061  sender->handle(this,
1063  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1064  ptr);
1065  return 1;
1066 }
1067 
1068 
1069 long
1070 GUIApplicationWindow::onCmdStart(FXObject*, FXSelector, void*) {
1071  // check whether a net was loaded successfully
1072  if (!myRunThread->simulationAvailable()) {
1073  myStatusbar->getStatusLine()->setText("No simulation loaded!");
1074  return 1;
1075  }
1076  // check whether it was started before and paused;
1077  if (!myWasStarted) {
1078  myRunThread->begin();
1079  myWasStarted = true;
1080  }
1081  myRunThread->resume();
1082  getApp()->forceRefresh(); // only callking myToolBar2->forceRefresh somehow loses keyboard focus
1083  return 1;
1084 }
1085 
1086 
1087 long
1088 GUIApplicationWindow::onCmdStop(FXObject*, FXSelector, void*) {
1089  myRunThread->stop();
1090  getApp()->forceRefresh(); // only callking myToolBar2->forceRefresh somehow loses keyboard focus
1091  return 1;
1092 }
1093 
1094 
1095 long
1096 GUIApplicationWindow::onCmdStep(FXObject*, FXSelector, void*) {
1097  // check whether a net was loaded successfully
1098  if (!myRunThread->simulationAvailable()) {
1099  myStatusbar->getStatusLine()->setText("No simulation loaded!");
1100  return 1;
1101  }
1102  // check whether it was started before and paused;
1103  if (!myWasStarted) {
1104  myRunThread->begin();
1105  myWasStarted = true;
1106  }
1108  return 1;
1109 }
1110 
1111 
1112 long
1113 GUIApplicationWindow::onCmdSaveState(FXObject*, FXSelector, void*) {
1114  // get the new file name
1115  FXFileDialog opendialog(this, "Save Simulation State");
1116  opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1117  opendialog.setSelectMode(SELECTFILE_ANY);
1118  opendialog.setPatternList("GZipped State (*.xml.gz)\nXML State (*.xml)");
1119  if (gCurrentFolder.length() != 0) {
1120  opendialog.setDirectory(gCurrentFolder);
1121  }
1122  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1123  return 1;
1124  }
1125 
1126  const std::string file = MFXUtils::assureExtension(opendialog.getFilename(),
1127  opendialog.getPatternText(opendialog.getCurrentPattern()).after('.').before(')')).text();
1128  MSStateHandler::saveState(file, MSNet::getInstance()->getCurrentTimeStep());
1129  setStatusBarText("Simulation saved to " + file);
1130  return 1;
1131 }
1132 
1133 
1134 long
1135 GUIApplicationWindow::onCmdTimeToggle(FXObject*, FXSelector, void*) {
1139  }
1140  return 1;
1141 }
1142 
1143 
1144 long
1145 GUIApplicationWindow::onCmdDelayToggle(FXObject*, FXSelector, void*) {
1146  const double tmp = myAlternateSimDelay;
1148  mySimDelay = tmp;
1149  return 1;
1150 }
1151 
1152 
1153 long
1154 GUIApplicationWindow::onCmdDemandScale(FXObject*, FXSelector, void*) {
1157  }
1158  return 1;
1159 }
1160 
1161 
1162 long
1163 GUIApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
1165  return 1;
1166 }
1167 
1168 
1169 long
1170 GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
1171  sender->handle(this,
1173  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1174  ptr);
1175  return 1;
1176 }
1177 
1178 
1179 long
1180 GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
1181  sender->handle(this,
1183  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1184  ptr);
1185  return 1;
1186 }
1187 
1188 
1189 long
1190 GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
1191  sender->handle(this,
1193  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1194  ptr);
1195  return 1;
1196 }
1197 
1198 
1199 long
1200 GUIApplicationWindow::onUpdNeedsSimulation(FXObject* sender, FXSelector, void* ptr) {
1201  bool disable = !myRunThread->simulationAvailable() || myAmLoading;
1202  sender->handle(this, disable ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1203  // mySelectLanesMenuCascade has to be disabled manually
1204  if (disable) {
1205  mySelectLanesMenuCascade->disable();
1206  } else {
1207  mySelectLanesMenuCascade->enable();
1208  }
1209  return 1;
1210 }
1211 
1212 long
1213 GUIApplicationWindow::onUpdTraCIStatus(FXObject* sender, FXSelector, void* ptr) {
1214  sender->handle(this, TraCIServer::getInstance() == nullptr ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1215  return 1;
1216 }
1217 
1218 
1219 long
1220 GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
1221  if (myMDIClient->numChildren() > 0) {
1222  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1223  if (w != nullptr) {
1224  w->onCmdLocate(nullptr, sel, nullptr);
1225  }
1226  }
1227  return 1;
1228 }
1229 
1230 
1231 long
1232 GUIApplicationWindow::onCmdShowStats(FXObject*, FXSelector, void*) {
1233  if (myMDIClient->numChildren() > 0) {
1234  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1236  }
1237  return 1;
1238 }
1239 
1240 
1241 long
1242 GUIApplicationWindow::onCmdAppSettings(FXObject*, FXSelector, void*) {
1244  d->create();
1245  d->show(PLACEMENT_OWNER);
1246  return 1;
1247 }
1248 
1249 
1250 long
1251 GUIApplicationWindow::onCmdGaming(FXObject*, FXSelector, void*) {
1252  if (myGLWindows.empty()) {
1253  return 1;
1254  }
1256  myGLWindows[0]->getView()->getVisualisationSettings().gaming = myAmGaming;
1257  if (myAmGaming) {
1258  myGamingModeCheckbox->setCheck(TRUE);
1259  myMenuBar->hide();
1260  myStatusbar->hide();
1261  myToolBar1->hide();
1262  myToolBar2->hide();
1263  myToolBar4->hide();
1264  myToolBar5->hide();
1265  myToolBar6->show();
1266  myToolBar8->hide();
1267  myToolBar10->show();
1268  if (myTLSGame) {
1269  myToolBar7->show();
1270  } else {
1271  myToolBar9->show();
1272  }
1273  myMessageWindow->hide();
1279  } else {
1280  myGamingModeCheckbox->setCheck(FALSE);
1281  myMenuBar->show();
1282  myStatusbar->show();
1283  myToolBar1->show();
1284  myToolBar2->show();
1285  myToolBar4->show();
1286  myToolBar5->show();
1287  myToolBar6->hide();
1288  myToolBar7->hide();
1289  myToolBar8->show();
1290  myToolBar9->hide();
1291  myToolBar10->hide();
1292  myMessageWindow->show();
1294  }
1295  if (myMDIClient->numChildren() > 0) {
1296  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1297  if (w != nullptr) {
1299  }
1300  }
1301  update();
1302  return 1;
1303 }
1304 
1305 
1306 long
1307 GUIApplicationWindow::onCmdFullScreen(FXObject*, FXSelector, void*) {
1308  if (myGLWindows.empty()) {
1309  return 1;
1310  }
1312  if (myAmFullScreen) {
1313  getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1314  getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1315  getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1316  getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1317  maximize();
1318  setDecorations(DECOR_NONE);
1319  place(PLACEMENT_MAXIMIZED);
1320  myMenuBar->hide();
1321  myStatusbar->hide();
1322  myToolBar1->hide();
1323  myToolBar2->hide();
1324  myToolBar3->hide();
1325  myToolBar4->hide();
1326  myToolBar5->hide();
1327  myToolBar6->hide();
1328  myToolBar7->hide();
1329  myToolBar8->hide();
1330  myMessageWindow->hide();
1331  if (myMDIClient->numChildren() > 0) {
1332  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1333  if (w != nullptr) {
1334  w->setToolBarVisibility(false);
1335  }
1336  }
1337  update();
1338  } else {
1339  place(PLACEMENT_VISIBLE);
1340  setDecorations(DECOR_ALL);
1341  restore();
1342  myToolBar3->show();
1344  onCmdGaming(nullptr, 0, nullptr);
1345  setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
1346  setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1347  setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
1348  setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
1349  }
1350  return 1;
1351 }
1352 
1353 
1354 long
1355 GUIApplicationWindow::onCmdListInternal(FXObject*, FXSelector, void*) {
1357  return 1;
1358 }
1359 
1360 
1361 long
1362 GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) {
1364  return 1;
1365 }
1366 
1367 long
1368 GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) {
1370  return 1;
1371 }
1372 
1373 
1374 long
1375 GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) {
1377  return 1;
1378 }
1379 
1380 
1381 #ifdef HAVE_OSG
1382 long
1383 GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1385  return 1;
1386 }
1387 #endif
1388 
1389 
1390 long
1391 GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
1392  GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this);
1393  about->create();
1394  about->show(PLACEMENT_OWNER);
1395  return 1;
1396 }
1397 
1398 long
1399 GUIApplicationWindow::onCmdHallOfFame(FXObject*, FXSelector, void*) {
1400  GUIDialog_HallOfFame* hall = new GUIDialog_HallOfFame(this);
1401  hall->create();
1402  hall->show(PLACEMENT_OWNER);
1403  return 1;
1404 }
1405 
1406 
1407 long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1408  FXEvent* event = (FXEvent*)ptr;
1409  FXString string = GUIUserIO::clipped.c_str();
1410  setDNDData(FROM_CLIPBOARD, event->target, string);
1411  return 1;
1412 }
1413 
1414 
1415 long
1416 GUIApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
1417  eventOccurred();
1418  return 1;
1419 }
1420 
1421 
1422 long
1423 GUIApplicationWindow::onRunThreadEvent(FXObject*, FXSelector, void*) {
1424  eventOccurred();
1425  return 1;
1426 }
1427 
1428 
1429 void
1431  while (!myEvents.empty()) {
1432  // get the next event
1433  GUIEvent* e = myEvents.top();
1434  myEvents.pop();
1435  // process
1436  switch (e->getOwnType()) {
1439  break;
1441  if (myRunThread->simulationAvailable()) { // avoid race-condition related crash if reload was pressed
1443  }
1444  break;
1452  break;
1455  break;
1456  default:
1457  break;
1458  }
1459  delete e;
1460  }
1461  myToolBar2->forceRefresh();
1462  myToolBar3->forceRefresh();
1463 }
1464 
1465 
1466 void
1468  myAmLoading = false;
1470  // check whether the loading was successfull
1471  if (ec->myNet == nullptr) {
1472  // report failure
1473  setStatusBarText("Loading of '" + ec->myFile + "' failed!");
1474  if (GUIGlobals::gQuitOnEnd) {
1475  closeAllWindows();
1476  getApp()->exit(1);
1477  }
1478  } else {
1479  // initialise simulation thread
1480  if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1481  if (GUIGlobals::gQuitOnEnd) {
1482  closeAllWindows();
1483  getApp()->exit(1);
1484  }
1485  } else {
1486  // report success
1487  setStatusBarText("'" + ec->myFile + "' loaded.");
1489  myWasStarted = false;
1490  myHaveNotifiedAboutSimEnd = false;
1491  // initialise views
1492  myViewNumber = 0;
1494  if (ec->mySettingsFiles.size() > 0) {
1495  // open a view for each file and apply settings
1496  for (std::vector<std::string>::const_iterator it = ec->mySettingsFiles.begin(); it != ec->mySettingsFiles.end(); ++it) {
1497  GUISettingsHandler settings(*it);
1498  GUISUMOViewParent::ViewType vt = defaultType;
1499  if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
1501  }
1502  if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
1504  }
1505  GUISUMOAbstractView* view = openNewView(vt);
1506  if (view == nullptr) {
1507  break;
1508  }
1509  if (settings.getSettingName() != "") {
1510  view->setColorScheme(settings.getSettingName());
1511  }
1512  view->addDecals(settings.getDecals());
1513  settings.applyViewport(view);
1514  settings.setSnapshots(view);
1515  if (settings.getDelay() > 0.) {
1516  mySimDelay = settings.getDelay();
1517  }
1518  if (settings.getBreakpoints().size() > 0) {
1519  myRunThread->getBreakpointLock().lock();
1520  myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
1521  myRunThread->getBreakpointLock().unlock();
1522  }
1523  myJamSounds = settings.getEventDistribution("jam");
1524  myCollisionSounds = settings.getEventDistribution("collision");
1525  if (settings.getJamSoundTime() > 0) {
1526  myJamSoundTime = settings.getJamSoundTime();
1527  }
1528  }
1529  } else {
1530  openNewView(defaultType);
1531  }
1532 
1533  if (!OptionsCont::getOptions().isDefault("delay")) {
1534  setDelay(OptionsCont::getOptions().getFloat("delay"));
1535  mySimDelaySlider->setValue((int)mySimDelay);
1536  mySimDelaySpinner->setValue(mySimDelay);
1537  }
1538  if (!OptionsCont::getOptions().isDefault("breakpoints")) {
1539  std::vector<SUMOTime> breakpoints;
1540  for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
1541  SUMOTime t = string2time(val);
1542  // round down to nearest reachable time step
1543  t -= t % DELTA_T;
1544  breakpoints.push_back(t);
1545  }
1546  std::sort(breakpoints.begin(), breakpoints.end());
1547  myRunThread->getBreakpointLock().lock();
1548  myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1549  myRunThread->getBreakpointLock().unlock();
1550  }
1551 
1552  if (OptionsCont::getOptions().getBool("game")) {
1553  if (OptionsCont::getOptions().getString("game.mode") == "tls") {
1554  myTLSGame = true;
1555  setTitle("SUMO Interactive Traffic Light");
1556  } else {
1557  myTLSGame = false;
1558  setTitle("SUMO Interactive Demand-Responsive-Transport");
1559  }
1560  onCmdGaming(nullptr, 0, nullptr);
1561  } else {
1562  // set simulation name on the caption
1563  setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str()));
1564  }
1565  if (ec->myViewportFromRegistry) {
1566  Position off;
1567  off.set(getApp()->reg().readRealEntry("viewport", "x"),
1568  getApp()->reg().readRealEntry("viewport", "y"),
1569  getApp()->reg().readRealEntry("viewport", "z"));
1570  Position p(off.x(), off.y(), 0);
1571  GUISUMOAbstractView* view = myGLWindows[0]->getView();
1572  view->setViewportFromToRot(off, p, 0);
1573  }
1574  // set simulation step begin information
1575  myLCDLabel->setText("----------------");
1576  for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
1577  (*it)->setText("-");
1578  }
1579  // initialize scale from options unless already set in the UI
1580  if (myDemandScaleSpinner->getValue() == 1 || !OptionsCont::getOptions().isDefault("scale")) {
1581  myDemandScaleSpinner->setValue(OptionsCont::getOptions().getFloat("scale"));
1582  }
1583  }
1584  }
1585  getApp()->endWaitCursor();
1586  // start if wished
1587  if (GUIGlobals::gRunAfterLoad && ec->myNet != nullptr && myRunThread->simulationIsStartable()) {
1588  onCmdStart(nullptr, 0, nullptr);
1589  }
1590  update();
1591 }
1592 
1593 
1594 void
1596 #ifdef WIN32
1597  long t = SysUtils::getCurrentMillis();
1598  // only skip if the simulation is running
1599  if (t - myLastStepEventMillis < MIN_DRAW_DELAY && myRunThread->simulationIsStopable()) {
1600  // do not try to redraw with more than 50FPS (#6371)
1601  return;
1602  }
1604 #endif
1606  const int running = myRunThread->getNet().getVehicleControl().getRunningVehicleNo();
1607  const int backlog = myRunThread->getNet().getInsertionControl().getWaitingVehicleNo();
1608  if (backlog > running) {
1609  if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::GREENVEHICLE)) {
1611  }
1612  } else {
1613  if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::YELLOWVEHICLE)) {
1615  }
1616  }
1617  myStatButtons.front()->setText(toString(running).c_str());
1618  if (myRunThread->getNet().hasPersons()) {
1619  if (!myStatButtons[1]->shown()) {
1620  myStatButtons[1]->show();
1621  }
1623  }
1624  if (myRunThread->getNet().hasContainers()) {
1625  if (!myStatButtons[2]->shown()) {
1626  myStatButtons[2]->show();
1627  }
1629  }
1630  if (myAmGaming) {
1631  if (myTLSGame) {
1633  } else {
1635  }
1636  }
1638  getApp()->forceRefresh(); // restores keyboard focus
1639  }
1640  updateChildren();
1641  update();
1642 }
1643 
1644 
1645 void
1647  GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
1649  setStatusBarText(ec->getMsg());
1650  } else {
1651  myMessageWindow->appendMsg(ec->getOwnType(), ec->getMsg());
1652  }
1653 }
1654 
1655 
1656 void
1658  GUIEvent_SimulationEnded* ec = static_cast<GUIEvent_SimulationEnded*>(e);
1659  onCmdStop(nullptr, 0, nullptr);
1660  if (ec->getReason() == MSNet::SIMSTATE_LOADING) {
1661  onCmdReload(nullptr, 0, nullptr);
1662  } else if (GUIGlobals::gQuitOnEnd) {
1663  closeAllWindows();
1664  getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
1665  } else if (GUIGlobals::gDemoAutoReload) {
1666  onCmdReload(nullptr, 0, nullptr);
1667  } else if (!myHaveNotifiedAboutSimEnd) {
1668  // build the text
1669  const std::string text = "Simulation ended at time: " + time2string(ec->getTimeStep()) +
1670  ".\nReason: " + MSNet::getStateMessage(ec->getReason()) +
1671  "\nDo you want to close all open files and views?";
1672  FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, "Simulation ended", "%s", text.c_str());
1673  if (answer == 1) { //1:yes, 2:no, 4:esc
1674  closeAllWindows();
1675  }
1677  }
1678 }
1679 
1680 
1681 void
1686 #ifdef HAVE_DANGEROUS_SOUNDS // disable user-configurable command execution for public build
1687  if (myJamSounds.getOverallProb() > 0) {
1688  // play honking sound if some vehicle is waiting too long
1689  for (; it != end; ++it) {
1690  // XXX use impatience instead of waiting time ?
1691  if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
1692  const std::string cmd = myJamSounds.get(&myGamingRNG);
1693  if (cmd != "") {
1694  // yay! fun with dangerous commands... Never use this over the internet
1696  // one sound per simulation step is enough
1697  break;
1698  }
1699  }
1700  }
1701  }
1702  if (myCollisionSounds.getOverallProb() > 0) {
1703  int collisions = MSNet::getInstance()->getVehicleControl().getCollisionCount();
1704  if (myPreviousCollisionNumber != collisions) {
1705  const std::string cmd = myCollisionSounds.get(&myGamingRNG);
1706  if (cmd != "") {
1707  // yay! fun with dangerous commands... Never use this over the internet
1709  }
1710  myPreviousCollisionNumber = collisions;
1711  }
1712  }
1713 #endif
1714 
1715  // update performance indicators
1716  for (it = vc.loadedVehBegin(); it != end; ++it) {
1717  const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
1718  assert(veh != 0);
1719  if (veh->isOnRoad() && !veh->isStopped()) {
1720  const double vmax = MIN2(veh->getVehicleType().getMaxSpeed(), veh->getEdge()->getSpeedLimit());
1721  if (veh->getSpeed() < SUMO_const_haltingSpeed) {
1723  if (veh->getID().rfind("emergency", 0) == 0) {
1725  }
1726  }
1727  myTimeLoss += TIME2STEPS(TS * (vmax - veh->getSpeed()) / vmax); // may be negative with speedFactor > 1
1728  }
1729 
1730  }
1734 }
1735 
1736 void
1738  // update performance indicators
1742 
1745  for (auto it = vc.loadedVehBegin(); it != end; ++it) {
1746  const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
1747  assert(veh != 0);
1748  if (veh->isOnRoad() && !veh->isStopped()) {
1749  myTotalDistance += SPEED2DIST(veh->getSpeed());
1750  }
1751  }
1753 }
1754 
1755 void
1756 GUIApplicationWindow::loadConfigOrNet(const std::string& file) {
1757  if (!myAmLoading) {
1759  getApp()->beginWaitCursor();
1760  myAmLoading = true;
1761  closeAllWindows();
1762  gSchemeStorage.saveViewport(0, 0, -1, 0); // recenter view
1764  setStatusBarText("Loading '" + file + "'.");
1765  update();
1766  }
1767 }
1768 
1769 
1772  if (!myRunThread->simulationAvailable()) {
1773  myStatusbar->getStatusLine()->setText("No simulation loaded!");
1774  return nullptr;
1775  }
1776  GUISUMOAbstractView* oldView = nullptr;
1777  if (myMDIClient->numChildren() > 0) {
1778  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1779  if (w != nullptr) {
1780  oldView = w->getView();
1781  }
1782  }
1783  std::string caption = "View #" + toString(myViewNumber++);
1784  FXuint opts = MDI_TRACKING;
1785  GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
1786  this, GUIIconSubSys::getIcon(GUIIcon::SUMO_MINI), opts, 10, 10, 200, 100);
1788  if (oldView != nullptr) {
1789  // copy viewport
1790  oldView->copyViewportTo(v);
1791  }
1792  w->create();
1793  if (myMDIClient->numChildren() == 1) {
1794  w->maximize();
1795  } else {
1796  myMDIClient->vertical(true);
1797  }
1798  myMDIClient->setActiveChild(w);
1799 
1800  return v;
1801 }
1802 
1803 
1804 FXGLCanvas*
1806  if (myMDIClient->numChildren() == 0) {
1807  return nullptr;
1808  }
1809  GUISUMOViewParent* share_tmp1 =
1810  static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
1811  return share_tmp1->getBuildGLCanvas();
1812 }
1813 
1814 
1815 void
1817  myTrackerLock.lock();
1818  myLCDLabel->setText("----------------");
1819  for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
1820  (*it)->setText("-");
1821  if (it != myStatButtons.begin()) {
1822  (*it)->hide();
1823  }
1824  }
1825  // delete the simulation
1827  // reset the caption
1828  setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
1829  // remove trackers and other external windows (must be delayed until deleteSim)
1830  while (!myGLWindows.empty()) {
1831  delete myGLWindows.front();
1832  }
1833  // make a copy because deleting modifyes the vector;
1834  std::vector<FXMainWindow*> trackerWindows = myTrackerWindows;;
1835  for (FXMainWindow* const window : trackerWindows) {
1836  delete window;
1837  }
1838  myTrackerWindows.clear();
1839  // clear selected items
1840  gSelected.clear();
1841  // add a separator to the log
1843  myTrackerLock.unlock();
1844  // remove coordinate information
1845  myGeoCoordinate->setText("N/A");
1846  myCartesianCoordinate->setText("N/A");
1847  //
1850  update();
1851 }
1852 
1853 
1854 FXCursor*
1856  return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
1857 }
1858 
1859 
1860 SUMOTime
1863 }
1864 
1865 
1866 double
1869 }
1870 
1871 
1872 void
1874  loadConfigOrNet("");
1875 }
1876 
1877 
1878 void
1879 GUIApplicationWindow::setStatusBarText(const std::string& text) {
1880  myStatusbar->getStatusLine()->setText(text.c_str());
1881  myStatusbar->getStatusLine()->setNormalText(text.c_str());
1882 }
1883 
1884 
1885 void
1886 GUIApplicationWindow::addRecentFile(const FX::FXString& f) {
1887  myRecentNetworksAndConfigs.appendFile(f);
1888 }
1889 
1890 
1891 void
1893  time -= DELTA_T; // synchronize displayed time with netstate output
1894  if (time < 0) {
1895  myLCDLabel->setText("----------------");
1896  return;
1897  }
1898  if (myAmGaming) {
1899  // show time counting backwards
1900  time = myRunThread->getSimEndTime() - time;
1901  }
1902  std::ostringstream str;
1903  str << std::setfill('0');
1904  const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0;
1905  if (myShowTimeAsHMS) {
1906  SUMOTime day = time / 86400000;
1907  if (day > 0) {
1908  str << day << '-';
1909  time %= 86400000;
1910  }
1911  str << std::setw(2);
1912  str << time / 3600000 << '-';
1913  time %= 3600000;
1914  str << std::setw(2) << time / 60000 << '-';
1915  time %= 60000;
1916  }
1917  str << std::setw(2) << time / 1000;
1918  if (!hideFraction) {
1919  str << '.' << std::setw(3) << time % 1000;
1920  }
1921  myLCDLabel->setText(str.str().c_str());
1922 }
1923 
1924 
1925 long
1926 GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* ptr) {
1927  const long handled = FXMainWindow::onKeyPress(o, sel, ptr);
1928  if (handled == 0 && myMDIClient->numChildren() > 0) {
1929  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1930  if (w != nullptr) {
1931  w->onKeyPress(nullptr, sel, ptr);
1932  }
1933  }
1934  return 0;
1935 }
1936 
1937 
1938 long
1939 GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* ptr) {
1940  const long handled = FXMainWindow::onKeyRelease(o, sel, ptr);
1941  if (handled == 0 && myMDIClient->numChildren() > 0) {
1942  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1943  if (w != nullptr) {
1944  w->onKeyRelease(nullptr, sel, ptr);
1945  }
1946  }
1947  return 0;
1948 }
1949 
1950 
1951 void
1953  myEventMutex.lock();
1954  myEvents.push_back(event);
1957  myEventMutex.unlock();
1958 }
1959 
1960 void
1961 GUIApplicationWindow::setBreakpoints(const std::vector<SUMOTime>& breakpoints) {
1962  if (myRunThread != nullptr) {
1963  myRunThread->getBreakpointLock().lock();
1964  myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1965  myRunThread->getBreakpointLock().unlock();
1966  }
1967 }
1968 
1969 const std::vector<SUMOTime>
1971  myRunThread->getBreakpointLock().lock();
1972  std::vector<SUMOTime> result = myRunThread->getBreakpoints();
1973  myRunThread->getBreakpointLock().unlock();
1974  return result;
1975 }
1976 
1977 
1978 /****************************************************************************/
@ MID_HOTKEY_CTRL_Q_CLOSE
Main window closes.
Definition: GUIAppEnum.h:103
@ ID_RUNTHREAD_EVENT
The Simulation execution thread.
Definition: GUIAppEnum.h:300
@ MID_LOCATEPERSON
Locate person - button.
Definition: GUIAppEnum.h:359
@ MID_LISTINTERNAL
Locator configuration - menu entry.
Definition: GUIAppEnum.h:322
@ MID_NEW_MICROVIEW
Open a new microscopic view.
Definition: GUIAppEnum.h:288
@ MID_LOCATEJUNCTION
Locate junction - button.
Definition: GUIAppEnum.h:349
@ MID_OPEN_CONFIG
Open configuration - ID.
Definition: GUIAppEnum.h:264
@ MID_HOTKEY_CTRL_W_CLOSESIMULATION
Close simulation - ID.
Definition: GUIAppEnum.h:113
@ MID_HOTKEY_CTRL_D_SINGLESIMULATIONSTEP_OPENDEMANDELEMENTS
Perform a single simulation step in SUMO and open Demand Elements in NETEDIT.
Definition: GUIAppEnum.h:85
@ MID_HOTKEY_F9_EDIT_VIEWSCHEME
open edit scheme menu
Definition: GUIAppEnum.h:199
@ MID_LOCATEPOLY
Locate polygons - button.
Definition: GUIAppEnum.h:369
@ MID_TRACI_STATUS
update traci status
Definition: GUIAppEnum.h:339
@ MID_HOTKEY_CTRL_SHIFT_S_SAVENETWORK_AS
save network as
Definition: GUIAppEnum.h:167
@ MID_HOTKEY_CTRL_B_EDITBREAKPOINT_OPENDATAELEMENTS
Edit simulation breakpoints in SUMO and open Data Elements in NETEDIT.
Definition: GUIAppEnum.h:81
@ MID_HOTKEY_F1_ONLINEDOCUMENTATION
open online documentation
Definition: GUIAppEnum.h:183
@ MID_HOTKEY_CTRL_R_RELOAD
Reload the previously loaded simulation.
Definition: GUIAppEnum.h:107
@ MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK
Stop the simulation in SUMO and save network in NETEDIT.
Definition: GUIAppEnum.h:105
@ MID_LOCATEADD
Locate addtional structure - button.
Definition: GUIAppEnum.h:365
@ MID_LOCATEPOI
Locate poi - button.
Definition: GUIAppEnum.h:367
@ MID_OPEN_NETWORK
Open network - ID.
Definition: GUIAppEnum.h:266
@ MID_DEMAND_SCALE
scale traffic
Definition: GUIAppEnum.h:381
@ MID_HOTKEY_CTRL_I_EDITVIEWPORT
Open viewport editor.
Definition: GUIAppEnum.h:91
@ MID_RECENTFILE
Loads a file previously loaded.
Definition: GUIAppEnum.h:272
@ MID_APPSETTINGS
Application settings - menu entry.
Definition: GUIAppEnum.h:320
@ MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW
Open a New Window.
Definition: GUIAppEnum.h:165
@ MID_HOTKEY_SHIFT_F11_HALLOFFAME
show the hall of fame dialog
Definition: GUIAppEnum.h:205
@ MID_NETEDIT
Open in netedit.
Definition: GUIAppEnum.h:312
@ MID_CLEARMESSAGEWINDOW
Clear simulation output.
Definition: GUIAppEnum.h:331
@ MID_OPEN_EDGEDATA
Load edge data for visualization.
Definition: GUIAppEnum.h:270
@ MID_HOTKEY_CTRL_F_FULSCREENMODE
Fullscreen mode - menu entry.
Definition: GUIAppEnum.h:93
@ MID_SIMSAVE
Save state to file.
Definition: GUIAppEnum.h:280
@ MID_LISTTELEPORTING
Definition: GUIAppEnum.h:324
@ MID_HOTKEY_CTRL_G_GAMINGMODE_TOGGLEGRID
Toggle Gaming mode in SUMO and grid in NETEDIT.
Definition: GUIAppEnum.h:87
@ MID_SHOWNETSTATS
Show network statistics.
Definition: GUIAppEnum.h:333
@ ID_LOADTHREAD_EVENT
The loading thread.
Definition: GUIAppEnum.h:298
@ MID_EDITCHOSEN
Open editor for selections.
Definition: GUIAppEnum.h:310
@ MID_SHOWPERSONSTATS
Show person statistics.
Definition: GUIAppEnum.h:337
@ MID_DELAY_TOGGLE
toggle delay between alternative value
Definition: GUIAppEnum.h:379
@ MID_HOTKEY_ALT_F4_CLOSE
Main window closes.
Definition: GUIAppEnum.h:147
@ MID_TIME_TOGGLE
toggle time display mode
Definition: GUIAppEnum.h:377
@ MID_LOCATEEDGE
Locate edge - button.
Definition: GUIAppEnum.h:351
@ MID_HOTKEY_CTRL_A_STARTSIMULATION_OPENADDITIONALS
Start the simulation in SUMO and open Additionals Elemements in NETEDIT.
Definition: GUIAppEnum.h:79
@ MID_LOCATEVEHICLE
Locate vehicle - button.
Definition: GUIAppEnum.h:353
@ MID_LOCATETLS
Locate TLS - button.
Definition: GUIAppEnum.h:363
@ MID_LISTPARKING
Definition: GUIAppEnum.h:323
@ MID_NEW_OSGVIEW
Open a new microscopic 3D view.
Definition: GUIAppEnum.h:290
@ MID_HOTKEY_F12_ABOUT
open about dialog
Definition: GUIAppEnum.h:207
@ MID_SHOWVEHSTATS
Show vehicle statistics.
Definition: GUIAppEnum.h:335
@ MID_HOTKEY_CTRL_P
Load additional file with poi and polygons.
Definition: GUIAppEnum.h:268
@ MID_WINDOW
Main window-ID.
Definition: GUIAppEnum.h:245
@ MID_LOCATECONTAINER
Locate container - button.
Definition: GUIAppEnum.h:361
FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[]
#define MIN_DRAW_DELAY
GUICompleteSchemeStorage gSchemeStorage
#define GUIDesignSlider
Definition: GUIDesigns.h:434
#define GUIDesignSpinDial
Definition: GUIDesigns.h:417
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
Definition: GUIDesigns.h:381
#define GUIDesignMDIButtonLeft
Definition: GUIDesigns.h:168
#define GUIDesignToolBarRaisedSameTop
design for first toolbar shell positioned in the same position of dock
Definition: GUIDesigns.h:387
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition: GUIDesigns.h:100
#define GUIDesignHorizontalFrameStatusBar
Horizontal frame used in status bar.
Definition: GUIDesigns.h:302
#define GUIDesignToolBar
design for default toolbar
Definition: GUIDesigns.h:369
#define GUIDesignSplitter
Definition: GUIDesigns.h:406
#define GUIDesignSplitterMDI
MDI Splitter.
Definition: GUIDesigns.h:409
#define GUIDesignToolbarMenuBar
Definition: GUIDesigns.h:363
#define GUIDesignToolBarRaisedNextTop
design for first toolbar shell positioned in the next-top position of dock
Definition: GUIDesigns.h:384
#define GUIDesignButtonToolbarText
Definition: GUIDesigns.h:97
#define GUIDesignMDIButtonRight
MDIButton oriented to right.
Definition: GUIDesigns.h:171
#define GUIDesignStatusBar
design used in status bar
Definition: GUIDesigns.h:378
@ 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
@ 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
@ LOCATECONTAINER
@ LOCATEJUNCTION
@ APP_BREAKPOINTS
@ WINDOWS_TILE_HORI
@ YELLOWVEHICLE
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:282
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:32
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:74
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:61
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:46
void setTarget(FXObject *tgt)
set the target
Definition: FXBaseObject.h:128
void setSelector(FXSelector sel)
set the selector
Definition: FXBaseObject.h:138
void setHorizontal(const FXint len)
set/get segment horizontal length - must be more than twice the segment width
Definition: FXLCDLabel.cpp:161
void setThickness(const FXint w)
set/get segment width - must be less than half the segment length
Definition: FXLCDLabel.cpp:197
void setText(FXString lbl)
manipulate text in LCD label
Definition: FXLCDLabel.cpp:146
void setVertical(const FXint len)
set/get segment vertical length - must be more than twice the segment width
Definition: FXLCDLabel.cpp:179
void setFgColor(FXColor clr)
set/get forground color
Definition: FXLCDLabel.cpp:120
void setGroove(const FXint w)
set/get groove width - must be less than segment width
Definition: FXLCDLabel.cpp:215
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:49
static void resetFont()
to be called when the font context is invalidated
Definition: GLHelper.cpp:524
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)
FXMenuCheck * myGamingModeCheckbox
menu checkbox to activate game mode
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.
FXRecentNetworks myRecentNetworksAndConfigs
List of recent networks and configs.
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 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 (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)
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.
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
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:31
static FXMenuCommand * buildFXMenuCommandRecentFile(FXComposite *p, const std::string &text, FXObject *tgt, FXSelector sel)
build menu command (for recent files)
Definition: GUIDesigns.cpp:86
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
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:53
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:126
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition: GUINet.cpp:432
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:533
MSTransportableControl & getContainerControl() override
Returns the container control.
Definition: GUINet.cpp:135
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
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 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:918
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:990
static bool gUseMesoSim
Definition: MSGlobals.h:94
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition: MSLane.h:549
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:174
@ SIMSTATE_LOADING
The simulation is loading.
Definition: MSNet.h:95
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
Definition: MSNet.h:105
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:376
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition: MSNet.cpp:774
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition: MSNet.h:499
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:318
bool hasContainers() const
Returns whether containers are simulated.
Definition: MSNet.h:409
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:429
bool hasPersons() const
Returns whether persons are simulated.
Definition: MSNet.h:393
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:75
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSVehicle.h:574
double getSpeed() const
Returns the vehicle's current speed.
Definition: MSVehicle.h:462
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:74
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: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.
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:64
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition: SysUtils.cpp:39
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:149
@ SEL_THREAD_EVENT
Definition: fxexdefs.h:180
@ SEL_THREAD
Definition: fxexdefs.h:162