SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GUIApplicationWindow.cpp
Go to the documentation of this file.
1 /****************************************************************************/
10 // The main window of the SUMO-gui.
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
34 #ifdef HAVE_VERSION_H
35 #include <version.h>
36 #endif
37 
38 #include <string>
39 #include <sstream>
40 #include <algorithm>
41 
42 #include <guisim/GUINet.h>
43 #include <guisim/GUILane.h>
44 #include <netload/NLHandler.h>
45 #include <microsim/MSGlobals.h>
46 #include <microsim/MSEdge.h>
47 #include <microsim/MSVehicle.h>
48 
49 #include "GUISUMOViewParent.h"
50 #include "GUILoadThread.h"
51 #include "GUIRunThread.h"
52 #include "GUIApplicationWindow.h"
55 #include "GUIEvent_Screenshot.h"
56 
57 #include <utils/common/ToString.h>
63 
64 #include <utils/xml/XMLSubSys.h>
80 #include "GUIGlobals.h"
84 
85 #ifdef CHECK_MEMORY_LEAKS
86 #include <foreign/nvwa/debug_new.h>
87 #endif
88 
89 
90 // ===========================================================================
91 // FOX-declarations
92 // ===========================================================================
93 FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[] = {
94  FXMAPFUNC(SEL_COMMAND, MID_QUIT, GUIApplicationWindow::onCmdQuit),
95  FXMAPFUNC(SEL_SIGNAL, MID_QUIT, GUIApplicationWindow::onCmdQuit),
96  FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GUIApplicationWindow::onCmdQuit),
97 
101  FXMAPFUNC(SEL_COMMAND, MID_RECENTFILE, GUIApplicationWindow::onCmdOpenRecent),
102  FXMAPFUNC(SEL_COMMAND, MID_RELOAD, GUIApplicationWindow::onCmdReload),
103  FXMAPFUNC(SEL_COMMAND, MID_CLOSE, GUIApplicationWindow::onCmdClose),
104  FXMAPFUNC(SEL_COMMAND, MID_EDITCHOSEN, GUIApplicationWindow::onCmdEditChosen),
106 
108  FXMAPFUNC(SEL_COMMAND, MID_GAMING, GUIApplicationWindow::onCmdGaming),
109  FXMAPFUNC(SEL_COMMAND, MID_FULLSCREEN, GUIApplicationWindow::onCmdFullScreen),
111  FXMAPFUNC(SEL_COMMAND, MID_ABOUT, GUIApplicationWindow::onCmdAbout),
112  FXMAPFUNC(SEL_COMMAND, MID_NEW_MICROVIEW, GUIApplicationWindow::onCmdNewView),
113 #ifdef HAVE_OSG
114  FXMAPFUNC(SEL_COMMAND, MID_NEW_OSGVIEW, GUIApplicationWindow::onCmdNewOSG),
115 #endif
116  FXMAPFUNC(SEL_COMMAND, MID_START, GUIApplicationWindow::onCmdStart),
117  FXMAPFUNC(SEL_COMMAND, MID_STOP, GUIApplicationWindow::onCmdStop),
118  FXMAPFUNC(SEL_COMMAND, MID_STEP, GUIApplicationWindow::onCmdStep),
122 
123  FXMAPFUNC(SEL_UPDATE, MID_OPEN_CONFIG, GUIApplicationWindow::onUpdOpen),
124  FXMAPFUNC(SEL_UPDATE, MID_OPEN_NETWORK, GUIApplicationWindow::onUpdOpen),
125  FXMAPFUNC(SEL_UPDATE, MID_OPEN_NETWORK, GUIApplicationWindow::onUpdOpen),
126  FXMAPFUNC(SEL_UPDATE, MID_OPEN_SHAPES, GUIApplicationWindow::onUpdReload),
127  FXMAPFUNC(SEL_UPDATE, MID_RELOAD, GUIApplicationWindow::onUpdReload),
130 #ifdef HAVE_OSG
131  FXMAPFUNC(SEL_COMMAND, MID_NEW_OSGVIEW, GUIApplicationWindow::onUpdAddView),
132 #endif
133  FXMAPFUNC(SEL_UPDATE, MID_START, GUIApplicationWindow::onUpdStart),
134  FXMAPFUNC(SEL_UPDATE, MID_STOP, GUIApplicationWindow::onUpdStop),
135  FXMAPFUNC(SEL_UPDATE, MID_STEP, GUIApplicationWindow::onUpdStep),
138 
139  // forward requests to the active view
140  FXMAPFUNC(SEL_COMMAND, MID_LOCATEJUNCTION, GUIApplicationWindow::onCmdLocate),
141  FXMAPFUNC(SEL_COMMAND, MID_LOCATEEDGE, GUIApplicationWindow::onCmdLocate),
142  FXMAPFUNC(SEL_COMMAND, MID_LOCATEVEHICLE, GUIApplicationWindow::onCmdLocate),
143  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPERSON, GUIApplicationWindow::onCmdLocate),
144  FXMAPFUNC(SEL_COMMAND, MID_LOCATETLS, GUIApplicationWindow::onCmdLocate),
145  FXMAPFUNC(SEL_COMMAND, MID_LOCATEADD, GUIApplicationWindow::onCmdLocate),
146  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPOI, GUIApplicationWindow::onCmdLocate),
147  FXMAPFUNC(SEL_COMMAND, MID_LOCATEPOLY, GUIApplicationWindow::onCmdLocate),
156  FXMAPFUNC(SEL_KEYPRESS, 0, GUIApplicationWindow::onKeyPress),
157  FXMAPFUNC(SEL_KEYRELEASE, 0, GUIApplicationWindow::onKeyRelease),
158 
159  FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GUIApplicationWindow::onClipboardRequest),
160 
165 };
166 
167 // Object implementation
168 FXIMPLEMENT(GUIApplicationWindow, FXMainWindow, GUIApplicationWindowMap, ARRAYNUMBER(GUIApplicationWindowMap))
169 
170 // ===========================================================================
171 // static members
172 // ===========================================================================
173 MTRand GUIApplicationWindow::myGamingRNG;
174 
175 // ===========================================================================
176 // member method definitions
177 // ===========================================================================
179  const std::string& configPattern)
180  : GUIMainWindow(a),
181  myLoadThread(0), myRunThread(0),
182  myAmLoading(false),
183  myAlternateSimDelay(0),
184  myRecentNets(a, "nets"), myConfigPattern(configPattern),
185  hadDependentBuild(false),
186  myShowTimeAsHMS(false),
187  myAmFullScreen(false),
188  myHaveNotifiedAboutSimEnd(false),
189  // game specific
190  myJamSoundTime(60),
191  myWaitingTime(0),
192  myTimeLoss(0) {
194 }
195 
196 
197 void
199  // don't do this twice
200  if (hadDependentBuild) {
201  return;
202  }
203  hadDependentBuild = true;
204 
205  setTarget(this);
206  setSelector(MID_WINDOW);
207 
208  // build menu bar
209  myMenuBarDrag = new FXToolBarShell(this, FRAME_NORMAL);
210  myMenuBar = new FXMenuBar(myTopDock, myMenuBarDrag,
211  LAYOUT_SIDE_TOP | LAYOUT_FILL_X | FRAME_RAISED);
212  new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP,
213  TOOLBARGRIP_DOUBLE);
214  buildToolBars();
215  // build the thread - io
220 
221  // build the status bar
222  myStatusbar = new FXStatusBar(this, LAYOUT_SIDE_BOTTOM | LAYOUT_FILL_X | FRAME_RAISED);
223  {
224  myGeoFrame =
225  new FXHorizontalFrame(myStatusbar, LAYOUT_FIX_WIDTH | LAYOUT_FILL_Y | LAYOUT_RIGHT | FRAME_SUNKEN,
226  0, 0, 20, 0, 0, 0, 0, 0, 0, 0);
227  myGeoCoordinate = new FXLabel(myGeoFrame, "N/A", 0, LAYOUT_CENTER_Y);
229  new FXHorizontalFrame(myStatusbar, LAYOUT_FIX_WIDTH | LAYOUT_FILL_Y | LAYOUT_RIGHT | FRAME_SUNKEN,
230  0, 0, 20, 0, 0, 0, 0, 0, 0, 0);
231  myCartesianCoordinate = new FXLabel(myCartesianFrame, "N/A", 0, LAYOUT_CENTER_Y);
232  }
233 
234  // make the window a mdi-window
235  myMainSplitter = new FXSplitter(this,
236  SPLITTER_REVERSED | SPLITTER_VERTICAL | LAYOUT_FILL_X | LAYOUT_FILL_Y | SPLITTER_TRACKING | FRAME_RAISED | FRAME_THICK);
237  myMDIClient = new FXMDIClient(myMainSplitter,
238  LAYOUT_FILL_X | LAYOUT_FILL_Y | FRAME_SUNKEN | FRAME_THICK);
239  myMDIMenu = new FXMDIMenu(this, myMDIClient);
240  new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient,
241  FXMDIClient::ID_MDI_MENUWINDOW, LAYOUT_LEFT);
242  new FXMDIDeleteButton(myMenuBar, myMDIClient,
243  FXMDIClient::ID_MDI_MENUCLOSE, FRAME_RAISED | LAYOUT_RIGHT);
244  new FXMDIRestoreButton(myMenuBar, myMDIClient,
245  FXMDIClient::ID_MDI_MENURESTORE, FRAME_RAISED | LAYOUT_RIGHT);
246  new FXMDIMinimizeButton(myMenuBar, myMDIClient,
247  FXMDIClient::ID_MDI_MENUMINIMIZE, FRAME_RAISED | LAYOUT_RIGHT);
248 
249  // build the message window
251  // fill menu and tool bar
252  fillMenuBar();
253  myToolBar6->hide();
254  myToolBar7->hide();
255  // build additional threads
256  myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent);
257  myRunThread = new GUIRunThread(getApp(), this, *mySimDelayTarget, myEvents,
259  // set the status bar
260  myStatusbar->getStatusLine()->setText("Ready.");
261  // set the caption
262  setTitle(MFXUtils::getTitleText(("SUMO " + getBuildName(VERSION_STRING)).c_str()));
263 
264  // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
265  myRunThread->start();
267 }
268 
269 
270 void
272  if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 0) {
273  setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
274  setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
275  setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
276  setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
277  }
278  gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
279  FXMainWindow::create();
280  myMenuBarDrag->create();
281  myToolBarDrag1->create();
282  myToolBarDrag2->create();
283  myToolBarDrag3->create();
284  myToolBarDrag4->create();
285  myToolBarDrag5->create();
286  myToolBarDrag6->create();
287  myToolBarDrag7->create();
288  myFileMenu->create();
289  mySelectByPermissions->create();
290  myEditMenu->create();
291  mySettingsMenu->create();
292  myLocatorMenu->create();
293  myControlMenu->create();
294  myWindowsMenu->create();
295  myHelpMenu->create();
296 
297  FXint width = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
298  myCartesianFrame->setWidth(width);
299  myGeoFrame->setWidth(width);
300 
301  show(PLACEMENT_SCREEN);
302  if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
303  maximize();
304  }
305  myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
306  myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
307 }
308 
309 
312  myRunThread->join();
313  closeAllWindows();
314  //
316  delete myGLVisual;
317  // delete some non-parented windows
318  delete myToolBarDrag1;
319  //
320  delete myRunThread;
321  delete myFileMenu;
322  delete myEditMenu;
323  delete mySelectByPermissions;
324  delete mySettingsMenu;
325  delete myLocatorMenu;
326  delete myControlMenu;
327  delete myWindowsMenu;
328  delete myHelpMenu;
329 
330  delete myLoadThread;
331 
332  while (!myEvents.empty()) {
333  // get the next event
334  GUIEvent* e = myEvents.top();
335  myEvents.pop();
336  delete e;
337  }
338 }
339 
340 
341 void
343  FXMainWindow::detach();
344  myMenuBarDrag->detach();
345  myToolBarDrag1->detach();
346 }
347 
348 
349 void
351  // build file menu
352  myFileMenu = new FXMenuPane(this);
353  new FXMenuTitle(myMenuBar, "&File", NULL, myFileMenu);
355  "&Open Simulation...\tCtl-O\tOpen a simulation (Configuration file).",
358  "Open &Network...\tCtl-N\tOpen a network.",
361  "Open Shapes \tCtl-P\tLoad POIs and Polygons for visualization.",
364  "&Reload\tCtl-R\tReloads the simulation / the network.",
366  new FXMenuSeparator(myFileMenu);
368  "Close\tCtl-W\tClose the simulation.",
370  // Recent files
371  FXMenuSeparator* sep1 = new FXMenuSeparator(myFileMenu);
372  sep1->setTarget(&myRecentConfigs);
373  sep1->setSelector(FXRecentFiles::ID_ANYFILES);
374  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_1);
375  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_2);
376  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_3);
377  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_4);
378  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_5);
379  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_6);
380  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_7);
381  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_8);
382  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_9);
383  new FXMenuCommand(myFileMenu, "", 0, &myRecentConfigs, FXRecentFiles::ID_FILE_10);
384  new FXMenuCommand(myFileMenu, "C&lear Recent Configurations", NULL, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
385  myRecentConfigs.setTarget(this);
386  myRecentConfigs.setSelector(MID_RECENTFILE);
387  FXMenuSeparator* sep2 = new FXMenuSeparator(myFileMenu);
388  sep2->setTarget(&myRecentNets);
389  sep2->setSelector(FXRecentFiles::ID_ANYFILES);
390  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_1);
391  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_2);
392  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_3);
393  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_4);
394  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_5);
395  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_6);
396  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_7);
397  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_8);
398  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_9);
399  new FXMenuCommand(myFileMenu, "", 0, &myRecentNets, FXRecentFiles::ID_FILE_10);
400  new FXMenuCommand(myFileMenu, "Cl&ear Recent Networks", NULL, &myRecentNets, FXRecentFiles::ID_CLEAR);
401  myRecentNets.setTarget(this);
402  myRecentNets.setSelector(MID_RECENTFILE);
403  new FXMenuSeparator(myFileMenu);
405  "&Quit\tCtl-Q\tQuit the Application.",
406  0, this, MID_QUIT, 0);
407 
408  // build edit menu
409  mySelectByPermissions = new FXMenuPane(this);
410  std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
411  for (std::vector<std::string>::iterator it = vehicleClasses.begin(); it != vehicleClasses.end(); ++it) {
413  (*it).c_str(), NULL, this, MID_EDITCHOSEN);
414  }
415 
416  myEditMenu = new FXMenuPane(this);
417  new FXMenuTitle(myMenuBar, "&Edit", NULL, myEditMenu);
419  "Edit Selected...\tCtl-E\tOpens a Dialog for editing the List of Selected Items.",
421  new FXMenuCascade(myEditMenu,
422  "Select lanes which allow...\t\tOpens a menu for selecting a vehicle class by which to selected lanes.",
424  new FXMenuSeparator(myEditMenu);
426  "Edit Breakpoints...\tCtl-B\tOpens a Dialog for editing breakpoints.",
427  0, this, MID_EDIT_BREAKPOINTS);
428 
429  // build settings menu
430  mySettingsMenu = new FXMenuPane(this);
431  new FXMenuTitle(myMenuBar, "&Settings", NULL, mySettingsMenu);
433  "Application Settings...\t\tOpen a Dialog for Application Settings editing.",
434  NULL, this, MID_APPSETTINGS);
435  new FXMenuCheck(mySettingsMenu,
436  "Gaming Mode\tCtl-G\tToggle gaming mode on/off.",
437  this, MID_GAMING);
438  new FXMenuCheck(mySettingsMenu,
439  "Full Screen Mode\tCtl-F\tToggle full screen mode on/off.",
440  this, MID_FULLSCREEN);
441  // build Locate menu
442  myLocatorMenu = new FXMenuPane(this);
443  new FXMenuTitle(myMenuBar, "&Locate", NULL, myLocatorMenu);
445  "Locate &Junctions\t\tOpen a Dialog for Locating a Junction.",
448  "Locate &Edges\t\tOpen a Dialog for Locating an Edge.",
450  if (!MSGlobals::gUseMesoSim) { // there are no gui-vehicles in mesosim
452  "Locate &Vehicles\t\tOpen a Dialog for Locating a Vehicle.",
454  }
456  "Locate &Persons\t\tOpen a Dialog for Locating a Person.",
459  "Locate &TLS\t\tOpen a Dialog for Locating a Traffic Light.",
462  "Locate &Additional\t\tOpen a Dialog for Locating an Additional Structure.",
465  "Locate P&oI\t\tOpen a Dialog for Locating a Point of Intereset.",
468  "Locate Po&lygon\t\tOpen a Dialog for Locating a Polygon.",
470  new FXMenuSeparator(myLocatorMenu);
471  new FXMenuCheck(myLocatorMenu,
472  "Show Internal Structures\t\tShow internal junctions and streets in locator Dialog.",
473  this, MID_LISTINTERNAL);
474  // build control menu
475  myControlMenu = new FXMenuPane(this);
476  new FXMenuTitle(myMenuBar, "Simulation", NULL, myControlMenu);
478  "Run\tCtl-A\tStart running the simulation.",
479  NULL, this, MID_START);
481  "Stop\tCtl-S\tStop running the simulation.",
482  NULL, this, MID_STOP);
484  "Step\tCtl-D\tPerform one simulation step.",
485  NULL, this, MID_STEP);
486 
487  // build windows menu
488  myWindowsMenu = new FXMenuPane(this);
489  new FXMenuTitle(myMenuBar, "&Windows", NULL, myWindowsMenu);
490  new FXMenuCheck(myWindowsMenu,
491  "Show Status Line\t\tToggle the Status Bar on/off.",
492  myStatusbar, FXWindow::ID_TOGGLESHOWN);
493  new FXMenuCheck(myWindowsMenu,
494  "Show Message Window\t\tToggle the Message Window on/off.",
495  myMessageWindow, FXWindow::ID_TOGGLESHOWN);
496  new FXMenuCheck(myWindowsMenu,
497  "Show Simulation Time\t\tToggle the Simulation Time on/off.",
498  myToolBar3, FXWindow::ID_TOGGLESHOWN);
499  new FXMenuCheck(myWindowsMenu,
500  "Show Simulation Delay\t\tToggle the Simulation Delay Entry on/off.",
501  myToolBar4, FXWindow::ID_TOGGLESHOWN);
503  new FXMenuSeparator(myWindowsMenu);
504  new FXMenuCommand(myWindowsMenu, "Tile &Horizontally",
506  myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
507  new FXMenuCommand(myWindowsMenu, "Tile &Vertically",
509  myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
510  new FXMenuCommand(myWindowsMenu, "Cascade",
512  myMDIClient, FXMDIClient::ID_MDI_CASCADE);
513  new FXMenuCommand(myWindowsMenu, "&Close", NULL,
514  myMDIClient, FXMDIClient::ID_MDI_CLOSE);
515  sep1 = new FXMenuSeparator(myWindowsMenu);
516  sep1->setTarget(myMDIClient);
517  sep1->setSelector(FXMDIClient::ID_MDI_ANY);
518  new FXMenuCommand(myWindowsMenu, "", 0, myMDIClient, FXMDIClient::ID_MDI_1);
519  new FXMenuCommand(myWindowsMenu, "", 0, myMDIClient, FXMDIClient::ID_MDI_2);
520  new FXMenuCommand(myWindowsMenu, "", 0, myMDIClient, FXMDIClient::ID_MDI_3);
521  new FXMenuCommand(myWindowsMenu, "", 0, myMDIClient, FXMDIClient::ID_MDI_4);
522  new FXMenuCommand(myWindowsMenu, "&Others...", 0, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
523  new FXMenuSeparator(myWindowsMenu);
525  "Clear Message Window\t\tClear the message window.",
526  0, this, MID_CLEARMESSAGEWINDOW);
527 
528  // build help menu
529  myHelpMenu = new FXMenuPane(this);
530  new FXMenuTitle(myMenuBar, "&Help", NULL, myHelpMenu);
532  this, MID_ABOUT);
533 }
534 
535 
536 void
538  // build tool bars
539  {
540  // file and simulation tool bar
541  myToolBarDrag1 = new FXToolBarShell(this, FRAME_NORMAL);
542  myToolBar1 = new FXToolBar(myTopDock, myToolBarDrag1,
543  LAYOUT_DOCK_NEXT | LAYOUT_SIDE_TOP | FRAME_RAISED);
544  new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP,
545  TOOLBARGRIP_DOUBLE);
546  // build file tools
547  new FXButton(myToolBar1, "\t\tOpen a simulation (Configuration file).",
549  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
550  new FXButton(myToolBar1, "\t\tOpen a network.",
552  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
553  new FXButton(myToolBar1, "\t\tReloads the simulation / the network.",
555  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
556  }
557  {
558  // build simulation tools
559  myToolBarDrag2 = new FXToolBarShell(this, FRAME_NORMAL);
560  myToolBar2 = new FXToolBar(myTopDock, myToolBarDrag2,
561  LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED);
562  new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP,
563  TOOLBARGRIP_DOUBLE);
564  new FXButton(myToolBar2, "\t\tStart the loaded simulation.",
566  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
567  new FXButton(myToolBar2, "\t\tStop the running simulation.",
569  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
570  new FXButton(myToolBar2, "\t\tPerform a single simulation step.",
572  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
573  }
574  {
575  // Simulation Step Display
576  myToolBarDrag3 = new FXToolBarShell(this, FRAME_NORMAL);
577  myToolBar3 = new FXToolBar(myTopDock, myToolBarDrag3,
578  LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED);
579  new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP,
580  TOOLBARGRIP_DOUBLE);
581  new FXButton(myToolBar3, "Time:\t\tToggle between seconds and hour:minute:seconds display", 0, this, MID_TIME_TOOGLE,
582  BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
583  myLCDLabel = new FXEX::FXLCDLabel(myToolBar3, 13, 0, 0, JUSTIFY_RIGHT);
587  myLCDLabel->setGroove(2);
588  myLCDLabel->setText("-------------");
589  }
590  {
591  // Simulation Delay
592  myToolBarDrag4 = new FXToolBarShell(this, FRAME_NORMAL);
593  myToolBar4 = new FXToolBar(myTopDock, myToolBarDrag4,
594  LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED | LAYOUT_FILL_Y);
595  new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP,
596  TOOLBARGRIP_DOUBLE);
597  new FXButton(myToolBar4, "Delay (ms):\t\tToggle between alternative delay values", 0, this, MID_DELAY_TOOGLE,
598  BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
601  LAYOUT_TOP | FRAME_SUNKEN | FRAME_THICK | LAYOUT_FILL_Y);
603  mySimDelayTarget->setIncrements(1, 10, 10);
604  mySimDelayTarget->setRange(0, 1000);
606  }
607  {
608  // Views
609  myToolBarDrag5 = new FXToolBarShell(this, FRAME_NORMAL);
610  myToolBar5 = new FXToolBar(myTopDock, myToolBarDrag5,
611  LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED);
612  new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP,
613  TOOLBARGRIP_DOUBLE);
614  // build view tools
615  new FXButton(myToolBar5, "\t\tOpen a new microscopic view.",
617  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
618 #ifdef HAVE_OSG
619  new FXButton(myToolBar5, "\t\tOpen a new 3D view.",
621  ICON_ABOVE_TEXT | BUTTON_TOOLBAR | FRAME_RAISED | LAYOUT_TOP | LAYOUT_LEFT);
622 #endif
623  }
624  {
626  // total waitingTime
627  myToolBarDrag6 = new FXToolBarShell(this, FRAME_NORMAL);
628  myToolBar6 = new FXToolBar(myTopDock, myToolBarDrag6, LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED);
629  new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, TOOLBARGRIP_DOUBLE);
630  new FXLabel(myToolBar6, "Waiting Time:\t\tTime spent waiting accumulated for all vehicles", 0, LAYOUT_TOP | LAYOUT_LEFT);
631  myWaitingTimeLabel = new FXEX::FXLCDLabel(myToolBar6, 13, 0, 0, JUSTIFY_RIGHT);
636  myWaitingTimeLabel->setText("-------------");
637 
638  // idealistic time loss
639  myToolBarDrag7 = new FXToolBarShell(this, FRAME_NORMAL);
640  myToolBar7 = new FXToolBar(myTopDock, myToolBarDrag7, LAYOUT_DOCK_SAME | LAYOUT_SIDE_TOP | FRAME_RAISED);
641  new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, TOOLBARGRIP_DOUBLE);
642  new FXLabel(myToolBar7, "Time Loss:\t\tTime lost due to being unable to drive with maximum speed for all vehicles", 0, LAYOUT_TOP | LAYOUT_LEFT);
643  myTimeLossLabel = new FXEX::FXLCDLabel(myToolBar7, 13, 0, 0, JUSTIFY_RIGHT);
648  myTimeLossLabel->setText("-------------");
649  }
650 }
651 
652 
653 long
655  if (!myAmFullScreen) {
656  getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
657  getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
658  getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
659  getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
660  }
661  getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
662  getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
663  getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
664  getApp()->reg().writeIntEntry("gui", "alternateSimDelay", myAlternateSimDelay);
665  getApp()->exit(0);
666  return 1;
667 }
668 
669 
670 long
672  FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
673  if (mc->getText() == "Edit Selected...") {
674  GUIDialog_GLChosenEditor* chooser =
676  chooser->create();
677  chooser->show();
678  } else {
680  const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
681  for (size_t i = 0; i < MSEdge::dictSize(); ++i) {
682  const std::vector<MSLane*>& lanes = MSEdge::dictionary(i)->getLanes();
683  for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
684  GUILane* lane = dynamic_cast<GUILane*>(*it);
685  assert(lane != 0);
686  if ((lane->getPermissions() & svc) != 0) {
687  gSelected.select(lane->getGlID());
688  }
689  }
690  }
691  if (myMDIClient->numChildren() > 0) {
692  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
693  if (w != 0) {
694  // color by selection
696  }
697  }
698  }
699  updateChildren();
700  }
701  return 1;
702 }
703 
704 
705 long
708  chooser->create();
709  chooser->show();
710  return 1;
711 }
712 
713 
714 long
716  // get the new file name
717  FXFileDialog opendialog(this, "Open Simulation Configuration");
718  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
719  opendialog.setSelectMode(SELECTFILE_EXISTING);
720  opendialog.setPatternList(myConfigPattern.c_str());
721  if (gCurrentFolder.length() != 0) {
722  opendialog.setDirectory(gCurrentFolder);
723  }
724  if (opendialog.execute()) {
725  gCurrentFolder = opendialog.getDirectory();
726  std::string file = opendialog.getFilename().text();
727  loadConfigOrNet(file, false);
728  myRecentConfigs.appendFile(file.c_str());
729  }
730  return 1;
731 }
732 
733 
734 long
736  // get the new file name
737  FXFileDialog opendialog(this, "Open Network");
738  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
739  opendialog.setSelectMode(SELECTFILE_EXISTING);
740  opendialog.setPatternList("SUMO nets (*.net.xml)\nAll files (*)");
741  if (gCurrentFolder.length() != 0) {
742  opendialog.setDirectory(gCurrentFolder);
743  }
744  if (opendialog.execute()) {
745  gCurrentFolder = opendialog.getDirectory();
746  std::string file = opendialog.getFilename().text();
747  loadConfigOrNet(file, true);
748  myRecentNets.appendFile(file.c_str());
749  }
750  return 1;
751 }
752 
753 
754 long
756  // get the shape file name
757  FXFileDialog opendialog(this, "Open Shapes");
758  opendialog.setIcon(GUIIconSubSys::getIcon(ICON_EMPTY));
759  opendialog.setSelectMode(SELECTFILE_EXISTING);
760  opendialog.setPatternList("Additional files (*.xml)\nAll files (*)");
761  if (gCurrentFolder.length() != 0) {
762  opendialog.setDirectory(gCurrentFolder);
763  }
764  if (opendialog.execute()) {
765  gCurrentFolder = opendialog.getDirectory();
766  std::string file = opendialog.getFilename().text();
767 
769  if (!XMLSubSys::runParser(handler, file, false)) {
770  WRITE_MESSAGE("Loading of " + file + " failed.");
771  }
772  update();
773  }
774  return 1;
775 }
776 
777 
778 long
780  getApp()->beginWaitCursor();
781  myAmLoading = true;
782  closeAllWindows();
783  myLoadThread->start();
784  setStatusBarText("Reloading.");
785  update();
786  return 1;
787 }
788 
789 
790 long
791 GUIApplicationWindow::onCmdOpenRecent(FXObject* sender, FXSelector, void* data) {
792  if (myAmLoading) {
793  myStatusbar->getStatusLine()->setText("Already loading!");
794  return 1;
795  }
796  std::string file((const char*)data);
797  loadConfigOrNet(file, sender == &myRecentNets);
798  return 1;
799 }
800 
801 
802 long
804  closeAllWindows();
805  return 1;
806 }
807 
808 
809 long
810 GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
811  sender->handle(this,
812  myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
813  ptr);
814  return 1;
815 }
816 
817 
818 long
819 GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
820  sender->handle(this,
822  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
823  ptr);
824  return 1;
825 }
826 
827 
828 long
829 GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
830  sender->handle(this,
831  myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
832  ptr);
833  return 1;
834 }
835 
836 
837 long
838 GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
839  sender->handle(this,
841  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
842  ptr);
843  return 1;
844 }
845 
846 
847 long
849  // check whether a net was loaded successfully
851  myStatusbar->getStatusLine()->setText("No simulation loaded!");
852  return 1;
853  }
854  // check whether it was started before and paused;
855  if (!myWasStarted) {
856  myRunThread->begin();
857  myWasStarted = true;
858  }
859  myRunThread->resume();
860  getApp()->forceRefresh(); // only callking myToolBar2->forceRefresh somehow loses keyboard focus
861  return 1;
862 }
863 
864 
865 long
867  myRunThread->stop();
868  getApp()->forceRefresh(); // only callking myToolBar2->forceRefresh somehow loses keyboard focus
869  return 1;
870 }
871 
872 
873 long
875  // check whether a net was loaded successfully
877  myStatusbar->getStatusLine()->setText("No simulation loaded!");
878  return 1;
879  }
880  // check whether it was started before and paused;
881  if (!myWasStarted) {
882  myRunThread->begin();
883  myWasStarted = true;
884  }
886  return 1;
887 }
888 
889 
890 long
895  }
896  return 1;
897 }
898 
899 
900 long
902  const SUMOTime tmp = myAlternateSimDelay;
905  return 1;
906 }
907 
908 
909 long
912  return 1;
913 }
914 
915 
916 long
917 GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
918  sender->handle(this,
920  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
921  ptr);
922  return 1;
923 }
924 
925 
926 long
927 GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
928  sender->handle(this,
930  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
931  ptr);
932  return 1;
933 }
934 
935 
936 long
937 GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
938  sender->handle(this,
940  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
941  ptr);
942  return 1;
943 }
944 
945 
946 long
947 GUIApplicationWindow::onUpdNeedsSimulation(FXObject* sender, FXSelector, void* ptr) {
948  sender->handle(this,
950  ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
951  ptr);
952  return 1;
953 }
954 
955 
956 long
957 GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
958  if (myMDIClient->numChildren() > 0) {
959  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
960  if (w != 0) {
961  w->onCmdLocate(0, sel, 0);
962  }
963  }
964  return 1;
965 }
966 
967 long
970  d->create();
971  d->show(PLACEMENT_OWNER);
972  return 1;
973 }
974 
975 
976 long
979  if (myAmGaming) {
980  myMenuBar->hide();
981  myStatusbar->hide();
982  myToolBar1->hide();
983  myToolBar2->hide();
984  myToolBar4->hide();
985  myToolBar5->hide();
986  myToolBar6->show();
987  myToolBar7->show();
988  myMessageWindow->hide();
993  } else {
994  myMenuBar->show();
995  myStatusbar->show();
996  myToolBar1->show();
997  myToolBar2->show();
998  myToolBar4->show();
999  myToolBar5->show();
1000  myToolBar6->hide();
1001  myToolBar7->hide();
1002  myMessageWindow->show();
1004  gSchemeStorage.getDefault().gaming = false;
1005  }
1006  if (myMDIClient->numChildren() > 0) {
1007  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1008  if (w != 0) {
1010  }
1011  }
1012  update();
1013  return 1;
1014 }
1015 
1016 
1017 long
1020  if (myAmFullScreen) {
1021  getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1022  getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1023  getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1024  getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1025  maximize();
1026  setDecorations(DECOR_NONE);
1027  place(PLACEMENT_MAXIMIZED);
1028  myMenuBar->hide();
1029  myStatusbar->hide();
1030  myToolBar1->hide();
1031  myToolBar2->hide();
1032  myToolBar3->hide();
1033  myToolBar4->hide();
1034  myToolBar5->hide();
1035  myToolBar6->hide();
1036  myToolBar7->hide();
1037  myMessageWindow->hide();
1038  if (myMDIClient->numChildren() > 0) {
1039  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1040  if (w != 0) {
1041  w->setToolBarVisibility(false);
1042  }
1043  }
1044  update();
1045  } else {
1046  place(PLACEMENT_VISIBLE);
1047  setDecorations(DECOR_ALL);
1048  restore();
1049  myToolBar3->show();
1051  onCmdGaming(0, 0, 0);
1052  setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
1053  setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1054  setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
1055  setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
1056  }
1057  return 1;
1058 }
1059 
1060 
1061 long
1064  return 1;
1065 }
1066 
1067 
1068 long
1071  return 1;
1072 }
1073 
1074 
1075 #ifdef HAVE_OSG
1076 long
1077 GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1079  return 1;
1080 }
1081 #endif
1082 
1083 
1084 long
1086  GUIDialog_AboutSUMO* about =
1087  new GUIDialog_AboutSUMO(this, "About SUMO", 0, 0);
1088  about->create();
1089  about->show(PLACEMENT_OWNER);
1090  return 1;
1091 }
1092 
1093 
1094 long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1095  FXEvent* event = (FXEvent*)ptr;
1096  FXString string = GUIUserIO::clipped.c_str();
1097  setDNDData(FROM_CLIPBOARD, event->target, string);
1098  return 1;
1099 }
1100 
1101 
1102 long
1104  eventOccured();
1105  return 1;
1106 }
1107 
1108 
1109 long
1111  eventOccured();
1112  return 1;
1113 }
1114 
1115 
1116 void
1118  while (!myEvents.empty()) {
1119  // get the next event
1120  GUIEvent* e = myEvents.top();
1121  myEvents.pop();
1122  // process
1123  switch (e->getOwnType()) {
1126  break;
1127  case EVENT_SIMULATION_STEP:
1128  if (myRunThread->simulationAvailable()) { // avoid race-condition related crash if reload was pressed
1130  }
1131  break;
1132  case EVENT_MESSAGE_OCCURED:
1133  case EVENT_WARNING_OCCURED:
1134  case EVENT_ERROR_OCCURED:
1136  break;
1139  break;
1140  case EVENT_SCREENSHOT:
1142  break;
1143  default:
1144  break;
1145  }
1146  delete e;
1147  }
1148  myToolBar2->forceRefresh();
1149  myToolBar3->forceRefresh();
1150 }
1151 
1152 
1153 void
1155  myAmLoading = false;
1157  // check whether the loading was successfull
1158  if (ec->myNet == 0) {
1159  // report failure
1160  setStatusBarText("Loading of '" + ec->myFile + "' failed!");
1161  if (GUIGlobals::gQuitOnEnd) {
1162  closeAllWindows();
1163  getApp()->exit(1);
1164  }
1165  } else {
1166  // initialise simulation thread
1167  if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1168  if (GUIGlobals::gQuitOnEnd) {
1169  closeAllWindows();
1170  getApp()->exit(1);
1171  }
1172  } else {
1173  // report success
1174  setStatusBarText("'" + ec->myFile + "' loaded.");
1175  myWasStarted = false;
1176  myHaveNotifiedAboutSimEnd = false;
1177  // initialise views
1178  myViewNumber = 0;
1180  if (ec->mySettingsFiles.size() > 0) {
1181  // open a view for each file and apply settings
1182  for (std::vector<std::string>::const_iterator it = ec->mySettingsFiles.begin(); it != ec->mySettingsFiles.end(); ++it) {
1183  GUISettingsHandler settings(*it);
1184  GUISUMOViewParent::ViewType vt = defaultType;
1185  if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
1187  }
1188  if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
1190  }
1191  GUISUMOAbstractView* view = openNewView(vt);
1192  if (view == 0) {
1193  break;
1194  }
1195  std::string settingsName = settings.addSettings(view);
1196  view->addDecals(settings.getDecals());
1197  settings.setViewport(view);
1198  settings.setSnapshots(view);
1199  if (settings.getDelay() > 0) {
1200  mySimDelayTarget->setValue(settings.getDelay());
1201  }
1202  if (settings.getBreakpoints().size() > 0) {
1204  myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
1206  }
1207  myJamSounds = settings.getEventDistribution("jam");
1208  if (settings.getJamSoundTime() > 0) {
1209  myJamSoundTime = settings.getJamSoundTime();
1210  }
1211  }
1212  } else {
1213  openNewView(defaultType);
1214  }
1215 
1216  if (isGaming()) {
1217  setTitle("SUMO Interactive Traffic Light");
1218  } else {
1219  // set simulation name on the caption
1220  std::string caption = "SUMO " + getBuildName(VERSION_STRING);
1221  setTitle(MFXUtils::getTitleText(caption.c_str(), ec->myFile.c_str()));
1222  }
1223  // set simulation step begin information
1224  myLCDLabel->setText("-------------");
1225  }
1226  }
1227  getApp()->endWaitCursor();
1228  // start if wished
1230  onCmdStart(0, 0, 0);
1231  }
1232  update();
1233 }
1234 
1235 
1236 void
1238  updateChildren();
1240  if (myAmGaming) {
1242  }
1244  getApp()->forceRefresh(); // restores keyboard focus
1245  }
1246  update();
1247 }
1248 
1249 
1250 void
1252  GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
1253  myMessageWindow->appendMsg(ec->getOwnType(), ec->getMsg());
1254 }
1255 
1256 
1257 void
1259  GUIEvent_SimulationEnded* ec = static_cast<GUIEvent_SimulationEnded*>(e);
1260  onCmdStop(0, 0, 0);
1261  if (GUIGlobals::gQuitOnEnd) {
1262  closeAllWindows();
1263  getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
1264  } else if (!myHaveNotifiedAboutSimEnd) {
1265  // build the text
1266  const std::string text = "Simulation ended at time: " + time2string(ec->getTimeStep()) +
1267  ".\nReason: " + MSNet::getStateMessage(ec->getReason()) +
1268  "\nDo you want to close all open files and views?";
1269  FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, "Simulation ended", "%s", text.c_str());
1270  if (answer == 1) { //1:yes, 2:no, 4:esc
1271  closeAllWindows();
1272  }
1274  }
1275 }
1276 
1277 
1278 void
1280  GUIEvent_Screenshot* ec = static_cast<GUIEvent_Screenshot*>(e);
1281  myEventMutex.lock();
1282  const std::string error = ec->myView->makeSnapshot(ec->myFile);
1283  if (error != "") {
1284  WRITE_WARNING(error);
1285  }
1286  myEventCondition.signal();
1287  myEventMutex.unlock();
1288 }
1289 
1290 
1291 void
1296 #ifdef HAVE_INTERNAL
1297  if (myJamSounds.getOverallProb() > 0) {
1298  // play honking sound if some vehicle is waiting too long
1299  for (; it != end; ++it) {
1300  // XXX use impatience instead of waiting time ?
1301  if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
1302  const std::string cmd = myJamSounds.get(&myGamingRNG);
1303  if (cmd != "") {
1304  // yay! fun with dangerous commands... Never use this over the internet
1306  // one sound per simulation step is enough
1307  break;
1308  }
1309  }
1310  }
1311  }
1312 #endif
1313 
1314  // update performance indicators
1315  for (it = vc.loadedVehBegin(); it != end; ++it) {
1316  const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
1317  assert(veh != 0);
1318  if (veh->isOnRoad()) {
1319  const SUMOReal vmax = MIN2(veh->getVehicleType().getMaxSpeed(), veh->getEdge()->getSpeedLimit());
1320  if (veh->getSpeed() < SUMO_const_haltingSpeed) {
1322  }
1323  myTimeLoss += TS * TIME2STEPS(vmax - veh->getSpeed()) / vmax; // may be negative with speedFactor > 1
1324  }
1325  }
1328 }
1329 
1330 
1331 void
1332 GUIApplicationWindow::loadConfigOrNet(const std::string& file, bool isNet) {
1333  getApp()->beginWaitCursor();
1334  myAmLoading = true;
1335  closeAllWindows();
1336  gSchemeStorage.saveViewport(0, 0, -1); // recenter view
1337  myLoadThread->loadConfigOrNet(file, isNet);
1338  setStatusBarText("Loading '" + file + "'.");
1339  update();
1340 }
1341 
1342 
1345  if (!myRunThread->simulationAvailable()) {
1346  myStatusbar->getStatusLine()->setText("No simulation loaded!");
1347  return 0;
1348  }
1349  std::string caption = "View #" + toString(myViewNumber++);
1350  FXuint opts = MDI_TRACKING;
1351  GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
1352  this, GUIIconSubSys::getIcon(ICON_APP), opts, 10, 10, 300, 200);
1354  w->create();
1355  if (myMDIClient->numChildren() == 1) {
1356  w->maximize();
1357  } else {
1358  myMDIClient->vertical(true);
1359  }
1360  myMDIClient->setActiveChild(w);
1361  return v;
1362 }
1363 
1364 
1365 FXGLCanvas*
1367  if (myMDIClient->numChildren() == 0) {
1368  return 0;
1369  }
1370  GUISUMOViewParent* share_tmp1 =
1371  static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
1372  return share_tmp1->getBuildGLCanvas();
1373 }
1374 
1375 
1376 void
1378  myTrackerLock.lock();
1379  myLCDLabel->setText("-------------");
1380  // remove trackers and other external windows
1381  size_t i;
1382  for (i = 0; i < mySubWindows.size(); ++i) {
1383  mySubWindows[i]->destroy();
1384  }
1385  for (i = 0; i < myTrackerWindows.size(); ++i) {
1386  myTrackerWindows[i]->destroy();
1387  }
1388  // delete the simulation
1390  // reset the caption
1391  setTitle(MFXUtils::getTitleText(("SUMO " + getBuildName(VERSION_STRING)).c_str()));
1392  // delete other children
1393  while (myTrackerWindows.size() != 0) {
1394  delete myTrackerWindows[0];
1395  }
1396  while (mySubWindows.size() != 0) {
1397  delete mySubWindows[0];
1398  }
1399  mySubWindows.clear();
1400  // clear selected items
1401  gSelected.clear();
1402  // add a separator to the log
1405  // remove coordinate information
1406  myGeoCoordinate->setText("N/A");
1407  myCartesianCoordinate->setText("N/A");
1408  //
1410  update();
1411 }
1412 
1413 
1414 FXCursor*
1416  return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
1417 }
1418 
1419 
1420 SUMOTime
1423 }
1424 
1425 
1426 void
1428  loadConfigOrNet("", false);
1429 }
1430 
1431 
1432 void
1434  myStatusbar->getStatusLine()->setText(text.c_str());
1435  myStatusbar->getStatusLine()->setNormalText(text.c_str());
1436 }
1437 
1438 
1439 void
1441  time -= DELTA_T; // synchronize displayed time with netstate output
1442  if (myAmGaming) {
1443  // show time counting backwards
1444  time = myRunThread->getSimEndTime() - time;
1445  }
1446  SUMOReal fracSeconds = STEPS2TIME(time);
1447  const bool hideFraction = myAmGaming || fmod(TS, 1.) == 0.;
1448  const int BuffSize = 100;
1449  char buffer[BuffSize];
1450  if (myShowTimeAsHMS) {
1451  const int hours = (int)fracSeconds / 3600;
1452  const int minutes = ((int)fracSeconds % 3600) / 60;
1453  fracSeconds = fracSeconds - 3600 * hours - 60 * minutes;
1454  const std::string format = (hideFraction ?
1455  "%02d-%02d-%02.0f" : "%02d-%02d-%06.3f");
1456  snprintf(buffer, BuffSize, format.c_str(), hours, minutes, fracSeconds);
1457  } else {
1458  const std::string format = (hideFraction ?
1459  "%13.0f" : "%13.3f");
1460  snprintf(buffer, BuffSize, format.c_str(), fracSeconds);
1461  }
1462  myLCDLabel->setText(buffer);
1463 }
1464 
1465 
1466 long
1467 GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* data) {
1468  const long handled = FXMainWindow::onKeyPress(o, sel, data);
1469  if (handled == 0 && myMDIClient->numChildren() > 0) {
1470  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1471  if (w != 0) {
1472  w->onKeyPress(0, sel, data);
1473  }
1474  }
1475  return 0;
1476 }
1477 
1478 
1479 long
1480 GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* data) {
1481  const long handled = FXMainWindow::onKeyRelease(o, sel, data);
1482  if (handled == 0 && myMDIClient->numChildren() > 0) {
1483  GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1484  if (w != 0) {
1485  w->onKeyRelease(0, sel, data);
1486  }
1487  }
1488  return 0;
1489 }
1490 
1491 
1492 void
1494  myEventMutex.lock();
1495  myEvents.add(event);
1498  myEventMutex.unlock();
1499 }
1500 
1501 
1502 /****************************************************************************/
std::vector< FXMainWindow * > myTrackerWindows
Event sent when the the simulation is over.
MFXMutex & getBreakpointLock()
Definition: GUIRunThread.h:119
RandomDistributor< std::string > myJamSounds
About SUMO - ID.
Definition: GUIAppEnum.h:85
FXLabel * myGeoCoordinate
GUISUMOAbstractView * getView() const
virtual ~GUIApplicationWindow()
Destructor.
GUILoadThread * myLoadThread
GUICompleteSchemeStorage gSchemeStorage
void pop()
Definition: MFXEventQue.h:53
long onCmdStep(FXObject *, FXSelector, void *)
Called on &quot;step&quot;.
static std::string clipped
Definition: GUIUserIO.h:64
Representation of a vehicle in the micro simulation.
Definition: MSVehicle.h:80
void handleEvent_SimulationLoaded(GUIEvent *e)
SUMOReal getMaxSpeed() const
Get vehicle&#39;s maximum speed [m/s].
long long int SUMOTime
Definition: SUMOTime.h:43
long onCmdReload(FXObject *, FXSelector, void *)
Called on reload.
Fullscreen mode - menu entry.
Definition: GUIAppEnum.h:141
virtual bool simulationIsStepable() const
Locate poi - button.
Definition: GUIAppEnum.h:173
void appendMsg(GUIEventType eType, const std::string &msg)
Adds new text to the window.
std::string addSettings(GUISUMOAbstractView *view=0) const
Adds the parsed settings to the global list of settings.
MSNet::SimulationState getReason() const
Returns the reason the simulation has ended due.
The Simulation execution thread.
Definition: GUIAppEnum.h:117
SUMOTime myAlternateSimDelay
The alternate simulation delay for toggling.
GUIVisualizationSettings * getVisualisationSettings()
send when a message occured
Definition: GUIEvent.h:50
bool empty()
Definition: MFXEventQue.h:72
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
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
long onUpdOpenRecent(FXObject *, FXSelector, void *)
Determines whether opening a recent file is enabled.
const std::string & getViewType() const
Returns the parsed view type.
long onCmdEditChosen(FXObject *, FXSelector, void *)
Called on menu Edit-&gt;Edit Chosen.
static MTRand myGamingRNG
A random number generator used to choose a gaming sound.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
bool gaming
whether the application is in gaming mode or not
Locate vehicle - button.
Definition: GUIAppEnum.h:165
const bool myOsgView
whether to load the OpenSceneGraph view
void add(T what)
Definition: MFXEventQue.h:59
const std::string & getMsg() const
Returns the message.
GUIColorer laneColorer
The lane colorer.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
FXToolBarShell * myToolBarDrag4
long onUpdStop(FXObject *, FXSelector, void *)
Determines whether &quot;stop&quot; is enabled.
long onClipboardRequest(FXObject *sender, FXSelector sel, void *ptr)
Somebody wants our clipped text.
virtual void setValue(FXdouble value)
Change current value.
Locate person - button.
Definition: GUIAppEnum.h:167
void setNumberFormat(FXint prec, FXbool bExp=FALSE)
Start the simulation.
Definition: GUIAppEnum.h:93
virtual bool simulationIsStartable() const
static bool gRunAfterLoad
the simulation shall start direct after loading
Definition: GUIGlobals.h:52
std::string time2string(SUMOTime t)
Definition: SUMOTime.cpp:61
void setToolBarVisibility(const bool value)
about toggled gaming status
Locate TLS - button.
Definition: GUIAppEnum.h:169
Edit simulation breakpoints.
Definition: GUIAppEnum.h:129
virtual void detach()
Detaches the tool/menu bar.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition: MSNet.cpp:162
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:205
Reload the previously loaded simulation.
Definition: GUIAppEnum.h:79
FXGLVisual * myGLVisual
The gl-visual used.
GUISUMOAbstractView * openNewView(GUISUMOViewParent::ViewType vt=GUISUMOViewParent::VIEW_2D_OPENGL)
long onCmdLocate(FXObject *, FXSelector, void *)
locator-callback
long onCmdStop(FXObject *, FXSelector, void *)
Called on &quot;stop&quot;.
FXMutex myEventMutex
the mutex for the waiting semaphore
const std::vector< SUMOTime > & getBreakpoints() const
Returns the parsed breakpoints.
static bool dictionary(const std::string &id, MSEdge *edge)
Inserts edge into the static dictionary Returns true if the key id isn&#39;t already in the dictionary...
Definition: MSEdge.cpp:553
FXString gCurrentFolder
The folder used as last.
Open configuration - ID.
Definition: GUIAppEnum.h:73
void handleEvent_Screenshot(GUIEvent *e)
void loadConfigOrNet(const std::string &file, bool isNet)
#define TIME2STEPS(x)
Definition: SUMOTime.h:66
Close simulation - ID.
Definition: GUIAppEnum.h:83
#define TS
Definition: SUMOTime.h:52
Loads a file previously loaded.
Definition: GUIAppEnum.h:81
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition: MSNet.h:251
Open network - ID.
Definition: GUIAppEnum.h:75
bool isGaming() const
return whether the gui is in gaming mode
Definition: GUIMainWindow.h:84
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:114
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)
Locate junction - button.
Definition: GUIAppEnum.h:161
GUIGlID getGlID() const
Returns the numerical id of the object.
Definition: GUIGlObject.h:115
long onUpdOpen(FXObject *, FXSelector, void *)
Determines whether opening is enabled.
virtual FXGLCanvas * getBuildGLCanvas() const
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
void addDecals(const std::vector< Decal > &decals)
#define WRITE_WARNING(msg)
Definition: MsgHandler.h:200
FXDEFMAP(GUIDialog_AppSettings) GUIDialog_AppSettingsMap[]
FXToolBarShell * myToolBarDrag2
void setViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
void setFgColor(FXColor clr)
set/get forground color
Definition: FXLCDLabel.cpp:128
void checkGamingEvents()
handles additional game-related events
FXMenuPane * myFileMenu
the submenus
void addSeparator()
Adds a a separator to this log window.
std::vector< SUMOTime > & getBreakpoints()
Definition: GUIRunThread.h:115
Main window closes.
Definition: GUIAppEnum.h:55
Application settings - menu entry.
Definition: GUIAppEnum.h:137
virtual void create()
Creates the main window (required by FOX)
Representation of a lane in the micro simulation (gui-version)
Definition: GUILane.h:70
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
FXHorizontalFrame * myCartesianFrame
SUMOReal getDelay() const
Returns the parsed delay.
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)
Editor for simulation breakpoints.
const std::string myFile
the name of the file to save to
bool myAmGaming
information whether the gui is currently in gaming mode
bool myShowTimeAsHMS
whether to show time as hour:minute:second
void handleEvent_Message(GUIEvent *e)
std::vector< FXMDIChild * > mySubWindows
static void clearTextures()
clears loaded textures
GUIEventType getOwnType() const
returns the event type
Definition: GUIEvent.h:81
long onCmdOpenRecent(FXObject *, FXSelector, void *)
Called on opening a recent file.
static const RGBColor GREEN
Definition: RGBColor.h:190
An error occured during the simulation step.
Definition: MSNet.h:109
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
void updateTimeLCD(SUMOTime time)
updates the simulation time display
void setRange(FXdouble lo, FXdouble hi)
Change the spinner&#39;s range.
Locator configuration - menu entry.
Definition: GUIAppEnum.h:143
FXCondition myEventCondition
the semaphore when waiting for event completion
void handleEvent_SimulationEnded(GUIEvent *e)
FXdouble getValue() const
Return current value.
bool myHaveNotifiedAboutSimEnd
whether the simulation end was already announced
Locate polygons - button.
Definition: GUIAppEnum.h:175
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:75
long onCmdEditBreakpoints(FXObject *, FXSelector, void *)
Called on menu Edit-&gt;Edit Breakpoints.
#define snprintf
SUMOReal myJamSoundTime
waiting time after which vehicles trigger jam sounds
long onCmdStart(FXObject *, FXSelector, void *)
Called on &quot;play&quot;.
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition: MSNet.h:415
long onCmdAppSettings(FXObject *, FXSelector, void *)
Opens the application settings menu (Settings-&gt;Application Settings...)
virtual void buildToolBars()
Builds the tool bar.
void setHorizontal(const FXint len)
set/get segment horizontal length - must be more than twice the segment width
Definition: FXLCDLabel.cpp:169
The loading thread.
Definition: GUIAppEnum.h:115
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition: MSNet.h:304
static void init(FXApp *a)
size_t myViewNumber
The current view number.
T get(MTRand *which=0) const
Draw a sample of the distribution.
FXMDIMenu * myMDIMenu
The menu used for the MDI-windows.
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
void setVertical(const FXint len)
set/get segment vertical length - must be more than twice the segment width
Definition: FXLCDLabel.cpp:187
FXToolBarShell * myMenuBarDrag
const std::string getBuildName(const std::string &version)
attach some build flags to the version string
Definition: StdDefs.cpp:88
SUMOTime getCurrentSimTime() const
ViewType
Available view types.
long onCmdListInternal(FXObject *, FXSelector, void *)
Toggle listing of internal structures.
Gaming mode - menu entry.
Definition: GUIAppEnum.h:139
Perform a single simulation step.
Definition: GUIAppEnum.h:97
long onUpdReload(FXObject *, FXSelector, void *)
Determines whether reloading is enabled.
long onCmdDelayToggle(FXObject *, FXSelector, void *)
Called on &quot;delay toggle&quot;.
#define STEPS2TIME(x)
Definition: SUMOTime.h:65
const std::string myFile
the name of the loaded file
FXToolBarShell * myToolBarDrag3
T MIN2(T a, T b)
Definition: StdDefs.h:68
The application&#39;s &quot;About&quot; - dialog.
void setStatusBarText(const std::string &)
bool myAmFullScreen
whether to show the window in full screen mode
The Simulation delay control.
Definition: GUIAppEnum.h:145
long onCmdAbout(FXObject *, FXSelector, void *)
Shows the about dialog.
const std::string & getFileName() const
long onCmdClose(FXObject *, FXSelector, void *)
Called on menu File-&gt;Close.
void saveViewport(const SUMOReal x, const SUMOReal y, const SUMOReal zoom)
Makes the given viewport the default.
send when a error occured
Definition: GUIEvent.h:56
Send when a screenshot is requested; View and file name are stored within the event.
Definition: GUIEvent.h:64
#define VERSION_STRING
Definition: version.h:1
Open chosen editor - ID.
Definition: GUIAppEnum.h:127
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition: MSLane.h:384
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
void setTarget(FXObject *tgt)
set the target
Definition: FXBaseObject.h:137
bool myListInternal
information whether the locator should list internal structures
long onCmdOpenShapes(FXObject *, FXSelector, void *)
Called on menu File-&gt;Load Shapes.
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Definition: ToString.h:53
virtual bool simulationIsStopable() const
The dialog to change the application (gui) settings.
SUMOReal getSpeedLimit() const
Returns the speed limit of the edge The speed limit of the first lane is retured; should probably be...
Definition: MSEdge.cpp:656
Send when the simulation is over; The reason and the time step are stored within the event...
Definition: GUIEvent.h:60
long onCmdClearMsgWindow(FXObject *, FXSelector, void *)
Called if the message window shall be cleared.
std::string makeSnapshot(const std::string &destFile)
Takes a snapshots and writes it into the given file.
FXMenuPane * mySelectByPermissions
GUINet & getNet() const
virtual void fillMenuBar()
Builds the menu bar.
Open a new microscopic 3D view.
Definition: GUIAppEnum.h:107
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:55
long onCmdGaming(FXObject *, FXSelector, void *)
Toggle gaming mode.
FXStatusBar * myStatusbar
The status bar.
void unlock()
release mutex lock
Definition: MFXMutex.cpp:96
FXMenuBar * myMenuBar
The application menu bar.
FXToolBarShell * myToolBarDrag5
SUMOReal getOverallProb() const
Return the sum of the probabilites assigned to the members.
FXGLCanvas * getBuildGLCanvas() const
FXToolBarShell * myToolBarDrag7
long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
GUIVisualizationSettings & getDefault()
Returns the default scheme.
GUISUMOAbstractView *const myView
the view to save
FXToolBarShell * myToolBarDrag6
static const RGBColor RED
Definition: RGBColor.h:189
Locate addtional structure - button.
Definition: GUIAppEnum.h:171
long onCmdOpenConfiguration(FXObject *, FXSelector, void *)
Called on menu File-&gt;Open Configuration.
long onRunThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the simulation thread.
The XML-Handler for shapes loading network loading.
Definition: NLHandler.h:73
void setGroove(const FXint width)
set/get groove width - must be less than segment width
Definition: FXLCDLabel.cpp:223
FXLabel * myCartesianCoordinate
Labels for the current cartesian and geo-coordinate.
Load additional file with poi and polygons.
Definition: GUIAppEnum.h:77
toogle time display mode
Definition: GUIAppEnum.h:187
void prepareDestruction()
MFXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
virtual void sendBlockingEvent(GUIEvent *event)
Sends an event from the application thread to the GUI and waits until it is handled.
void setSelector(FXSelector sel)
set the selector
Definition: FXBaseObject.h:147
MFXEventQue< GUIEvent * > myEvents
List of got requests.
static void close()
long onUpdAddView(FXObject *, FXSelector, void *)
Determines whether adding a view is enabled.
SUMOTime getSimEndTime() const
Definition: GUIRunThread.h:111
long onCmdLocate(FXObject *, FXSelector, void *)
Called on menu commands from the Locator menu.
FXEX::FXLCDLabel * myTimeLossLabel
FXRealSpinDial * mySimDelayTarget
FXHorizontalFrame * myGeoFrame
static size_t dictSize()
Returns the number of edges.
Definition: MSEdge.cpp:587
FXDockSite * myTopDock
FXRecentFiles myRecentConfigs
List of recent config files.
const MSVehicleType & getVehicleType() const
Returns the vehicle&#39;s type definition.
Definition: MSBaseVehicle.h:90
const SUMOReal SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition: StdDefs.h:54
void create()
Creates the widget (and the icons)
void clear()
Clears the list of selected objects.
FXToolBarShell * myToolBarDrag1
for some menu detaching fun
SUMOReal getSpeed() const
Returns the vehicle&#39;s current speed.
Definition: MSVehicle.h:294
FXEX::FXThreadEvent myLoadThreadEvent
io-event with the load-thread
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
void lock()
lock mutex
Definition: MFXMutex.cpp:86
void text()
Definition: gl2psTest.c:260
FXEX::FXThreadEvent myRunThreadEvent
io-event with the run-thread
toogle delay between alternative value
Definition: GUIAppEnum.h:189
FXMDIClient * myMDIClient
The multi view panel.
send when a simulation has been loaded
Definition: GUIEvent.h:44
bool simulationAvailable() const
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition: MFXUtils.cpp:125
Stop the simulation.
Definition: GUIAppEnum.h:95
send when a warning occured
Definition: GUIEvent.h:53
FXToolBar * myToolBar1
The application tool bar.
long onCmdOpenNetwork(FXObject *, FXSelector, void *)
Called on menu File-&gt;Open Network.
long onUpdNeedsSimulation(FXObject *, FXSelector, void *)
Determines whether some buttons which require an active simulation may be shown.
SUMOTime getTimeStep() const
Returns the time step the simulation has ended at.
void setIncrements(FXdouble fine, FXdouble norm, FXdouble coarse)
Change all spinner increment.
#define SUMOReal
Definition: config.h:215
static const bool gUseMesoSim
Definition: MSGlobals.h:102
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:541
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
static FXString getTitleText(const FXString &appname, FXString filename="")
Returns the title text in dependance to an optional file name.
Definition: MFXUtils.cpp:73
long onLoadThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the loading thread.
virtual GUISUMOAbstractView * init(FXGLCanvas *share, GUINet &net, ViewType type)
&quot;Initialises&quot; this window by building the contents
Locate edge - button.
Definition: GUIAppEnum.h:163
#define DELTA_T
Definition: SUMOTime.h:50
const MSEdge * getEdge() const
Returns the edge the vehicle is currently at.
The class responsible for building and deletion of vehicles.
void setText(FXString lbl)
manipulate text in LCD label
Definition: FXLCDLabel.cpp:154
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 ...
long onCmdTimeToggle(FXObject *, FXSelector, void *)
Called on &quot;time toggle&quot;.
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition: MSVehicle.h:339
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
Main window-ID.
Definition: GUIAppEnum.h:53
void handleEvent_SimulationStep(GUIEvent *e)
Spinner control.
#define WRITE_MESSAGE(msg)
Definition: MsgHandler.h:201
FXEX::FXLCDLabel * myLCDLabel
the simulation step display
virtual void create()
GUISelectedStorage gSelected
A global holder of selected objects.
A logging window for the gui.
send when a simulation step has been performed
Definition: GUIEvent.h:47
long onUpdStep(FXObject *, FXSelector, void *)
Determines whether &quot;step&quot; is enabled.
Open a new microscopic view.
Definition: GUIAppEnum.h:105
static FXIcon * getIcon(GUIIcon which)
long onCmdQuit(FXObject *, FXSelector, void *)
Called by FOX if the application shall be closed.
virtual void addToWindowsMenu(FXMenuPane *)
long onUpdStart(FXObject *sender, FXSelector, void *ptr)
Determines whether &quot;play&quot; is enabled.
The main window of the SUMO-gui.