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-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
18 // The main window of the SUMO-gui.
19 /****************************************************************************/
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #ifdef HAVE_VERSION_H
28 #include <version.h>
29 #endif
30 
31 #include <string>
32 #include <sstream>
33 #include <algorithm>
34 #include <iomanip>
35 
36 #include <guisim/GUINet.h>
37 #include <guisim/GUILane.h>
38 #include <netload/NLHandler.h>
40 #include <microsim/MSGlobals.h>
41 #include <microsim/MSEdge.h>
42 #include <microsim/MSVehicle.h>
45 #include <microsim/MSEdgeControl.h>
48 
49 #include "GUISUMOViewParent.h"
50 #include "GUILoadThread.h"
51 #include "GUIRunThread.h"
52 #include "GUIApplicationWindow.h"
55 
56 #include <utils/common/ToString.h>
62 
63 #include <utils/xml/XMLSubSys.h>
76 #include <utils/gui/div/GLHelper.h>
87 #include "GUIGlobals.h"
91 
92 
93 //#define HAVE_DANGEROUS_SOUNDS
94 
95 // ===========================================================================
96 // FOX-declarations
97 // ===========================================================================
98 FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[] = {
102  FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GUIApplicationWindow::onCmdQuit),
103 
108  FXMAPFUNC(SEL_COMMAND, MID_RECENTFILE, GUIApplicationWindow::onCmdOpenRecent),
111  FXMAPFUNC(SEL_COMMAND, MID_EDITCHOSEN, GUIApplicationWindow::onCmdEditChosen),
115  FXMAPFUNC(SEL_COMMAND, MID_NETEDIT, GUIApplicationWindow::onCmdNetedit),
116 
123  FXMAPFUNC(SEL_COMMAND, MID_HOTKEY_F2_ABOUT, GUIApplicationWindow::onCmdAbout),
124  FXMAPFUNC(SEL_COMMAND, MID_NEW_MICROVIEW, GUIApplicationWindow::onCmdNewView),
125 #ifdef HAVE_OSG
126  FXMAPFUNC(SEL_COMMAND, MID_NEW_OSGVIEW, GUIApplicationWindow::onCmdNewOSG),
127 #endif
131  FXMAPFUNC(SEL_COMMAND, MID_SIMSAVE, GUIApplicationWindow::onCmdSaveState),
136 
140 
141  FXMAPFUNC(SEL_UPDATE, MID_OPEN_CONFIG, GUIApplicationWindow::onUpdOpen),
142  FXMAPFUNC(SEL_UPDATE, MID_OPEN_NETWORK, GUIApplicationWindow::onUpdOpen),
143  FXMAPFUNC(SEL_UPDATE, MID_OPEN_NETWORK, GUIApplicationWindow::onUpdOpen),
149 #ifdef HAVE_OSG
150  FXMAPFUNC(SEL_UPDATE, MID_NEW_OSGVIEW, GUIApplicationWindow::onUpdAddView),
151 #endif
164 
165  // forward requests to the active view
166  FXMAPFUNC(SEL_COMMAND, MID_LOCATEJUNCTION, GUIApplicationWindow::onCmdLocate),
167  FXMAPFUNC(SEL_COMMAND, MID_LOCATEEDGE, GUIApplicationWindow::onCmdLocate),
168  FXMAPFUNC(SEL_COMMAND, MID_LOCATEVEHICLE, GUIApplicationWindow::onCmdLocate),
169  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPERSON, GUIApplicationWindow::onCmdLocate),
170  FXMAPFUNC(SEL_COMMAND, MID_LOCATETLS, GUIApplicationWindow::onCmdLocate),
171  FXMAPFUNC(SEL_COMMAND, MID_LOCATEADD, GUIApplicationWindow::onCmdLocate),
172  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPOI, GUIApplicationWindow::onCmdLocate),
173  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPOLY, GUIApplicationWindow::onCmdLocate),
182  FXMAPFUNC(SEL_KEYPRESS, 0, GUIApplicationWindow::onKeyPress),
183  FXMAPFUNC(SEL_KEYRELEASE, 0, GUIApplicationWindow::onKeyRelease),
184 
185  FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GUIApplicationWindow::onClipboardRequest),
186 
191 };
192 
193 // Object implementation
194 FXIMPLEMENT(GUIApplicationWindow, FXMainWindow, GUIApplicationWindowMap, ARRAYNUMBER(GUIApplicationWindowMap))
195 
196 // ===========================================================================
197 // static members
198 // ===========================================================================
200 
201 // ===========================================================================
202 // member method definitions
203 // ===========================================================================
204 GUIApplicationWindow::GUIApplicationWindow(FXApp* a, const std::string& configPattern) :
205  GUIMainWindow(a),
206  myLoadThread(nullptr), myRunThread(nullptr),
207  myAmLoading(false),
208  myAlternateSimDelay(0),
209  myRecentNets(a, "nets"),
210  myConfigPattern(configPattern),
211  hadDependentBuild(false),
212  myShowTimeAsHMS(false),
213  myHaveNotifiedAboutSimEnd(false),
214  // game specific
215  myJamSoundTime(60),
216  myPreviousCollisionNumber(0),
217  myWaitingTime(0),
218  myTimeLoss(0),
219  myEmergencyVehicleCount(0),
220  myTotalDistance(0) {
221  // init icons
223  // init cursors
225 }
226 
227 
228 void
230  // don't do this twice
231  if (hadDependentBuild) {
232  return;
233  }
234  hadDependentBuild = true;
235 
236  setTarget(this);
237  setSelector(MID_WINDOW);
238 
239  // build menu bar
240  myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBar);
242  new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
243  buildToolBars();
244  // build the thread - io
247 
248  // build the status bar
249  myStatusbar = new FXStatusBar(this, GUIDesignStatusBar);
250  {
251  myGeoFrame = new FXHorizontalFrame(myStatusbar, GUIDesignHorizontalFrameStatusBar);
252  myGeoCoordinate = new FXLabel(myGeoFrame, "N/A\t\tOriginal coordinate (before coordinate transformation in NETCONVERT)", nullptr, LAYOUT_CENTER_Y);
254  myCartesianCoordinate = new FXLabel(myCartesianFrame, "N/A\t\tNetwork coordinate", nullptr, LAYOUT_CENTER_Y);
257  myStatButtons.back()->hide();
258  myStatButtons.push_back(new FXButton(myStatusbar, "-", GUIIconSubSys::getIcon(ICON_GREENEDGE), this, MID_SHOWVEHSTATS));
259  myStatButtons.back()->hide();
260  }
261 
262  // make the window a mdi-window
263  myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
264  myMDIClient = new FXMDIClient(myMainSplitter, GUIDesignSplitterMDI);
265  myMDIMenu = new FXMDIMenu(this, myMDIClient);
266  new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
267  new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
268  new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
269  new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
270 
271  // build the message window
273  // fill menu and tool bar
274  fillMenuBar();
275  myToolBar6->hide();
276  myToolBar7->hide();
277  myToolBar9->hide();
278  myToolBar10->hide();
279  // build additional threads
280  myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent);
282  // set the status bar
283  myStatusbar->getStatusLine()->setText("Ready.");
284  // set the caption
285  setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
286 
287  // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
288  myRunThread->start();
291 }
292 
293 
294 void
297  gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
298  FXMainWindow::create();
299  myMenuBarDrag->create();
300  myToolBarDrag1->create();
301  myToolBarDrag2->create();
302  myToolBarDrag3->create();
303  myToolBarDrag4->create();
304  myToolBarDrag5->create();
305  myToolBarDrag6->create();
306  myToolBarDrag7->create();
307  myFileMenu->create();
308  mySelectByPermissions->create();
309  myEditMenu->create();
310  mySettingsMenu->create();
311  myLocatorMenu->create();
312  myControlMenu->create();
313  myWindowsMenu->create();
314  myHelpMenu->create();
315 
316  FXint textWidth = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
317  myCartesianFrame->setWidth(textWidth);
318  myGeoFrame->setWidth(textWidth);
319 
320  show(PLACEMENT_DEFAULT);
321  if (!OptionsCont::getOptions().isSet("window-size")) {
322  if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
323  maximize();
324  }
325  }
326  myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
327  myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
328 }
329 
330 
333  myRunThread->join();
334  closeAllWindows();
335  //
337  delete myGLVisual;
338  // delete some non-parented windows
339  delete myToolBarDrag1;
340  //
341  delete myRunThread;
342  delete myFileMenu;
343  delete myEditMenu;
344  delete mySelectByPermissions;
345  delete mySettingsMenu;
346  delete myLocatorMenu;
347  delete myControlMenu;
348  delete myWindowsMenu;
349  delete myHelpMenu;
350 
351  delete myLoadThread;
352 
353  while (!myEvents.empty()) {
354  // get the next event
355  GUIEvent* e = myEvents.top();
356  myEvents.pop();
357  delete e;
358  }
359 }
360 
361 
362 void
364  FXMainWindow::detach();
365  myMenuBarDrag->detach();
366  myToolBarDrag1->detach();
367 }
368 
369 
370 void
372  // build file menu
373  myFileMenu = new FXMenuPane(this);
374  new FXMenuTitle(myMenuBar, "&File", nullptr, myFileMenu);
375  new FXMenuCommand(myFileMenu,
376  "&Open Simulation...\tCtrl+O\tOpen a simulation (Configuration file).",
378  new FXMenuCommand(myFileMenu,
379  "Open &Network...\tCtrl+N\tOpen a network.",
381  new FXMenuCommand(myFileMenu,
382  "Open Shapes \tCtrl+P\tLoad POIs and Polygons for visualization.",
384  new FXMenuCommand(myFileMenu,
385  "Open EdgeData \tCtrl+U\tLoad edge related data for visualization.",
387  new FXMenuCommand(myFileMenu,
388  "&Reload\tCtrl+R\tReloads the simulation / the network.",
390  new FXMenuSeparator(myFileMenu);
391  new FXMenuCommand(myFileMenu,
392  "Close\tCtrl+W\tClose the simulation.",
394  // Recent files
395  FXMenuSeparator* sep1 = new FXMenuSeparator(myFileMenu);
396  sep1->setTarget(&myRecentConfigs);
397  sep1->setSelector(FXRecentFiles::ID_ANYFILES);
398  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentConfigs, FXRecentFiles::ID_FILE_1);
399  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentConfigs, FXRecentFiles::ID_FILE_2);
400  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentConfigs, FXRecentFiles::ID_FILE_3);
401  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentConfigs, FXRecentFiles::ID_FILE_4);
402  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentConfigs, FXRecentFiles::ID_FILE_5);
403  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentConfigs, FXRecentFiles::ID_FILE_6);
404  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentConfigs, FXRecentFiles::ID_FILE_7);
405  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentConfigs, FXRecentFiles::ID_FILE_8);
406  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentConfigs, FXRecentFiles::ID_FILE_9);
407  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentConfigs, FXRecentFiles::ID_FILE_10);
408  new FXMenuCommand(myFileMenu, "C&lear Recent Configurations", nullptr, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
409  myRecentConfigs.setTarget(this);
410  myRecentConfigs.setSelector(MID_RECENTFILE);
411  FXMenuSeparator* sep2 = new FXMenuSeparator(myFileMenu);
412  sep2->setTarget(&myRecentNets);
413  sep2->setSelector(FXRecentFiles::ID_ANYFILES);
414  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentNets, FXRecentFiles::ID_FILE_1);
415  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentNets, FXRecentFiles::ID_FILE_2);
416  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentNets, FXRecentFiles::ID_FILE_3);
417  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentNets, FXRecentFiles::ID_FILE_4);
418  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentNets, FXRecentFiles::ID_FILE_5);
419  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentNets, FXRecentFiles::ID_FILE_6);
420  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentNets, FXRecentFiles::ID_FILE_7);
421  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentNets, FXRecentFiles::ID_FILE_8);
422  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentNets, FXRecentFiles::ID_FILE_9);
423  new FXMenuCommand(myFileMenu, "", nullptr, &myRecentNets, FXRecentFiles::ID_FILE_10);
424  new FXMenuCommand(myFileMenu, "Cl&ear Recent Networks", nullptr, &myRecentNets, FXRecentFiles::ID_CLEAR);
425  myRecentNets.setTarget(this);
426  myRecentNets.setSelector(MID_RECENTFILE);
427  new FXMenuSeparator(myFileMenu);
428  new FXMenuCommand(myFileMenu,
429  "&Quit\tCtrl+Q\tQuit the Application.",
430  nullptr, this, MID_HOTKEY_CTRL_Q_CLOSE, 0);
431 
432  // build edit menu
433  mySelectByPermissions = new FXMenuPane(this);
434  std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
435  for (auto i : vehicleClasses) {
436  new FXMenuCommand(mySelectByPermissions, i.c_str(), nullptr, this, MID_EDITCHOSEN);
437  }
438 
439  myEditMenu = new FXMenuPane(this);
440  new FXMenuTitle(myMenuBar, "&Edit", nullptr, myEditMenu);
441  new FXMenuCommand(myEditMenu,
442  "Edit Selected...\tCtrl+E\tOpens a dialog for editing the list of selected items.",
444  mySelectLanesMenuCascade = new FXMenuCascade(myEditMenu,
445  "Select lanes which allow...\t\tOpens a menu for selecting a vehicle class by which to selected lanes.",
447  new FXMenuSeparator(myEditMenu);
448  new FXMenuCommand(myEditMenu,
449  "Edit Breakpoints\tCtrl+B\tOpens a dialog for editing breakpoints.",
450  nullptr, this, MID_HOTKEY_CTRL_B_EDITBREAKPOINT);
451  new FXMenuCommand(myEditMenu,
452  "Edit Visualisation\tCtrl+V\tOpens a dialog for editing visualization settings.",
453  nullptr, this, MID_EDITVIEWSCHEME);
454  new FXMenuCommand(myEditMenu,
455  "Edit Viewport\tCtrl+I\tOpens a dialog for editing viewing are, zoom and rotation.",
456  nullptr, this, MID_EDITVIEWPORT);
457  new FXMenuSeparator(myEditMenu);
458  new FXMenuCommand(myEditMenu,
459  "Open in Netedit\tCtrl+T\tOpens the netedit application with the current network.",
460  nullptr, this, MID_NETEDIT);
461 
462  // build settings menu
463  mySettingsMenu = new FXMenuPane(this);
464  new FXMenuTitle(myMenuBar, "&Settings", nullptr, mySettingsMenu);
465  new FXMenuCommand(mySettingsMenu,
466  "Application Settings...\t\tOpen a Dialog for Application Settings editing.",
467  nullptr, this, MID_APPSETTINGS);
468  new FXMenuCheck(mySettingsMenu,
469  "Gaming Mode\tCtrl+G\tToggle gaming mode on/off.",
471  new FXMenuCheck(mySettingsMenu,
472  "Full Screen Mode\tCtrl+F\tToggle full screen mode on/off.",
474  // build Locate menu
475  myLocatorMenu = new FXMenuPane(this);
476  new FXMenuTitle(myMenuBar, "&Locate", nullptr, myLocatorMenu);
477  new FXMenuCommand(myLocatorMenu,
478  "Locate &Junctions\t\tOpen a Dialog for Locating a Junction.",
480  new FXMenuCommand(myLocatorMenu,
481  "Locate &Edges\t\tOpen a Dialog for Locating an Edge.",
483  if (!MSGlobals::gUseMesoSim) { // there are no gui-vehicles in mesosim
484  new FXMenuCommand(myLocatorMenu,
485  "Locate &Vehicles\t\tOpen a Dialog for Locating a Vehicle.",
487  }
488  new FXMenuCommand(myLocatorMenu,
489  "Locate &Persons\t\tOpen a Dialog for Locating a Person.",
491  new FXMenuCommand(myLocatorMenu,
492  "Locate &TLS\t\tOpen a Dialog for Locating a Traffic Light.",
494  new FXMenuCommand(myLocatorMenu,
495  "Locate &Additional\t\tOpen a Dialog for Locating an Additional Structure.",
497  new FXMenuCommand(myLocatorMenu,
498  "Locate P&oI\t\tOpen a Dialog for Locating a Point of Intereset.",
500  new FXMenuCommand(myLocatorMenu,
501  "Locate Po&lygon\t\tOpen a Dialog for Locating a Polygon.",
503  new FXMenuSeparator(myLocatorMenu);
504  new FXMenuCheck(myLocatorMenu,
505  "Show Internal Structures\t\tShow internal junctions and streets in locator dialog.",
506  this, MID_LISTINTERNAL);
507  FXMenuCheck* listParking = new FXMenuCheck(myLocatorMenu,
508  "Show Parking Vehicles\t\tShow parking vehicles in locator dialog.",
509  this, MID_LISTPARKING);
510  listParking->setCheck(myListParking);
511  new FXMenuCheck(myLocatorMenu,
512  "Show vehicles outside the road network\t\tShow vehicles that are teleporting or driving remote-controlled outside the road network in locator dialog.",
513  this, MID_LISTTELEPORTING);
514  // build control menu
515  myControlMenu = new FXMenuPane(this);
516  new FXMenuTitle(myMenuBar, "Simulation", nullptr, myControlMenu);
517  new FXMenuCommand(myControlMenu,
518  "Run\tCtrl+A\tStart running the simulation.",
520  new FXMenuCommand(myControlMenu,
521  "Stop\tCtrl+S\tStop running the simulation.",
523  new FXMenuCommand(myControlMenu,
524  "Step\tCtrl+D\tPerform one simulation step.",
526  new FXMenuCommand(myControlMenu,
527  "Save\t\tSave the current simulation state to a file.",
529 
530  // build windows menu
531  myWindowsMenu = new FXMenuPane(this);
532  new FXMenuTitle(myMenuBar, "&Windows", nullptr, myWindowsMenu);
533  new FXMenuCheck(myWindowsMenu,
534  "Show Status Line\t\tToggle the Status Bar on/off.",
535  myStatusbar, FXWindow::ID_TOGGLESHOWN);
536  new FXMenuCheck(myWindowsMenu,
537  "Show Message Window\t\tToggle the Message Window on/off.",
538  myMessageWindow, FXWindow::ID_TOGGLESHOWN);
539  new FXMenuCheck(myWindowsMenu,
540  "Show Simulation Time\t\tToggle the Simulation Time on/off.",
541  myToolBar3, FXWindow::ID_TOGGLESHOWN);
542  new FXMenuCheck(myWindowsMenu,
543  "Show Simulation Delay\t\tToggle the Simulation Delay Entry on/off.",
544  myToolBar4, FXWindow::ID_TOGGLESHOWN);
546  new FXMenuSeparator(myWindowsMenu);
547  new FXMenuCommand(myWindowsMenu, "Tile &Horizontally",
549  myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
550  new FXMenuCommand(myWindowsMenu, "Tile &Vertically",
552  myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
553  new FXMenuCommand(myWindowsMenu, "Cascade",
555  myMDIClient, FXMDIClient::ID_MDI_CASCADE);
556  new FXMenuCommand(myWindowsMenu, "&Close", nullptr,
557  myMDIClient, FXMDIClient::ID_MDI_CLOSE);
558  sep1 = new FXMenuSeparator(myWindowsMenu);
559  sep1->setTarget(myMDIClient);
560  sep1->setSelector(FXMDIClient::ID_MDI_ANY);
561  new FXMenuCommand(myWindowsMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_1);
562  new FXMenuCommand(myWindowsMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_2);
563  new FXMenuCommand(myWindowsMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_3);
564  new FXMenuCommand(myWindowsMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_4);
565  new FXMenuCommand(myWindowsMenu, "&Others...", nullptr, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
566  new FXMenuSeparator(myWindowsMenu);
567  new FXMenuCommand(myWindowsMenu,
568  "Clear Message Window\t\tClear the message window.",
569  nullptr, this, MID_CLEARMESSAGEWINDOW);
570 
571  // build help menu
572  myHelpMenu = new FXMenuPane(this);
573  new FXMenuTitle(myMenuBar, "&Help", nullptr, myHelpMenu);
574  new FXMenuCommand(myHelpMenu, "&Online Documentation\tF1\tOpen Online documentation", nullptr, this, MID_HOTKEY_F1_ONLINEDOCUMENTATION);
575  new FXMenuCommand(myHelpMenu, "&About\tF2\tAbout sumo-gui", GUIIconSubSys::getIcon(ICON_SUMO_MINI), this, MID_HOTKEY_F2_ABOUT);
576 
577  //new FXButton(myMenuBar, "\t\tShows TraCI status", GUIIconSubSys::getIcon(ICON_ADD), this, MID_TRACI_STATUS, 0, 0, 0, 14, 14, 0, 0, 0, 0);
578 
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(ICON_OPEN_CONFIG), this, MID_OPEN_CONFIG, GUIDesignButtonToolbar);
594  new FXButton(myToolBar1, "\t\tOpen a network.", GUIIconSubSys::getIcon(ICON_OPEN_NET), this, MID_OPEN_NETWORK, GUIDesignButtonToolbar);
595  new FXButton(myToolBar1, "\t\tReloads the simulation / the network.", GUIIconSubSys::getIcon(ICON_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
604  new FXButton(myToolBar2, "\t\tStop the running simulation.", GUIIconSubSys::getIcon(ICON_STOP), this, MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK, GUIDesignButtonToolbar);
605  new FXButton(myToolBar2, "\t\tPerform a single simulation step.", GUIIconSubSys::getIcon(ICON_STEP), this, MID_HOTKEY_CTRL_D_SINGLESIMULATIONSTEP_OPENDEMAND, GUIDesignButtonToolbar);
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 
628  mySimDelay = 0;
629  mySimDelayTarget = new FXDataTarget(mySimDelay);
630  mySimDelaySpinner = new FXRealSpinner(myToolBar4, 7, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSpinDial);
631  mySimDelaySlider = new FXSlider(myToolBar4, mySimDelayTarget, FXDataTarget::ID_VALUE, LAYOUT_FIX_WIDTH | SLIDER_ARROW_UP | SLIDER_TICKS_TOP, 0, 0, 300, 10, 0, 0, 5, 0);
632  mySimDelaySlider->setRange(0, 1000);
633  mySimDelaySlider->setHeadSize(10);
634  mySimDelaySlider->setIncrement(50);
635  mySimDelaySlider->setTickDelta(100);
636  mySimDelaySlider->setValue((int)mySimDelay);
637  //mySimDelayTarget->setNumberFormat(0);
638  //mySimDelayTarget->setIncrements(1, 10, 10);
639  mySimDelaySpinner->setIncrement(10);
640  mySimDelaySpinner->setRange(0, 10000);
641  mySimDelaySpinner->setValue(mySimDelay);
642  }
643  {
644  // Scale traffic (flows and incrementally loaded vehicles)
645  myToolBarDrag8 = new FXToolBarShell(this, GUIDesignToolBar);
647  new FXToolBarGrip(myToolBar8, myToolBar8, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
648  new FXLabel(myToolBar8, "Scale Traffic:\t\tScale traffic from flows and vehicles that are loaded incrementally from route files", nullptr, LAYOUT_TOP | LAYOUT_LEFT);
649  myDemandScaleSpinner = new FXRealSpinner(myToolBar8, 7, this, MID_DEMAND_SCALE, GUIDesignSpinDial);
650  myDemandScaleSpinner->setIncrement(0.5);
651  myDemandScaleSpinner->setRange(0, 1000);
652  myDemandScaleSpinner->setValue(1);
653  }
654  {
655  // Views
656  myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBar);
658  new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
659  // build view tools
660  new FXButton(myToolBar5, "\t\tOpen a new microscopic view.",
662 #ifdef HAVE_OSG
663  new FXButton(myToolBar5, "\t\tOpen a new 3D view.",
665 #endif
666  }
667  {
669  // total waitingTime
670  myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBar);
672  new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
673  new FXLabel(myToolBar6, "Waiting Time:\t\tTime spent waiting accumulated for all vehicles", nullptr, LAYOUT_TOP | LAYOUT_LEFT);
674  myWaitingTimeLabel = new FXEX::FXLCDLabel(myToolBar6, 13, nullptr, 0, JUSTIFY_RIGHT);
679  myWaitingTimeLabel->setText("-------------");
680 
681  // idealistic time loss
682  myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBar);
684  new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
685  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);
686  myTimeLossLabel = new FXEX::FXLCDLabel(myToolBar7, 13, nullptr, 0, JUSTIFY_RIGHT);
691  myTimeLossLabel->setText("-------------");
692 
693  // total driving distance
694  myToolBarDrag9 = new FXToolBarShell(this, GUIDesignToolBar);
696  new FXToolBarGrip(myToolBar9, myToolBar9, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
697  new FXLabel(myToolBar9, "Distance (km):\t\tTotal distance driven by DRT vehicles", nullptr, LAYOUT_TOP | LAYOUT_LEFT);
698  myTotalDistanceLabel = new FXEX::FXLCDLabel(myToolBar9, 13, nullptr, 0, JUSTIFY_RIGHT);
703  myTotalDistanceLabel->setText("-------------");
704 
705  // emergency vehicle counts
706  myToolBarDrag10 = new FXToolBarShell(this, GUIDesignToolBar);
708  new FXToolBarGrip(myToolBar10, myToolBar10, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
709  new FXLabel(myToolBar10, "Emergency Vehicle waiting time:\t\tTime spent waiting accumulated for emergency vehicles", nullptr, LAYOUT_TOP | LAYOUT_LEFT);
710  myEmergencyVehicleLabel = new FXEX::FXLCDLabel(myToolBar10, 13, nullptr, 0, JUSTIFY_RIGHT);
715  myEmergencyVehicleLabel->setText("-------------");
716  }
717 }
718 
719 
720 long
721 GUIApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
723  getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
724  getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
725  getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
726  getApp()->reg().writeIntEntry("gui", "alternateSimDelay", (int)myAlternateSimDelay);
727  getApp()->exit(0);
728  return 1;
729 }
730 
731 
732 long
733 GUIApplicationWindow::onCmdEditChosen(FXObject* menu, FXSelector, void*) {
734  FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
735  if (mc->getText() == "Edit Selected...") {
736  GUIDialog_GLChosenEditor* chooser =
738  chooser->create();
739  chooser->show();
740  } else {
742  const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
743  for (MSEdgeVector::const_iterator i = MSEdge::getAllEdges().begin(); i != MSEdge::getAllEdges().end(); ++i) {
744  const std::vector<MSLane*>& lanes = (*i)->getLanes();
745  for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
746  GUILane* lane = dynamic_cast<GUILane*>(*it);
747  assert(lane != 0);
748  if ((lane->getPermissions() & svc) != 0) {
749  gSelected.select(lane->getGlID());
750  }
751  }
752  }
753  if (myMDIClient->numChildren() > 0) {
754  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
755  if (w != nullptr) {
756  // color by selection
758  }
759  }
760  }
761  updateChildren();
762  }
763  return 1;
764 }
765 
766 
767 long
768 GUIApplicationWindow::onCmdEditBreakpoints(FXObject*, FXSelector, void*) {
770  chooser->create();
771  chooser->show();
772  return 1;
773 }
774 
775 long
776 GUIApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
777  if (!myGLWindows.empty()) {
778  myGLWindows[0]->getView()->showViewportEditor();
779  }
780  return 1;
781 }
782 
783 
784 long
785 GUIApplicationWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
786  if (!myGLWindows.empty()) {
787  myGLWindows[0]->getView()->showViewschemeEditor();
788  }
789  return 1;
790 }
791 
792 
793 long
794 GUIApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
795  FXLinkLabel::fxexecute("https://sumo.dlr.de/wiki/SUMO-GUI");
796  return 1;
797 }
798 
799 
800 long
801 GUIApplicationWindow::onCmdNetedit(FXObject*, FXSelector, void*) {
802  if (myGLWindows.empty()) {
803  return 1;
804  }
805  FXRegistry reg("SUMO netedit", "Eclipse");
806  reg.read();
807  const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
808  reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
809  reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
810  reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
811  reg.write();
812  std::string netedit = "netedit";
813  const char* sumoPath = getenv("SUMO_HOME");
814  if (sumoPath != nullptr) {
815  std::string newPath = std::string(sumoPath) + "/bin/netedit";
816  if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
817  netedit = "\"" + newPath + "\"";
818  }
819  }
820  std::string cmd = netedit + " --registry-viewport -s " + OptionsCont::getOptions().getString("net-file");
821  // start in background
822 #ifndef WIN32
823  cmd = cmd + " &";
824 #else
825  // see "help start" for the parameters
826  cmd = "start /B \"\" " + cmd;
827 #endif
828  WRITE_MESSAGE("Running " + cmd + ".");
829  // yay! fun with dangerous commands... Never use this over the internet
831  return 1;
832 }
833 
834 
835 long
836 GUIApplicationWindow::onCmdOpenConfiguration(FXObject*, FXSelector, void*) {
837  // get the new file name
838  FXFileDialog opendialog(this, "Open Simulation Configuration");
839  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
840  opendialog.setSelectMode(SELECTFILE_EXISTING);
841  opendialog.setPatternList(myConfigPattern.c_str());
842  if (gCurrentFolder.length() != 0) {
843  opendialog.setDirectory(gCurrentFolder);
844  }
845  if (opendialog.execute()) {
846  gCurrentFolder = opendialog.getDirectory();
847  std::string file = opendialog.getFilename().text();
848  loadConfigOrNet(file, false);
849  myRecentConfigs.appendFile(file.c_str());
850  }
851  return 1;
852 }
853 
854 
855 long
856 GUIApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
857  // get the new file name
858  FXFileDialog opendialog(this, "Open Network");
859  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
860  opendialog.setSelectMode(SELECTFILE_EXISTING);
861  opendialog.setPatternList("SUMO nets (*.net.xml)\nAll files (*)");
862  if (gCurrentFolder.length() != 0) {
863  opendialog.setDirectory(gCurrentFolder);
864  }
865  if (opendialog.execute()) {
866  gCurrentFolder = opendialog.getDirectory();
867  std::string file = opendialog.getFilename().text();
868  loadConfigOrNet(file, true);
869  myRecentNets.appendFile(file.c_str());
870  }
871  return 1;
872 }
873 
874 
875 long
876 GUIApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
877  // get the shape file name
878  FXFileDialog opendialog(this, "Open Shapes");
879  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
880  opendialog.setSelectMode(SELECTFILE_EXISTING);
881  opendialog.setPatternList("Additional files (*.xml)\nAll files (*)");
882  if (gCurrentFolder.length() != 0) {
883  opendialog.setDirectory(gCurrentFolder);
884  }
885  if (opendialog.execute()) {
886  gCurrentFolder = opendialog.getDirectory();
887  std::string file = opendialog.getFilename().text();
888 
889  dynamic_cast<GUIShapeContainer&>(myRunThread->getNet().getShapeContainer()).allowReplacement();
891  if (!XMLSubSys::runParser(handler, file, false)) {
892  WRITE_MESSAGE("Loading of " + file + " failed.");
893  }
894  update();
895  if (myMDIClient->numChildren() > 0) {
896  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
897  if (w != nullptr) {
898  w->getView()->update();
899  }
900  }
901  }
902  return 1;
903 }
904 
905 long
906 GUIApplicationWindow::onCmdOpenEdgeData(FXObject*, FXSelector, void*) {
907  // get the shape file name
908  FXFileDialog opendialog(this, "Open EdgeData");
909  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
910  opendialog.setSelectMode(SELECTFILE_EXISTING);
911  opendialog.setPatternList("EdgeData files (*.xml)\nAll files (*)");
912  if (gCurrentFolder.length() != 0) {
913  opendialog.setDirectory(gCurrentFolder);
914  }
915  if (opendialog.execute()) {
916  gCurrentFolder = opendialog.getDirectory();
917  std::string file = opendialog.getFilename().text();
918  if (!GUINet::getGUIInstance()->loadEdgeData(file)) {
919  WRITE_MESSAGE("Loading of " + file + " failed.");
920  }
921  update();
922  if (myMDIClient->numChildren() > 0) {
923  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
924  if (w != nullptr) {
925  w->getView()->update();
926  }
927  }
928  }
929  return 1;
930 }
931 
932 long
933 GUIApplicationWindow::onCmdReload(FXObject*, FXSelector, void*) {
935  getApp()->beginWaitCursor();
936  myAmLoading = true;
937  closeAllWindows();
938  myLoadThread->start();
939  setStatusBarText("Reloading.");
940  update();
941  return 1;
942 }
943 
944 
945 long
946 GUIApplicationWindow::onCmdOpenRecent(FXObject* sender, FXSelector, void* data) {
947  if (myAmLoading) {
948  myStatusbar->getStatusLine()->setText("Already loading!");
949  return 1;
950  }
951  std::string file((const char*)data);
952  loadConfigOrNet(file, sender == &myRecentNets);
953  return 1;
954 }
955 
956 
957 long
958 GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
959  closeAllWindows();
960  return 1;
961 }
962 
963 
964 long
965 GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
966  sender->handle(this,
967  myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
968  ptr);
969  return 1;
970 }
971 
972 
973 long
974 GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
975  sender->handle(this,
977  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
978  ptr);
979  return 1;
980 }
981 
982 
983 long
984 GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
985  sender->handle(this,
986  myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
987  ptr);
988  return 1;
989 }
990 
991 
992 long
993 GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
994  sender->handle(this,
996  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
997  ptr);
998  return 1;
999 }
1000 
1001 
1002 long
1003 GUIApplicationWindow::onCmdStart(FXObject*, FXSelector, void*) {
1004  // check whether a net was loaded successfully
1005  if (!myRunThread->simulationAvailable()) {
1006  myStatusbar->getStatusLine()->setText("No simulation loaded!");
1007  return 1;
1008  }
1009  // check whether it was started before and paused;
1010  if (!myWasStarted) {
1011  myRunThread->begin();
1012  myWasStarted = true;
1013  }
1014  myRunThread->resume();
1015  getApp()->forceRefresh(); // only callking myToolBar2->forceRefresh somehow loses keyboard focus
1016  return 1;
1017 }
1018 
1019 
1020 long
1021 GUIApplicationWindow::onCmdStop(FXObject*, FXSelector, void*) {
1022  myRunThread->stop();
1023  getApp()->forceRefresh(); // only callking myToolBar2->forceRefresh somehow loses keyboard focus
1024  return 1;
1025 }
1026 
1027 
1028 long
1029 GUIApplicationWindow::onCmdStep(FXObject*, FXSelector, void*) {
1030  // check whether a net was loaded successfully
1031  if (!myRunThread->simulationAvailable()) {
1032  myStatusbar->getStatusLine()->setText("No simulation loaded!");
1033  return 1;
1034  }
1035  // check whether it was started before and paused;
1036  if (!myWasStarted) {
1037  myRunThread->begin();
1038  myWasStarted = true;
1039  }
1041  return 1;
1042 }
1043 
1044 
1045 long
1046 GUIApplicationWindow::onCmdSaveState(FXObject*, FXSelector, void*) {
1047  // get the new file name
1048  FXFileDialog opendialog(this, "Save Simulation State");
1049  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_SAVE));
1050  opendialog.setSelectMode(SELECTFILE_ANY);
1051  opendialog.setPatternList("Binary State (*.sbx)\nXML State (*.xml)");
1052  if (gCurrentFolder.length() != 0) {
1053  opendialog.setDirectory(gCurrentFolder);
1054  }
1055  if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1056  return 1;
1057  }
1058 
1059  FXString file = MFXUtils::assureExtension(opendialog.getFilename(),
1060  opendialog.getPatternText(opendialog.getCurrentPattern()).after('.').before(')'));
1062  myStatusbar->getStatusLine()->setText("Simulation saved to " + file);
1063  return 1;
1064 }
1065 
1066 
1067 long
1068 GUIApplicationWindow::onCmdTimeToggle(FXObject*, FXSelector, void*) {
1072  }
1073  return 1;
1074 }
1075 
1076 
1077 long
1078 GUIApplicationWindow::onCmdDelayToggle(FXObject*, FXSelector, void*) {
1079  const double tmp = myAlternateSimDelay;
1081  mySimDelay = tmp;
1082  return 1;
1083 }
1084 
1085 
1086 long
1087 GUIApplicationWindow::onCmdDemandScale(FXObject*, FXSelector, void*) {
1090  }
1091  return 1;
1092 }
1093 
1094 
1095 long
1096 GUIApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
1098  return 1;
1099 }
1100 
1101 
1102 long
1103 GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
1104  sender->handle(this,
1106  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1107  ptr);
1108  return 1;
1109 }
1110 
1111 
1112 long
1113 GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
1114  sender->handle(this,
1116  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1117  ptr);
1118  return 1;
1119 }
1120 
1121 
1122 long
1123 GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
1124  sender->handle(this,
1126  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1127  ptr);
1128  return 1;
1129 }
1130 
1131 
1132 long
1133 GUIApplicationWindow::onUpdNeedsSimulation(FXObject* sender, FXSelector, void* ptr) {
1134  bool disable = !myRunThread->simulationAvailable() || myAmLoading;
1135  sender->handle(this, disable ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1136  // mySelectLanesMenuCascade has to be disabled manually
1137  if (disable) {
1138  mySelectLanesMenuCascade->disable();
1139  } else {
1140  mySelectLanesMenuCascade->enable();
1141  }
1142  return 1;
1143 }
1144 
1145 long
1146 GUIApplicationWindow::onUpdTraCIStatus(FXObject* sender, FXSelector, void* ptr) {
1147  sender->handle(this, TraCIServer::getInstance() == nullptr ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1148  return 1;
1149 }
1150 
1151 
1152 long
1153 GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
1154  if (myMDIClient->numChildren() > 0) {
1155  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1156  if (w != nullptr) {
1157  w->onCmdLocate(nullptr, sel, nullptr);
1158  }
1159  }
1160  return 1;
1161 }
1162 
1163 
1164 long
1165 GUIApplicationWindow::onCmdShowStats(FXObject*, FXSelector, void*) {
1166  if (myMDIClient->numChildren() > 0) {
1167  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1169  }
1170  return 1;
1171 }
1172 
1173 
1174 long
1175 GUIApplicationWindow::onCmdAppSettings(FXObject*, FXSelector, void*) {
1177  d->create();
1178  d->show(PLACEMENT_OWNER);
1179  return 1;
1180 }
1181 
1182 
1183 long
1184 GUIApplicationWindow::onCmdGaming(FXObject*, FXSelector, void*) {
1186  myGLWindows[0]->getView()->getVisualisationSettings()->gaming = myAmGaming;;
1187  if (myAmGaming) {
1188  myMenuBar->hide();
1189  myStatusbar->hide();
1190  myToolBar1->hide();
1191  myToolBar2->hide();
1192  myToolBar4->hide();
1193  myToolBar5->hide();
1194  myToolBar6->show();
1195  myToolBar8->hide();
1196  myToolBar10->show();
1197  if (myTLSGame) {
1198  myToolBar7->show();
1199  } else {
1200  myToolBar9->show();
1201  }
1202  myMessageWindow->hide();
1208  } else {
1209  myMenuBar->show();
1210  myStatusbar->show();
1211  myToolBar1->show();
1212  myToolBar2->show();
1213  myToolBar4->show();
1214  myToolBar5->show();
1215  myToolBar6->hide();
1216  myToolBar7->hide();
1217  myToolBar8->show();
1218  myToolBar9->hide();
1219  myToolBar10->hide();
1220  myMessageWindow->show();
1222  }
1223  if (myMDIClient->numChildren() > 0) {
1224  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1225  if (w != nullptr) {
1227  }
1228  }
1229  update();
1230  return 1;
1231 }
1232 
1233 
1234 long
1235 GUIApplicationWindow::onCmdFullScreen(FXObject*, FXSelector, void*) {
1237  if (myAmFullScreen) {
1238  getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1239  getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1240  getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1241  getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1242  maximize();
1243  setDecorations(DECOR_NONE);
1244  place(PLACEMENT_MAXIMIZED);
1245  myMenuBar->hide();
1246  myStatusbar->hide();
1247  myToolBar1->hide();
1248  myToolBar2->hide();
1249  myToolBar3->hide();
1250  myToolBar4->hide();
1251  myToolBar5->hide();
1252  myToolBar6->hide();
1253  myToolBar7->hide();
1254  myToolBar8->hide();
1255  myMessageWindow->hide();
1256  if (myMDIClient->numChildren() > 0) {
1257  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1258  if (w != nullptr) {
1259  w->setToolBarVisibility(false);
1260  }
1261  }
1262  update();
1263  } else {
1264  place(PLACEMENT_VISIBLE);
1265  setDecorations(DECOR_ALL);
1266  restore();
1267  myToolBar3->show();
1269  onCmdGaming(nullptr, 0, nullptr);
1270  setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
1271  setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1272  setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
1273  setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
1274  }
1275  return 1;
1276 }
1277 
1278 
1279 long
1280 GUIApplicationWindow::onCmdListInternal(FXObject*, FXSelector, void*) {
1282  return 1;
1283 }
1284 
1285 
1286 long
1287 GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) {
1289  return 1;
1290 }
1291 
1292 long
1293 GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) {
1295  return 1;
1296 }
1297 
1298 
1299 long
1300 GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) {
1302  return 1;
1303 }
1304 
1305 
1306 #ifdef HAVE_OSG
1307 long
1308 GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1310  return 1;
1311 }
1312 #endif
1313 
1314 
1315 long
1316 GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
1317  GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this);
1318  about->create();
1319  about->show(PLACEMENT_OWNER);
1320  return 1;
1321 }
1322 
1323 
1324 long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1325  FXEvent* event = (FXEvent*)ptr;
1326  FXString string = GUIUserIO::clipped.c_str();
1327  setDNDData(FROM_CLIPBOARD, event->target, string);
1328  return 1;
1329 }
1330 
1331 
1332 long
1333 GUIApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
1334  eventOccurred();
1335  return 1;
1336 }
1337 
1338 
1339 long
1340 GUIApplicationWindow::onRunThreadEvent(FXObject*, FXSelector, void*) {
1341  eventOccurred();
1342  return 1;
1343 }
1344 
1345 
1346 void
1348  while (!myEvents.empty()) {
1349  // get the next event
1350  GUIEvent* e = myEvents.top();
1351  myEvents.pop();
1352  // process
1353  switch (e->getOwnType()) {
1356  break;
1357  case EVENT_SIMULATION_STEP:
1358  if (myRunThread->simulationAvailable()) { // avoid race-condition related crash if reload was pressed
1360  }
1361  break;
1364  case EVENT_ERROR_OCCURRED:
1365  case EVENT_DEBUG_OCCURRED:
1367  case EVENT_STATUS_OCCURRED:
1369  break;
1372  break;
1373  default:
1374  break;
1375  }
1376  delete e;
1377  }
1378  myToolBar2->forceRefresh();
1379  myToolBar3->forceRefresh();
1380 }
1381 
1382 
1383 void
1385  myAmLoading = false;
1387  // check whether the loading was successfull
1388  if (ec->myNet == nullptr) {
1389  // report failure
1390  setStatusBarText("Loading of '" + ec->myFile + "' failed!");
1391  if (GUIGlobals::gQuitOnEnd) {
1392  closeAllWindows();
1393  getApp()->exit(1);
1394  }
1395  } else {
1396  // initialise simulation thread
1397  if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1398  if (GUIGlobals::gQuitOnEnd) {
1399  closeAllWindows();
1400  getApp()->exit(1);
1401  }
1402  } else {
1403  // report success
1404  setStatusBarText("'" + ec->myFile + "' loaded.");
1406  myWasStarted = false;
1407  myHaveNotifiedAboutSimEnd = false;
1408  // initialise views
1409  myViewNumber = 0;
1411  if (ec->mySettingsFiles.size() > 0) {
1412  // open a view for each file and apply settings
1413  for (std::vector<std::string>::const_iterator it = ec->mySettingsFiles.begin(); it != ec->mySettingsFiles.end(); ++it) {
1414  GUISettingsHandler settings(*it);
1415  GUISUMOViewParent::ViewType vt = defaultType;
1416  if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
1418  }
1419  if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
1421  }
1422  GUISUMOAbstractView* view = openNewView(vt);
1423  if (view == nullptr) {
1424  break;
1425  }
1426  std::string settingsName = settings.addSettings(view);
1427  view->addDecals(settings.getDecals());
1428  settings.applyViewport(view);
1429  settings.setSnapshots(view);
1430  if (settings.getDelay() > 0.) {
1431  mySimDelay = settings.getDelay();
1432  }
1433  if (settings.getBreakpoints().size() > 0) {
1434  myRunThread->getBreakpointLock().lock();
1435  myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
1436  myRunThread->getBreakpointLock().unlock();
1437  }
1438  if (!OptionsCont::getOptions().isDefault("breakpoints")) {
1439  std::vector<SUMOTime> breakpoints;
1440  for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
1441  breakpoints.push_back(string2time(val));
1442  }
1443  std::sort(breakpoints.begin(), breakpoints.end());
1444  myRunThread->getBreakpointLock().lock();
1445  myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1446  myRunThread->getBreakpointLock().unlock();
1447  }
1448  myJamSounds = settings.getEventDistribution("jam");
1449  myCollisionSounds = settings.getEventDistribution("collision");
1450  if (settings.getJamSoundTime() > 0) {
1451  myJamSoundTime = settings.getJamSoundTime();
1452  }
1453  }
1454  } else {
1455  openNewView(defaultType);
1456  }
1457  if (!OptionsCont::getOptions().isDefault("breakpoints")) {
1458  std::vector<SUMOTime> breakpoints;
1459  for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
1460  breakpoints.push_back(string2time(val));
1461  }
1462  std::sort(breakpoints.begin(), breakpoints.end());
1463  myRunThread->getBreakpointLock().lock();
1464  myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1465  myRunThread->getBreakpointLock().unlock();
1466  }
1467 
1468  if (OptionsCont::getOptions().getBool("game")) {
1469  if (OptionsCont::getOptions().getString("game.mode") == "tls") {
1470  myTLSGame = true;
1471  setTitle("SUMO Interactive Traffic Light");
1472  } else {
1473  myTLSGame = false;
1474  setTitle("SUMO Interactive Demand-Responsive-Transport");
1475  }
1476  onCmdGaming(nullptr, 0, nullptr);
1477  } else {
1478  // set simulation name on the caption
1479  setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str()));
1480  }
1481  if (ec->myViewportFromRegistry) {
1482  Position off;
1483  off.set(getApp()->reg().readRealEntry("viewport", "x"),
1484  getApp()->reg().readRealEntry("viewport", "y"),
1485  getApp()->reg().readRealEntry("viewport", "z"));
1486  Position p(off.x(), off.y(), 0);
1487  GUISUMOAbstractView* view = myGLWindows[0]->getView();
1488  view->setViewportFromToRot(off, p, 0);
1489  }
1490  // set simulation step begin information
1491  myLCDLabel->setText("----------------");
1492  for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
1493  (*it)->setText("-");
1494  }
1495  // initialize scale from options
1496  myDemandScaleSpinner->setValue(OptionsCont::getOptions().getFloat("scale"));
1497  }
1498  }
1499  getApp()->endWaitCursor();
1500  // start if wished
1501  if (GUIGlobals::gRunAfterLoad && ec->myNet != nullptr && myRunThread->simulationIsStartable()) {
1502  onCmdStart(nullptr, 0, nullptr);
1503  }
1504  update();
1505 }
1506 
1507 
1508 void
1511  const int running = myRunThread->getNet().getVehicleControl().getRunningVehicleNo();
1512  const int backlog = myRunThread->getNet().getInsertionControl().getWaitingVehicleNo();
1513  if (backlog > running) {
1514  if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(ICON_GREENVEHICLE)) {
1516  }
1517  } else {
1518  if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(ICON_YELLOWVEHICLE)) {
1520  }
1521  }
1522  myStatButtons.front()->setText(toString(running).c_str());
1523  if (myRunThread->getNet().hasPersons()) {
1524  if (!myStatButtons[1]->shown()) {
1525  myStatButtons[1]->show();
1526  }
1528  }
1529  if (myRunThread->getNet().hasContainers()) {
1530  if (!myStatButtons[2]->shown()) {
1531  myStatButtons[2]->show();
1532  }
1534  }
1535  if (myAmGaming) {
1536  if (myTLSGame) {
1538  } else {
1540  }
1541  }
1543  getApp()->forceRefresh(); // restores keyboard focus
1544  }
1545  updateChildren();
1546  update();
1547 }
1548 
1549 
1550 void
1552  GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
1553  if (ec->getOwnType() == EVENT_STATUS_OCCURRED) {
1554  setStatusBarText(ec->getMsg());
1555  } else {
1556  myMessageWindow->appendMsg(ec->getOwnType(), ec->getMsg());
1557  }
1558 }
1559 
1560 
1561 void
1563  GUIEvent_SimulationEnded* ec = static_cast<GUIEvent_SimulationEnded*>(e);
1564  onCmdStop(nullptr, 0, nullptr);
1565  if (ec->getReason() == MSNet::SIMSTATE_LOADING) {
1566  onCmdReload(nullptr, 0, nullptr);
1567  } else if (GUIGlobals::gQuitOnEnd) {
1568  closeAllWindows();
1569  getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
1570  } else if (GUIGlobals::gDemoAutoReload) {
1571  onCmdReload(nullptr, 0, nullptr);
1572  } else if (!myHaveNotifiedAboutSimEnd) {
1573  // build the text
1574  const std::string text = "Simulation ended at time: " + time2string(ec->getTimeStep()) +
1575  ".\nReason: " + MSNet::getStateMessage(ec->getReason()) +
1576  "\nDo you want to close all open files and views?";
1577  FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, "Simulation ended", "%s", text.c_str());
1578  if (answer == 1) { //1:yes, 2:no, 4:esc
1579  closeAllWindows();
1580  }
1582  }
1583 }
1584 
1585 
1586 void
1591 #ifdef HAVE_DANGEROUS_SOUNDS // disable user-configurable command execution for public build
1592  if (myJamSounds.getOverallProb() > 0) {
1593  // play honking sound if some vehicle is waiting too long
1594  for (; it != end; ++it) {
1595  // XXX use impatience instead of waiting time ?
1596  if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
1597  const std::string cmd = myJamSounds.get(&myGamingRNG);
1598  if (cmd != "") {
1599  // yay! fun with dangerous commands... Never use this over the internet
1601  // one sound per simulation step is enough
1602  break;
1603  }
1604  }
1605  }
1606  }
1607  if (myCollisionSounds.getOverallProb() > 0) {
1608  int collisions = MSNet::getInstance()->getVehicleControl().getCollisionCount();
1609  if (myPreviousCollisionNumber != collisions) {
1610  const std::string cmd = myCollisionSounds.get(&myGamingRNG);
1611  if (cmd != "") {
1612  // yay! fun with dangerous commands... Never use this over the internet
1614  }
1615  myPreviousCollisionNumber = collisions;
1616  }
1617  }
1618 #endif
1619 
1620  // update performance indicators
1621  for (it = vc.loadedVehBegin(); it != end; ++it) {
1622  const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
1623  assert(veh != 0);
1624  if (veh->isOnRoad() && !veh->isStopped()) {
1625  const double vmax = MIN2(veh->getVehicleType().getMaxSpeed(), veh->getEdge()->getSpeedLimit());
1626  if (veh->getSpeed() < SUMO_const_haltingSpeed) {
1628  if (veh->getID().rfind("emergency", 0) == 0) {
1630  }
1631  }
1632  myTimeLoss += TIME2STEPS(TS * (vmax - veh->getSpeed()) / vmax); // may be negative with speedFactor > 1
1633  }
1634 
1635  }
1639 }
1640 
1641 void
1643  // update performance indicators
1647 
1650  for (auto it = vc.loadedVehBegin(); it != end; ++it) {
1651  const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
1652  assert(veh != 0);
1653  if (veh->isOnRoad() && !veh->isStopped()) {
1654  myTotalDistance += SPEED2DIST(veh->getSpeed());
1655  }
1656  }
1658 }
1659 
1660 void
1661 GUIApplicationWindow::loadConfigOrNet(const std::string& file, bool isNet) {
1663  getApp()->beginWaitCursor();
1664  myAmLoading = true;
1665  closeAllWindows();
1666  gSchemeStorage.saveViewport(0, 0, -1, 0); // recenter view
1667  myLoadThread->loadConfigOrNet(file, isNet);
1668  setStatusBarText("Loading '" + file + "'.");
1669  update();
1670 }
1671 
1672 
1675  if (!myRunThread->simulationAvailable()) {
1676  myStatusbar->getStatusLine()->setText("No simulation loaded!");
1677  return nullptr;
1678  }
1679  GUISUMOAbstractView* oldView = nullptr;
1680  if (myMDIClient->numChildren() > 0) {
1681  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1682  if (w != nullptr) {
1683  oldView = w->getView();
1684  }
1685  }
1686  std::string caption = "View #" + toString(myViewNumber++);
1687  FXuint opts = MDI_TRACKING;
1688  GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
1689  this, GUIIconSubSys::getIcon(ICON_SUMO_MINI), opts, 10, 10, 300, 200);
1691  if (oldView != nullptr) {
1692  // copy viewport
1693  oldView->copyViewportTo(v);
1694  }
1695  w->create();
1696  if (myMDIClient->numChildren() == 1) {
1697  w->maximize();
1698  } else {
1699  myMDIClient->vertical(true);
1700  }
1701  myMDIClient->setActiveChild(w);
1702 
1703  return v;
1704 }
1705 
1706 
1707 FXGLCanvas*
1709  if (myMDIClient->numChildren() == 0) {
1710  return nullptr;
1711  }
1712  GUISUMOViewParent* share_tmp1 =
1713  static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
1714  return share_tmp1->getBuildGLCanvas();
1715 }
1716 
1717 
1718 void
1720  myTrackerLock.lock();
1721  myLCDLabel->setText("----------------");
1722  for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
1723  (*it)->setText("-");
1724  if (it != myStatButtons.begin()) {
1725  (*it)->hide();
1726  }
1727  }
1728  // delete the simulation
1730  // reset the caption
1731  setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
1732  // remove trackers and other external windows (must be delayed until deleteSim)
1733  while (!myGLWindows.empty()) {
1734  delete myGLWindows.front();
1735  }
1736  for (FXMainWindow* const window : myTrackerWindows) {
1737  delete window;
1738  }
1739  myTrackerWindows.clear();
1740  // clear selected items
1741  gSelected.clear();
1742  // add a separator to the log
1744  myTrackerLock.unlock();
1745  // remove coordinate information
1746  myGeoCoordinate->setText("N/A");
1747  myCartesianCoordinate->setText("N/A");
1748  //
1751  update();
1752 }
1753 
1754 
1755 FXCursor*
1757  return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
1758 }
1759 
1760 
1761 SUMOTime
1764 }
1765 
1766 
1767 double
1770 }
1771 
1772 
1773 void
1775  loadConfigOrNet("", false);
1776 }
1777 
1778 
1779 void
1780 GUIApplicationWindow::setStatusBarText(const std::string& text) {
1781  myStatusbar->getStatusLine()->setText(text.c_str());
1782 
1783  myStatusbar->getStatusLine()->setNormalText(text.c_str());
1784 }
1785 
1786 
1787 void
1788 GUIApplicationWindow::addRecentFile(const FX::FXString& f, const bool isNet) {
1789  if (isNet) {
1790  myRecentNets.appendFile(f);
1791  } else {
1792  myRecentConfigs.appendFile(f);
1793  }
1794 }
1795 
1796 
1797 void
1799  time -= DELTA_T; // synchronize displayed time with netstate output
1800  if (time < 0) {
1801  myLCDLabel->setText("----------------");
1802  return;
1803  }
1804  if (myAmGaming) {
1805  // show time counting backwards
1806  time = myRunThread->getSimEndTime() - time;
1807  }
1808  std::ostringstream str;
1809  str << std::setfill('0');
1810  const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0;
1811  if (myShowTimeAsHMS) {
1812  SUMOTime day = time / 86400000;
1813  if (day > 0) {
1814  str << day << '-';
1815  time %= 86400000;
1816  }
1817  str << std::setw(2);
1818  str << time / 3600000 << '-';
1819  time %= 3600000;
1820  str << std::setw(2) << time / 60000 << '-';
1821  time %= 60000;
1822  }
1823  str << std::setw(2) << time / 1000;
1824  if (!hideFraction) {
1825  str << '.' << std::setw(3) << time % 1000;
1826  }
1827  myLCDLabel->setText(str.str().c_str());
1828 }
1829 
1830 
1831 long
1832 GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* data) {
1833  const long handled = FXMainWindow::onKeyPress(o, sel, data);
1834  if (handled == 0 && myMDIClient->numChildren() > 0) {
1835  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1836  if (w != nullptr) {
1837  w->onKeyPress(nullptr, sel, data);
1838  }
1839  }
1840  return 0;
1841 }
1842 
1843 
1844 long
1845 GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* data) {
1846  const long handled = FXMainWindow::onKeyRelease(o, sel, data);
1847  if (handled == 0 && myMDIClient->numChildren() > 0) {
1848  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1849  if (w != nullptr) {
1850  w->onKeyRelease(nullptr, sel, data);
1851  }
1852  }
1853  return 0;
1854 }
1855 
1856 
1857 void
1859  myEventMutex.lock();
1860  myEvents.push_back(event);
1863  myEventMutex.unlock();
1864 }
1865 
1866 void
1867 GUIApplicationWindow::setBreakpoints(const std::vector<SUMOTime>& breakpoints) {
1868  if (myRunThread != nullptr) {
1869  myRunThread->getBreakpointLock().lock();
1870  myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1871  myRunThread->getBreakpointLock().unlock();
1872  }
1873 }
1874 
1875 const std::vector<SUMOTime>
1877  myRunThread->getBreakpointLock().lock();
1878  std::vector<SUMOTime> result = myRunThread->getBreakpoints();
1879  myRunThread->getBreakpointLock().unlock();
1880  return result;
1881 }
1882 
1883 /****************************************************************************/
Locate junction - button.
Definition: GUIAppEnum.h:307
Show vehicle statistics.
Definition: GUIAppEnum.h:293
Main window-ID.
Definition: GUIAppEnum.h:205
std::vector< FXMainWindow * > myTrackerWindows
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
Event sent when the the simulation is over.
RandomDistributor< std::string > myJamSounds
Perform a single simulation step in SUMO and open Demand Elements in NETEDIT.
Definition: GUIAppEnum.h:82
Main window closes.
Definition: GUIAppEnum.h:96
FXLabel * myGeoCoordinate
Fullscreen mode - menu entry.
Definition: GUIAppEnum.h:86
long onCmdShowStats(FXObject *, FXSelector, void *)
Called on commands from the statistic buttons.
virtual ~GUIApplicationWindow()
Destructor.
GUILoadThread * myLoadThread
the thread that loads simulations
FXToolBarShell * myToolBarDrag9
GUICompleteSchemeStorage gSchemeStorage
long onCmdStep(FXObject *, FXSelector, void *)
Called on "step".
send when a warning occured
Definition: GUIEvent.h:46
static std::string clipped
Definition: GUIUserIO.h:61
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
void handleEvent_SimulationLoaded(GUIEvent *e)
long long int SUMOTime
Definition: SUMOTime.h:35
Show network statistics.
Definition: GUIAppEnum.h:291
FXRealSpinner * myDemandScaleSpinner
the demand scale
long onCmdReload(FXObject *, FXSelector, void *)
Called on reload.
bool hasPersons() const
Returns whether persons are simulated.
Definition: MSNet.h:354
static void resetFont()
to be called when the font context is invalidated
Definition: GLHelper.cpp:633
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
void appendMsg(GUIEventType eType, const std::string &msg)
Adds new text to the window.
#define SPEED2DIST(x)
Definition: SUMOTime.h:47
Reload the previously loaded simulation.
Definition: GUIAppEnum.h:100
virtual FXGLCanvas * getBuildGLCanvas() const
get build GL Canvas
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
virtual void deleteSim()
FXSplitter * myMainSplitter
The splitter that divides the main window into vies and the log window.
virtual bool init(GUINet *net, SUMOTime start, SUMOTime end)
initialises the thread with the new simulation
SUMOTime getTimeStep() const
Returns the time step the simulation has ended at.
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
Save state to file.
Definition: GUIAppEnum.h:238
static bool isReadable(std::string path)
Checks whether the given file is readable.
Definition: FileHelpers.cpp:49
long onUpdOpenRecent(FXObject *, FXSelector, void *)
Determines whether opening a recent file is enabled.
Storage for geometrical objects extended by mutexes.
long onCmdEditChosen(FXObject *, FXSelector, void *)
Called on menu Edit->Edit Chosen.
Open in netedit.
Definition: GUIAppEnum.h:270
long onCmdListParking(FXObject *, FXSelector, void *)
Toggle listing of parking vehicles.
#define GUIDesignSplitterMDI
MDI Splitter.
Definition: GUIDesigns.h:350
Show person statistics.
Definition: GUIAppEnum.h:295
Locate addtional structure - button.
Definition: GUIAppEnum.h:321
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition: GUIDesigns.h:95
const bool myOsgView
whether to load the OpenSceneGraph view
Edit simulation breakpoints.
Definition: GUIAppEnum.h:80
GUIColorer laneColorer
The lane colorer.
Open configuration - ID.
Definition: GUIAppEnum.h:222
static void buildSUMOAccelerators(GUIApplicationWindow *GUIApp)
build SUMO Accelerators
virtual void setBreakpoints(const std::vector< SUMOTime > &breakpoints)
Sets the breakpoints of the parent application.
toogle time display mode
Definition: GUIAppEnum.h:337
const std::string & getFileName() const
long onCmdEditViewport(FXObject *, FXSelector, void *)
Called on menu Edit->Viewport.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
double y() const
Returns the y-position.
Definition: Position.h:62
GUIVisualizationSettings * getVisualisationSettings() const
get visualitation settings
void addRecentFile(const FX::FXString &f, const bool isNet)
GUINet & getNet() const
FXToolBarShell * myToolBarDrag4
static void initIcons(FXApp *a)
Initiate GUIIconSubSys.
long onUpdTraCIStatus(FXObject *, FXSelector, void *)
Determines whether traci is active.
long onUpdStop(FXObject *, FXSelector, void *)
Determines whether "stop" is enabled.
static FXbool userPermitsOverwritingWhenFileExists(FXWindow *const parent, const FXString &file)
Returns true if either the file given by its name does not exist or the user allows overwriting it...
Definition: MFXUtils.cpp:41
long onCmdSaveState(FXObject *, FXSelector, void *)
Called on "save state".
bool myListParking
information whether the locator should list parking vehicles
long onClipboardRequest(FXObject *sender, FXSelector sel, void *ptr)
Somebody wants our clipped text.
static bool gRunAfterLoad
the simulation shall start direct after loading
Definition: GUIGlobals.h:45
#define GUIDesignStatusBar
design used in status bar
Definition: GUIDesigns.h:320
bool empty()
Definition: FXSynchQue.h:105
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:65
void setToolBarVisibility(const bool value)
about toggled gaming status
static void initCursors(FXApp *a)
Initiate GUICursorSubSys.
double x() const
Returns the x-position.
Definition: Position.h:57
send when a debug occured
Definition: GUIEvent.h:52
int myViewNumber
The current view number.
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call ...
virtual bool simulationIsStopable() const
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
Definition: GUIDesigns.h:323
#define GUIDesignSplitter
Definition: GUIDesigns.h:347
Close simulation - ID.
Definition: GUIAppEnum.h:104
virtual void detach()
Detaches the tool/menu bar.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:168
Editor for the list of chosen objects.
void setThickness(const FXint width)
set/get segment width - must be less than half the segment length
Definition: FXLCDLabel.cpp:197
FXGLVisual * myGLVisual
The gl-visual used.
#define GUIDesignMDIButtonLeft
Definition: GUIDesigns.h:145
GUISUMOAbstractView * openNewView(GUISUMOViewParent::ViewType vt=GUISUMOViewParent::VIEW_2D_OPENGL)
long onCmdLocate(FXObject *, FXSelector, void *)
locator-callback
SUMOTime DELTA_T
Definition: SUMOTime.cpp:35
bool myWasStarted
the information whether the simulation was started before
long onCmdStop(FXObject *, FXSelector, void *)
Called on "stop".
FXMutex myEventMutex
the mutex for the waiting semaphore
long onCmdNetedit(FXObject *, FXSelector, void *)
Called on menu Edit->Netedit.
FXString gCurrentFolder
The folder used as last.
update traci status
Definition: GUIAppEnum.h:297
#define GUIDesignToolBar
design for default toolbar
Definition: GUIDesigns.h:311
virtual void copyViewportTo(GUISUMOAbstractView *view)
copy the viewport to the given view
void loadConfigOrNet(const std::string &file, bool isNet)
#define TIME2STEPS(x)
Definition: SUMOTime.h:59
const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints if provided by the application
virtual double getZPos() const =0
Returns the camera height corresponding to the current zoom factor.
#define TS
Definition: SUMOTime.h:44
void set(double x, double y)
set positions x and y
Definition: Position.h:87
void show()
sets the focus after the window is created
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false)
Runs the given handler on the given file; returns if everything&#39;s ok.
Definition: XMLSubSys.cpp:113
const SUMOTime myBegin
the time the simulation shall start with
long onCmdNewView(FXObject *, FXSelector, void *)
Called if a new view shall be opened (2D view)
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
static bool gDemoAutoReload
the simulation shall reload when it has ended (demo)
Definition: GUIGlobals.h:51
FXMenuCascade * mySelectLanesMenuCascade
the menu cascades
double myAlternateSimDelay
The alternate simulation delay in milliseconds for toggling.
send when a status change occured
Definition: GUIEvent.h:58
long onUpdOpen(FXObject *, FXSelector, void *)
Determines whether opening is enabled.
double getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
Definition: MSEdge.cpp:916
long onCmdHelp(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Documentation
MSNet::SimulationState getReason() const
Returns the reason the simulation has ended due.
Main window closes.
Definition: GUIAppEnum.h:136
bool myListTeleporting
information whether the locator should list teleporting vehicles
virtual bool simulationIsStepable() const
void addDecals(const std::vector< Decal > &decals)
add decals
FXToolBarShell * myToolBarDrag2
Loads a file previously loaded.
Definition: GUIAppEnum.h:230
void setFgColor(FXColor clr)
set/get forground color
Definition: FXLCDLabel.cpp:120
static OptionsCont & getOptions()
Retrieves the options.
Definition: OptionsCont.cpp:58
const bool myViewportFromRegistry
whether loading viewport from registry
void checkGamingEvents()
handles additional game-related events
FXMenuPane * myFileMenu
the submenus
double getDelay() const
Returns the parsed delay.
Open editor for selections.
Definition: GUIAppEnum.h:268
void addSeparator()
Adds a a separator to this log window.
void saveViewport(const double x, const double y, const double z, const double rot)
Makes the given viewport the default.
std::vector< SUMOTime > & getBreakpoints()
Definition: GUIRunThread.h:109
virtual void create()
Creates the main window (required by FOX)
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:62
long onCmdOpenEdgeData(FXObject *, FXSelector, void *)
Called on menu File->Load EdgeData.
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
FXHorizontalFrame * myCartesianFrame
FXRecentFiles myRecentNets
List of recent nets.
const std::vector< std::string > mySettingsFiles
the name of the settings file to load
void loadConfigOrNet(const std::string &file, bool isNet)
begins the loading of the given file
RandomDistributor< std::string > getEventDistribution(const std::string &id)
const std::string & getMsg() const
Returns the message.
Editor for simulation breakpoints.
bool myAmGaming
information whether the gui is currently in gaming mode
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSVehicle.h:583
bool myShowTimeAsHMS
whether to show time as hour:minute:second
void handleEvent_Message(GUIEvent *e)
static void clearTextures()
clears loaded textures
void push_back(T what)
Definition: FXSynchQue.h:91
long onCmdOpenRecent(FXObject *, FXSelector, void *)
Called on opening a recent file.
#define GUIDesignMDIButtonRight
MDIButton oriented to right.
Definition: GUIDesigns.h:148
static const RGBColor GREEN
Definition: RGBColor.h:191
FXEX::FXLCDLabel * myTotalDistanceLabel
An error occurred during the simulation step.
Definition: MSNet.h:109
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
Locate polygons - button.
Definition: GUIAppEnum.h:325
void updateTimeLCD(SUMOTime time)
updates the simulation time display
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition: ToString.h:48
Open a new microscopic 3D view.
Definition: GUIAppEnum.h:248
FXCondition myEventCondition
the semaphore when waiting for event completion
void handleEvent_SimulationEnded(GUIEvent *e)
bool myHaveNotifiedAboutSimEnd
whether the simulation end was already announced
static double gTrackerInterval
the aggregation period for tracker windows in seconds
Definition: GUIGlobals.h:54
std::string myConfigPattern
Input file pattern.
static unsigned long runHiddenCommand(const std::string &cmd)
run a shell command without popping up any windows (particuarly on win32)
Definition: SysUtils.cpp:64
long onCmdEditBreakpoints(FXObject *, FXSelector, void *)
Called on menu Edit->Edit Breakpoints.
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition: GUINet.cpp:516
std::vector< FXButton * > myStatButtons
Buttons showing and running values and triggering statistic windows.
long onCmdStart(FXObject *, FXSelector, void *)
Called on "play".
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition: MSNet.h:460
T get(std::mt19937 *which=0) const
Draw a sample of the distribution.
toogle delay between alternative value
Definition: GUIAppEnum.h:339
long onCmdAppSettings(FXObject *, FXSelector, void *)
Opens the application settings menu (Settings->Application Settings...)
A point in 2D or 3D with translation and scaling methods.
Definition: Position.h:39
const std::vector< SUMOTime > & getBreakpoints() const
Returns the parsed breakpoints.
virtual void buildToolBars()
Builds the tool bar.
Locate person - button.
Definition: GUIAppEnum.h:317
void setHorizontal(const FXint len)
set/get segment horizontal length - must be more than twice the segment width
Definition: FXLCDLabel.cpp:161
#define GUIDesignToolBarRaisedNextTop
design for first toolbar shell positioned in the next-top position of dock
Definition: GUIDesigns.h:326
Open a new microscopic view.
Definition: GUIAppEnum.h:246
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:337
FXEX::FXLCDLabel * myEmergencyVehicleLabel
FXMDIMenu * myMDIMenu
The menu used for the MDI-windows.
virtual bool simulationIsStartable() const
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
Open viewport editor - button.
Definition: GUIAppEnum.h:327
void setVertical(const FXint len)
set/get segment vertical length - must be more than twice the segment width
Definition: FXLCDLabel.cpp:179
FXToolBarShell * myMenuBarDrag
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition: MSLane.h:549
bool hasContainers() const
Returns whether containers are simulated.
Definition: MSNet.h:370
ViewType
Available view types.
GUIRunThread * myRunThread
the thread that runs simulations
long onCmdListInternal(FXObject *, FXSelector, void *)
Toggle listing of internal structures.
long onUpdReload(FXObject *, FXSelector, void *)
Determines whether reloading is enabled.
Locate vehicle - button.
Definition: GUIAppEnum.h:311
long onCmdDelayToggle(FXObject *, FXSelector, void *)
Called on "delay toggle".
GUIPerspectiveChanger & getChanger() const
get changer
const std::string myFile
the name of the loaded file
FXToolBarShell * myToolBarDrag8
FXToolBarShell * myToolBarDrag3
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:284
bool simulationAvailable() const
#define GUIDesignToolBarRaisedSameTop
design for first toolbar shell positioned in the same position of dock
Definition: GUIDesigns.h:329
SUMOTime string2time(const std::string &r)
Definition: SUMOTime.cpp:42
double getMaxSpeed() const
Get vehicle&#39;s maximum speed [m/s].
T MIN2(T a, T b)
Definition: StdDefs.h:74
Load additional file with poi and polygons.
Definition: GUIAppEnum.h:226
Toogle Gaming mode in SUMO and grid in NETEDIT.
Definition: GUIAppEnum.h:84
The application&#39;s "About" - dialog.
FXGLCanvas * getBuildGLCanvas() const
long onCmdAbout(FXObject *, FXSelector, void *)
Shows the about dialog.
Locate edge - button.
Definition: GUIAppEnum.h:309
double mySimDelay
the simulation delay in milliseconds
long onCmdClose(FXObject *, FXSelector, void *)
Called on menu File->Close.
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
Clear simulation output.
Definition: GUIAppEnum.h:289
void setTarget(FXObject *tgt)
set the target
Definition: FXBaseObject.h:130
bool myListInternal
information whether the locator should list internal structures
long onCmdOpenShapes(FXObject *, FXSelector, void *)
Called on menu File->Load Shapes.
The dialog to change the application (gui) settings.
Send when the simulation is over;.
Definition: GUIEvent.h:63
long onCmdClearMsgWindow(FXObject *, FXSelector, void *)
Called if the message window shall be cleared.
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
Start the simulation in SUMO and open Additionals Elemements in NETEDIT.
Definition: GUIAppEnum.h:78
std::vector< GUIGlChildWindow * > myGLWindows
FXMenuPane * mySelectByPermissions
FXMutex & getBreakpointLock()
Definition: GUIRunThread.h:113
virtual void fillMenuBar()
Builds the menu bar.
std::string addSettings(GUISUMOAbstractView *view=0) const
Adds the parsed settings to the global list of settings.
GUIApplicationWindow()
FOX needs this for static members.
#define VERSION_STRING
Definition: config.h:207
Open view editor - button.
Definition: GUIAppEnum.h:329
A single child window which contains a view of the simulation area.
FXEX::FXLCDLabel * myWaitingTimeLabel
performance indicators
static bool gQuitOnEnd
the window shall be closed when the simulation has ended
Definition: GUIGlobals.h:48
long onCmdGaming(FXObject *, FXSelector, void *)
Toggle gaming mode.
FXStatusBar * myStatusbar
The status bar.
FXToolBarShell * myToolBarDrag10
FXMenuBar * myMenuBar
The application menu bar.
FXToolBarShell * myToolBarDrag5
#define GUIDesignButtonToolbarText
Definition: GUIDesigns.h:92
FXToolBarShell * myToolBarDrag7
long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
static FXString assureExtension(const FXString &filename, const FXString &defaultExtension)
Corrects missing extension.
Definition: MFXUtils.cpp:71
The simulation is loading.
Definition: MSNet.h:99
FXToolBarShell * myToolBarDrag6
static const RGBColor RED
named colors
Definition: RGBColor.h:190
int getWaitingForVehicleNumber() const
Returns the number of vehicles waiting for a ride.
bool listParking() const
return whether to list parking vehicles
Definition: GUIMainWindow.h:93
RandomDistributor< std::string > myCollisionSounds
long onCmdOpenConfiguration(FXObject *, FXSelector, void *)
Called on menu File->Open Configuration.
Locate TLS - button.
Definition: GUIAppEnum.h:319
long onRunThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the simulation thread.
The XML-Handler for shapes loading network loading.
Definition: NLHandler.h:57
void setGroove(const FXint width)
set/get groove width - must be less than segment width
Definition: FXLCDLabel.cpp:215
FXLabel * myCartesianCoordinate
Labels for the current cartesian and geo-coordinate.
send when a gldebug occured
Definition: GUIEvent.h:55
void prepareDestruction()
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[]
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
virtual void sendBlockingEvent(GUIEvent *event)
Sends an event from the application thread to the GUI and waits until it is handled.
GUISUMOAbstractView * getView() const
return GUISUMOAbstractView
Locator configuration - menu entry.
Definition: GUIAppEnum.h:280
Open network - ID.
Definition: GUIAppEnum.h:224
void setSelector(FXSelector sel)
set the selector
Definition: FXBaseObject.h:140
The loading thread.
Definition: GUIAppEnum.h:256
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition: MSNet.h:390
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition: MSEdge.cpp:837
void setScale(double scale)
sets the demand scaling factor
send when a message occured
Definition: GUIEvent.h:43
static void close()
close GUIIconSubSys
long onUpdAddView(FXObject *, FXSelector, void *)
Determines whether adding a view is enabled.
Load edge data for visualization.
Definition: GUIAppEnum.h:228
long onCmdLocate(FXObject *, FXSelector, void *)
Called on menu commands from the Locator menu.
void pop()
Definition: FXSynchQue.h:54
FXEX::FXLCDLabel * myTimeLossLabel
static TraCIServer * getInstance()
Definition: TraCIServer.h:71
FXHorizontalFrame * myGeoFrame
FXDockSite * myTopDock
void setStatusBarText(const std::string &text)
FXRecentFiles myRecentConfigs
List of recent config files.
SUMOTime getCurrentSimTime() const
void create()
Creates the widget.
send when a error occured
Definition: GUIEvent.h:49
void clear()
Clears the list of selected objects.
FXToolBarShell * myToolBarDrag1
for some menu detaching fun
scale traffic
Definition: GUIAppEnum.h:341
FXEX::FXThreadEvent myLoadThreadEvent
io-event with the load-thread
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
#define GUIDesignToolbarMenuBar
Definition: GUIDesigns.h:305
MSTransportableControl & getPersonControl() override
Returns the person control.
Definition: GUINet.cpp:120
FXEX::FXThreadEvent myRunThreadEvent
io-event with the run-thread
FXMDIClient * myMDIClient
The multi view panel.
double getOverallProb() const
Return the sum of the probabilites assigned to the members.
send when a simulation has been loaded
Definition: GUIEvent.h:37
Stop the simulation in SUMO and save network in NETEDIT.
Definition: GUIAppEnum.h:98
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:61
virtual double getYPos() const =0
Returns the y-offset of the field to show stored in this changer.
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:114
FXRealSpinner * mySimDelaySpinner
GUIGlID getGlID() const
Returns the numerical id of the object.
FXToolBar * myToolBar1
The application tool bar.
#define GUIDesignHorizontalFrameStatusBar
Horizontal frame used in status bar.
Definition: GUIDesigns.h:249
long onCmdOpenNetwork(FXObject *, FXSelector, void *)
Called on menu File->Open Network.
double myJamSoundTime
waiting time after which vehicles trigger jam sounds
hot key <F1> open online documentation
Definition: GUIAppEnum.h:158
FXSynchQue< GUIEvent * > myEvents
List of got requests.
long onUpdNeedsSimulation(FXObject *, FXSelector, void *)
Determines whether some buttons which require an active simulation may be shown.
An XML-handler for visualisation schemes.
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition: MSNet.cpp:614
bool myAmFullScreen
whether to show the window in full screen mode
const std::string & getViewType() const
Returns the parsed view type.
GUIEventType getOwnType() const
returns the event type
Definition: GUIEvent.h:80
#define GUIDesignSpinDial
Definition: GUIDesigns.h:357
static FXString getTitleText(const FXString &appname, FXString filename="")
Returns the title text in dependance to an optional file name.
Definition: MFXUtils.cpp:62
long onLoadThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the loading thread.
virtual GUISUMOAbstractView * init(FXGLCanvas *share, GUINet &net, ViewType type)
"Initialises" this window by building the contents
long onCmdDemandScale(FXObject *, FXSelector, void *)
Called on "demand scale".
long onCmdEditViewScheme(FXObject *, FXSelector, void *)
Called on menu Edit->Visualization.
bool isStopped() const
Returns whether the vehicle is at a stop.
Definition: MSVehicle.cpp:1751
The class responsible for building and deletion of vehicles.
void setText(FXString lbl)
manipulate text in LCD label
Definition: FXLCDLabel.cpp:146
GUIMessageWindow * myMessageWindow
A window to display messages, warnings and error in.
const SUMOTime myEnd
the time the simulation shall end with
virtual void begin()
void clear()
Clears the window.
bool myAmLoading
information whether the gui is currently loading and the load-options shall be greyed out ...
int getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
long onCmdTimeToggle(FXObject *, FXSelector, void *)
Called on "time toggle".
long onCmdListTeleporting(FXObject *, FXSelector, void *)
Toggle listing of teleporting vehicles.
double getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:477
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
Locate poi - button.
Definition: GUIAppEnum.h:323
Application settings - menu entry.
Definition: GUIAppEnum.h:278
void storeWindowSizeAndPos()
record window position and size in registry
void handleEvent_SimulationStep(GUIEvent *e)
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:240
FXEX::FXLCDLabel * myLCDLabel
the simulation step display
virtual void create()
create GUIGlChildWindow
SUMOTime getSimEndTime() const
Definition: GUIRunThread.h:105
static std::mt19937 myGamingRNG
A random number generator used to choose a gaming sound.
const std::string & getID() const
Returns the name of the vehicle.
GUISelectedStorage gSelected
A global holder of selected objects.
static bool gUseMesoSim
Definition: MSGlobals.h:91
int getCollisionCount() const
return the number of collisions
A logging window for the gui.
hot key <F2> open about dialog
Definition: GUIAppEnum.h:160
send when a simulation step has been performed
Definition: GUIEvent.h:40
long onUpdStep(FXObject *, FXSelector, void *)
Determines whether "step" is enabled.
static FXIcon * getIcon(GUIIcon which)
returns a icon previously defined in the enum GUIIcon
virtual double getXPos() const =0
Returns the x-offset of the field to show stored in this changer.
bool myTLSGame
current game mode
long onCmdQuit(FXObject *, FXSelector, void *)
Called by FOX if the application shall be closed.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
virtual void addToWindowsMenu(FXMenuPane *)
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition: GUINet.cpp:423
MSTransportableControl & getContainerControl() override
Returns the container control.
Definition: GUINet.cpp:129
static void saveState(const std::string &file, SUMOTime step)
Saves the current state.
The Simulation execution thread.
Definition: GUIAppEnum.h:258
long onUpdStart(FXObject *sender, FXSelector, void *ptr)
Determines whether "play" is enabled.
FXDataTarget * mySimDelayTarget
The main window of the SUMO-gui.