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 // build buttons
345 std::vector<std::string> help({
346 TL("number of running vehicles"),
347 TL("number of insertion backlogged vehicles"),
348 TL("percentage of teleports per departed vehicles"),
349 TL("number of active persons"),
350 TL("number of active containers")});
351
352 const GUIIcon greenVehIcon = (OptionsCont::getOptions().isSet("mesosim") && OptionsCont::getOptions().getBool("mesosim")) ?
356 myStatButtons.back()->hide();
358 myStatButtons.back()->hide();
359 GUIIcon greenPersonIcon = GUIIcon::GREENPERSON;
360 if (OptionsCont::getOptions().isSet("pedestrian.model")) {
361 const std::string pedModel = OptionsCont::getOptions().getString("pedestrian.model");
362 if (StringUtils::to_lower_case(pedModel) == "noninteracting") {
364 } else if (StringUtils::to_lower_case(pedModel) == "jupedsim") {
365 greenPersonIcon = GUIIcon::GREEN_PERSON_JUPEDSIM;
366 }
367 }
369 myStatButtons.back()->hide();
371 myStatButtons.back()->hide();
372 }
373 // make the window a mdi-window
374 myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
376 myMDIMenu = new FXMDIMenu(this, myMDIClient);
377 new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
378 new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
379 new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
380 new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
381 // build the message window
383 // fill menu and tool bar
384 fillMenuBar();
385 myToolBar6->hide();
386 myToolBar7->hide();
387 myToolBar9->hide();
388 myToolBar10->hide();
389 // build additional threads
390 myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent, isLibsumo);
392 // set the status bar
393 setStatusBarText(TL("Ready."));
394 // set the caption
395 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
396 // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
397 myRunThread->start();
400}
401
402
403void
406 gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
407 FXMainWindow::create();
408 myMenuBarDrag->create();
409 myToolBarDrag1->create();
410 myToolBarDrag2->create();
411 myToolBarDrag3->create();
412 myToolBarDrag4->create();
413 myToolBarDrag5->create();
414 myToolBarDrag6->create();
415 myToolBarDrag7->create();
416 myFileMenu->create();
417 mySelectByPermissions->create();
418 myEditMenu->create();
419 mySettingsMenu->create();
420 myLocatorMenu->create();
421 myControlMenu->create();
422 myWindowMenu->create();
423 myLanguageMenu->create();
424 myHelpMenu->create();
425 FXint textWidth = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
426 myCartesianFrame->setWidth(textWidth);
427 myGeoFrame->setWidth(textWidth);
428 if (myTestFrame) {
429 myTestFrame->setWidth(textWidth);
430 }
431
432 show(PLACEMENT_DEFAULT);
433 if (!OptionsCont::getOptions().isSet("window-size")) {
434 if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
435 maximize();
436 }
437 }
438 myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
439 myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
440 const std::string& onlineMaps = getApp()->reg().readStringEntry("gui", "onlineMaps", "");
441 for (const std::string& entry : StringTokenizer(onlineMaps, "\n").getVector()) {
442 const std::vector<std::string> split = StringTokenizer(entry, "\t").getVector();
443 if (split.size() == 2) {
444 myOnlineMaps[split[0]] = split[1];
445 }
446 }
447 if (myOnlineMaps.empty()) {
448 myOnlineMaps["GeoHack"] = "https://geohack.toolforge.org/geohack.php?params=%lat;%lon_scale:1000";
449 myOnlineMaps["Google Maps"] = "https://www.google.com/maps/search/?api=1&query=%lat,%lon&zoom=19";
450 myOnlineMaps["OSM"] = "https://www.openstreetmap.org/?mlat=%lat&mlon=%lon&zoom=18&layers=M";
451 }
453}
454
455
458 myRunThread->join();
460 // close icons
463 // delete visual
464 delete myGLVisual;
465 // delete some non-parented windows
466 delete myToolBarDrag1;
467 delete mySimDelayTarget;
468 // delete rest of elements
471 delete myRunThread;
472 delete myFileMenu;
473 delete myEditMenu;
475 delete mySettingsMenu;
476 delete myLocatorMenu;
477 delete myControlMenu;
478 delete myLanguageMenu;
479 delete myWindowMenu;
480 delete myHelpMenu;
481 delete myLoadThread;
482
483 while (!myEvents.empty()) {
484 // get the next event
485 GUIEvent* e = myEvents.top();
486 myEvents.pop();
487 delete e;
488 }
489 for (auto item : myHotkeyPress) {
490 delete item.second;
491 }
492 for (auto item : myHotkeyRelease) {
493 delete item.second;
494 }
495}
496
497
498void
500 FXMainWindow::detach();
501 myMenuBarDrag->detach();
502 myToolBarDrag1->detach();
503}
504
505
506void
507GUIApplicationWindow::addToWindowsMenu(FXMenuPane* /*menuPane*/) {
508 // unused, implement in children
509}
510
511
512void
514 // build file menu
515 myFileMenu = new FXMenuPane(this);
518 TL("New Window"), "Ctrl+Shift+N", TL("Open a new sumo-gui window."),
519 nullptr, this, MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW);
520 new FXMenuSeparator(myFileMenu);
522 TL("&Open Simulation..."), "Ctrl+O", TL("Open a simulation (Configuration file)."),
525 TL("Open &Network..."), "Ctrl+N", TL("Open a network."),
528 TL("Open Shapes "), "Ctrl+P", TL("Load POIs and Polygons for visualization."),
531 TL("Open EdgeData "), "Ctrl+U", TL("Load edge related data for visualization."),
534 TL("&Reload"), "Ctrl+R", TL("Reloads the simulation / the network."),
537 TL("Quick-Reload"), "Ctrl+0", TL("Reloads the simulation (but not network)."),
539 new FXMenuSeparator(myFileMenu);
541 TL("Save Configuration"), "Ctrl+Shift+S", TL("Save current options as a configuration file."),
544 TL("Close"), "Ctrl+W", TL("Close the simulation."),
546 new FXMenuSeparator(myFileMenu);
547 // build recent files
550 new FXMenuSeparator(myFileMenu);
552 TL("&Quit"), "Ctrl+Q", TL("Quit the Application."),
553 nullptr, this, MID_HOTKEY_CTRL_Q_CLOSE);
554 // build edit menu
555 mySelectByPermissions = new FXMenuPane(this);
556 std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
557 for (const auto& vehicleClass : vehicleClasses) {
559 }
560 myEditMenu = new FXMenuPane(this);
563 TL("Edit Selected..."), "Ctrl+E", TL("Opens a dialog for editing the list of selected items."),
565 mySelectLanesMenuCascade = new FXMenuCascade(myEditMenu, TL("Select lanes which allow..."), GUIIconSubSys::getIcon(GUIIcon::FLAG), mySelectByPermissions);
566 mySelectLanesMenuCascade->setHelpText(TL("Opens a menu for selecting a vehicle class by which to selected lanes."));
567 new FXMenuSeparator(myEditMenu);
569 TL("Set Breakpoint"), "B", TL("Sets a breakpoint at the current simulation step"),
572 TL("Set Breakpoint with offset"), "Alt+B", TL("Sets a breakpoint at the current simulation step + offset configured in application settings"),
575 TL("Edit Breakpoints"), "Ctrl+B", TL("Opens a dialog for editing breakpoints."),
578 TL("Edit Visualization"), "F9", TL("Opens a dialog for editing visualization settings."),
581 TL("Edit Viewport"), "Ctrl+I", TL("Opens a dialog for editing viewing area, zoom and rotation."),
583 new FXMenuSeparator(myEditMenu);
584 // add open in sumo options
585 myLoadAdditionalsInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load additionals in netedit"), TL("Load additionals in netedit."), this, MID_TOOLBAREDIT_LOADADDITIONALS);
586 myLoadAdditionalsInNetedit->setCheck(TRUE);
587 myLoadDemandInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load demand in netedit"), TL("Load demand in netedit."), this, MID_TOOLBAREDIT_LOADDEMAND);
588 myLoadDemandInNetedit->setCheck(FALSE);
590 TL("Open in netedit"), "Ctrl+T", TL("Opens current simulation in NETEDIT."),
593 TL("Open network in netedit"), "Ctrl+Shift+T", TL("Opens current network in NETEDIT."),
595 // build settings menu
596 mySettingsMenu = new FXMenuPane(this);
599 TL("Application Settings"), "Ctrl+H", TL("Open a Dialog for Application Settings editing."),
601 myGamingModeCheckbox = new FXMenuCheck(mySettingsMenu,
602 TL("Gaming Mode\tCtrl+G\tToggle gaming mode on/off."),
605 TL("Full Screen Mode"), "Ctrl+F", TL("Toggle full screen mode on/off."),
607 // build Locate menu
608 myLocatorMenu = new FXMenuPane(this);
611 TL("&Junctions"), "Shift+J", TL("Open a dialog for locating a Junction."),
614 TL("&Edges"), "Shift+E", TL("Open a dialog for locating an Edge."),
617 TL("&Vehicles"), "Shift+V", TL("Open a dialog for locating a Vehicle."),
620 TL("&Persons"), "Shift+P", TL("Open a dialog for locating a Person."),
623 TL("&Container"), "Shift+C", TL("Open a dialog for locating a Container."),
626 TL("&TLS"), "Shift+T", TL("Open a dialog for locating a Traffic Light."),
629 TL("&Additional"), "Shift+A", TL("Open a dialog for locating an Additional Structure."),
632 TL("P&oI"), "Shift+O", TL("Open a dialog for locating a Point of Interest."),
635 TL("Po&lygon"), "Shift+L", TL("Open a dialog for locating a Polygon."),
637 new FXMenuSeparator(myLocatorMenu);
638 GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Internal Structures"), TL("Show internal junctions and streets in locator dialog."), this, MID_LISTINTERNAL);
639 FXMenuCheck* listParking = GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Parking Vehicles"), TL("Show parking vehicles in locator dialog."), this, MID_LISTPARKING);
640 listParking->setCheck(myListParking);
641 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);
642 // build control menu
643 // the shortcut designator is not only at text in the submenu but also defines the real shortcut key assigned with it!
644 // secondary shortcuts (ctrl+A, ctrl+S, ctrl+D) are defined in GUIShortcutsSubSys::buildSUMOAccelerators
645 myControlMenu = new FXMenuPane(this);
646 GUIDesigns::buildFXMenuTitle(myMenuBar, TL("Simulation"), nullptr, myControlMenu);
648 TL("Run"), "A,space", TL("Start/ Resume the simulation."),
651 TLC("Simulation", "Stop"), "S,space", TL("Halt the simulation."),
654 TL("Step"), "D", TL("Perform one simulation step."),
657 TL("Delay+"), "PgUp", TL("Increase simulation step delay."), nullptr, this, MID_DELAY_INC);
659 TL("Delay-"), "PgDn", TL("Decrease simulation step delay."), nullptr, this, MID_DELAY_DEC);
661 TL("Save"), "", TL("Save the current simulation state to a file."),
664 TL("Load"), "", TL("Load simulation state for the current network from file."),
666 // build windows menu
667 myWindowMenu = new FXMenuPane(this);
669 GUIDesigns::buildFXMenuCommandShortcut(myWindowMenu, TL("Open new view"), "", TL("Open a new microscopic view."), GUIIconSubSys::getIcon(GUIIcon::MICROVIEW), this, MID_NEW_MICROVIEW);
670#ifdef HAVE_OSG
672#endif
674 TL("Tile &Horizontally"), "", TL("Tile the views horizontally."),
675 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_HORI), myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
677 TL("Tile &Vertically"), "", TL("Tile the views vertically."),
678 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_VERT), myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
680 TL("Cascade"), "", TL("Cascade the views."),
682 myMDIClient, FXMDIClient::ID_MDI_CASCADE);
684 TL("&Close"), "", TL("Close the selected view."),
685 nullptr, myMDIClient, FXMDIClient::ID_MDI_CLOSE);
686 FXMenuSeparator* sep2 = new FXMenuSeparator(myWindowMenu);
687 sep2->setTarget(myMDIClient);
688 sep2->setSelector(FXMDIClient::ID_MDI_ANY);
689 // for whatever reason, sonar complains in the next line that sep2 may leak, but fox does the cleanup
690 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_1); // NOSONAR
691 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_2);
692 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_3);
693 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_4);
694 GUIDesigns::buildFXMenuCommand(myWindowMenu, TL("&Others..."), nullptr, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
695
696 new FXMenuSeparator(myWindowMenu);
697 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Status Line"), TL("Toggle the Status Bar on/off."), myStatusbar, FXWindow::ID_TOGGLESHOWN);
698 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Message Window"), TL("Toggle the Message Window on/off."), myMessageWindow, FXWindow::ID_TOGGLESHOWN);
699 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Time"), TL("Toggle the Simulation Time on/off."), myToolBar3, FXWindow::ID_TOGGLESHOWN);
700 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Delay"), TL("Toggle the Simulation Delay Entry on/off."), myToolBar4, FXWindow::ID_TOGGLESHOWN);
702
703 new FXMenuSeparator(myWindowMenu);
705 TL("Clear Message Window"), "", TL("Clear the message window."),
707 // build windows menu
709 // build help menu
710 myHelpMenu = new FXMenuPane(this);
712 TL("&Help"),
713 nullptr, myHelpMenu);
714 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Online Documentation"), "F1", TL("Open Online documentation."),
715 nullptr, this, MID_HOTKEY_F1_ONLINEDOCUMENTATION);
716 new FXMenuSeparator(myHelpMenu);
717 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Changelog"), "", TL("Open Changelog."),
718 nullptr, this, MID_CHANGELOG);
719 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Hotkeys"), "", TL("Open Hotkeys."),
720 nullptr, this, MID_HOTKEYS);
721 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Tutorial"), "", TL("Open Tutorial."),
722 nullptr, this, MID_TUTORIAL);
723 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Feedback"), "", TL("Open feedback dialog."),
724 nullptr, this, MID_FEEDBACK);
725 new FXMenuSeparator(myHelpMenu);
726 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&About"), "F12", TL("About sumo-gui."),
728 // build SUMO Accelerators (hotkeys)
729 GUIShortcutsSubSys::buildAccelerators(getAccelTable(), this, true);
730}
731
732
733void
735 // file and simulation tool bar
736 {
737 myToolBarDrag1 = new FXToolBarShell(this, GUIDesignToolBar);
739 new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
740 // build file tools
741 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen simulation\tOpen a simulation (Configuration file)."),
743 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen network\tOpen a network."),
745 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tReload\tReloads the simulation / the network."),
747 }
748 // simulation toolbar
749 {
750 myToolBarDrag2 = new FXToolBarShell(this, GUIDesignToolBar);
752 new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
753 // build simulation tools
754 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tRun\tStart/Resume the loaded simulation."),
756 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStop\tHalt the running simulation."),
758 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStep\tPerform a single simulation step."),
760 }
761 // Simulation Step Display
762 {
763 myToolBarDrag3 = new FXToolBarShell(this, GUIDesignToolBar);
765 new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
766 new MFXButtonTooltip(myToolBar3, myStaticTooltipMenu, TL("Time:\tToggle between time formats\tToggle between seconds and hour:minute:seconds display."), nullptr, this, MID_TIME_TOGGLE, GUIDesignButtonToolbarText);
767
768 myLCDLabel = new MFXLCDLabel(myToolBar3, myStaticTooltipMenu, 16, nullptr, 0, JUSTIFY_RIGHT);
773 myLCDLabel->setText("----------------");
774 }
775 // Simulation Delay
776 {
777 myToolBarDrag4 = new FXToolBarShell(this, GUIDesignToolBar);
779 new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
780 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);
781 // create spinner for delay
782 mySimDelay = 0;
783 mySimDelayTarget = new FXDataTarget(mySimDelay);
785 // create slider
786 mySimDelaySlider = new FXSlider(myToolBar4, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSlider);
787 mySimDelaySlider->setRange(0, 1000);
788 mySimDelaySlider->setHeadSize(10);
789 mySimDelaySlider->setIncrement(50);
790 mySimDelaySlider->setTickDelta(100);
791 mySimDelaySlider->setValue((int)mySimDelay);
792 //mySimDelayTarget->setNumberFormat(0);
793 //mySimDelayTarget->setIncrements(1, 10, 10);
794 mySimDelaySpinner->setIncrement(10);
795 mySimDelaySpinner->setRange(0, 10000);
796 mySimDelaySpinner->setValue(mySimDelay);
797 }
798 // Scale traffic (flows and incrementally loaded vehicles)
799 {
800 myToolBarDrag8 = new FXToolBarShell(this, GUIDesignToolBar);
802 new FXToolBarGrip(myToolBar8, myToolBar8, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
803 myScaleTrafficTooltip = new MFXLabelTooltip(myToolBar8, myStaticTooltipMenu, TL("Scale Traffic:"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
804 myScaleTrafficTooltip->setHelpText(TL("Scale traffic volume from running flows and from vehicles that are loaded incrementally from route files."));
806 myDemandScaleSpinner->setIncrement(0.5);
807 myDemandScaleSpinner->setRange(0, 1000);
808 myDemandScaleSpinner->setValue(1);
809 }
810 // Views
811 {
812 myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBar);
814 new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
815 // build view tools
816 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new view") + std::string("\t") + TL("Open a new microscopic view.")).c_str(),
818#ifdef HAVE_OSG
819 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new 3D view") + std::string("\t") + TL("Open a new 3D view.")).c_str(),
821#endif
822 // add toggle button for tooltips in view on/off (by default unchecked)
824 myStaticTooltipMenu, (std::string("\t") + TL("Toggle View Tooltips") + std::string("\t") + TL("Toggles whether tooltips in the view shall be shown.")).c_str(),
826 myShowToolTipsView->setChecked(getApp()->reg().readIntEntry("gui", "viewToolTips", 0) == 1);
828 // add toggle button for tooltips in menu on/off (by default checked)
830 myStaticTooltipMenu, (std::string("\t") + TL("Toggle Menu Tooltips") + std::string("\t") + TL("Toggles whether tooltips in the menu shall be shown.")).c_str(),
832 myShowToolTipsMenu->setChecked(getApp()->reg().readIntEntry("gui", "menuToolTips", 0) != 1);
834 }
836 {
837 // total waitingTime
838 myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBar);
840 new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
841 GUIDesigns::buildFXLabel(myToolBar6, TL("Waiting Time:"), "", TL("Time spent waiting accumulated for all vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
842 myWaitingTimeLabel = new MFXLCDLabel(myToolBar6, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
847 myWaitingTimeLabel->setText("-------------");
848 // idealistic time loss
849 myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBar);
851 new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
852 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);
853 myTimeLossLabel = new MFXLCDLabel(myToolBar7, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
858 myTimeLossLabel->setText("-------------");
859 // total driving distance
860 myToolBarDrag9 = new FXToolBarShell(this, GUIDesignToolBar);
862 new FXToolBarGrip(myToolBar9, myToolBar9, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
863 GUIDesigns::buildFXLabel(myToolBar9, TL("Distance (km):"), "", TL("Total distance driven by DRT vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
864 myTotalDistanceLabel = new MFXLCDLabel(myToolBar9, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
869 myTotalDistanceLabel->setText("-------------");
870 // emergency vehicle counts
871 myToolBarDrag10 = new FXToolBarShell(this, GUIDesignToolBar);
873 new FXToolBarGrip(myToolBar10, myToolBar10, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
874 GUIDesigns::buildFXLabel(myToolBar10, TL("Emergency Vehicle waiting time:"), "", TL("Time spent waiting accumulated for emergency vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
875 myEmergencyVehicleLabel = new MFXLCDLabel(myToolBar10, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
880 myEmergencyVehicleLabel->setText("-------------");
881 }
882}
883
884
885void
886GUIApplicationWindow::buildRecentNetworks(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentNetworks) {
887 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
888 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_1);
889 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_2);
890 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_3);
891 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_4);
892 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_5);
893 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_6);
894 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_7);
895 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_8);
896 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_9);
897 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_10);
898 new FXMenuSeparator(fileMenuRecentNetworks); // NOSONAR, Fox does the cleanup
899 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("Cl&ear Recent Networks"), nullptr, &myRecentNetworks, FXRecentFiles::ID_CLEAR);
900 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("No Recent Networks"), nullptr, &myRecentNetworks, MFXRecentNetworks::ID_NOFILES);
901 // set target
902 myRecentNetworks.setTarget(this);
903 myRecentNetworks.setSelector(MID_RECENTFILE);
904 new FXMenuCascade(fileMenu, TL("Recent Networks"), nullptr, fileMenuRecentNetworks);
905}
906
907
908void
909GUIApplicationWindow::buildRecentConfigs(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentConfigs) {
910 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
911 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_1);
912 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_2);
913 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_3);
914 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_4);
915 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_5);
916 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_6);
917 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_7);
918 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_8);
919 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_9);
920 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_10);
921 new FXMenuSeparator(fileMenuRecentConfigs); // NOSONAR, Fox does the cleanup
922 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("Cl&ear Recent Configs"), nullptr, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
923 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("No Recent Configs"), nullptr, &myRecentConfigs, MFXRecentNetworks::ID_NOFILES);
924 // set target
925 myRecentConfigs.setTarget(this);
926 myRecentConfigs.setSelector(MID_RECENTFILE);
927 new FXMenuCascade(fileMenu, TL("Recent Configs"), nullptr, fileMenuRecentConfigs);
928}
929
930
931long
932GUIApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
934 getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
935 getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
936 getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
937 getApp()->reg().writeIntEntry("gui", "alternateSimDelay", (int)myAlternateSimDelay);
939 getApp()->exit(0);
940 return 1;
941}
942
943
944long
945GUIApplicationWindow::onCmdEditChosen(FXObject* menu, FXSelector, void*) {
946 FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
947 if (mc->getText() == StringUtils::replace(TL("Edit Selected..."), "&", "").c_str()) {
949 chooser->create();
950 chooser->show();
951 } else {
953 const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
954 for (MSEdgeVector::const_iterator i = MSEdge::getAllEdges().begin(); i != MSEdge::getAllEdges().end(); ++i) {
955 const std::vector<MSLane*>& lanes = (*i)->getLanes();
956 for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
957 GUILane* lane = dynamic_cast<GUILane*>(*it);
958 assert(lane != 0);
959 if ((lane->getPermissions() & svc) != 0) {
960 gSelected.select(lane->getGlID());
961 }
962 }
963 }
964 if (myMDIClient->numChildren() > 0) {
965 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
966 if (w != nullptr) {
967 // color by selection
969 }
970 }
971 }
973 }
974 return 1;
975}
976
977
978long
979GUIApplicationWindow::onCmdEditBreakpoints(FXObject*, FXSelector, void*) {
980 if (myBreakpointDialog == nullptr) {
982 } else {
983 myBreakpointDialog->restore();
984 myBreakpointDialog->setFocus();
985 myBreakpointDialog->raise();
986 }
987 return 1;
988}
989
990
991long
992GUIApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
993 if (!myGLWindows.empty()) {
994 myGLWindows[0]->getView()->showViewportEditor();
995 }
996 return 1;
997}
998
999
1000long
1001GUIApplicationWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
1002 if (!myGLWindows.empty()) {
1003 myGLWindows[0]->getView()->showViewschemeEditor();
1004 }
1005 return 1;
1006}
1007
1008
1009long
1010GUIApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
1011 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html");
1012 return 1;
1013}
1014
1015
1016long
1017GUIApplicationWindow::onCmdChangelog(FXObject*, FXSelector, void*) {
1018 // update in every version
1019 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/ChangeLog.html");
1020 return 1;
1021}
1022
1023
1024long
1025GUIApplicationWindow::onCmdHotkeys(FXObject*, FXSelector, void*) {
1026 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html#keyboard_shortcuts");
1027 return 1;
1028}
1029
1030
1031long
1032GUIApplicationWindow::onCmdTutorial(FXObject*, FXSelector, void*) {
1033 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/Tutorials/index.html");
1034 return 1;
1035}
1036
1037
1038long
1039GUIApplicationWindow::onCmdOpenInNetedit(FXObject* sender, FXSelector, void* ptr) {
1040 if (myGLWindows.empty()) {
1041 return 1;
1042 }
1043 bool onlyNet;
1044 if (sender == myOpenNetInNetedit) {
1045 onlyNet = true;
1046 } else if (sender == myOpenInNetedit) {
1047 onlyNet = false;
1048 } else {
1049 // we have to check (menu-item) sender first because ptr is only valid when
1050 // triggered via hotkey
1051 FXEvent* e = (FXEvent*) ptr;
1052 onlyNet = (e->state & SHIFTMASK) != 0;
1053 }
1054 FXRegistry reg("SUMO netedit", "netedit");
1055 reg.read();
1056 const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
1057 reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
1058 reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
1059 reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
1060 reg.write();
1061 std::string netedit = "netedit";
1062 const char* sumoPath = getenv("SUMO_HOME");
1063 if (sumoPath != nullptr) {
1064 std::string newPath = std::string(sumoPath) + "/bin/netedit";
1065 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1066 netedit = "\"" + newPath + "\"";
1067 }
1068 }
1069 // declare command for calling netedit using the viewport saved in registry
1070 std::string cmd = netedit + " --registry-viewport";
1071 // continue depending if we're loading only a network or the entire sumo config
1072 if (myLoadAdditionalsInNetedit->shown() && !onlyNet) {
1073 cmd += " --sumocfg-file \"" + OptionsCont::getOptions().getString("configuration-file") + "\"";
1074 // check if ignore additional or demand elements
1075 if (myLoadAdditionalsInNetedit->getCheck() == FALSE) {
1076 cmd += " --ignore.additionalelements";
1077 }
1078 if (myLoadDemandInNetedit->getCheck() == FALSE) {
1079 cmd += " --ignore.routeelements";
1080 }
1081 } else {
1082 cmd += " -s \"" + OptionsCont::getOptions().getString("net-file") + "\"";
1083 }
1084 // start in background
1085#ifndef WIN32
1086 cmd = cmd + " &";
1087#else
1088 // see "help start" for the parameters
1089 cmd = "start /B \"\" " + cmd;
1090#endif
1091 WRITE_MESSAGEF(TL("Running %."), cmd);
1092 // yay! fun with dangerous commands... Never use this over the internet
1094 return 1;
1095}
1096
1097
1098long
1099GUIApplicationWindow::onCmdNewWindow(FXObject*, FXSelector, void*) {
1100 FXRegistry reg("SUMO sumo-gui", "sumo-gui");
1101 std::string sumo_gui = "sumo-gui";
1102 const char* sumoPath = getenv("SUMO_HOME");
1103 if (sumoPath != nullptr) {
1104 std::string newPath = std::string(sumoPath) + "/bin/sumo_gui";
1105 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1106 sumo_gui = "\"" + newPath + "\"";
1107 }
1108 }
1109 std::string cmd = sumo_gui;
1110 // start in background
1111#ifndef WIN32
1112 cmd = cmd + " &";
1113#else
1114 // see "help start" for the parameters
1115 cmd = "start /B \"\" " + cmd;
1116#endif
1117 WRITE_MESSAGEF(TL("Running %."), cmd);
1118 // yay! fun with dangerous commands... Never use this over the internet
1120 return 1;
1121}
1122
1123
1124long
1126 // get the new file name
1127 FXFileDialog opendialog(this, TL("Open Simulation Configuration"));
1129 opendialog.setSelectMode(SELECTFILE_EXISTING);
1130 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1131 if (gCurrentFolder.length() != 0) {
1132 opendialog.setDirectory(gCurrentFolder);
1133 }
1134 if (opendialog.execute()) {
1135 gCurrentFolder = opendialog.getDirectory();
1136 std::string file = opendialog.getFilename().text();
1137 loadConfigOrNet(file);
1138 myRecentConfigs.appendFile(file.c_str());
1139 }
1140 return 1;
1141}
1142
1143
1144long
1145GUIApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
1146 // get the new file name
1147 FXFileDialog opendialog(this, TL("Open Network"));
1148 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1149 opendialog.setSelectMode(SELECTFILE_EXISTING);
1150 opendialog.setPatternList(SUMOXMLDefinitions::NetFileExtensions.getMultilineString().c_str());
1151 if (gCurrentFolder.length() != 0) {
1152 opendialog.setDirectory(gCurrentFolder);
1153 }
1154 if (opendialog.execute()) {
1155 gCurrentFolder = opendialog.getDirectory();
1156 std::string file = opendialog.getFilename().text();
1157 loadConfigOrNet(file);
1158 myRecentNetworks.appendFile(file.c_str());
1159 }
1160 return 1;
1161}
1162
1163
1164long
1165GUIApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
1166 // get the shape file name
1167 FXFileDialog opendialog(this, TL("Open Shapes"));
1168 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_SHAPES));
1169 opendialog.setSelectMode(SELECTFILE_EXISTING);
1170 opendialog.setPatternList(SUMOXMLDefinitions::ShapesFileExtensions.getMultilineString().c_str());
1171 if (gCurrentFolder.length() != 0) {
1172 opendialog.setDirectory(gCurrentFolder);
1173 }
1174 if (opendialog.execute()) {
1175 gCurrentFolder = opendialog.getDirectory();
1176 std::string file = opendialog.getFilename().text();
1177
1178 dynamic_cast<GUIShapeContainer&>(myRunThread->getNet().getShapeContainer()).allowReplacement();
1180 if (!XMLSubSys::runParser(handler, file, false)) {
1181 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1182 }
1183 update();
1184 if (myMDIClient->numChildren() > 0) {
1185 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1186 if (w != nullptr) {
1187 w->getView()->update();
1188 }
1189 }
1190 }
1191 return 1;
1192}
1193
1194
1195long
1196GUIApplicationWindow::onCmdOpenEdgeData(FXObject*, FXSelector, void*) {
1197 // get the shape file name
1198 FXFileDialog opendialog(this, TL("Open EdgeData"));
1199 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1200 opendialog.setSelectMode(SELECTFILE_EXISTING);
1201 opendialog.setPatternList(SUMOXMLDefinitions::EdgeDataFileExtensions.getMultilineString().c_str());
1202 if (gCurrentFolder.length() != 0) {
1203 opendialog.setDirectory(gCurrentFolder);
1204 }
1205 if (opendialog.execute()) {
1206 gCurrentFolder = opendialog.getDirectory();
1207 std::string file = opendialog.getFilename().text();
1208 if (!GUINet::getGUIInstance()->loadEdgeData(file)) {
1209 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1210 }
1211 update();
1212 if (myMDIClient->numChildren() > 0) {
1213 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1214 if (w != nullptr) {
1215 w->getView()->update();
1216 }
1217 }
1218 }
1219 return 1;
1220}
1221
1222
1223long
1224GUIApplicationWindow::onCmdReload(FXObject* sender, FXSelector sel, void*) {
1225 if (!myAmLoading && (sender == nullptr || (myRunThread->networkAvailable() && myLoadThread->getFileName() != "" && TraCIServer::getInstance() == nullptr))) {
1227 getApp()->beginWaitCursor();
1228 myAmLoading = true;
1229 myIsReload = sender != nullptr || sel == 1;
1231 myLoadThread->start();
1232 if (sender == nullptr) {
1233 setStatusBarText(sel == 1 ? TL("Auto-Reloading.") : TL("TraCI-Loading."));
1234 } else {
1235 setStatusBarText(TL("Reloading."));
1236 }
1237 update();
1238 }
1239 return 1;
1240}
1241
1242
1243long
1244GUIApplicationWindow::onCmdQuickReload(FXObject*, FXSelector, void*) {
1245 if (!myAmLoading) {
1246 setStatusBarText(TL("Quick-Reloading."));
1248 }
1249 return 1;
1250}
1251
1252
1253long
1254GUIApplicationWindow::onCmdOpenRecent(FXObject* /* sender */, FXSelector, void* ptr) {
1255 if (myAmLoading) {
1256 myStatusbar->getStatusLine()->setText(TL("Already loading!"));
1257 return 1;
1258 }
1259 std::string file((const char*)ptr);
1260 loadConfigOrNet(file);
1261 return 1;
1262}
1263
1264
1265long
1266GUIApplicationWindow::onCmdSaveConfig(FXObject*, FXSelector, void*) {
1267 // get the new file name
1268 FXFileDialog opendialog(this, TL("Save SUMO Configuration"));
1269 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1270 opendialog.setSelectMode(SELECTFILE_ANY);
1271 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1272 if (gCurrentFolder.length() != 0) {
1273 opendialog.setDirectory(gCurrentFolder);
1274 }
1275 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1276 return 1;
1277 }
1278 const std::string file = MFXUtils::assureExtension(opendialog).text();
1279 std::ofstream out(XMLSubSys::transcodeToLocal(file));
1280 if (out.good()) {
1281 OptionsCont::getOptions().writeConfiguration(out, true, false, false, file, true);
1282 setStatusBarText(TLF("Configuration saved to %.", file));
1283 } else {
1284 setStatusBarText(TLF("Could not save configuration to %.", file));
1285 }
1286 out.close();
1287 return 1;
1288}
1289
1290
1291long
1292GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
1294 return 1;
1295}
1296
1297
1298long
1299GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
1300 sender->handle(this,
1301 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1302 ptr);
1303 return 1;
1304}
1305
1306
1307long
1308GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
1309 sender->handle(this,
1311 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1312 ptr);
1313 return 1;
1314}
1315
1316
1317long
1318GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
1319 sender->handle(this,
1320 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1321 ptr);
1322 return 1;
1323}
1324
1325
1326long
1327GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
1328 sender->handle(this,
1330 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1331 ptr);
1332 return 1;
1333}
1334
1335
1336long
1337GUIApplicationWindow::onCmdStart(FXObject*, FXSelector, void*) {
1338 // check whether a net was loaded successfully
1339 if (!myRunThread->networkAvailable()) {
1340 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1341 return 1;
1342 }
1343 // check whether it was started before and paused;
1344 if (!myWasStarted) {
1345 myRunThread->begin();
1346 myWasStarted = true;
1347 }
1349 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1350 return 1;
1351}
1352
1353
1354long
1355GUIApplicationWindow::onCmdStop(FXObject*, FXSelector, void*) {
1356 myRunThread->stop();
1357 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1358 return 1;
1359}
1360
1361
1362long
1363GUIApplicationWindow::onCmdStep(FXObject*, FXSelector, void*) {
1364 // check whether a net was loaded successfully
1365 if (!myRunThread->networkAvailable()) {
1366 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1367 return 1;
1368 }
1369 // check whether it was started before and paused;
1370 if (!myWasStarted) {
1371 myRunThread->begin();
1372 myWasStarted = true;
1373 }
1375 return 1;
1376}
1377
1378
1379long
1380GUIApplicationWindow::onCmdSaveState(FXObject*, FXSelector, void*) {
1381 // get the new file name
1382 FXFileDialog opendialog(this, TL("Save Simulation State"));
1383 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1384 opendialog.setSelectMode(SELECTFILE_ANY);
1385 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1386 if (gCurrentFolder.length() != 0) {
1387 opendialog.setDirectory(gCurrentFolder);
1388 }
1389 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1390 return 1;
1391 }
1392 const std::string file = MFXUtils::assureExtension(opendialog).text();
1393 MSStateHandler::saveState(file, MSNet::getInstance()->getCurrentTimeStep(), false);
1394 setStatusBarText(TLF("Simulation state saved to '%'.", file));
1395 return 1;
1396}
1397
1398
1399long
1400GUIApplicationWindow::onCmdLoadState(FXObject*, FXSelector, void*) {
1401 // get the new file name
1402 FXFileDialog opendialog(this, TL("Load Simulation State"));
1403 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN));
1404 opendialog.setSelectMode(SELECTFILE_ANY);
1405 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1406 if (gCurrentFolder.length() != 0) {
1407 opendialog.setDirectory(gCurrentFolder);
1408 }
1409 if (opendialog.execute() && FXStat::exists(opendialog.getFilename())) {
1410 gCurrentFolder = opendialog.getDirectory();
1411 const std::string file = opendialog.getFilename().text();
1412 try {
1413 MSNet::getInstance()->loadState(file, true);
1414 setStatusBarText(TLF("State loaded from '%'.", file));
1415 } catch (ProcessError& e) {
1416 setStatusBarText(TLF("Failed to load state from '%' (%).", file, e.what()));
1417 }
1418 }
1419 return 1;
1420}
1421
1422
1423long
1424GUIApplicationWindow::onCmdTimeToggle(FXObject*, FXSelector, void*) {
1425 // toggle show time as HMS
1430 }
1431 return 1;
1432}
1433
1434
1435long
1436GUIApplicationWindow::onCmdDelayInc(FXObject*, FXSelector, void*) {
1437 if (mySimDelay < 10) {
1438 mySimDelay = 10;
1439 } else if (mySimDelay >= 20 && mySimDelay < 50) {
1440 mySimDelay = 50;
1441 } else if (mySimDelay >= 200 && mySimDelay < 500) {
1442 mySimDelay = 500;
1443 } else {
1444 mySimDelay *= 2;
1445 }
1446 if (mySimDelay > 1000) {
1447 // setting high delay by pressing the key too often is hard to recover from
1448 mySimDelay = 1000;
1449 }
1450 mySimDelaySlider->setValue((int)mySimDelay);
1451 mySimDelaySpinner->setValue(mySimDelay);
1452 return 1;
1453}
1454
1455
1456long
1457GUIApplicationWindow::onCmdDelayDec(FXObject*, FXSelector, void*) {
1458 if (mySimDelay <= 10) {
1459 mySimDelay = 0;
1460 } else if (mySimDelay > 20 && mySimDelay <= 50) {
1461 mySimDelay = 20;
1462 } else if (mySimDelay > 200 && mySimDelay <= 500) {
1463 mySimDelay = 200;
1464 } else {
1465 mySimDelay /= 2;
1466 }
1467 mySimDelaySlider->setValue((int)mySimDelay);
1468 mySimDelaySpinner->setValue(mySimDelay);
1469 return 1;
1470}
1471
1472
1473long
1474GUIApplicationWindow::onCmdDelayToggle(FXObject*, FXSelector, void*) {
1475 const double tmp = myAlternateSimDelay;
1477 mySimDelay = tmp;
1478 return 1;
1479}
1480
1481
1482long
1483GUIApplicationWindow::onCmdDemandScale(FXObject*, FXSelector, void*) {
1486 }
1487 return 1;
1488}
1489
1490
1491long
1492GUIApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
1494 return 1;
1495}
1496
1497
1498long
1499GUIApplicationWindow::onCmdBreakpoint(FXObject*, FXSelector, void*) {
1500 // see updateTimeLCD for the DELTA_T
1503 }
1504 return 1;
1505}
1506
1507
1508long
1509GUIApplicationWindow::onCmdBreakpointEarly(FXObject*, FXSelector, void*) {
1510 // see updateTimeLCD for the DELTA_T
1513 }
1514 return 1;
1515}
1516
1517
1518long
1519GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
1520 sender->handle(this,
1522 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1523 ptr);
1525 // bind start simulation with space key
1527 }
1528 return 1;
1529}
1530
1531
1532long
1533GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
1534 sender->handle(this,
1536 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1537 ptr);
1539 // bind stop simulation with space key
1541 }
1542 return 1;
1543}
1544
1545
1546long
1547GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
1548 sender->handle(this,
1550 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1551 ptr);
1552 return 1;
1553}
1554
1555
1556long
1557GUIApplicationWindow::onUpdNeedsNetwork(FXObject* sender, FXSelector, void* ptr) {
1558 // check if there is a loaded network and gui isn't loading
1560 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1561 // enable certain elements manually
1562 mySelectLanesMenuCascade->enable();
1563 myScaleTrafficTooltip->setTipText(TL("Scale number of vehicles in simulation"));
1564 } else {
1565 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1566 // disable certain elements manually
1567 mySelectLanesMenuCascade->disable();
1568 myScaleTrafficTooltip->setTipText("");
1569 }
1570 return 1;
1571}
1572
1573
1574long
1575GUIApplicationWindow::onUpdNeedsSumoConfig(FXObject* sender, FXSelector, void* ptr) {
1576 // check if there is a loaded network and gui isn't loading
1577 if (myRunThread->networkAvailable() && !myAmLoading && OptionsCont::getOptions().isSet("configuration-file")) {
1578 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1579 sender->handle(this, FXSEL(SEL_COMMAND, ID_SHOW), ptr);
1580 myOpenInNetedit->setText(TL("Open sumo config in netedit"));
1581 } else {
1582 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1583 sender->handle(this, FXSEL(SEL_COMMAND, ID_HIDE), ptr);
1584 myOpenInNetedit->setText(TL("Open network in netedit"));
1585 }
1586 return 1;
1587}
1588
1589
1590long
1591GUIApplicationWindow::onUpdTraCIStatus(FXObject* /*sender*/, FXSelector, void* /*ptr*/) {
1593 myTraCiFrame->show();
1594 } else {
1595 myTraCiFrame->hide();
1596 }
1597 return 1;
1598}
1599
1600
1601long
1602GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
1603 if (myMDIClient->numChildren() > 0) {
1604 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1605 if (w != nullptr) {
1606 w->onCmdLocate(nullptr, sel, nullptr);
1607 }
1608 }
1609 return 1;
1610}
1611
1612
1613long
1614GUIApplicationWindow::onCmdShowStats(FXObject*, FXSelector, void*) {
1615 if (myMDIClient->numChildren() > 0) {
1616 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1618 }
1619 return 1;
1620}
1621
1622
1623long
1624GUIApplicationWindow::onCmdAppSettings(FXObject*, FXSelector, void*) {
1626 d->create();
1627 d->show(PLACEMENT_OWNER);
1628 return 1;
1629}
1630
1631
1632long
1633GUIApplicationWindow::onCmdGaming(FXObject*, FXSelector, void*) {
1634 if (myGLWindows.empty()) {
1635 return 1;
1636 }
1638 myGLWindows[0]->getView()->editVisualisationSettings()->gaming = myAmGaming;
1639 if (myAmGaming) {
1640 myGamingModeCheckbox->setCheck(TRUE);
1641 myMenuBar->hide();
1642 myStatusbar->hide();
1643 myToolBar1->hide();
1644 myToolBar2->hide();
1645 myToolBar4->hide();
1646 myToolBar5->hide();
1647 myToolBar6->show();
1648 myToolBar8->hide();
1649 myToolBar10->show();
1650 if (myTLSGame) {
1651 myToolBar7->show();
1652 } else {
1653 myToolBar9->show();
1654 }
1655 myMessageWindow->hide();
1661 } else {
1662 myGamingModeCheckbox->setCheck(FALSE);
1663 myMenuBar->show();
1664 myStatusbar->show();
1665 myToolBar1->show();
1666 myToolBar2->show();
1667 myToolBar4->show();
1668 myToolBar5->show();
1669 myToolBar6->hide();
1670 myToolBar7->hide();
1671 myToolBar8->show();
1672 myToolBar9->hide();
1673 myToolBar10->hide();
1674 myMessageWindow->show();
1676 }
1677 if (myMDIClient->numChildren() > 0) {
1678 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1679 if (w != nullptr) {
1681 }
1682 }
1683 update();
1684 return 1;
1685}
1686
1687
1688long
1690 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1691 if (w != nullptr) {
1692 // show or hide grid depending of myNetworkViewOptions.menuCheckToggleGrid
1695 } else {
1697 }
1698 w->getView()->update();
1699 }
1700 return 1;
1701}
1702
1703
1704long
1706 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1707 if (w != nullptr) {
1708 // toggle secondary shape visualization
1710 w->getView()->update();
1711 }
1712 return 1;
1713}
1714
1715
1716long
1717GUIApplicationWindow::onCmdFullScreen(FXObject*, FXSelector, void*) {
1718 if (myGLWindows.empty()) {
1719 return 1;
1720 }
1722 if (myAmFullScreen) {
1723 getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1724 getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1725 getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1726 getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1727 maximize();
1728 setDecorations(DECOR_NONE);
1729 place(PLACEMENT_MAXIMIZED);
1730 myMenuBar->hide();
1731 myStatusbar->hide();
1732 myToolBar1->hide();
1733 myToolBar2->hide();
1734 myToolBar3->hide();
1735 myToolBar4->hide();
1736 myToolBar5->hide();
1737 myToolBar6->hide();
1738 myToolBar7->hide();
1739 myToolBar8->hide();
1740 myMessageWindow->hide();
1741 if (myMDIClient->numChildren() > 0) {
1742 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1743 if (w != nullptr) {
1744 w->setToolBarVisibility(false);
1745 }
1746 }
1747 update();
1748 } else {
1749 place(PLACEMENT_VISIBLE);
1750 setDecorations(DECOR_ALL);
1751 restore();
1752 myToolBar3->show();
1754 onCmdGaming(nullptr, 0, nullptr);
1755 setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
1756 setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1757 setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
1758 setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
1759 }
1760 // show or hide the full screen hint
1761 for (GUIGlChildWindow* const window : myGLWindows) {
1762 window->getView()->update();
1763 }
1764 return 1;
1765}
1766
1767
1768long
1769GUIApplicationWindow::onCmdListInternal(FXObject*, FXSelector, void*) {
1771 return 1;
1772}
1773
1774
1775long
1776GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) {
1778 return 1;
1779}
1780
1781long
1782GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) {
1784 return 1;
1785}
1786
1787
1788long
1789GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) {
1791 return 1;
1792}
1793
1794
1795#ifdef HAVE_OSG
1796long
1797GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1799 return 1;
1800}
1801#endif
1802
1803
1804long
1805GUIApplicationWindow::onCmdShowToolTipsView(FXObject*, FXSelector, void*) {
1806 // invert check
1808 // update parent
1810 // save in registry
1811 getApp()->reg().writeIntEntry("gui", "viewToolTips", myShowToolTipsView->amChecked() ? 1 : 0);
1812 return 1;
1813}
1814
1815
1816long
1817GUIApplicationWindow::onCmdShowToolTipsMenu(FXObject*, FXSelector, void*) {
1818 // invert check
1820 // update parent
1822 // save in registry
1823 getApp()->reg().writeIntEntry("gui", "menuToolTips", myShowToolTipsMenu->amChecked() ? 0 : 1);
1824 return 1;
1825}
1826
1827
1828long
1829GUIApplicationWindow::onCmdFeedback(FXObject*, FXSelector, void*) {
1830 // create and open feedback dialog
1831 GUIDialog_Feedback* feedback = new GUIDialog_Feedback(this);
1832 feedback->create();
1833 feedback->show(PLACEMENT_OWNER);
1834 return 1;
1835}
1836
1837
1838long
1839GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
1840 GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this);
1841 about->create();
1842 about->show(PLACEMENT_OWNER);
1843 return 1;
1844}
1845
1846
1847long
1848GUIApplicationWindow::onCmdHallOfFame(FXObject*, FXSelector, void*) {
1850 hall->create();
1851 hall->show(PLACEMENT_OWNER);
1852 return 1;
1853}
1854
1855
1856long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1857 FXEvent* event = (FXEvent*)ptr;
1858 FXString string = GUIUserIO::clipped.c_str();
1859 setDNDData(FROM_CLIPBOARD, event->target, string);
1860 return 1;
1861}
1862
1863
1864long
1865GUIApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
1866 eventOccurred();
1867 return 1;
1868}
1869
1870
1871long
1872GUIApplicationWindow::onRunThreadEvent(FXObject*, FXSelector, void*) {
1873 eventOccurred();
1874 return 1;
1875}
1876
1877
1878void
1880 while (!myEvents.empty()) {
1881 // get the next event
1882 GUIEvent* e = myEvents.top();
1883 myEvents.pop();
1884 // process
1885 switch (e->getOwnType()) {
1888 setFocus();
1889 break;
1891 if (myRunThread->networkAvailable()) { // avoid race-condition related crash if reload was pressed
1893 }
1894 break;
1902 break;
1904 GUIEvent_AddView* ave = dynamic_cast<GUIEvent_AddView*>(e);
1906 if (ave->getSchemeName() != "") {
1907 MFXComboBoxIcon* sCombo = v->getColoringSchemesCombo();
1908 int index = sCombo->findItem(ave->getSchemeName().c_str());
1909 if (index >= 0) {
1910 sCombo->setCurrentItem(index);
1911 }
1912 v->setColorScheme(ave->getSchemeName());
1913 }
1914 break;
1915 }
1917 GUIEvent_CloseView* ave = dynamic_cast<GUIEvent_CloseView*>(e);
1918 removeViewByID(ave->getCaption());
1919 break;
1920 }
1923 break;
1924 default:
1925 break;
1926 }
1927 delete e;
1928 }
1929 myToolBar2->forceRefresh();
1930 myToolBar3->forceRefresh();
1931}
1932
1933
1934void
1936 myAmLoading = false;
1938 // check whether the loading was successful
1939 if (ec->myNet == nullptr) {
1940 // report failure
1941 setStatusBarText(TLF("Loading of '%' failed!", ec->myFile));
1944 getApp()->exit(1);
1945 }
1946 } else {
1947 // initialise simulation thread
1948 if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1951 getApp()->exit(1);
1952 }
1953 } else {
1954 // report success
1955 setStatusBarText(TLF("'%' loaded.", ec->myFile));
1957 myWasStarted = false;
1959 // initialise views
1960 myViewNumber = 0;
1962 // check/record settings file modification time
1963 long long mTime = myGuiSettingsFileMTime;
1964 if (ec->mySettingsFiles.size() > 0) {
1965 for (std::string fname : ec->mySettingsFiles) {
1966 mTime = MAX2(mTime, SysUtils::getModifiedTime(fname));
1967 }
1968 }
1969 // always reload if settings were modified or to restore multiple views
1970 if (!myIsReload) {
1972 }
1973 if (ec->mySettingsFiles.size() > 0 && (!myIsReload || myGuiSettingsFileMTime < mTime || ec->mySettingsFiles.size() > 1)) {
1974 // open a view for each file and apply settings
1975 for (std::string fname : ec->mySettingsFiles) {
1976 GUISettingsHandler settings(getApp(), fname);
1977 GUISUMOViewParent::ViewType vt = defaultType;
1978 if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
1980 }
1981 if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
1983 }
1984 GUISUMOAbstractView* view = openNewView(vt);
1985 if (view == nullptr) {
1986 break;
1987 }
1988 if (settings.getSettingName() != "") {
1989 view->setColorScheme(settings.getSettingName());
1990 MFXComboBoxIcon* sCombo = view->getColoringSchemesCombo();
1991 int index = sCombo->findItem(settings.getSettingName().c_str());
1992 if (index >= 0) {
1993 sCombo->setCurrentItem(index);
1994 }
1995 }
1996 view->addDecals(settings.getDecals());
1997 settings.applyViewport(view);
1998 settings.setSnapshots(view);
1999 if (settings.getDelay() > 0.) {
2000 mySimDelay = settings.getDelay();
2001 }
2002 if (settings.getBreakpoints().size() > 0) {
2004 myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
2005 myRunThread->getBreakpointLock().unlock();
2006 }
2007 myJamSounds = settings.getEventDistribution("jam");
2008 myCollisionSounds = settings.getEventDistribution("collision");
2009 if (settings.getJamSoundTime() > 0) {
2010 myJamSoundTime = settings.getJamSoundTime();
2011 }
2012 for (const std::string& tlsID : settings.getTrackers()) {
2013 if (MSNet::getInstance()->getTLSControl().knows(tlsID)) {
2016 if (tllW) {
2017 tllW->begin2TrackPhases(this);
2018 }
2019 } else {
2020 WRITE_WARNINGF("Tracker for unknown tlLogic '%' in settings file '%'", tlsID, fname);
2021 }
2022 }
2023 }
2024 } else {
2025 openNewView(defaultType);
2026 }
2027 myGuiSettingsFileMTime = mTime;
2028 if (!OptionsCont::getOptions().isDefault("delay")) {
2029 setDelay(OptionsCont::getOptions().getFloat("delay"));
2030 mySimDelaySlider->setValue((int)mySimDelay);
2031 mySimDelaySpinner->setValue(mySimDelay);
2032 }
2033 if (!OptionsCont::getOptions().isDefault("breakpoints") && !myIsReload) {
2034 std::vector<SUMOTime> breakpoints;
2035 for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
2036 SUMOTime t = string2time(val);
2037 // round down to nearest reachable time step
2038 t -= t % DELTA_T;
2039 breakpoints.push_back(t);
2040 }
2041 std::sort(breakpoints.begin(), breakpoints.end());
2043 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
2044 myRunThread->getBreakpointLock().unlock();
2045 }
2046 if (!OptionsCont::getOptions().isDefault("selection-file")) {
2047 delete myDynamicSelection;
2048 myDynamicSelection = new std::stringstream();
2049 std::string msg = gSelected.load(OptionsCont::getOptions().getString("selection-file"), GLO_MAX, myDynamicSelection);
2050 if (msg != "") {
2051 WRITE_ERRORF("Errors while loading selection: %", msg.c_str());
2052 }
2053 if (!myDynamicSelection->str().empty()) {
2054 std::string dummy;
2055 int numNotFound = 0;
2056 while (myDynamicSelection->good()) {
2057 (*myDynamicSelection) >> dummy;
2058 numNotFound++;
2059 }
2060 myDynamicSelection->clear(); // first clear error state before seek works
2061 myDynamicSelection->seekg(0);
2062 // @note for some reason the last line is read twice
2063 WRITE_MESSAGEF("% dynamic objects not present while loading selection", numNotFound - 1);
2064 }
2065 }
2066 myTLSGame = OptionsCont::getOptions().getString("game.mode") == "tls";
2067 if (OptionsCont::getOptions().getBool("game")) {
2068 if (myTLSGame) {
2069 setTitle(TL("SUMO Interactive Traffic Light"));
2070 } else {
2071 setTitle(TL("SUMO Interactive Demand-Responsive-Transport"));
2072 }
2073 onCmdGaming(nullptr, 0, nullptr);
2074 } else {
2075 // set simulation name on the caption
2076 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str()));
2077 }
2078 if (ec->myViewportFromRegistry) {
2079 Position off;
2080 off.set(getApp()->reg().readRealEntry("viewport", "x"),
2081 getApp()->reg().readRealEntry("viewport", "y"),
2082 getApp()->reg().readRealEntry("viewport", "z"));
2083 Position p(off.x(), off.y(), 0);
2084 GUISUMOAbstractView* view = myGLWindows[0]->getView();
2085 view->setViewportFromToRot(off, p, 0);
2086 }
2087 // set simulation step begin information
2088 myLCDLabel->setText("----------------");
2090 myStatButtons[STAT_VEHS]->setIcon(GUIIconSubSys::getIcon(greenVehIcon));
2091
2092 const std::string pedModel = OptionsCont::getOptions().getString("pedestrian.model");
2093 if (StringUtils::to_lower_case(pedModel) == "noninteracting") {
2095 } else if (StringUtils::to_lower_case(pedModel) == "jupedsim") {
2097 } else {
2099 }
2100
2101 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2102 (*it)->setText("-");
2103 }
2104 // initialize scale from options unless already set in the UI
2105 if (myDemandScaleSpinner->getValue() == 1 || !OptionsCont::getOptions().isDefault("scale")) {
2107 }
2109 }
2110 }
2111 getApp()->endWaitCursor();
2112 // start if wished
2114 onCmdStart(nullptr, 0, nullptr);
2115 }
2116 update();
2117}
2118
2119
2120void
2122#ifdef WIN32
2123 long t = SysUtils::getCurrentMillis();
2124 // only skip if the simulation is running
2125 if (t - myLastStepEventMillis < MIN_DRAW_DELAY && myRunThread->simulationIsStopable()) {
2126 // do not try to redraw with more than 50FPS (#6371)
2127 return;
2128 }
2130#endif
2132 FXButton* vehStats = myStatButtons[STAT_VEHS];
2133 FXButton* delayStats = myStatButtons[STAT_DELAYED];
2134 FXButton* teleStats = myStatButtons[STAT_TELEPORTS];
2135 FXButton* personStats = myStatButtons[STAT_PERSONS];
2136 FXButton* containerStats = myStatButtons[STAT_CONTAINERS];
2137
2138 const int running = myRunThread->getNet().getVehicleControl().getRunningVehicleNo();
2139 const int backlog = myRunThread->getNet().getInsertionControl().getWaitingVehicleNo();
2140 const int teleports = myRunThread->getNet().getVehicleControl().getTeleportCount();
2141 const int departed = myRunThread->getNet().getVehicleControl().getDepartedVehicleNo();
2143 if (backlog > running) {
2144 if (vehStats->getIcon() == GUIIconSubSys::getIcon(greenVehIcon)) {
2146 }
2147 } else {
2148 if (vehStats->getIcon() == GUIIconSubSys::getIcon(GUIIcon::YELLOWVEHICLE)) {
2149 vehStats->setIcon(GUIIconSubSys::getIcon(greenVehIcon));
2150 }
2151 }
2152 vehStats->setText(toString(running).c_str());
2153 if (backlog > 0) {
2154 if (!delayStats->shown()) {
2155 delayStats->show();
2156 }
2157 delayStats->setText(toString(backlog).c_str());
2158 } else {
2159 if (delayStats->shown()) {
2160 delayStats->hide();
2161 }
2162 }
2163 if (teleports > 0) {
2164 if (!teleStats->shown()) {
2165 teleStats->show();
2166 }
2167 teleStats->setText((toString(100.00 * teleports / departed) + "%").c_str());
2168 }
2169 if (myRunThread->getNet().hasPersons()) {
2170 if (!personStats->shown()) {
2171 personStats->show();
2172 }
2173 personStats->setText(toString(myRunThread->getNet().getPersonControl().getRunningNumber()).c_str());
2174 }
2175 if (myRunThread->getNet().hasContainers()) {
2176 if (!containerStats->shown()) {
2177 containerStats->show();
2178 }
2179 containerStats->setText(toString(myRunThread->getNet().getContainerControl().getRunningNumber()).c_str());
2180 }
2181 if (myAmGaming) {
2182 if (myTLSGame) {
2184 } else {
2186 }
2187 }
2189 getApp()->forceRefresh(); // restores keyboard focus
2190 }
2191 // try to load dynamic selection
2192 if (myDynamicSelection != nullptr) {
2193 std::stringstream tmp;
2195 if (tmp.str().empty()) {
2196 delete myDynamicSelection;
2197 myDynamicSelection = nullptr;
2198 } else {
2199 myDynamicSelection->str(tmp.str());
2200 myDynamicSelection->clear(); // first clear error state before seek works
2201 myDynamicSelection->seekg(0);
2202 }
2203 }
2205 update();
2206}
2207
2208
2209void
2211 GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
2213 setStatusBarText(ec->getMsg());
2214 } else {
2216 }
2217}
2218
2219
2220void
2223 onCmdStop(nullptr, 0, nullptr);
2224 if (ec->getReason() == MSNet::SIMSTATE_LOADING) {
2225 onCmdReload(nullptr, 0, nullptr);
2226 } else if (GUIGlobals::gQuitOnEnd) {
2228 getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
2229 } else if (GUIGlobals::gDemoAutoReload) {
2230 onCmdReload(nullptr, 1, nullptr);
2231 } else if (!myHaveNotifiedAboutSimEnd) {
2232 // GUIRunThread::deleteSim() triggers the final message to the log file
2233 // (this will never reach the GUI but we cannot use WRITE_MESSAGE here
2234 // to avoid a duplicate log entry)
2236 TLF("Simulation ended at time: %. (%)",
2238 // build the text
2239 const std::string text = TLF("Simulation ended at time: %.", time2string(ec->getTimeStep())) + "\n" +
2240 TL("Reason:") + MSNet::getStateMessage(ec->getReason()) + "\n" +
2241 TL("Do you want to close all open files and views?");
2242 FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, TL("Simulation ended"), "%s", text.c_str());
2243 if (answer == 1) { //1:yes, 2:no, 4:esc
2245 } else {
2248 update();
2249 }
2251 }
2252}
2253
2254
2255void
2260#ifdef HAVE_DANGEROUS_SOUNDS // disable user-configurable command execution for public build
2261 if (myJamSounds.getOverallProb() > 0) {
2262 // play honking sound if some vehicle is waiting too long
2263 for (; it != end; ++it) {
2264 // XXX use impatience instead of waiting time ?
2265 if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
2266 const std::string cmd = myJamSounds.get(&myGamingRNG);
2267 if (cmd != "") {
2268 // yay! fun with dangerous commands... Never use this over the internet
2270 // one sound per simulation step is enough
2271 break;
2272 }
2273 }
2274 }
2275 }
2278 if (myPreviousCollisionNumber != collisions) {
2279 const std::string cmd = myCollisionSounds.get(&myGamingRNG);
2280 if (cmd != "") {
2281 // yay! fun with dangerous commands... Never use this over the internet
2283 }
2284 myPreviousCollisionNumber = collisions;
2285 }
2286 }
2287#endif
2288 // update performance indicators
2289 for (it = vc.loadedVehBegin(); it != end; ++it) {
2290 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2291 assert(veh != 0);
2292 if (veh->isOnRoad() && !veh->isStopped()) {
2293 const double vmax = veh->getLane()->getVehicleMaxSpeed(veh);
2294 if (veh->getSpeed() < SUMO_const_haltingSpeed) {
2296 if (veh->getVClass() == SVC_EMERGENCY) {
2298 }
2299 }
2300 myTimeLoss += TIME2STEPS(TS * (vmax - veh->getSpeed()) / vmax); // may be negative with speedFactor > 1
2301 }
2302
2303 }
2307}
2308
2309
2310void
2312 // update performance indicators
2316
2319 for (auto it = vc.loadedVehBegin(); it != end; ++it) {
2320 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2321 assert(veh != 0);
2322 if (veh->isOnRoad() && !veh->isStopped()) {
2324 }
2325 }
2327}
2328
2329
2330void
2332 if (!myAmLoading) {
2334 getApp()->beginWaitCursor();
2335 myAmLoading = true;
2336 myIsReload = false;
2338 gSchemeStorage.saveViewport(0, 0, -1, 0); // recenter view
2340 setStatusBarText(TLF("Loading '%'.", file));
2341 update();
2342 }
2343}
2344
2345
2348 if (!myRunThread->networkAvailable()) {
2349 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
2350 return nullptr;
2351 }
2352 GUISUMOAbstractView* oldView = nullptr;
2353 if (myMDIClient->numChildren() > 0) {
2354 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2355 if (w != nullptr) {
2356 oldView = w->getView();
2357 }
2358 }
2359 if (caption == "") {
2360 caption = "View #" + toString(myViewNumber++);
2361 }
2362 FXuint opts = MDI_TRACKING;
2363 GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
2364 this, GUIIconSubSys::getIcon(GUIIcon::SUMO_MINI), opts, 10, 10, 200, 100);
2366 if (oldView != nullptr) {
2367 // copy viewport
2368 oldView->copyViewportTo(v);
2369 }
2370 w->create();
2371 if (myMDIClient->numChildren() == 1) {
2372 w->maximize();
2373 } else {
2374 myMDIClient->vertical(true);
2375 }
2376 myMDIClient->setActiveChild(w);
2377
2378 return v;
2379}
2380
2381
2382FXGLCanvas*
2384 if (myMDIClient->numChildren() == 0) {
2385 return nullptr;
2386 }
2387 GUISUMOViewParent* share_tmp1 =
2388 static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
2389 return share_tmp1->getBuildGLCanvas();
2390}
2391
2392
2393void
2395 myTrackerLock.lock();
2396 myLCDLabel->setText("----------------");
2399 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2400 (*it)->setText("-");
2401 if (it != myStatButtons.begin()) {
2402 (*it)->hide();
2403 }
2404 }
2405 // save decals and viewport
2406 for (GUIGlChildWindow* window : myGLWindows) {
2407 GUISUMOAbstractView* view = window->getView();
2410 view->getChanger().getZPos(), view->getChanger().getRotation());
2411 }
2412 // delete the simulation
2414 // reset the caption
2415 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
2416 // clear decals and release GPU textures
2417 for (GUIGlChildWindow* window : myGLWindows) {
2418 GUISUMOAbstractView* view = window->getView();
2419 if (view->makeCurrent()) {
2420 view->clearDecals();
2424 view->makeNonCurrent();
2425 }
2426 }
2427 // remove trackers and other external windows (must be delayed until deleteSim)
2428 while (!myGLWindows.empty()) {
2429 delete myGLWindows.front();
2430 }
2431 // make a copy because deleting modifyes the vector;
2432 std::vector<FXMainWindow*> trackerWindows = myTrackerWindows;
2433 for (FXMainWindow* const window : trackerWindows) {
2434 delete window;
2435 }
2436 myTrackerWindows.clear();
2437 // clear selected items
2438 gSelected.clear();
2439 // add a separator to the log
2441 myTrackerLock.unlock();
2442 // remove coordinate information
2443 myGeoCoordinate->setText(TL("N/A"));
2444 myGeoCoordinate->disable();
2445 myGeoCoordinate->setEditable(false);
2446 myCartesianCoordinate->setText(TL("N/A"));
2447 if (myTestCoordinate) {
2448 myTestCoordinate->setText(TL("N/A"));
2449 }
2450 update();
2451}
2452
2453
2454FXCursor*
2456 return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
2457}
2458
2459
2464
2465
2466double
2470
2471
2472void
2474 loadConfigOrNet("");
2475 if (wait) {
2476 while (myAmLoading) {
2477 myRunThread->sleep(50);
2478 }
2479 }
2480}
2481
2482
2483void
2485 myStatusbar->getStatusLine()->setText(text.c_str());
2486 myStatusbar->getStatusLine()->setNormalText(text.c_str());
2487}
2488
2489
2490void
2492 myRecentNetworks.appendFile(f);
2493}
2494
2495
2496void
2498 myRecentConfigs.appendFile(f);
2499}
2500
2501
2502void
2504 if (myShowTimeAsHMS) {
2505 myLCDLabel->setToolTipText("HH:MM:SS");
2506 if (myAmGaming) {
2508 myTimeLossLabel->setToolTipText("HH:MM:SS");
2510 }
2511 } else {
2512 myLCDLabel->setToolTipText(TL("seconds"));
2513 if (myAmGaming) {
2515 myTimeLossLabel->setToolTipText(TL("seconds"));
2517 }
2518 }
2519}
2520
2521
2522void
2524 time -= DELTA_T; // synchronize displayed time with netstate output
2525 if (time < 0) {
2526 myLCDLabel->setText("----------------");
2527 return;
2528 }
2529 if (myAmGaming) {
2530 // show time counting backwards
2531 time = myRunThread->getSimEndTime() - time;
2532 }
2533 std::ostringstream str;
2534 str << std::setfill('0');
2535 const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0;
2536 if (myShowTimeAsHMS) {
2537 SUMOTime day = time / SUMOTime_DAY;
2538 if (day > 0) {
2539 str << day << '-';
2540 time %= SUMOTime_DAY;
2541 }
2542 str << std::setw(2);
2543 str << time / SUMOTime_HOUR << '-';
2544 time %= SUMOTime_HOUR;
2545 str << std::setw(2) << time / SUMOTime_MINUTE << '-';
2546 time %= SUMOTime_MINUTE;
2547 }
2548 str << std::setw(2) << time / 1000;
2549 if (!hideFraction) {
2550 str << '.' << std::setw(3) << time % 1000;
2551 }
2552 myLCDLabel->setText(str.str().c_str());
2553}
2554
2555
2556void
2558 if (press != nullptr) {
2559 myHotkeyPress[key] = press;
2560 }
2561 if (release != nullptr) {
2562 myHotkeyRelease[key] = release;
2563 }
2564}
2565
2566
2567long
2568GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* ptr) {
2569 FXEvent* e = (FXEvent*) ptr;
2570 if (e->code == KEY_Escape) {
2571 if (myGeoCoordinate && myGeoCoordinate->hasFocus()) {
2572 myGeoCoordinate->killFocus();
2573 if (getActiveView()) {
2575 }
2576 return 1;
2577 }
2578 if (myCartesianCoordinate && myCartesianCoordinate->hasFocus()) {
2579 myCartesianCoordinate->killFocus();
2580 if (getActiveView()) {
2582 }
2583 return 1;
2584 }
2585 }
2586 // PgUp and PgDown switch between widgets by default and binding them via menu shortcuts does not work reliably
2587 // so we must intercept them before FXMainWindow can handle it
2588 if (e->code == FX::KEY_Page_Up) {
2589 onCmdDelayInc(nullptr, 0, nullptr);
2590 } else if (e->code == FX::KEY_Page_Down) {
2591 onCmdDelayDec(nullptr, 0, nullptr);
2592 } else {
2593 // disable hotkeys without modifiers for the game
2594 const bool ignoreSimple = myAmGaming && (e->state & (CONTROLMASK | SHIFTMASK | ALTMASK)) == 0;
2595 const long handled = ignoreSimple ? 0 : FXMainWindow::onKeyPress(o, sel, ptr);
2596 if (handled == 0 && myMDIClient->numChildren() > 0) {
2597 auto it = myHotkeyPress.find(e->code);
2598 if (it != myHotkeyPress.end()) {
2599 it->second->execute(SIMSTEP);
2600 }
2601 if (!ignoreSimple) {
2602 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2603 if (w != nullptr) {
2604 w->onKeyPress(nullptr, sel, ptr);
2605 }
2606 }
2607 }
2608 }
2609 return 0;
2610}
2611
2612
2613long
2614GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* ptr) {
2615 const long handled = FXMainWindow::onKeyRelease(o, sel, ptr);
2616 if (handled == 0 && myMDIClient->numChildren() > 0) {
2617 FXEvent* e = (FXEvent*) ptr;
2618 auto it = myHotkeyRelease.find(e->code);
2619 if (it != myHotkeyRelease.end()) {
2620 it->second->execute(SIMSTEP);
2621 }
2622 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2623 if (w != nullptr) {
2624 w->onKeyRelease(nullptr, sel, ptr);
2625 }
2626 }
2627 return 0;
2628}
2629
2630
2631double
2633 return mySimDelay;
2634}
2635
2636
2637void
2639 mySimDelay = delay;
2640}
2641
2642
2643void
2645 myEventMutex.lock();
2646 myEvents.push_back(event);
2648 //myEventCondition.wait(myEventMutex);
2649 myEventMutex.unlock();
2650}
2651
2652
2653void
2654GUIApplicationWindow::setBreakpoints(const std::vector<SUMOTime>& breakpoints) {
2655 if (myRunThread != nullptr) {
2657 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
2658 myRunThread->getBreakpointLock().unlock();
2660 }
2661}
2662
2663
2664void
2666 const SUMOTime begin = string2time(OptionsCont::getOptions().getString("begin"));
2667 if (time >= begin) {
2668 // ensure breakpoint is valid
2669 time -= (time - begin) % DELTA_T;
2670 std::vector<SUMOTime> breakpoints = retrieveBreakpoints();
2671 if (std::find(breakpoints.begin(), breakpoints.end(), time) == breakpoints.end()) {
2672 breakpoints.push_back(time);
2673 std::sort(breakpoints.begin(), breakpoints.end());
2674 setBreakpoints(breakpoints);
2675 setStatusBarText(TLF("Set breakpoint at %", time2string(time)));
2676 }
2677 }
2678}
2679
2680
2681const std::vector<SUMOTime>
2684 std::vector<SUMOTime> result = myRunThread->getBreakpoints();
2685 myRunThread->getBreakpointLock().unlock();
2686 return result;
2687}
2688
2689
2690void
2694
2695/****************************************************************************/
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