Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIApplicationWindow.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 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>
36#include <microsim/MSGlobals.h>
42#include <netload/NLHandler.h>
71#include <utils/xml/XMLSubSys.h>
72
76#include "GUIGlobals.h"
77#include "GUILoadThread.h"
78#include "GUIRunThread.h"
84
85
86#define MIN_DRAW_DELAY 20
87//#define HAVE_DANGEROUS_SOUNDS
88
89#define STAT_VEHS 0
90#define STAT_DELAYED 1
91#define STAT_TELEPORTS 2
92#define STAT_PERSONS 3
93#define STAT_CONTAINERS 4
94
95// ===========================================================================
96// FOX-declarations
97// ===========================================================================
98FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[] = {
99 // close
103 FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GUIApplicationWindow::onCmdQuit),
104 // toolbar
121 // gaming
131 // OSG
132#ifdef HAVE_OSG
133 FXMAPFUNC(SEL_COMMAND, MID_NEW_OSGVIEW, GUIApplicationWindow::onCmdNewOSG),
135
136#endif
139 // Time
146 FXMAPFUNC(SEL_COMMAND, MID_DELAY_INC, GUIApplicationWindow::onCmdDelayInc),
147 FXMAPFUNC(SEL_COMMAND, MID_DELAY_DEC, GUIApplicationWindow::onCmdDelayDec),
148 FXMAPFUNC(SEL_COMMAND, MID_SIMSAVE, GUIApplicationWindow::onCmdSaveState),
149 FXMAPFUNC(SEL_COMMAND, MID_SIMLOAD, GUIApplicationWindow::onCmdLoadState),
156 // Stats
160 // these functions do not assign shortcut keys to commands, but rather affect the button enable status upon other events (e.g. simulation loaded)
161 // since those events are invoked through pseudo key events (?), the same key shortcuts as in cmd must be supplied as well
191 FXMAPFUNC(SEL_COMMAND, MID_HOTKEYS, GUIApplicationWindow::onCmdHotkeys),
192 FXMAPFUNC(SEL_COMMAND, MID_TUTORIAL, GUIApplicationWindow::onCmdTutorial),
194 FXMAPFUNC(SEL_COMMAND, MID_FEEDBACK, GUIApplicationWindow::onCmdFeedback),
196 // forward requests to the active view
215 // languages
236 // coordinate inputs
243 // keys
244 FXMAPFUNC(SEL_KEYPRESS, 0, GUIApplicationWindow::onKeyPress),
245 FXMAPFUNC(SEL_KEYRELEASE, 0, GUIApplicationWindow::onKeyRelease),
246 // clipboard
247 FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GUIApplicationWindow::onClipboardRequest),
248 // events
253};
254
255// Object implementation
256FXIMPLEMENT(GUIApplicationWindow, FXMainWindow, GUIApplicationWindowMap, ARRAYNUMBER(GUIApplicationWindowMap))
257
258// ===========================================================================
259// static members
260// ===========================================================================
262
263
264// ===========================================================================
265// member method definitions
266// ===========================================================================
267#ifdef _MSC_VER
268#pragma warning(push)
269#pragma warning(disable: 4355) // mask warning about "this" in initializers
270#endif
272 GUIMainWindow(a),
273 myFileMenuRecentNetworks(new FXMenuPane(this)),
274 myFileMenuRecentConfigs(new FXMenuPane(this)),
275 myRecentNetworks(a, "networks"),
276 myRecentConfigs(a, "configs"),
277 myLastStepEventMillis(SysUtils::getCurrentMillis() - MIN_DRAW_DELAY) {
278 // init icons
280 // init Textures
282 // init cursors
284 // disable tooltips
285 a->setTooltipTime(1000000000);
286 a->setTooltipPause(1000000000);
287}
288#ifdef _MSC_VER
289#pragma warning(pop)
290#endif
291
292
297
298
299void
301 // don't do this twice
302 if (hadDependentBuild) {
303 return;
304 }
305 hadDependentBuild = true;
306 setTarget(this);
307 setSelector(MID_WINDOW);
308 // build menu bar
309 myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBar);
311 new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
313 // build the thread - io
318 // build the status bar
319 myStatusbar = new FXStatusBar(this, GUIDesignStatusBar);
320 {
321 // build TraCi info
323 auto button = GUIDesigns::buildFXButton(myTraCiFrame, "TraCI", "", "", nullptr, this, MID_TRACI_STATUS, GUIDesignButtonStatusBarFixed);
324 button->setBackColor(FXRGBA(253, 255, 206, 255));
325 if (TraCIServer::getInstance() == nullptr) {
326 myTraCiFrame->hide();
327 }
328 // build geo coordiantes
330 myGeoCoordinate = new FXTextField(myGeoFrame, 26, this, MID_GEO_COORDINATE, FRAME_NONE | LAYOUT_CENTER_Y | TEXTFIELD_ENTER_ONLY, 0, 0, 0, GUIDesignHeight, 2, 2, 1, 1);
331 myGeoCoordinate->setHelpText(TL("Original coordinate (before coordinate transformation in netconvert). Enter 'lat, lon' or 'lat:... lon:...' to center view"));
332 myGeoCoordinate->setTipText(TL("Enter 'lat, lon' to center view"));
333 myGeoCoordinate->setBackColor(myGeoFrame->getBackColor());
334 myGeoCoordinate->setText(TL("N/A"));
335 myGeoCoordinate->disable();
336 myGeoCoordinate->setEditable(false);
337 // build cartesian coordinates
339 myCartesianCoordinate = new FXTextField(myCartesianFrame, 22, this, MID_CARTESIAN_COORDINATE, FRAME_NONE | LAYOUT_CENTER_Y | TEXTFIELD_ENTER_ONLY, 0, 0, 0, GUIDesignHeight, 2, 2, 1, 1);
340 myCartesianCoordinate->setHelpText(TL("Network coordinate. Enter 'x, y' to center view"));
341 myCartesianCoordinate->setTipText(TL("Enter 'x, y' to center view"));
342 myCartesianCoordinate->setBackColor(myCartesianFrame->getBackColor());
343 myCartesianCoordinate->setText(TL("N/A"));
344 myCartesianCoordinate->disable();
345 myCartesianCoordinate->setEditable(false);
346 // build buttons
347 std::vector<std::string> help({
348 TL("number of running vehicles"),
349 TL("number of insertion backlogged vehicles"),
350 TL("percentage of teleports per departed vehicles"),
351 TL("number of active persons"),
352 TL("number of active containers")});
353
354 const GUIIcon greenVehIcon = (OptionsCont::getOptions().isSet("mesosim") && OptionsCont::getOptions().getBool("mesosim")) ?
358 myStatButtons.back()->hide();
360 myStatButtons.back()->hide();
361 GUIIcon greenPersonIcon = GUIIcon::GREENPERSON;
362 if (OptionsCont::getOptions().isSet("pedestrian.model")) {
363 const std::string pedModel = OptionsCont::getOptions().getString("pedestrian.model");
364 if (StringUtils::to_lower_case(pedModel) == "noninteracting") {
366 } else if (StringUtils::to_lower_case(pedModel) == "jupedsim") {
367 greenPersonIcon = GUIIcon::GREEN_PERSON_JUPEDSIM;
368 }
369 }
371 myStatButtons.back()->hide();
373 myStatButtons.back()->hide();
374 }
375 // make the window a mdi-window
376 myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
378 myMDIMenu = new FXMDIMenu(this, myMDIClient);
379 new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
380 new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
381 new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
382 new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
383 // build the message window
385 // fill menu and tool bar
386 fillMenuBar();
387 myToolBar6->hide();
388 myToolBar7->hide();
389 myToolBar9->hide();
390 myToolBar10->hide();
391 // build additional threads
392 myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent, isLibsumo);
394 // set the status bar
395 setStatusBarText(TL("Ready."));
396 // set the caption
397 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
398 // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
399 myRunThread->start();
402}
403
404
405void
408 gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
409 FXMainWindow::create();
410 myMenuBarDrag->create();
411 myToolBarDrag1->create();
412 myToolBarDrag2->create();
413 myToolBarDrag3->create();
414 myToolBarDrag4->create();
415 myToolBarDrag5->create();
416 myToolBarDrag6->create();
417 myToolBarDrag7->create();
418 myFileMenu->create();
419 mySelectByPermissions->create();
420 myEditMenu->create();
421 mySettingsMenu->create();
422 myLocatorMenu->create();
423 myControlMenu->create();
424 myWindowMenu->create();
425 myLanguageMenu->create();
426 myHelpMenu->create();
427 FXint textWidth = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
428 myCartesianFrame->setWidth(textWidth);
429 myGeoFrame->setWidth(textWidth);
430 if (myTestFrame) {
431 myTestFrame->setWidth(textWidth);
432 }
433
434 show(PLACEMENT_DEFAULT);
435 if (!OptionsCont::getOptions().isSet("window-size")) {
436 if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
437 maximize();
438 }
439 }
440 myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
441 myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
442 const std::string& onlineMaps = getApp()->reg().readStringEntry("gui", "onlineMaps", "");
443 for (const std::string& entry : StringTokenizer(onlineMaps, "\n").getVector()) {
444 const std::vector<std::string> split = StringTokenizer(entry, "\t").getVector();
445 if (split.size() == 2) {
446 myOnlineMaps[split[0]] = split[1];
447 }
448 }
449 if (myOnlineMaps.empty()) {
450 myOnlineMaps["GeoHack"] = "https://geohack.toolforge.org/geohack.php?params=%lat;%lon_scale:1000";
451 myOnlineMaps["Google Maps"] = "https://www.google.com/maps/search/?api=1&query=%lat,%lon&zoom=19";
452 myOnlineMaps["OSM"] = "https://www.openstreetmap.org/?mlat=%lat&mlon=%lon&zoom=18&layers=M";
453 }
455}
456
457
460 myRunThread->join();
462 // close icons
465 // delete visual
466 delete myGLVisual;
467 // delete some non-parented windows
468 delete myToolBarDrag1;
469 delete mySimDelayTarget;
470 // delete rest of elements
473 delete myRunThread;
474 delete myFileMenu;
475 delete myEditMenu;
477 delete mySettingsMenu;
478 delete myLocatorMenu;
479 delete myControlMenu;
480 delete myLanguageMenu;
481 delete myWindowMenu;
482 delete myHelpMenu;
483 delete myLoadThread;
484
485 while (!myEvents.empty()) {
486 // get the next event
487 GUIEvent* e = myEvents.top();
488 myEvents.pop();
489 delete e;
490 }
491 for (auto item : myHotkeyPress) {
492 delete item.second;
493 }
494 for (auto item : myHotkeyRelease) {
495 delete item.second;
496 }
497}
498
499
500void
502 FXMainWindow::detach();
503 myMenuBarDrag->detach();
504 myToolBarDrag1->detach();
505}
506
507
508void
509GUIApplicationWindow::addToWindowsMenu(FXMenuPane* /*menuPane*/) {
510 // unused, implement in children
511}
512
513
514void
516 // build file menu
517 myFileMenu = new FXMenuPane(this);
520 TL("New Window"), "Ctrl+Shift+N", TL("Open a new sumo-gui window."),
521 nullptr, this, MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW);
522 new FXMenuSeparator(myFileMenu);
524 TL("&Open Simulation..."), "Ctrl+O", TL("Open a simulation (Configuration file)."),
527 TL("Open &Network..."), "Ctrl+N", TL("Open a network."),
530 TL("Open Shapes "), "Ctrl+P", TL("Load POIs and Polygons for visualization."),
533 TL("Open EdgeData "), "Ctrl+U", TL("Load edge related data for visualization."),
536 TL("&Reload"), "Ctrl+R", TL("Reloads the simulation / the network."),
539 TL("Quick-Reload"), "Ctrl+0", TL("Reloads the simulation (but not network)."),
541 new FXMenuSeparator(myFileMenu);
543 TL("Save Configuration"), "Ctrl+Shift+S", TL("Save current options as a configuration file."),
546 TL("Close"), "Ctrl+W", TL("Close the simulation."),
548 new FXMenuSeparator(myFileMenu);
549 // build recent files
552 new FXMenuSeparator(myFileMenu);
554 TL("&Quit"), "Ctrl+Q", TL("Quit the Application."),
555 nullptr, this, MID_HOTKEY_CTRL_Q_CLOSE);
556 // build edit menu
557 mySelectByPermissions = new FXMenuPane(this);
558 std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
559 for (const auto& vehicleClass : vehicleClasses) {
561 }
562 myEditMenu = new FXMenuPane(this);
565 TL("Edit Selected..."), "Ctrl+E", TL("Opens a dialog for editing the list of selected items."),
567 mySelectLanesMenuCascade = new FXMenuCascade(myEditMenu, TL("Select lanes which allow..."), GUIIconSubSys::getIcon(GUIIcon::FLAG), mySelectByPermissions);
568 mySelectLanesMenuCascade->setHelpText(TL("Opens a menu for selecting a vehicle class by which to selected lanes."));
569 new FXMenuSeparator(myEditMenu);
571 TL("Set Breakpoint"), "B", TL("Sets a breakpoint at the current simulation step"),
574 TL("Set Breakpoint with offset"), "Alt+B", TL("Sets a breakpoint at the current simulation step + offset configured in application settings"),
577 TL("Edit Breakpoints"), "Ctrl+B", TL("Opens a dialog for editing breakpoints."),
580 TL("Edit Visualization"), "F9", TL("Opens a dialog for editing visualization settings."),
583 TL("Edit Viewport"), "Ctrl+I", TL("Opens a dialog for editing viewing area, zoom and rotation."),
585 new FXMenuSeparator(myEditMenu);
586 // add open in sumo options
587 myLoadAdditionalsInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load additionals in netedit"), TL("Load additionals in netedit."), this, MID_TOOLBAREDIT_LOADADDITIONALS);
588 myLoadAdditionalsInNetedit->setCheck(TRUE);
589 myLoadDemandInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load demand in netedit"), TL("Load demand in netedit."), this, MID_TOOLBAREDIT_LOADDEMAND);
590 myLoadDemandInNetedit->setCheck(FALSE);
592 TL("Open in netedit"), "Ctrl+T", TL("Opens current simulation in NETEDIT."),
595 TL("Open network in netedit"), "Ctrl+Shift+T", TL("Opens current network in NETEDIT."),
597 // build settings menu
598 mySettingsMenu = new FXMenuPane(this);
601 TL("Application Settings"), "Ctrl+H", TL("Open a Dialog for Application Settings editing."),
603 myGamingModeCheckbox = new FXMenuCheck(mySettingsMenu,
604 TL("Gaming Mode\tCtrl+G\tToggle gaming mode on/off."),
607 TL("Full Screen Mode"), "Ctrl+F", TL("Toggle full screen mode on/off."),
609 // build Locate menu
610 myLocatorMenu = new FXMenuPane(this);
613 TL("&Junctions"), "Shift+J", TL("Open a dialog for locating a Junction."),
616 TL("&Edges"), "Shift+E", TL("Open a dialog for locating an Edge."),
619 TL("&Vehicles"), "Shift+V", TL("Open a dialog for locating a Vehicle."),
622 TL("&Persons"), "Shift+P", TL("Open a dialog for locating a Person."),
625 TL("&Container"), "Shift+C", TL("Open a dialog for locating a Container."),
628 TL("&TLS"), "Shift+T", TL("Open a dialog for locating a Traffic Light."),
631 TL("&Additional"), "Shift+A", TL("Open a dialog for locating an Additional Structure."),
634 TL("P&oI"), "Shift+O", TL("Open a dialog for locating a Point of Interest."),
637 TL("Po&lygon"), "Shift+L", TL("Open a dialog for locating a Polygon."),
639 new FXMenuSeparator(myLocatorMenu);
640 GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Internal Structures"), TL("Show internal junctions and streets in locator dialog."), this, MID_LISTINTERNAL);
641 FXMenuCheck* listParking = GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Parking Vehicles"), TL("Show parking vehicles in locator dialog."), this, MID_LISTPARKING);
642 listParking->setCheck(myListParking);
643 GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show vehicles outside the road network"), TL("Show vehicles that are teleporting or driving remote-controlled outside the road network in locator dialog."), this, MID_LISTTELEPORTING);
644 // build control menu
645 // the shortcut designator is not only at text in the submenu but also defines the real shortcut key assigned with it!
646 // secondary shortcuts (ctrl+A, ctrl+S, ctrl+D) are defined in GUIShortcutsSubSys::buildSUMOAccelerators
647 myControlMenu = new FXMenuPane(this);
648 GUIDesigns::buildFXMenuTitle(myMenuBar, TL("Simulation"), nullptr, myControlMenu);
650 TL("Run"), "A,space", TL("Start/ Resume the simulation."),
653 TLC("Simulation", "Stop"), "S,space", TL("Halt the simulation."),
656 TL("Step"), "D", TL("Perform one simulation step."),
659 TL("Delay+"), "PgUp", TL("Increase simulation step delay."), nullptr, this, MID_DELAY_INC);
661 TL("Delay-"), "PgDn", TL("Decrease simulation step delay."), nullptr, this, MID_DELAY_DEC);
663 TL("Save"), "", TL("Save the current simulation state to a file."),
666 TL("Load"), "", TL("Load simulation state for the current network from file."),
668 // build windows menu
669 myWindowMenu = new FXMenuPane(this);
671 GUIDesigns::buildFXMenuCommandShortcut(myWindowMenu, TL("Open new view"), "", TL("Open a new microscopic view."), GUIIconSubSys::getIcon(GUIIcon::MICROVIEW), this, MID_NEW_MICROVIEW);
672#ifdef HAVE_OSG
674#endif
676 TL("Tile &Horizontally"), "", TL("Tile the views horizontally."),
677 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_HORI), myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
679 TL("Tile &Vertically"), "", TL("Tile the views vertically."),
680 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_VERT), myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
682 TL("Cascade"), "", TL("Cascade the views."),
684 myMDIClient, FXMDIClient::ID_MDI_CASCADE);
686 TL("&Close"), "", TL("Close the selected view."),
687 nullptr, myMDIClient, FXMDIClient::ID_MDI_CLOSE);
688 FXMenuSeparator* sep2 = new FXMenuSeparator(myWindowMenu);
689 sep2->setTarget(myMDIClient);
690 sep2->setSelector(FXMDIClient::ID_MDI_ANY);
691 // for whatever reason, sonar complains in the next line that sep2 may leak, but fox does the cleanup
692 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_1); // NOSONAR
693 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_2);
694 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_3);
695 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_4);
696 GUIDesigns::buildFXMenuCommand(myWindowMenu, TL("&Others..."), nullptr, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
697
698 new FXMenuSeparator(myWindowMenu);
699 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Status Line"), TL("Toggle the Status Bar on/off."), myStatusbar, FXWindow::ID_TOGGLESHOWN);
700 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Message Window"), TL("Toggle the Message Window on/off."), myMessageWindow, FXWindow::ID_TOGGLESHOWN);
701 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Time"), TL("Toggle the Simulation Time on/off."), myToolBar3, FXWindow::ID_TOGGLESHOWN);
702 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Delay"), TL("Toggle the Simulation Delay Entry on/off."), myToolBar4, FXWindow::ID_TOGGLESHOWN);
704
705 new FXMenuSeparator(myWindowMenu);
707 TL("Clear Message Window"), "", TL("Clear the message window."),
709 // build windows menu
711 // build help menu
712 myHelpMenu = new FXMenuPane(this);
714 TL("&Help"),
715 nullptr, myHelpMenu);
716 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Online Documentation"), "F1", TL("Open Online documentation."),
717 nullptr, this, MID_HOTKEY_F1_ONLINEDOCUMENTATION);
718 new FXMenuSeparator(myHelpMenu);
719 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Changelog"), "", TL("Open Changelog."),
720 nullptr, this, MID_CHANGELOG);
721 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Hotkeys"), "", TL("Open Hotkeys."),
722 nullptr, this, MID_HOTKEYS);
723 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Tutorial"), "", TL("Open Tutorial."),
724 nullptr, this, MID_TUTORIAL);
725 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Feedback"), "", TL("Open feedback dialog."),
726 nullptr, this, MID_FEEDBACK);
727 new FXMenuSeparator(myHelpMenu);
728 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&About"), "F12", TL("About sumo-gui."),
730 // build SUMO Accelerators (hotkeys)
731 GUIShortcutsSubSys::buildAccelerators(getAccelTable(), this, true);
732}
733
734
735void
737 // file and simulation tool bar
738 {
739 myToolBarDrag1 = new FXToolBarShell(this, GUIDesignToolBar);
741 new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
742 // build file tools
743 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen simulation\tOpen a simulation (Configuration file)."),
745 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen network\tOpen a network."),
747 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tReload\tReloads the simulation / the network."),
749 }
750 // simulation toolbar
751 {
752 myToolBarDrag2 = new FXToolBarShell(this, GUIDesignToolBar);
754 new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
755 // build simulation tools
756 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tRun\tStart/Resume the loaded simulation."),
758 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStop\tHalt the running simulation."),
760 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStep\tPerform a single simulation step."),
762 }
763 // Simulation Step Display
764 {
765 myToolBarDrag3 = new FXToolBarShell(this, GUIDesignToolBar);
767 new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
768 new MFXButtonTooltip(myToolBar3, myStaticTooltipMenu, TL("Time:\tToggle between time formats\tToggle between seconds and hour:minute:seconds display."), nullptr, this, MID_TIME_TOGGLE, GUIDesignButtonToolbarText);
769
770 myLCDLabel = new MFXLCDLabel(myToolBar3, myStaticTooltipMenu, 16, nullptr, 0, JUSTIFY_RIGHT);
775 myLCDLabel->setText("----------------");
776 }
777 // Simulation Delay
778 {
779 myToolBarDrag4 = new FXToolBarShell(this, GUIDesignToolBar);
781 new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
782 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);
783 // create spinner for delay
784 mySimDelay = 0;
785 mySimDelayTarget = new FXDataTarget(mySimDelay);
787 // create slider
788 mySimDelaySlider = new FXSlider(myToolBar4, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSlider);
789 mySimDelaySlider->setRange(0, 1000);
790 mySimDelaySlider->setHeadSize(10);
791 mySimDelaySlider->setIncrement(50);
792 mySimDelaySlider->setTickDelta(100);
793 mySimDelaySlider->setValue((int)mySimDelay);
794 //mySimDelayTarget->setNumberFormat(0);
795 //mySimDelayTarget->setIncrements(1, 10, 10);
796 mySimDelaySpinner->setIncrement(10);
797 mySimDelaySpinner->setRange(0, 10000);
798 mySimDelaySpinner->setValue(mySimDelay);
799 }
800 // Scale traffic (flows and incrementally loaded vehicles)
801 {
802 myToolBarDrag8 = new FXToolBarShell(this, GUIDesignToolBar);
804 new FXToolBarGrip(myToolBar8, myToolBar8, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
805 myScaleTrafficTooltip = new MFXLabelTooltip(myToolBar8, myStaticTooltipMenu, TL("Scale Traffic:"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
806 myScaleTrafficTooltip->setHelpText(TL("Scale traffic volume from running flows and from vehicles that are loaded incrementally from route files."));
808 myDemandScaleSpinner->setIncrement(0.5);
809 myDemandScaleSpinner->setRange(0, 1000);
810 myDemandScaleSpinner->setValue(1);
811 }
812 // Views
813 {
814 myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBar);
816 new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
817 // build view tools
818 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new view") + std::string("\t") + TL("Open a new microscopic view.")).c_str(),
820#ifdef HAVE_OSG
821 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new 3D view") + std::string("\t") + TL("Open a new 3D view.")).c_str(),
823#endif
824 // add toggle button for tooltips in view on/off (by default unchecked)
826 myStaticTooltipMenu, (std::string("\t") + TL("Toggle View Tooltips") + std::string("\t") + TL("Toggles whether tooltips in the view shall be shown.")).c_str(),
828 myShowToolTipsView->setChecked(getApp()->reg().readIntEntry("gui", "viewToolTips", 0) == 1);
830 // add toggle button for tooltips in menu on/off (by default checked)
832 myStaticTooltipMenu, (std::string("\t") + TL("Toggle Menu Tooltips") + std::string("\t") + TL("Toggles whether tooltips in the menu shall be shown.")).c_str(),
834 myShowToolTipsMenu->setChecked(getApp()->reg().readIntEntry("gui", "menuToolTips", 0) != 1);
836 }
838 {
839 // total waitingTime
840 myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBar);
842 new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
843 GUIDesigns::buildFXLabel(myToolBar6, TL("Waiting Time:"), "", TL("Time spent waiting accumulated for all vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
844 myWaitingTimeLabel = new MFXLCDLabel(myToolBar6, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
849 myWaitingTimeLabel->setText("-------------");
850 // idealistic time loss
851 myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBar);
853 new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
854 GUIDesigns::buildFXLabel(myToolBar7, TL("Time Loss:"), "", TL("Time lost due to being unable to drive with maximum speed for all vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
855 myTimeLossLabel = new MFXLCDLabel(myToolBar7, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
860 myTimeLossLabel->setText("-------------");
861 // total driving distance
862 myToolBarDrag9 = new FXToolBarShell(this, GUIDesignToolBar);
864 new FXToolBarGrip(myToolBar9, myToolBar9, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
865 GUIDesigns::buildFXLabel(myToolBar9, TL("Distance (km):"), "", TL("Total distance driven by DRT vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
866 myTotalDistanceLabel = new MFXLCDLabel(myToolBar9, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
871 myTotalDistanceLabel->setText("-------------");
872 // emergency vehicle counts
873 myToolBarDrag10 = new FXToolBarShell(this, GUIDesignToolBar);
875 new FXToolBarGrip(myToolBar10, myToolBar10, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
876 GUIDesigns::buildFXLabel(myToolBar10, TL("Emergency Vehicle waiting time:"), "", TL("Time spent waiting accumulated for emergency vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
877 myEmergencyVehicleLabel = new MFXLCDLabel(myToolBar10, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
882 myEmergencyVehicleLabel->setText("-------------");
883 }
884}
885
886
887void
888GUIApplicationWindow::buildRecentNetworks(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentNetworks) {
889 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
890 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_1);
891 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_2);
892 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_3);
893 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_4);
894 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_5);
895 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_6);
896 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_7);
897 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_8);
898 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_9);
899 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_10);
900 new FXMenuSeparator(fileMenuRecentNetworks); // NOSONAR, Fox does the cleanup
901 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("Cl&ear Recent Networks"), nullptr, &myRecentNetworks, FXRecentFiles::ID_CLEAR);
902 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("No Recent Networks"), nullptr, &myRecentNetworks, MFXRecentNetworks::ID_NOFILES);
903 // set target
904 myRecentNetworks.setTarget(this);
905 myRecentNetworks.setSelector(MID_RECENTFILE);
906 new FXMenuCascade(fileMenu, TL("Recent Networks"), nullptr, fileMenuRecentNetworks);
907}
908
909
910void
911GUIApplicationWindow::buildRecentConfigs(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentConfigs) {
912 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
913 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_1);
914 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_2);
915 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_3);
916 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_4);
917 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_5);
918 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_6);
919 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_7);
920 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_8);
921 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_9);
922 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_10);
923 new FXMenuSeparator(fileMenuRecentConfigs); // NOSONAR, Fox does the cleanup
924 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("Cl&ear Recent Configs"), nullptr, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
925 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("No Recent Configs"), nullptr, &myRecentConfigs, MFXRecentNetworks::ID_NOFILES);
926 // set target
927 myRecentConfigs.setTarget(this);
928 myRecentConfigs.setSelector(MID_RECENTFILE);
929 new FXMenuCascade(fileMenu, TL("Recent Configs"), nullptr, fileMenuRecentConfigs);
930}
931
932
933long
934GUIApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
936 getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
937 getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
938 getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
939 getApp()->reg().writeIntEntry("gui", "alternateSimDelay", (int)myAlternateSimDelay);
941 getApp()->exit(0);
942 return 1;
943}
944
945
946long
947GUIApplicationWindow::onCmdEditChosen(FXObject* menu, FXSelector, void*) {
948 FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
949 if (mc->getText() == StringUtils::replace(TL("Edit Selected..."), "&", "").c_str()) {
951 chooser->create();
952 chooser->show();
953 } else {
955 const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
956 for (MSEdgeVector::const_iterator i = MSEdge::getAllEdges().begin(); i != MSEdge::getAllEdges().end(); ++i) {
957 const std::vector<MSLane*>& lanes = (*i)->getLanes();
958 for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
959 GUILane* lane = dynamic_cast<GUILane*>(*it);
960 assert(lane != 0);
961 if ((lane->getPermissions() & svc) != 0) {
962 gSelected.select(lane->getGlID());
963 }
964 }
965 }
966 if (myMDIClient->numChildren() > 0) {
967 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
968 if (w != nullptr) {
969 // color by selection
971 }
972 }
973 }
975 }
976 return 1;
977}
978
979
980long
981GUIApplicationWindow::onCmdEditBreakpoints(FXObject*, FXSelector, void*) {
982 if (myBreakpointDialog == nullptr) {
984 } else {
985 myBreakpointDialog->restore();
986 myBreakpointDialog->setFocus();
987 myBreakpointDialog->raise();
988 }
989 return 1;
990}
991
992
993long
994GUIApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
995 if (!myGLWindows.empty()) {
996 myGLWindows[0]->getView()->showViewportEditor();
997 }
998 return 1;
999}
1000
1001
1002long
1003GUIApplicationWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
1004 if (!myGLWindows.empty()) {
1005 myGLWindows[0]->getView()->showViewschemeEditor();
1006 }
1007 return 1;
1008}
1009
1010
1011long
1012GUIApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
1013 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html");
1014 return 1;
1015}
1016
1017
1018long
1019GUIApplicationWindow::onCmdChangelog(FXObject*, FXSelector, void*) {
1020 // update in every version
1021 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/ChangeLog.html");
1022 return 1;
1023}
1024
1025
1026long
1027GUIApplicationWindow::onCmdHotkeys(FXObject*, FXSelector, void*) {
1028 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html#keyboard_shortcuts");
1029 return 1;
1030}
1031
1032
1033long
1034GUIApplicationWindow::onCmdTutorial(FXObject*, FXSelector, void*) {
1035 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/Tutorials/index.html");
1036 return 1;
1037}
1038
1039
1040long
1041GUIApplicationWindow::onCmdOpenInNetedit(FXObject* sender, FXSelector, void* ptr) {
1042 if (myGLWindows.empty()) {
1043 return 1;
1044 }
1045 bool onlyNet;
1046 if (sender == myOpenNetInNetedit) {
1047 onlyNet = true;
1048 } else if (sender == myOpenInNetedit) {
1049 onlyNet = false;
1050 } else {
1051 // we have to check (menu-item) sender first because ptr is only valid when
1052 // triggered via hotkey
1053 FXEvent* e = (FXEvent*) ptr;
1054 onlyNet = (e->state & SHIFTMASK) != 0;
1055 }
1056 FXRegistry reg("SUMO netedit", "netedit");
1057 reg.read();
1058 const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
1059 reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
1060 reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
1061 reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
1062 reg.write();
1063 std::string netedit = "netedit";
1064 const char* sumoPath = getenv("SUMO_HOME");
1065 if (sumoPath != nullptr) {
1066 std::string newPath = std::string(sumoPath) + "/bin/netedit";
1067 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1068 netedit = "\"" + newPath + "\"";
1069 }
1070 }
1071 // declare command for calling netedit using the viewport saved in registry
1072 std::string cmd = netedit + " --registry-viewport";
1073 // continue depending if we're loading only a network or the entire sumo config
1074 if (myLoadAdditionalsInNetedit->shown() && !onlyNet) {
1075 cmd += " --sumocfg-file \"" + OptionsCont::getOptions().getString("configuration-file") + "\"";
1076 // check if ignore additional or demand elements
1077 if (myLoadAdditionalsInNetedit->getCheck() == FALSE) {
1078 cmd += " --ignore.additionalelements";
1079 }
1080 if (myLoadDemandInNetedit->getCheck() == FALSE) {
1081 cmd += " --ignore.routeelements";
1082 }
1083 } else {
1084 cmd += " -s \"" + OptionsCont::getOptions().getString("net-file") + "\"";
1085 }
1086 // start in background
1087#ifndef WIN32
1088 cmd = cmd + " &";
1089#else
1090 // see "help start" for the parameters
1091 cmd = "start /B \"\" " + cmd;
1092#endif
1093 WRITE_MESSAGEF(TL("Running %."), cmd);
1094 // yay! fun with dangerous commands... Never use this over the internet
1096 return 1;
1097}
1098
1099
1100long
1101GUIApplicationWindow::onCmdNewWindow(FXObject*, FXSelector, void*) {
1102 FXRegistry reg("SUMO sumo-gui", "sumo-gui");
1103 std::string sumo_gui = "sumo-gui";
1104 const char* sumoPath = getenv("SUMO_HOME");
1105 if (sumoPath != nullptr) {
1106 std::string newPath = std::string(sumoPath) + "/bin/sumo_gui";
1107 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1108 sumo_gui = "\"" + newPath + "\"";
1109 }
1110 }
1111 std::string cmd = sumo_gui;
1112 // start in background
1113#ifndef WIN32
1114 cmd = cmd + " &";
1115#else
1116 // see "help start" for the parameters
1117 cmd = "start /B \"\" " + cmd;
1118#endif
1119 WRITE_MESSAGEF(TL("Running %."), cmd);
1120 // yay! fun with dangerous commands... Never use this over the internet
1122 return 1;
1123}
1124
1125
1126long
1128 // get the new file name
1129 FXFileDialog opendialog(this, TL("Open Simulation Configuration"));
1131 opendialog.setSelectMode(SELECTFILE_EXISTING);
1132 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1133 if (gCurrentFolder.length() != 0) {
1134 opendialog.setDirectory(gCurrentFolder);
1135 }
1136 if (opendialog.execute()) {
1137 gCurrentFolder = opendialog.getDirectory();
1138 std::string file = opendialog.getFilename().text();
1139 loadConfigOrNet(file);
1140 myRecentConfigs.appendFile(file.c_str());
1141 }
1142 return 1;
1143}
1144
1145
1146long
1147GUIApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
1148 // get the new file name
1149 FXFileDialog opendialog(this, TL("Open Network"));
1150 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1151 opendialog.setSelectMode(SELECTFILE_EXISTING);
1152 opendialog.setPatternList(SUMOXMLDefinitions::NetFileExtensions.getMultilineString().c_str());
1153 if (gCurrentFolder.length() != 0) {
1154 opendialog.setDirectory(gCurrentFolder);
1155 }
1156 if (opendialog.execute()) {
1157 gCurrentFolder = opendialog.getDirectory();
1158 std::string file = opendialog.getFilename().text();
1159 loadConfigOrNet(file);
1160 myRecentNetworks.appendFile(file.c_str());
1161 }
1162 return 1;
1163}
1164
1165
1166long
1167GUIApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
1168 // get the shape file name
1169 FXFileDialog opendialog(this, TL("Open Shapes"));
1170 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_SHAPES));
1171 opendialog.setSelectMode(SELECTFILE_EXISTING);
1172 opendialog.setPatternList(SUMOXMLDefinitions::ShapesFileExtensions.getMultilineString().c_str());
1173 if (gCurrentFolder.length() != 0) {
1174 opendialog.setDirectory(gCurrentFolder);
1175 }
1176 if (opendialog.execute()) {
1177 gCurrentFolder = opendialog.getDirectory();
1178 std::string file = opendialog.getFilename().text();
1179
1180 dynamic_cast<GUIShapeContainer&>(myRunThread->getNet().getShapeContainer()).allowReplacement();
1182 if (!XMLSubSys::runParser(handler, file, false)) {
1183 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1184 }
1185 update();
1186 if (myMDIClient->numChildren() > 0) {
1187 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1188 if (w != nullptr) {
1189 w->getView()->update();
1190 }
1191 }
1192 }
1193 return 1;
1194}
1195
1196
1197long
1198GUIApplicationWindow::onCmdOpenEdgeData(FXObject*, FXSelector, void*) {
1199 // get the shape file name
1200 FXFileDialog opendialog(this, TL("Open EdgeData"));
1201 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1202 opendialog.setSelectMode(SELECTFILE_EXISTING);
1203 opendialog.setPatternList(SUMOXMLDefinitions::EdgeDataFileExtensions.getMultilineString().c_str());
1204 if (gCurrentFolder.length() != 0) {
1205 opendialog.setDirectory(gCurrentFolder);
1206 }
1207 if (opendialog.execute()) {
1208 gCurrentFolder = opendialog.getDirectory();
1209 std::string file = opendialog.getFilename().text();
1210 if (!GUINet::getGUIInstance()->loadEdgeData(file)) {
1211 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1212 }
1213 update();
1214 if (myMDIClient->numChildren() > 0) {
1215 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1216 if (w != nullptr) {
1217 w->getView()->update();
1218 }
1219 }
1220 }
1221 return 1;
1222}
1223
1224
1225long
1226GUIApplicationWindow::onCmdReload(FXObject* sender, FXSelector sel, void*) {
1227 if (!myAmLoading && (sender == nullptr || (myRunThread->networkAvailable() && myLoadThread->getFileName() != "" && TraCIServer::getInstance() == nullptr))) {
1229 getApp()->beginWaitCursor();
1230 myAmLoading = true;
1231 myIsReload = sender != nullptr || sel == 1;
1233 myLoadThread->start();
1234 if (sender == nullptr) {
1235 setStatusBarText(sel == 1 ? TL("Auto-Reloading.") : TL("TraCI-Loading."));
1236 } else {
1237 setStatusBarText(TL("Reloading."));
1238 }
1239 update();
1240 }
1241 return 1;
1242}
1243
1244
1245long
1246GUIApplicationWindow::onCmdQuickReload(FXObject*, FXSelector, void*) {
1247 if (!myAmLoading) {
1248 setStatusBarText(TL("Quick-Reloading."));
1250 }
1251 return 1;
1252}
1253
1254
1255long
1256GUIApplicationWindow::onCmdOpenRecent(FXObject* /* sender */, FXSelector, void* ptr) {
1257 if (myAmLoading) {
1258 myStatusbar->getStatusLine()->setText(TL("Already loading!"));
1259 return 1;
1260 }
1261 std::string file((const char*)ptr);
1262 loadConfigOrNet(file);
1263 return 1;
1264}
1265
1266
1267long
1268GUIApplicationWindow::onCmdSaveConfig(FXObject*, FXSelector, void*) {
1269 // get the new file name
1270 FXFileDialog opendialog(this, TL("Save SUMO Configuration"));
1271 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1272 opendialog.setSelectMode(SELECTFILE_ANY);
1273 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1274 if (gCurrentFolder.length() != 0) {
1275 opendialog.setDirectory(gCurrentFolder);
1276 }
1277 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1278 return 1;
1279 }
1280 const std::string file = MFXUtils::assureExtension(opendialog).text();
1281 std::ofstream out(XMLSubSys::transcodeToLocal(file));
1282 if (out.good()) {
1283 OptionsCont::getOptions().writeConfiguration(out, true, false, false, file, true);
1284 setStatusBarText(TLF("Configuration saved to %.", file));
1285 } else {
1286 setStatusBarText(TLF("Could not save configuration to %.", file));
1287 }
1288 out.close();
1289 return 1;
1290}
1291
1292
1293long
1294GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
1296 return 1;
1297}
1298
1299
1300long
1301GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
1302 sender->handle(this,
1303 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1304 ptr);
1305 return 1;
1306}
1307
1308
1309long
1310GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
1311 sender->handle(this,
1313 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1314 ptr);
1315 return 1;
1316}
1317
1318
1319long
1320GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
1321 sender->handle(this,
1322 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1323 ptr);
1324 return 1;
1325}
1326
1327
1328long
1329GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
1330 sender->handle(this,
1332 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1333 ptr);
1334 return 1;
1335}
1336
1337
1338long
1339GUIApplicationWindow::onCmdStart(FXObject*, FXSelector, void*) {
1340 // check whether a net was loaded successfully
1341 if (!myRunThread->networkAvailable()) {
1342 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1343 return 1;
1344 }
1345 // check whether it was started before and paused;
1346 if (!myWasStarted) {
1347 myRunThread->begin();
1348 myWasStarted = true;
1349 }
1351 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1352 return 1;
1353}
1354
1355
1356long
1357GUIApplicationWindow::onCmdStop(FXObject*, FXSelector, void*) {
1358 myRunThread->stop();
1359 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1360 return 1;
1361}
1362
1363
1364long
1365GUIApplicationWindow::onCmdStep(FXObject*, FXSelector, void*) {
1366 // check whether a net was loaded successfully
1367 if (!myRunThread->networkAvailable()) {
1368 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1369 return 1;
1370 }
1371 // check whether it was started before and paused;
1372 if (!myWasStarted) {
1373 myRunThread->begin();
1374 myWasStarted = true;
1375 }
1377 return 1;
1378}
1379
1380
1381long
1382GUIApplicationWindow::onCmdSaveState(FXObject*, FXSelector, void*) {
1383 // get the new file name
1384 FXFileDialog opendialog(this, TL("Save Simulation State"));
1385 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1386 opendialog.setSelectMode(SELECTFILE_ANY);
1387 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1388 if (gCurrentFolder.length() != 0) {
1389 opendialog.setDirectory(gCurrentFolder);
1390 }
1391 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1392 return 1;
1393 }
1394 const std::string file = MFXUtils::assureExtension(opendialog).text();
1395 MSStateHandler::saveState(file, MSNet::getInstance()->getCurrentTimeStep(), false);
1396 setStatusBarText(TLF("Simulation state saved to '%'.", file));
1397 return 1;
1398}
1399
1400
1401long
1402GUIApplicationWindow::onCmdLoadState(FXObject*, FXSelector, void*) {
1403 // get the new file name
1404 FXFileDialog opendialog(this, TL("Load Simulation State"));
1405 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN));
1406 opendialog.setSelectMode(SELECTFILE_ANY);
1407 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1408 if (gCurrentFolder.length() != 0) {
1409 opendialog.setDirectory(gCurrentFolder);
1410 }
1411 if (opendialog.execute() && FXStat::exists(opendialog.getFilename())) {
1412 gCurrentFolder = opendialog.getDirectory();
1413 const std::string file = opendialog.getFilename().text();
1414 try {
1415 MSNet::getInstance()->loadState(file, true);
1416 setStatusBarText(TLF("State loaded from '%'.", file));
1417 } catch (ProcessError& e) {
1418 setStatusBarText(TLF("Failed to load state from '%' (%).", file, e.what()));
1419 }
1420 }
1421 return 1;
1422}
1423
1424
1425long
1426GUIApplicationWindow::onCmdTimeToggle(FXObject*, FXSelector, void*) {
1427 // toggle show time as HMS
1432 }
1433 return 1;
1434}
1435
1436
1437long
1438GUIApplicationWindow::onCmdDelayInc(FXObject*, FXSelector, void*) {
1439 if (mySimDelay < 10) {
1440 mySimDelay = 10;
1441 } else if (mySimDelay >= 20 && mySimDelay < 50) {
1442 mySimDelay = 50;
1443 } else if (mySimDelay >= 200 && mySimDelay < 500) {
1444 mySimDelay = 500;
1445 } else {
1446 mySimDelay *= 2;
1447 }
1448 if (mySimDelay > 1000) {
1449 // setting high delay by pressing the key too often is hard to recover from
1450 mySimDelay = 1000;
1451 }
1452 mySimDelaySlider->setValue((int)mySimDelay);
1453 mySimDelaySpinner->setValue(mySimDelay);
1454 return 1;
1455}
1456
1457
1458long
1459GUIApplicationWindow::onCmdDelayDec(FXObject*, FXSelector, void*) {
1460 if (mySimDelay <= 10) {
1461 mySimDelay = 0;
1462 } else if (mySimDelay > 20 && mySimDelay <= 50) {
1463 mySimDelay = 20;
1464 } else if (mySimDelay > 200 && mySimDelay <= 500) {
1465 mySimDelay = 200;
1466 } else {
1467 mySimDelay /= 2;
1468 }
1469 mySimDelaySlider->setValue((int)mySimDelay);
1470 mySimDelaySpinner->setValue(mySimDelay);
1471 return 1;
1472}
1473
1474
1475long
1476GUIApplicationWindow::onCmdDelayToggle(FXObject*, FXSelector, void*) {
1477 const double tmp = myAlternateSimDelay;
1479 mySimDelay = tmp;
1480 return 1;
1481}
1482
1483
1484long
1485GUIApplicationWindow::onCmdDemandScale(FXObject*, FXSelector, void*) {
1488 }
1489 return 1;
1490}
1491
1492
1493long
1494GUIApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
1496 return 1;
1497}
1498
1499
1500long
1501GUIApplicationWindow::onCmdBreakpoint(FXObject*, FXSelector, void*) {
1502 // see updateTimeLCD for the DELTA_T
1505 }
1506 return 1;
1507}
1508
1509
1510long
1511GUIApplicationWindow::onCmdBreakpointEarly(FXObject*, FXSelector, void*) {
1512 // see updateTimeLCD for the DELTA_T
1515 }
1516 return 1;
1517}
1518
1519
1520long
1521GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
1522 sender->handle(this,
1524 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1525 ptr);
1527 // bind start simulation with space key
1529 }
1530 return 1;
1531}
1532
1533
1534long
1535GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
1536 sender->handle(this,
1538 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1539 ptr);
1541 // bind stop simulation with space key
1543 }
1544 return 1;
1545}
1546
1547
1548long
1549GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
1550 sender->handle(this,
1552 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1553 ptr);
1554 return 1;
1555}
1556
1557
1558long
1559GUIApplicationWindow::onUpdNeedsNetwork(FXObject* sender, FXSelector, void* ptr) {
1560 // check if there is a loaded network and gui isn't loading
1562 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1563 // enable certain elements manually
1564 mySelectLanesMenuCascade->enable();
1565 myScaleTrafficTooltip->setTipText(TL("Scale number of vehicles in simulation"));
1566 } else {
1567 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1568 // disable certain elements manually
1569 mySelectLanesMenuCascade->disable();
1570 myScaleTrafficTooltip->setTipText("");
1571 }
1572 return 1;
1573}
1574
1575
1576long
1577GUIApplicationWindow::onUpdNeedsSumoConfig(FXObject* sender, FXSelector, void* ptr) {
1578 // check if there is a loaded network and gui isn't loading
1579 if (myRunThread->networkAvailable() && !myAmLoading && OptionsCont::getOptions().isSet("configuration-file")) {
1580 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1581 sender->handle(this, FXSEL(SEL_COMMAND, ID_SHOW), ptr);
1582 myOpenInNetedit->setText(TL("Open sumo config in netedit"));
1583 } else {
1584 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1585 sender->handle(this, FXSEL(SEL_COMMAND, ID_HIDE), ptr);
1586 myOpenInNetedit->setText(TL("Open network in netedit"));
1587 }
1588 return 1;
1589}
1590
1591
1592long
1593GUIApplicationWindow::onUpdTraCIStatus(FXObject* /*sender*/, FXSelector, void* /*ptr*/) {
1595 myTraCiFrame->show();
1596 } else {
1597 myTraCiFrame->hide();
1598 }
1599 return 1;
1600}
1601
1602
1603long
1604GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
1605 if (myMDIClient->numChildren() > 0) {
1606 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1607 if (w != nullptr) {
1608 w->onCmdLocate(nullptr, sel, nullptr);
1609 }
1610 }
1611 return 1;
1612}
1613
1614
1615long
1616GUIApplicationWindow::onCmdShowStats(FXObject*, FXSelector, void*) {
1617 if (myMDIClient->numChildren() > 0) {
1618 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1620 }
1621 return 1;
1622}
1623
1624
1625long
1626GUIApplicationWindow::onCmdAppSettings(FXObject*, FXSelector, void*) {
1628 d->create();
1629 d->show(PLACEMENT_OWNER);
1630 return 1;
1631}
1632
1633
1634long
1635GUIApplicationWindow::onCmdGaming(FXObject*, FXSelector, void*) {
1636 if (myGLWindows.empty()) {
1637 return 1;
1638 }
1640 myGLWindows[0]->getView()->editVisualisationSettings()->gaming = myAmGaming;
1641 if (myAmGaming) {
1642 myGamingModeCheckbox->setCheck(TRUE);
1643 myMenuBar->hide();
1644 myStatusbar->hide();
1645 myToolBar1->hide();
1646 myToolBar2->hide();
1647 myToolBar4->hide();
1648 myToolBar5->hide();
1649 myToolBar6->show();
1650 myToolBar8->hide();
1651 myToolBar10->show();
1652 if (myTLSGame) {
1653 myToolBar7->show();
1654 } else {
1655 myToolBar9->show();
1656 }
1657 myMessageWindow->hide();
1663 } else {
1664 myGamingModeCheckbox->setCheck(FALSE);
1665 myMenuBar->show();
1666 myStatusbar->show();
1667 myToolBar1->show();
1668 myToolBar2->show();
1669 myToolBar4->show();
1670 myToolBar5->show();
1671 myToolBar6->hide();
1672 myToolBar7->hide();
1673 myToolBar8->show();
1674 myToolBar9->hide();
1675 myToolBar10->hide();
1676 myMessageWindow->show();
1678 }
1679 if (myMDIClient->numChildren() > 0) {
1680 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1681 if (w != nullptr) {
1683 }
1684 }
1685 update();
1686 return 1;
1687}
1688
1689
1690long
1692 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1693 if (w != nullptr) {
1694 // show or hide grid depending of myNetworkViewOptions.menuCheckToggleGrid
1697 } else {
1699 }
1700 w->getView()->update();
1701 }
1702 return 1;
1703}
1704
1705
1706long
1708 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1709 if (w != nullptr) {
1710 // toggle secondary shape visualization
1712 w->getView()->update();
1713 }
1714 return 1;
1715}
1716
1717
1718long
1719GUIApplicationWindow::onCmdFullScreen(FXObject*, FXSelector, void*) {
1720 if (myGLWindows.empty()) {
1721 return 1;
1722 }
1724 if (myAmFullScreen) {
1725 getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1726 getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1727 getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1728 getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1729 maximize();
1730 setDecorations(DECOR_NONE);
1731 place(PLACEMENT_MAXIMIZED);
1732 myMenuBar->hide();
1733 myStatusbar->hide();
1734 myToolBar1->hide();
1735 myToolBar2->hide();
1736 myToolBar3->hide();
1737 myToolBar4->hide();
1738 myToolBar5->hide();
1739 myToolBar6->hide();
1740 myToolBar7->hide();
1741 myToolBar8->hide();
1742 myMessageWindow->hide();
1743 if (myMDIClient->numChildren() > 0) {
1744 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1745 if (w != nullptr) {
1746 w->setToolBarVisibility(false);
1747 }
1748 }
1749 update();
1750 } else {
1751 place(PLACEMENT_VISIBLE);
1752 setDecorations(DECOR_ALL);
1753 restore();
1754 myToolBar3->show();
1756 onCmdGaming(nullptr, 0, nullptr);
1757 setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
1758 setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1759 setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
1760 setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
1761 }
1762 // show or hide the full screen hint
1763 for (GUIGlChildWindow* const window : myGLWindows) {
1764 window->getView()->update();
1765 }
1766 return 1;
1767}
1768
1769
1770long
1771GUIApplicationWindow::onCmdListInternal(FXObject*, FXSelector, void*) {
1773 return 1;
1774}
1775
1776
1777long
1778GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) {
1780 return 1;
1781}
1782
1783long
1784GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) {
1786 return 1;
1787}
1788
1789
1790long
1791GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) {
1793 return 1;
1794}
1795
1796
1797#ifdef HAVE_OSG
1798long
1799GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1801 return 1;
1802}
1803#endif
1804
1805
1806long
1807GUIApplicationWindow::onCmdShowToolTipsView(FXObject*, FXSelector, void*) {
1808 // invert check
1810 // update parent
1812 // save in registry
1813 getApp()->reg().writeIntEntry("gui", "viewToolTips", myShowToolTipsView->amChecked() ? 1 : 0);
1814 return 1;
1815}
1816
1817
1818long
1819GUIApplicationWindow::onCmdShowToolTipsMenu(FXObject*, FXSelector, void*) {
1820 // invert check
1822 // update parent
1824 // save in registry
1825 getApp()->reg().writeIntEntry("gui", "menuToolTips", myShowToolTipsMenu->amChecked() ? 0 : 1);
1826 return 1;
1827}
1828
1829
1830long
1831GUIApplicationWindow::onCmdFeedback(FXObject*, FXSelector, void*) {
1832 // create and open feedback dialog
1833 GUIDialog_Feedback* feedback = new GUIDialog_Feedback(this);
1834 feedback->create();
1835 feedback->show(PLACEMENT_OWNER);
1836 return 1;
1837}
1838
1839
1840long
1841GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
1842 GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this);
1843 about->create();
1844 about->show(PLACEMENT_OWNER);
1845 return 1;
1846}
1847
1848
1849long
1850GUIApplicationWindow::onCmdHallOfFame(FXObject*, FXSelector, void*) {
1852 hall->create();
1853 hall->show(PLACEMENT_OWNER);
1854 return 1;
1855}
1856
1857
1858long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1859 FXEvent* event = (FXEvent*)ptr;
1860 FXString string = GUIUserIO::clipped.c_str();
1861 setDNDData(FROM_CLIPBOARD, event->target, string);
1862 return 1;
1863}
1864
1865
1866long
1867GUIApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
1868 eventOccurred();
1869 return 1;
1870}
1871
1872
1873long
1874GUIApplicationWindow::onRunThreadEvent(FXObject*, FXSelector, void*) {
1875 eventOccurred();
1876 return 1;
1877}
1878
1879
1880void
1882 while (!myEvents.empty()) {
1883 // get the next event
1884 GUIEvent* e = myEvents.top();
1885 myEvents.pop();
1886 // process
1887 switch (e->getOwnType()) {
1890 setFocus();
1891 break;
1893 if (myRunThread->networkAvailable()) { // avoid race-condition related crash if reload was pressed
1895 }
1896 break;
1904 break;
1906 GUIEvent_AddView* ave = dynamic_cast<GUIEvent_AddView*>(e);
1908 if (ave->getSchemeName() != "") {
1909 MFXComboBoxIcon* sCombo = v->getColoringSchemesCombo();
1910 int index = sCombo->findItem(ave->getSchemeName().c_str());
1911 if (index >= 0) {
1912 sCombo->setCurrentItem(index);
1913 }
1914 v->setColorScheme(ave->getSchemeName());
1915 }
1916 break;
1917 }
1919 GUIEvent_CloseView* ave = dynamic_cast<GUIEvent_CloseView*>(e);
1920 removeViewByID(ave->getCaption());
1921 break;
1922 }
1925 break;
1926 default:
1927 break;
1928 }
1929 delete e;
1930 }
1931 myToolBar2->forceRefresh();
1932 myToolBar3->forceRefresh();
1933}
1934
1935
1936void
1938 myAmLoading = false;
1940 // check whether the loading was successful
1941 if (ec->myNet == nullptr) {
1942 // report failure
1943 setStatusBarText(TLF("Loading of '%' failed!", ec->myFile));
1946 getApp()->exit(1);
1947 }
1948 } else {
1949 // initialise simulation thread
1950 if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1953 getApp()->exit(1);
1954 }
1955 } else {
1956 // report success
1957 setStatusBarText(TLF("'%' loaded.", ec->myFile));
1959 myWasStarted = false;
1961 // initialise views
1962 myViewNumber = 0;
1964 // check/record settings file modification time
1965 long long mTime = myGuiSettingsFileMTime;
1966 if (ec->mySettingsFiles.size() > 0) {
1967 for (std::string fname : ec->mySettingsFiles) {
1968 mTime = MAX2(mTime, SysUtils::getModifiedTime(fname));
1969 }
1970 }
1971 // always reload if settings were modified or to restore multiple views
1972 if (!myIsReload) {
1974 }
1975 if (ec->mySettingsFiles.size() > 0 && (!myIsReload || myGuiSettingsFileMTime < mTime || ec->mySettingsFiles.size() > 1)) {
1976 // open a view for each file and apply settings
1977 for (std::string fname : ec->mySettingsFiles) {
1978 GUISettingsHandler settings(getApp(), fname);
1979 GUISUMOViewParent::ViewType vt = defaultType;
1980 if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
1982 }
1983 if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
1985 }
1986 GUISUMOAbstractView* view = openNewView(vt);
1987 if (view == nullptr) {
1988 break;
1989 }
1990 if (settings.getSettingName() != "") {
1991 view->setColorScheme(settings.getSettingName());
1992 MFXComboBoxIcon* sCombo = view->getColoringSchemesCombo();
1993 int index = sCombo->findItem(settings.getSettingName().c_str());
1994 if (index >= 0) {
1995 sCombo->setCurrentItem(index);
1996 }
1997 }
1998 view->addDecals(settings.getDecals());
1999 settings.applyViewport(view);
2000 settings.setSnapshots(view);
2001 if (settings.getDelay() > 0.) {
2002 mySimDelay = settings.getDelay();
2003 }
2004 if (settings.getBreakpoints().size() > 0) {
2006 myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
2007 myRunThread->getBreakpointLock().unlock();
2008 }
2009 myJamSounds = settings.getEventDistribution("jam");
2010 myCollisionSounds = settings.getEventDistribution("collision");
2011 if (settings.getJamSoundTime() > 0) {
2012 myJamSoundTime = settings.getJamSoundTime();
2013 }
2014 for (const std::string& tlsID : settings.getTrackers()) {
2015 if (MSNet::getInstance()->getTLSControl().knows(tlsID)) {
2018 if (tllW) {
2019 tllW->begin2TrackPhases(this);
2020 }
2021 } else {
2022 WRITE_WARNINGF("Tracker for unknown tlLogic '%' in settings file '%'", tlsID, fname);
2023 }
2024 }
2025 }
2026 } else {
2027 openNewView(defaultType);
2028 }
2029 myGuiSettingsFileMTime = mTime;
2030 if (!OptionsCont::getOptions().isDefault("delay")) {
2031 setDelay(OptionsCont::getOptions().getFloat("delay"));
2032 mySimDelaySlider->setValue((int)mySimDelay);
2033 mySimDelaySpinner->setValue(mySimDelay);
2034 }
2035 if (!OptionsCont::getOptions().isDefault("breakpoints") && !myIsReload) {
2036 std::vector<SUMOTime> breakpoints;
2037 for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
2038 SUMOTime t = string2time(val);
2039 // round down to nearest reachable time step
2040 t -= t % DELTA_T;
2041 breakpoints.push_back(t);
2042 }
2043 std::sort(breakpoints.begin(), breakpoints.end());
2045 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
2046 myRunThread->getBreakpointLock().unlock();
2047 }
2048 if (!OptionsCont::getOptions().isDefault("selection-file")) {
2049 delete myDynamicSelection;
2050 myDynamicSelection = new std::stringstream();
2051 std::string msg = gSelected.load(OptionsCont::getOptions().getString("selection-file"), GLO_MAX, myDynamicSelection);
2052 if (msg != "") {
2053 WRITE_ERRORF("Errors while loading selection: %", msg.c_str());
2054 }
2055 if (!myDynamicSelection->str().empty()) {
2056 std::string dummy;
2057 int numNotFound = 0;
2058 while (myDynamicSelection->good()) {
2059 (*myDynamicSelection) >> dummy;
2060 numNotFound++;
2061 }
2062 myDynamicSelection->clear(); // first clear error state before seek works
2063 myDynamicSelection->seekg(0);
2064 // @note for some reason the last line is read twice
2065 WRITE_MESSAGEF("% dynamic objects not present while loading selection", numNotFound - 1);
2066 }
2067 }
2068 myTLSGame = OptionsCont::getOptions().getString("game.mode") == "tls";
2069 if (OptionsCont::getOptions().getBool("game")) {
2070 if (myTLSGame) {
2071 setTitle(TL("SUMO Interactive Traffic Light"));
2072 } else {
2073 setTitle(TL("SUMO Interactive Demand-Responsive-Transport"));
2074 }
2075 onCmdGaming(nullptr, 0, nullptr);
2076 } else {
2077 // set simulation name on the caption
2078 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str()));
2079 }
2080 if (ec->myViewportFromRegistry) {
2081 Position off;
2082 off.set(getApp()->reg().readRealEntry("viewport", "x"),
2083 getApp()->reg().readRealEntry("viewport", "y"),
2084 getApp()->reg().readRealEntry("viewport", "z"));
2085 Position p(off.x(), off.y(), 0);
2086 GUISUMOAbstractView* view = myGLWindows[0]->getView();
2087 view->setViewportFromToRot(off, p, 0);
2088 }
2089 // set simulation step begin information
2090 myLCDLabel->setText("----------------");
2092 myStatButtons[STAT_VEHS]->setIcon(GUIIconSubSys::getIcon(greenVehIcon));
2093
2094 const std::string pedModel = OptionsCont::getOptions().getString("pedestrian.model");
2095 if (StringUtils::to_lower_case(pedModel) == "noninteracting") {
2097 } else if (StringUtils::to_lower_case(pedModel) == "jupedsim") {
2099 } else {
2101 }
2102
2103 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2104 (*it)->setText("-");
2105 }
2106 // initialize scale from options unless already set in the UI
2107 if (myDemandScaleSpinner->getValue() == 1 || !OptionsCont::getOptions().isDefault("scale")) {
2109 }
2111 }
2112 }
2113 getApp()->endWaitCursor();
2114 // start if wished
2116 onCmdStart(nullptr, 0, nullptr);
2117 }
2118 update();
2119}
2120
2121
2122void
2124#ifdef WIN32
2125 long t = SysUtils::getCurrentMillis();
2126 // only skip if the simulation is running
2127 if (t - myLastStepEventMillis < MIN_DRAW_DELAY && myRunThread->simulationIsStopable()) {
2128 // do not try to redraw with more than 50FPS (#6371)
2129 return;
2130 }
2132#endif
2134 FXButton* vehStats = myStatButtons[STAT_VEHS];
2135 FXButton* delayStats = myStatButtons[STAT_DELAYED];
2136 FXButton* teleStats = myStatButtons[STAT_TELEPORTS];
2137 FXButton* personStats = myStatButtons[STAT_PERSONS];
2138 FXButton* containerStats = myStatButtons[STAT_CONTAINERS];
2139
2140 const int running = myRunThread->getNet().getVehicleControl().getRunningVehicleNo();
2141 const int backlog = myRunThread->getNet().getInsertionControl().getWaitingVehicleNo();
2142 const int teleports = myRunThread->getNet().getVehicleControl().getTeleportCount();
2143 const int departed = myRunThread->getNet().getVehicleControl().getDepartedVehicleNo();
2145 if (backlog > running) {
2146 if (vehStats->getIcon() == GUIIconSubSys::getIcon(greenVehIcon)) {
2148 }
2149 } else {
2150 if (vehStats->getIcon() == GUIIconSubSys::getIcon(GUIIcon::YELLOWVEHICLE)) {
2151 vehStats->setIcon(GUIIconSubSys::getIcon(greenVehIcon));
2152 }
2153 }
2154 vehStats->setText(toString(running).c_str());
2155 if (backlog > 0) {
2156 if (!delayStats->shown()) {
2157 delayStats->show();
2158 }
2159 delayStats->setText(toString(backlog).c_str());
2160 } else {
2161 if (delayStats->shown()) {
2162 delayStats->hide();
2163 }
2164 }
2165 if (teleports > 0) {
2166 if (!teleStats->shown()) {
2167 teleStats->show();
2168 }
2169 teleStats->setText((toString(100.00 * teleports / departed) + "%").c_str());
2170 }
2171 if (myRunThread->getNet().hasPersons()) {
2172 if (!personStats->shown()) {
2173 personStats->show();
2174 }
2175 personStats->setText(toString(myRunThread->getNet().getPersonControl().getRunningNumber()).c_str());
2176 }
2177 if (myRunThread->getNet().hasContainers()) {
2178 if (!containerStats->shown()) {
2179 containerStats->show();
2180 }
2181 containerStats->setText(toString(myRunThread->getNet().getContainerControl().getRunningNumber()).c_str());
2182 }
2183 if (myAmGaming) {
2184 if (myTLSGame) {
2186 } else {
2188 }
2189 }
2191 getApp()->forceRefresh(); // restores keyboard focus
2192 }
2193 // try to load dynamic selection
2194 if (myDynamicSelection != nullptr) {
2195 std::stringstream tmp;
2197 if (tmp.str().empty()) {
2198 delete myDynamicSelection;
2199 myDynamicSelection = nullptr;
2200 } else {
2201 myDynamicSelection->str(tmp.str());
2202 myDynamicSelection->clear(); // first clear error state before seek works
2203 myDynamicSelection->seekg(0);
2204 }
2205 }
2207 update();
2208}
2209
2210
2211void
2213 GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
2215 setStatusBarText(ec->getMsg());
2216 } else {
2218 }
2219}
2220
2221
2222void
2225 onCmdStop(nullptr, 0, nullptr);
2226 if (ec->getReason() == MSNet::SIMSTATE_LOADING) {
2227 onCmdReload(nullptr, 0, nullptr);
2228 } else if (GUIGlobals::gQuitOnEnd) {
2230 getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
2231 } else if (GUIGlobals::gDemoAutoReload) {
2232 onCmdReload(nullptr, 1, nullptr);
2233 } else if (!myHaveNotifiedAboutSimEnd) {
2234 // GUIRunThread::deleteSim() triggers the final message to the log file
2235 // (this will never reach the GUI but we cannot use WRITE_MESSAGE here
2236 // to avoid a duplicate log entry)
2238 TLF("Simulation ended at time: %. (%)",
2240 // build the text
2241 const std::string text = TLF("Simulation ended at time: %.", time2string(ec->getTimeStep())) + "\n" +
2242 TL("Reason:") + MSNet::getStateMessage(ec->getReason()) + "\n" +
2243 TL("Do you want to close all open files and views?");
2244 FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, TL("Simulation ended"), "%s", text.c_str());
2245 if (answer == 1) { //1:yes, 2:no, 4:esc
2247 } else {
2250 update();
2251 }
2253 }
2254}
2255
2256
2257void
2262#ifdef HAVE_DANGEROUS_SOUNDS // disable user-configurable command execution for public build
2263 if (myJamSounds.getOverallProb() > 0) {
2264 // play honking sound if some vehicle is waiting too long
2265 for (; it != end; ++it) {
2266 // XXX use impatience instead of waiting time ?
2267 if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
2268 const std::string cmd = myJamSounds.get(&myGamingRNG);
2269 if (cmd != "") {
2270 // yay! fun with dangerous commands... Never use this over the internet
2272 // one sound per simulation step is enough
2273 break;
2274 }
2275 }
2276 }
2277 }
2280 if (myPreviousCollisionNumber != collisions) {
2281 const std::string cmd = myCollisionSounds.get(&myGamingRNG);
2282 if (cmd != "") {
2283 // yay! fun with dangerous commands... Never use this over the internet
2285 }
2286 myPreviousCollisionNumber = collisions;
2287 }
2288 }
2289#endif
2290 // update performance indicators
2291 for (it = vc.loadedVehBegin(); it != end; ++it) {
2292 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2293 assert(veh != 0);
2294 if (veh->isOnRoad() && !veh->isStopped()) {
2295 const double vmax = veh->getLane()->getVehicleMaxSpeed(veh);
2296 if (veh->getSpeed() < SUMO_const_haltingSpeed) {
2298 if (veh->getVClass() == SVC_EMERGENCY) {
2300 }
2301 }
2302 myTimeLoss += TIME2STEPS(TS * (vmax - veh->getSpeed()) / vmax); // may be negative with speedFactor > 1
2303 }
2304
2305 }
2309}
2310
2311
2312void
2314 // update performance indicators
2318
2321 for (auto it = vc.loadedVehBegin(); it != end; ++it) {
2322 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2323 assert(veh != 0);
2324 if (veh->isOnRoad() && !veh->isStopped()) {
2326 }
2327 }
2329}
2330
2331
2332void
2334 if (!myAmLoading) {
2336 getApp()->beginWaitCursor();
2337 myAmLoading = true;
2338 myIsReload = false;
2340 gSchemeStorage.saveViewport(0, 0, -1, 0); // recenter view
2342 setStatusBarText(TLF("Loading '%'.", file));
2343 update();
2344 }
2345}
2346
2347
2350 if (!myRunThread->networkAvailable()) {
2351 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
2352 return nullptr;
2353 }
2354 GUISUMOAbstractView* oldView = nullptr;
2355 if (myMDIClient->numChildren() > 0) {
2356 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2357 if (w != nullptr) {
2358 oldView = w->getView();
2359 }
2360 }
2361 if (caption == "") {
2362 caption = "View #" + toString(myViewNumber++);
2363 }
2364 FXuint opts = MDI_TRACKING;
2365 GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
2366 this, GUIIconSubSys::getIcon(GUIIcon::SUMO_MINI), opts, 10, 10, 200, 100);
2368 if (oldView != nullptr) {
2369 // copy viewport
2370 oldView->copyViewportTo(v);
2371 }
2372 w->create();
2373 if (myMDIClient->numChildren() == 1) {
2374 w->maximize();
2375 } else {
2376 myMDIClient->vertical(true);
2377 }
2378 myMDIClient->setActiveChild(w);
2379
2380 return v;
2381}
2382
2383
2384FXGLCanvas*
2386 if (myMDIClient->numChildren() == 0) {
2387 return nullptr;
2388 }
2389 GUISUMOViewParent* share_tmp1 =
2390 static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
2391 return share_tmp1->getBuildGLCanvas();
2392}
2393
2394
2395void
2397 myTrackerLock.lock();
2398 myLCDLabel->setText("----------------");
2401 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2402 (*it)->setText("-");
2403 if (it != myStatButtons.begin()) {
2404 (*it)->hide();
2405 }
2406 }
2407 // save decals and viewport
2408 for (GUIGlChildWindow* window : myGLWindows) {
2409 GUISUMOAbstractView* view = window->getView();
2412 view->getChanger().getZPos(), view->getChanger().getRotation());
2413 }
2414 // delete the simulation
2416 // reset the caption
2417 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
2418 // clear decals and release GPU textures
2419 for (GUIGlChildWindow* window : myGLWindows) {
2420 GUISUMOAbstractView* view = window->getView();
2421 if (view->makeCurrent()) {
2422 view->clearDecals();
2426 view->makeNonCurrent();
2427 }
2428 }
2429 // remove trackers and other external windows (must be delayed until deleteSim)
2430 while (!myGLWindows.empty()) {
2431 delete myGLWindows.front();
2432 }
2433 // make a copy because deleting modifyes the vector;
2434 std::vector<FXMainWindow*> trackerWindows = myTrackerWindows;
2435 for (FXMainWindow* const window : trackerWindows) {
2436 delete window;
2437 }
2438 myTrackerWindows.clear();
2439 // clear selected items
2440 gSelected.clear();
2441 // add a separator to the log
2443 myTrackerLock.unlock();
2444 // remove coordinate information
2445 myGeoCoordinate->setText(TL("N/A"));
2446 myGeoCoordinate->disable();
2447 myGeoCoordinate->setEditable(false);
2448 myCartesianCoordinate->setText(TL("N/A"));
2449 myCartesianCoordinate->disable();
2450 myCartesianCoordinate->setEditable(false);
2451 if (myTestCoordinate) {
2452 myTestCoordinate->setText(TL("N/A"));
2453 }
2454 update();
2455}
2456
2457
2458FXCursor*
2460 return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
2461}
2462
2463
2468
2469
2470double
2474
2475
2476void
2478 loadConfigOrNet("");
2479 if (wait) {
2480 while (myAmLoading) {
2481 myRunThread->sleep(50);
2482 }
2483 }
2484}
2485
2486
2487void
2489 myStatusbar->getStatusLine()->setText(text.c_str());
2490 myStatusbar->getStatusLine()->setNormalText(text.c_str());
2491}
2492
2493
2494void
2496 myRecentNetworks.appendFile(f);
2497}
2498
2499
2500void
2502 myRecentConfigs.appendFile(f);
2503}
2504
2505
2506void
2508 if (myShowTimeAsHMS) {
2509 myLCDLabel->setToolTipText("HH:MM:SS");
2510 if (myAmGaming) {
2512 myTimeLossLabel->setToolTipText("HH:MM:SS");
2514 }
2515 } else {
2516 myLCDLabel->setToolTipText(TL("seconds"));
2517 if (myAmGaming) {
2519 myTimeLossLabel->setToolTipText(TL("seconds"));
2521 }
2522 }
2523}
2524
2525
2526void
2528 time -= DELTA_T; // synchronize displayed time with netstate output
2529 if (time < 0) {
2530 myLCDLabel->setText("----------------");
2531 return;
2532 }
2533 if (myAmGaming) {
2534 // show time counting backwards
2535 time = myRunThread->getSimEndTime() - time;
2536 }
2537 std::ostringstream str;
2538 str << std::setfill('0');
2539 const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0;
2540 if (myShowTimeAsHMS) {
2541 SUMOTime day = time / SUMOTime_DAY;
2542 if (day > 0) {
2543 str << day << '-';
2544 time %= SUMOTime_DAY;
2545 }
2546 str << std::setw(2);
2547 str << time / SUMOTime_HOUR << '-';
2548 time %= SUMOTime_HOUR;
2549 str << std::setw(2) << time / SUMOTime_MINUTE << '-';
2550 time %= SUMOTime_MINUTE;
2551 }
2552 str << std::setw(2) << time / 1000;
2553 if (!hideFraction) {
2554 str << '.' << std::setw(3) << time % 1000;
2555 }
2556 myLCDLabel->setText(str.str().c_str());
2557}
2558
2559
2560void
2562 if (press != nullptr) {
2563 myHotkeyPress[key] = press;
2564 }
2565 if (release != nullptr) {
2566 myHotkeyRelease[key] = release;
2567 }
2568}
2569
2570
2571long
2572GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* ptr) {
2573 FXEvent* e = (FXEvent*) ptr;
2574 if (e->code == KEY_Escape) {
2575 if (myGeoCoordinate && myGeoCoordinate->hasFocus()) {
2576 myGeoCoordinate->killFocus();
2577 if (getActiveView()) {
2579 }
2580 return 1;
2581 }
2582 if (myCartesianCoordinate && myCartesianCoordinate->hasFocus()) {
2583 myCartesianCoordinate->killFocus();
2584 if (getActiveView()) {
2586 }
2587 return 1;
2588 }
2589 }
2590 // PgUp and PgDown switch between widgets by default and binding them via menu shortcuts does not work reliably
2591 // so we must intercept them before FXMainWindow can handle it
2592 if (e->code == FX::KEY_Page_Up) {
2593 onCmdDelayInc(nullptr, 0, nullptr);
2594 } else if (e->code == FX::KEY_Page_Down) {
2595 onCmdDelayDec(nullptr, 0, nullptr);
2596 } else {
2597 // disable hotkeys without modifiers for the game
2598 const bool ignoreSimple = myAmGaming && (e->state & (CONTROLMASK | SHIFTMASK | ALTMASK)) == 0;
2599 const long handled = ignoreSimple ? 0 : FXMainWindow::onKeyPress(o, sel, ptr);
2600 if (handled == 0 && myMDIClient->numChildren() > 0) {
2601 auto it = myHotkeyPress.find(e->code);
2602 if (it != myHotkeyPress.end()) {
2603 it->second->execute(SIMSTEP);
2604 }
2605 if (!ignoreSimple) {
2606 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2607 if (w != nullptr) {
2608 w->onKeyPress(nullptr, sel, ptr);
2609 }
2610 }
2611 }
2612 }
2613 return 0;
2614}
2615
2616
2617long
2618GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* ptr) {
2619 const long handled = FXMainWindow::onKeyRelease(o, sel, ptr);
2620 if (handled == 0 && myMDIClient->numChildren() > 0) {
2621 FXEvent* e = (FXEvent*) ptr;
2622 auto it = myHotkeyRelease.find(e->code);
2623 if (it != myHotkeyRelease.end()) {
2624 it->second->execute(SIMSTEP);
2625 }
2626 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2627 if (w != nullptr) {
2628 w->onKeyRelease(nullptr, sel, ptr);
2629 }
2630 }
2631 return 0;
2632}
2633
2634
2635double
2637 return mySimDelay;
2638}
2639
2640
2641void
2643 mySimDelay = delay;
2644}
2645
2646
2647void
2649 myEventMutex.lock();
2650 myEvents.push_back(event);
2652 //myEventCondition.wait(myEventMutex);
2653 myEventMutex.unlock();
2654}
2655
2656
2657void
2658GUIApplicationWindow::setBreakpoints(const std::vector<SUMOTime>& breakpoints) {
2659 if (myRunThread != nullptr) {
2661 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
2662 myRunThread->getBreakpointLock().unlock();
2664 }
2665}
2666
2667
2668void
2670 const SUMOTime begin = string2time(OptionsCont::getOptions().getString("begin"));
2671 if (time >= begin) {
2672 // ensure breakpoint is valid
2673 time -= (time - begin) % DELTA_T;
2674 std::vector<SUMOTime> breakpoints = retrieveBreakpoints();
2675 if (std::find(breakpoints.begin(), breakpoints.end(), time) == breakpoints.end()) {
2676 breakpoints.push_back(time);
2677 std::sort(breakpoints.begin(), breakpoints.end());
2678 setBreakpoints(breakpoints);
2679 setStatusBarText(TLF("Set breakpoint at %", time2string(time)));
2680 }
2681 }
2682}
2683
2684
2685const std::vector<SUMOTime>
2688 std::vector<SUMOTime> result = myRunThread->getBreakpoints();
2689 myRunThread->getBreakpointLock().unlock();
2690 return result;
2691}
2692
2693
2694void
2698
2699/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ MID_HOTKEY_CTRL_Q_CLOSE
Main window closes.
Definition GUIAppEnum.h:115
@ ID_RUNTHREAD_EVENT
The testing thread.
Definition GUIAppEnum.h:350
@ MID_HOTKEY_CTRL_T_OPENNETEDIT_OPENSUMO
Open current SUMO simulation/network in netedit, or current netedit simulation/network in SUMO.
Definition GUIAppEnum.h:123
@ MID_LISTINTERNAL
Locator configuration - menu entry.
Definition GUIAppEnum.h:360
@ MID_TOOLBAREDIT_LOADADDITIONALS
load additionals in sumo-gui/netedit after press ctrl+T
Definition GUIAppEnum.h:695
@ MID_NEW_MICROVIEW
Open a new microscopic view.
Definition GUIAppEnum.h:338
@ MID_HOTKEY_CTRL_W_CLOSESIMULATION
Close simulation - ID.
Definition GUIAppEnum.h:129
@ MID_HOTKEY_CTRL_D_SINGLESIMULATIONSTEP_OPENDEMANDELEMENTS
Perform a single simulation step in SUMO and open Demand Elements in netedit.
Definition GUIAppEnum.h:89
@ MID_HOTKEY_CTRL_O_OPENSIMULATION_OPENNETWORK
Open simulation in SUMO and open network in netedit.
Definition GUIAppEnum.h:111
@ MID_HOTKEY_F9_EDIT_VIEWSCHEME
open edit scheme menu
Definition GUIAppEnum.h:248
@ MID_HOTKEY_CTRL_J_TOGGLEDRAWJUNCTIONSHAPE
toggle draw junction shape
Definition GUIAppEnum.h:101
@ MID_HOTKEY_A_MODE_STARTSIMULATION_ADDITIONALS_STOPS
hotkey for start simulation in SUMO and set editing mode additionals AND stops in netedit
Definition GUIAppEnum.h:43
@ MID_TRACI_STATUS
update traci status
Definition GUIAppEnum.h:377
@ MID_LANGUAGE_TR
change language to turkish
@ MID_CHANGELOG
changelog button
Definition GUIAppEnum.h:669
@ MID_HOTKEY_CTRL_B_EDITBREAKPOINT_OPENDATAELEMENTS
Edit simulation breakpoints in SUMO and open Data Elements in netedit.
Definition GUIAppEnum.h:85
@ MID_TOOLBAREDIT_LOADDEMAND
load demand in sumo-gui/netedit after press ctrl+T
Definition GUIAppEnum.h:697
@ MID_HOTKEY_F1_ONLINEDOCUMENTATION
open online documentation
Definition GUIAppEnum.h:232
@ MID_HOTKEY_CTRL_U_OPENEDGEDATA
Load edge data for visualization.
Definition GUIAppEnum.h:125
@ MID_HOTKEY_CTRL_R_RELOAD
Reload the previously loaded simulation.
Definition GUIAppEnum.h:119
@ MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK
Stop the simulation in SUMO and save network in netedit.
Definition GUIAppEnum.h:117
@ MID_HOTKEY_D_MODE_SINGLESIMULATIONSTEP_DELETE
hotkey for perform a single simulation step in SUMO and set delete mode in netedit
Definition GUIAppEnum.h:49
@ MID_HOTKEY_CTRL_A_STARTSIMULATION_OPENADDITIONALELEMENTS
Start the simulation in SUMO and open Additionals Elements in netedit.
Definition GUIAppEnum.h:83
@ MID_HOTKEY_SHIFT_O_LOCATEPOI
Locate poi - button.
Definition GUIAppEnum.h:182
@ MID_LANGUAGE_ZHT
change language to chinese (traditional)
@ MID_LANGUAGE_ES
change language to spanish
@ MID_HOTKEY_SHIFT_A_LOCATEADDITIONAL
Locate additional structure - button.
Definition GUIAppEnum.h:172
@ MID_SIMLOAD
(quick)-load state from file
Definition GUIAppEnum.h:330
@ MID_DEMAND_SCALE
scale traffic
Definition GUIAppEnum.h:407
@ MID_HOTKEY_CTRL_I_EDITVIEWPORT
Open viewport editor.
Definition GUIAppEnum.h:99
@ MID_SHOWTOOLTIPS_MENU
Show tool tips in menus - button.
Definition GUIAppEnum.h:393
@ MID_RECENTFILE
Loads a file previously loaded.
Definition GUIAppEnum.h:320
@ MID_HOTKEY_S_MODE_STOPSIMULATION_SELECT
hotkey for stop simulation in SUMO and set select mode in netedit
Definition GUIAppEnum.h:63
@ MID_HOTKEY_SHIFT_C_LOCATECONTAINER
Locate container - button.
Definition GUIAppEnum.h:174
@ MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW
open a new window (SUMO AND netedit)
Definition GUIAppEnum.h:218
@ MID_HOTKEY_SHIFT_V_LOCATEVEHICLE
Locate vehicle - button.
Definition GUIAppEnum.h:192
@ MID_HOTKEY_SHIFT_F11_HALLOFFAME
show the hall of fame dialog
Definition GUIAppEnum.h:254
@ MID_HOTKEY_SHIFT_L_LOCATEPOLY
Locate polygons - button.
Definition GUIAppEnum.h:180
@ MID_HOTKEY_CTRL_K_OPENTLSPROGRAMS
Load file with TLS Programs.
Definition GUIAppEnum.h:103
@ MID_LANGUAGE_IT
change language to italian
@ MID_HOTKEY_SHIFT_E_LOCATEEDGE
Locate edge - button.
Definition GUIAppEnum.h:176
@ MID_HOTKEY_ALT_B_BREAKPOINT_EARLY
hotkey for setting a breakpoint ahead of the current time
Definition GUIAppEnum.h:165
@ MID_CLEARMESSAGEWINDOW
Clear simulation output.
Definition GUIAppEnum.h:369
@ MID_HOTKEY_CTRL_F_FULSCREENMODE
Fullscreen mode - menu entry.
Definition GUIAppEnum.h:93
@ MID_SIMSAVE
Save state to file.
Definition GUIAppEnum.h:328
@ MID_TUTORIAL
tutorial button
Definition GUIAppEnum.h:673
@ MID_LISTTELEPORTING
Definition GUIAppEnum.h:362
@ MID_HOTKEY_CTRL_G_GAMINGMODE_TOGGLEGRID
Toggle Gaming mode in SUMO and grid in netedit.
Definition GUIAppEnum.h:95
@ MID_SHOWNETSTATS
Show network statistics.
Definition GUIAppEnum.h:371
@ ID_LOADTHREAD_EVENT
The loading thread.
Definition GUIAppEnum.h:348
@ MID_SHOWTOOLTIPS_VIEW
Show tool tips in view - button.
Definition GUIAppEnum.h:391
@ MID_GEO_COORDINATE
enter geo coordinate to center view
Definition GUIAppEnum.h:379
@ MID_HOTKEY_SHIFT_P_LOCATEPERSON
Locate person - button.
Definition GUIAppEnum.h:184
@ MID_HOTKEY_CTRL_P_OPENSHAPES
Load additional file with poi and polygons.
Definition GUIAppEnum.h:113
@ MID_LANGUAGE_EN
change language to english
@ MID_HOTKEY_SHIFT_J_LOCATEJUNCTION
Locate junction - button.
Definition GUIAppEnum.h:178
@ MID_SHOWPERSONSTATS
Show person statistics.
Definition GUIAppEnum.h:375
@ MID_DELAY_TOGGLE
toggle delay between alternative value
Definition GUIAppEnum.h:405
@ MID_HOTKEYS
hotkeys button
Definition GUIAppEnum.h:671
@ MID_TIMELINK_BREAKPOINT
Set breakpionts from messages - Option.
Definition GUIAppEnum.h:581
@ MID_HOTKEY_B_BREAKPOINT
hotkey for setting a breakpoint
Definition GUIAppEnum.h:47
@ MID_LANGUAGE_DE
change language to german
@ MID_HOTKEY_ALT_F4_CLOSE
Main window closes.
Definition GUIAppEnum.h:163
@ MID_TIME_TOGGLE
toggle time display mode
Definition GUIAppEnum.h:399
@ MID_DELAY_DEC
decrease sim delay
Definition GUIAppEnum.h:403
@ MID_LISTPARKING
Definition GUIAppEnum.h:361
@ MID_NEW_OSGVIEW
Open a new microscopic 3D view.
Definition GUIAppEnum.h:340
@ MID_CARTESIAN_COORDINATE
enter cartesian coordinate to center view
Definition GUIAppEnum.h:381
@ MID_LANGUAGE_JA
change language to japanese
@ MID_FEEDBACK
feedback button
Definition GUIAppEnum.h:675
@ MID_HOTKEY_CTRL_H_APPSETTINGS_OPENEDGETYPES
open app setting dialog in SUMO and open edge type files in netedit
Definition GUIAppEnum.h:97
@ MID_HOTKEY_CTRL_SHIFT_S_SAVESUMOCONFIG
save SUMOConfig (SUMO AND netedit)
Definition GUIAppEnum.h:222
@ MID_HOTKEY_F12_ABOUT
open about dialog
Definition GUIAppEnum.h:256
@ MID_HOTKEY_CTRL_E_EDITSELECTION_LOADNETEDITCONFIG
Edit selection in SUMO and load neteditConfig in netedit.
Definition GUIAppEnum.h:91
@ MID_HOTKEY_SHIFT_T_LOCATETLS
Locate TLS - button.
Definition GUIAppEnum.h:190
@ MID_DELAY_INC
increase sim delay
Definition GUIAppEnum.h:401
@ MID_HOTKEY_CTRL_N_OPENNETWORK_NEWNETWORK
open network in SUMO and create new empty network in netedit
Definition GUIAppEnum.h:109
@ MID_HOTKEY_CTRL_QUICK_RELOAD
Quick-Reload the previously loaded simulation (keep the net)
Definition GUIAppEnum.h:121
@ MID_LANGUAGE_ZH
change language to chinese (simplified)
@ MID_SHOWVEHSTATS
Show vehicle statistics.
Definition GUIAppEnum.h:373
@ MID_LANGUAGE_FR
change language to french
@ MID_HOTKEY_CTRL_SHIFT_T_OPEN_NET
load only the network in sumo-gui/netedit
Definition GUIAppEnum.h:224
@ MID_WINDOW
Main window-ID.
Definition GUIAppEnum.h:300
@ MID_LANGUAGE_KO
change language to korean
#define STAT_CONTAINERS
FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[]
#define STAT_DELAYED
#define MIN_DRAW_DELAY
#define STAT_PERSONS
#define STAT_TELEPORTS
#define STAT_VEHS
GUICompleteSchemeStorage gSchemeStorage
#define GUIDesignSlider
Definition GUIDesigns.h:536
#define GUIDesignSpinDial
Definition GUIDesigns.h:516
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
Definition GUIDesigns.h:480
#define GUIDesignButtonStatusBarFixed
button rectangular with thick and raise frame with a width of 100
Definition GUIDesigns.h:124
#define GUIDesignMDIButtonLeft
Definition GUIDesigns.h:220
#define GUIDesignToolBarRaisedSameTop
design for first toolbar shell positioned in the same position of dock
Definition GUIDesigns.h:486
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition GUIDesigns.h:144
#define GUIDesignHorizontalFrameStatusBar
Horizontal frame used in status bar.
Definition GUIDesigns.h:359
#define GUIDesignToolBar
design for default toolbar
Definition GUIDesigns.h:465
#define GUIDesignSplitter
Definition GUIDesigns.h:505
#define GUIDesignSplitterMDI
MDI Splitter.
Definition GUIDesigns.h:508
#define GUIDesignMFXCheckableButtonSquare
Definition GUIDesigns.h:158
#define GUIDesignToolbarMenuBar
Definition GUIDesigns.h:459
#define GUIDesignToolBarRaisedNextTop
design for first toolbar shell positioned in the next-top position of dock
Definition GUIDesigns.h:483
#define GUIDesignButtonToolbarText
Definition GUIDesigns.h:141
#define GUIDesignMDIButtonRight
MDIButton oriented to right.
Definition GUIDesigns.h:223
#define GUIDesignStatusBar
design used in status bar
Definition GUIDesigns.h:477
@ SIMULATION_ENDED
Send when the simulation is over;.
@ MESSAGE_OCCURRED
send when a message occurred
@ GLDEBUG_OCCURRED
send when a gldebug occurred
@ ERROR_OCCURRED
send when a error occurred
@ 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 occurred
@ DEBUG_OCCURRED
send when a debug occurred
@ WARNING_OCCURRED
send when a warning occurred
@ GLO_MAX
empty max
GUISelectedStorage gSelected
A global holder of selected objects.
FXString gCurrentFolder
The folder used as last.
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
@ INSERTION_DELAY
@ EDITVIEWPORT
@ CLEARMESSAGEWINDOW
@ NETEDIT_MINI
@ GREENVEHICLE
@ LOCATEVEHICLE
@ LOCATEPERSON
@ SHOWTOOLTIPS_MENU
@ WINDOWS_TILE_VERT
@ GREENCONTAINER
@ WINDOWS_CASCADE
@ GREEN_PERSON_NON_INTERACTING
@ GREEN_VEHICLE_MESO
@ SHOWTOOLTIPS_VIEW
@ OPEN
open icons
@ LOCATECONTAINER
@ LOCATEJUNCTION
@ APP_BREAKPOINTS
@ SAVE_SUMOCONFIG
@ WINDOWS_TILE_HORI
@ YELLOWVEHICLE
@ OPEN_SUMOCONFIG
@ SAVE
save icons
@ GREEN_PERSON_JUPEDSIM
@ KEY_SPACE
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:287
#define WRITE_MESSAGEF(...)
Definition MsgHandler.h:289
#define WRITE_ERRORF(...)
Definition MsgHandler.h:296
#define TL(string)
Definition MsgHandler.h:304
#define TLF(string,...)
Definition MsgHandler.h:306
SUMOTime DELTA_T
Definition SUMOTime.cpp:39
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:47
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:107
#define SPEED2DIST(x)
Definition SUMOTime.h:48
#define SUMOTime_MINUTE
Definition SUMOTime.h:39
#define SIMSTEP
Definition SUMOTime.h:69
constexpr SUMOTime TIME2STEPS(double x)
Definition SUMOTime.h:60
#define SUMOTime_DAY
Definition SUMOTime.h:37
#define SUMOTime_HOUR
Definition SUMOTime.h:38
#define TS
Definition SUMOTime.h:45
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
int GUIDesignHeight
the default height for GUI elements
Definition StdDefs.cpp:41
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition StdDefs.h:62
T MAX2(T a, T b)
Definition StdDefs.h:86
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:57
#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.
static void resetFont()
to be called when the font context is invalidated
Definition GLHelper.cpp:666
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
MFXLabelTooltip * myScaleTrafficTooltip
the demand scale label
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
long onCmdBreakpoint(FXObject *, FXSelector, void *)
Called to set a breakpoint via hotkey.
FXToolBarShell * myToolBarDrag9
FXRealSpinner * mySimDelaySpinner
Simulation delay spinner.
long onCmdBreakpointEarly(FXObject *, FXSelector, void *)
Called to set an early breakpoint via hotkey.
long onCmdChangelog(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Changelog
long onCmdOpenInNetedit(FXObject *, FXSelector, void *)
Called on menu Edit->open in Netedit.
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
MFXCheckableButton * myShowToolTipsView
checkable button for show tool tips in view
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
long onCmdShowToolTipsMenu(FXObject *, FXSelector, void *)
Called on "show tool tips in menu".
virtual void setDelay(double delay)
Sets the delay of the parent application in milliseconds.
MFXLCDLabel * myEmergencyVehicleLabel
emergency vehicle label
std::stringstream * myDynamicSelection
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.
GUIApplicationWindow(FXApp *a)
Constructor.
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
double getTrackerInterval() const
get tracker interval
long onCmdClose(FXObject *, FXSelector, void *)
Called on menu File->Close.
virtual void buildToolBars()
Builds the tool bar.
long onCmdDelayToggle(FXObject *, FXSelector, void *)
Called on "delay toggle".
FXMenuCheck * myLoadAdditionalsInNetedit
menuCheck for enable/disable load additionals in netedit
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
MFXCheckableButton * myShowToolTipsMenu
checkable button for show tool tips in menu
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.
long onUpdNeedsSumoConfig(FXObject *, FXSelector, void *)
Determines whether some buttons which require an sumoConfig may be shown.
void loadOnStartup(const bool wait=false)
config or net on startup
void addBreakpoint(SUMOTime time)
Adds the given breakpoint.
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.
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)
FXMenuCommand * myOpenNetInNetedit
menuCommand for opening only the network in netedit
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.
virtual void setBreakpoints(const std::vector< SUMOTime > &breakpoints)
Sets the breakpoints of the parent application.
long onUpdNeedsNetwork(FXObject *, FXSelector, void *)
Determines whether some buttons which require an active network may be shown.
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 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
long onCmdShowToolTipsView(FXObject *, FXSelector, void *)
Called on "show tool tips in view".
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 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.
FXMenuCheck * myLoadDemandInNetedit
menuCheck for enable/disable load demand elements in netedit
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 certain event ocurred
void checkGamingEvents()
handles additional game-related events
long onCmdQuickReload(FXObject *, FXSelector, void *)
Called on quick-reload.
FXMenuCommand * myOpenInNetedit
menuCommand for opening simulation/network in netedit
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.
void saveDecals(const std::vector< GUISUMOAbstractView::Decal > &decals)
Makes the given decals the default.
static void close()
close GUICursorSubSys
static void initCursors(FXApp *a)
Initiate GUICursorSubSys.
static FXLabel * buildFXLabel(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXuint opts, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
Construct label with given text and icon.
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXMenuTitle * buildFXMenuTitle(FXComposite *p, const std::string &text, FXIcon *icon, FXMenuPane *menuPane)
build menu title
static FXMenuCommand * buildFXMenuCommandRecentFile(FXComposite *p, const std::string &text, FXObject *tgt, FXSelector sel)
build menu command (for recent files)
static FXMenuCheck * buildFXMenuCheckbox(FXComposite *p, const std::string &text, const std::string &info, FXObject *tgt, FXSelector sel)
build menu checkbox
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
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
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
const std::string & getSchemeName() const
const std::string & getCaption() const
const std::string & getMsg() const
Returns the message.
Event sent when 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.
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)
long onCmdUnfocusCoordinate(FXObject *, FXSelector, void *)
called when a coordinate field in the status bar loses focus
std::vector< FXMainWindow * > myTrackerWindows
list of tracker windows
FXMenuPane * myLanguageMenu
Language menu common to all applications.
GUISUMOAbstractView * getActiveView() const
get the active view or 0
long onCmdSetGeoCoordinate(FXObject *, FXSelector, void *)
called when user enters a geo coordinate in the status bar
bool myListTeleporting
information whether the locator should list teleporting vehicles
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.
long onCmdSetCartesianCoordinate(FXObject *, FXSelector, void *)
called when user enters a cartesian coordinate in the status bar
FXHorizontalFrame * myTraCiFrame
frames for coordinates
void buildLanguageMenu(FXMenuBar *menuBar)
long onCmdChangeLanguage(FXObject *, FXSelector, void *)
MFXStaticToolTip * myStaticTooltipView
static toolTip used in view
bool listParking() const
return whether to list parking vehicles
FXHorizontalFrame * myGeoFrame
FXTextField * myCartesianCoordinate
Coordinate fields for the current cartesian, geo-coordinate and test coordinates.
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
long onCmdFocusCoordinate(FXObject *, FXSelector, void *)
called when user focuses a coordinate field in the status bar
bool myAmFullScreen
FOX need this.
FXStatusBar * myStatusbar
The status bar.
void updateChildren(int msg=MID_SIMSTEP)
update childrens
FXTextField * myGeoCoordinate
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.
static SUMOTime getBreakPointOffset()
ask whether locate links is enabled
MSTransportableControl & getPersonControl() override
Returns the person control.
Definition GUINet.cpp:130
void flushOutputsAtEnd()
flush outputs once the simulation has reached its end
Definition GUINet.cpp:814
GUITrafficLightLogicWrapper * getTLLWrapper(MSTrafficLightLogic *tll)
Definition GUINet.cpp:226
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition GUINet.cpp:486
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition GUINet.cpp:581
MSTransportableControl & getContainerControl() override
Returns the container control.
Definition GUINet.cpp:139
virtual double getRotation() const =0
Returns the rotation of the canvas stored in this changer.
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.
void singleStep()
called when the user presses the "single step"-button
GUINet & getNet() const
returns the loaded network
virtual void begin()
starts the simulation (execution of one step after another)
SUMOTime getSimBegin()
get simulation begin time
void resume()
called when the user presses the "resume"-button
virtual bool simulationIsStartable() const
check if simulation is startable
bool networkAvailable() const
returns the information whether a network has been loaded
virtual bool simulationIsStepable() const
check if simulation is stepable
std::vector< SUMOTime > & getBreakpoints()
get list of breakpoints
virtual bool init(GUINet *net, SUMOTime start, SUMOTime end)
initialises the thread with the new simulation
FXMutex & getBreakpointLock()
get breakpoint lock
SUMOTime getSimEndTime() const
get simulation end time
virtual bool simulationIsStopable() const
check if simulation is stopableo
virtual void deleteSim()
deletes the existing simulation
void stop()
halts the simulation execution
void prepareDestruction()
halts the thread before it shall be deleted
MFXComboBoxIcon * getColoringSchemesCombo()
get coloring schemes combo
void addDecals(const std::vector< Decal > &decals)
add decals
void processPendingTextureDeletes()
process pending texture deletions
FXbool makeCurrent()
A reimplementation due to some internal reasons.
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
GUIPerspectiveChanger & getChanger() const
get changer
std::vector< Decal > & getDecals()
The list of decals to show.
void clearDecals()
clear all decals
virtual void updatePositionInformationLabel() const
update position information labels
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
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.
std::string load(const std::string &filename, GUIGlObjectType type=GLO_MAX, std::ostream *dynamicNotFound=nullptr)
Loads a selection list (optionally with restricted type)
An XML-handler for visualisation schemes.
double getDelay() const
Returns the parsed delay.
const std::string & getSettingName() const
std::vector< std::string > getTrackers()
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 accelerator (used for toggle dynamically binding space key with start/end simulation)
static void resetTextures()
Reset textures.
static void initTextures(FXApp *a)
Initiate GUITextureSubSys for textures.
void begin2TrackPhases(GUIMainWindow *app=nullptr)
Builds a GUITLLogicPhasesTrackerWindow which will receive new phases.
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.
bool amChecked() const
check if this MFXCheckableButton is checked
void setChecked(bool val, const bool inform=false)
check or uncheck this MFXCheckableButton
long setCurrentItem(const FXint index, FXbool notify=FALSE)
Set the current item (index is zero-based)
FXint findItem(const FXString &text) const
find item
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 enableStaticToolTip(const bool value)
enable/disable static tooltip
void push_back(T what)
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:146
static FXString getTitleText(const FXString &appname, FXString filename="")
Returns the title text in dependence to an optional file name.
Definition MFXUtils.cpp:62
static FXbool userPermitsOverwritingWhenFileExists(FXWindow *const parent, const FXString &file)
Returns true if either the file given by its name does not exist or the user allows overwriting it.
Definition MFXUtils.cpp:41
static FXString assureExtension(const FXFileDialog &openDialog)
Corrects missing extension.
Definition MFXUtils.cpp:71
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:1157
static bool gUseMesoSim
Definition MSGlobals.h:106
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition MSLane.h:640
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition MSLane.h:575
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
Definition MSNet.cpp:1861
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:201
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition MSNet.h:475
@ SIMSTATE_LOADING
The simulation is loading.
Definition MSNet.h:96
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
Definition MSNet.h:106
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition MSNet.cpp:1038
void quickReload()
reset state to the beginning without reloading the network
Definition MSNet.cpp:1838
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:334
bool hasContainers() const
Returns whether containers are simulated.
Definition MSNet.h:435
bool hasPersons() const
Returns whether persons are simulated.
Definition MSNet.h:419
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition MSNet.h:455
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition MSNet.h:525
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:402
static void saveState(const std::string &file, SUMOTime step, bool usePrefix=true)
Saves the current state.
MSTrafficLightLogic * getActive() const
bool knows(const std::string &id) const
Returns the information whether the named tls is stored.
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
The parent class for traffic light logics.
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
int getDepartedVehicleNo() const
Returns the number of inserted vehicles.
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.
int getTeleportCount() const
return the number of teleports (including collisions)
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:605
const MSLane * getLane() const
Returns the lane the vehicle is on.
Definition MSVehicle.h:581
double getSpeed() const
Returns the vehicle's current speed.
Definition MSVehicle.h:490
The XML-Handler for shapes loading network loading.
Definition NLHandler.h:55
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 std::string &indent="") const
Writes the configuration.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
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.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
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:82
double x() const
Returns the x-position.
Definition Position.h:52
double y() const
Returns the y-position.
Definition Position.h:57
static const RGBColor GREEN
Definition RGBColor.h:205
static const RGBColor RED
named colors
Definition RGBColor.h:204
double getOverallProb() const
Return the sum of the probabilites assigned to the members.
T get(SumoRNG *which=nullptr) const
Draw a sample of the distribution.
static StringBijection< StateFileExtension > StateFileExtensions
state file extensions
static StringBijection< SumoConfigFileExtension > SumoConfigFileExtensions
sumo config file extensions
static StringBijection< EdgeDataFileExtension > EdgeDataFileExtensions
edgedata file extensions
static StringBijection< ShapesFileExtension > ShapesFileExtensions
additional file extensions
static StringBijection< NetFileExtension > NetFileExtensions
net file extensions
std::vector< std::string > getVector()
return vector of strings
static std::string to_lower_case(const std::string &str)
Transfers the content to lower case.
static std::string replace(std::string str, const std::string &what, const std::string &by)
Replaces all occurrences of the second string by the third string within the first string.
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
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.
static std::string transcodeToLocal(const std::string &utf8String)
convert a string from UTF-8 to the local codepage
@ SEL_THREAD_EVENT
Definition fxexdefs.h:171
@ SEL_THREAD
Definition fxexdefs.h:153