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