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-2025 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>
41#include <netload/NLHandler.h>
68#include <utils/xml/XMLSubSys.h>
69
73#include "GUIGlobals.h"
74#include "GUILoadThread.h"
75#include "GUIRunThread.h"
81
82
83#define MIN_DRAW_DELAY 20
84//#define HAVE_DANGEROUS_SOUNDS
85
86// ===========================================================================
87// FOX-declarations
88// ===========================================================================
89FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[] = {
90 // close
94 FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GUIApplicationWindow::onCmdQuit),
95 // toolbar
112 // gaming
122 // OSG
123#ifdef HAVE_OSG
124 FXMAPFUNC(SEL_COMMAND, MID_NEW_OSGVIEW, GUIApplicationWindow::onCmdNewOSG),
126
127#endif
128 // Time
135 FXMAPFUNC(SEL_COMMAND, MID_DELAY_INC, GUIApplicationWindow::onCmdDelayInc),
136 FXMAPFUNC(SEL_COMMAND, MID_DELAY_DEC, GUIApplicationWindow::onCmdDelayDec),
137 FXMAPFUNC(SEL_COMMAND, MID_SIMSAVE, GUIApplicationWindow::onCmdSaveState),
138 FXMAPFUNC(SEL_COMMAND, MID_SIMLOAD, GUIApplicationWindow::onCmdLoadState),
145 // Stats
149 // these functions do not assign shortcut keys to commands, but rather affect the button enable status upon other events (e.g. simulation loaded)
150 // since those events are invoked through pseudo key events (?), the same key shortcuts as in cmd must be supplied as well
180 FXMAPFUNC(SEL_COMMAND, MID_HOTKEYS, GUIApplicationWindow::onCmdHotkeys),
181 FXMAPFUNC(SEL_COMMAND, MID_TUTORIAL, GUIApplicationWindow::onCmdTutorial),
183 FXMAPFUNC(SEL_COMMAND, MID_FEEDBACK, GUIApplicationWindow::onCmdFeedback),
185 // forward requests to the active view
204 // languages
225 // keys
226 FXMAPFUNC(SEL_KEYPRESS, 0, GUIApplicationWindow::onKeyPress),
227 FXMAPFUNC(SEL_KEYRELEASE, 0, GUIApplicationWindow::onKeyRelease),
228 // clipboard
229 FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GUIApplicationWindow::onClipboardRequest),
230 // events
235};
236
237// Object implementation
238FXIMPLEMENT(GUIApplicationWindow, FXMainWindow, GUIApplicationWindowMap, ARRAYNUMBER(GUIApplicationWindowMap))
239
240// ===========================================================================
241// static members
242// ===========================================================================
244
245
246// ===========================================================================
247// member method definitions
248// ===========================================================================
249#ifdef _MSC_VER
250#pragma warning(push)
251#pragma warning(disable: 4355) // mask warning about "this" in initializers
252#endif
254 GUIMainWindow(a),
255 myFileMenuRecentNetworks(new FXMenuPane(this)),
256 myFileMenuRecentConfigs(new FXMenuPane(this)),
257 myRecentNetworks(a, "networks"),
258 myRecentConfigs(a, "configs"),
259 myLastStepEventMillis(SysUtils::getCurrentMillis() - MIN_DRAW_DELAY) {
260 // init icons
262 // init Textures
264 // init cursors
266 // disable tooltips
267 a->setTooltipTime(1000000000);
268 a->setTooltipPause(1000000000);
269}
270#ifdef _MSC_VER
271#pragma warning(pop)
272#endif
273
274
279
280
281void
283 // don't do this twice
284 if (hadDependentBuild) {
285 return;
286 }
287 hadDependentBuild = true;
288 setTarget(this);
289 setSelector(MID_WINDOW);
290 // build menu bar
291 myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBar);
293 new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
295 // build the thread - io
300 // build the status bar
301 myStatusbar = new FXStatusBar(this, GUIDesignStatusBar);
302 {
303 // build TraCi info
305 auto button = GUIDesigns::buildFXButton(myTraCiFrame, "TraCI", "", "", nullptr, this, MID_TRACI_STATUS, GUIDesignButtonStatusBarFixed);
306 button->setBackColor(FXRGBA(253, 255, 206, 255));
307 if (TraCIServer::getInstance() == nullptr) {
308 myTraCiFrame->hide();
309 }
310 // build geo coordiantes
312 myGeoCoordinate = GUIDesigns::buildFXLabel(myGeoFrame, TL("N/A"), "", TL("Original coordinate (before coordinate transformation in netconvert)"), nullptr, LAYOUT_CENTER_Y);
313 // build cartesian coordinates
315 myCartesianCoordinate = GUIDesigns::buildFXLabel(myCartesianFrame, TL("N/A"), "", TL("Network coordinate"), nullptr, LAYOUT_CENTER_Y);
316 // build buttons
319 myStatButtons.back()->hide();
321 myStatButtons.back()->hide();
322 }
323 // make the window a mdi-window
324 myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
326 myMDIMenu = new FXMDIMenu(this, myMDIClient);
327 new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
328 new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
329 new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
330 new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
331 // build the message window
333 // fill menu and tool bar
334 fillMenuBar();
335 myToolBar6->hide();
336 myToolBar7->hide();
337 myToolBar9->hide();
338 myToolBar10->hide();
339 // build additional threads
340 myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent, isLibsumo);
342 // set the status bar
343 setStatusBarText(TL("Ready."));
344 // set the caption
345 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
346 // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
347 myRunThread->start();
350}
351
352
353void
356 gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
357 FXMainWindow::create();
358 myMenuBarDrag->create();
359 myToolBarDrag1->create();
360 myToolBarDrag2->create();
361 myToolBarDrag3->create();
362 myToolBarDrag4->create();
363 myToolBarDrag5->create();
364 myToolBarDrag6->create();
365 myToolBarDrag7->create();
366 myFileMenu->create();
367 mySelectByPermissions->create();
368 myEditMenu->create();
369 mySettingsMenu->create();
370 myLocatorMenu->create();
371 myControlMenu->create();
372 myWindowMenu->create();
373 myLanguageMenu->create();
374 myHelpMenu->create();
375 FXint textWidth = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
376 myCartesianFrame->setWidth(textWidth);
377 myGeoFrame->setWidth(textWidth);
378 if (myTestFrame) {
379 myTestFrame->setWidth(textWidth);
380 }
381
382 show(PLACEMENT_DEFAULT);
383 if (!OptionsCont::getOptions().isSet("window-size")) {
384 if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
385 maximize();
386 }
387 }
388 myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
389 myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
390 const std::string& onlineMaps = getApp()->reg().readStringEntry("gui", "onlineMaps", "");
391 for (const std::string& entry : StringTokenizer(onlineMaps, "\n").getVector()) {
392 const std::vector<std::string> split = StringTokenizer(entry, "\t").getVector();
393 if (split.size() == 2) {
394 myOnlineMaps[split[0]] = split[1];
395 }
396 }
397 if (myOnlineMaps.empty()) {
398 myOnlineMaps["GeoHack"] = "https://geohack.toolforge.org/geohack.php?params=%lat;%lon_scale:1000";
399 myOnlineMaps["Google Maps"] = "https://www.google.com/maps?ll=%lat,%lon&t=h&z=18";
400 myOnlineMaps["OSM"] = "https://www.openstreetmap.org/?mlat=%lat&mlon=%lon&zoom=18&layers=M";
401 }
403}
404
405
408 myRunThread->join();
410 // close icons
413 // delete visual
414 delete myGLVisual;
415 // delete some non-parented windows
416 delete myToolBarDrag1;
417 delete mySimDelayTarget;
418 // delete rest of elements
421 delete myRunThread;
422 delete myFileMenu;
423 delete myEditMenu;
425 delete mySettingsMenu;
426 delete myLocatorMenu;
427 delete myControlMenu;
428 delete myLanguageMenu;
429 delete myWindowMenu;
430 delete myHelpMenu;
431 delete myLoadThread;
432
433 while (!myEvents.empty()) {
434 // get the next event
435 GUIEvent* e = myEvents.top();
436 myEvents.pop();
437 delete e;
438 }
439 for (auto item : myHotkeyPress) {
440 delete item.second;
441 }
442 for (auto item : myHotkeyRelease) {
443 delete item.second;
444 }
445}
446
447
448void
450 FXMainWindow::detach();
451 myMenuBarDrag->detach();
452 myToolBarDrag1->detach();
453}
454
455
456void
457GUIApplicationWindow::addToWindowsMenu(FXMenuPane* /*menuPane*/) {
458 // unused, implement in children
459}
460
461
462void
464 // build file menu
465 myFileMenu = new FXMenuPane(this);
468 TL("New Window"), "Ctrl+Shift+N", TL("Open a new sumo-gui window."),
469 nullptr, this, MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW);
470 new FXMenuSeparator(myFileMenu);
472 TL("&Open Simulation..."), "Ctrl+O", TL("Open a simulation (Configuration file)."),
475 TL("Open &Network..."), "Ctrl+N", TL("Open a network."),
478 TL("Open Shapes "), "Ctrl+P", TL("Load POIs and Polygons for visualization."),
481 TL("Open EdgeData "), "Ctrl+U", TL("Load edge related data for visualization."),
484 TL("&Reload"), "Ctrl+R", TL("Reloads the simulation / the network."),
487 TL("Quick-Reload"), "Ctrl+0", TL("Reloads the simulation (but not network)."),
489 new FXMenuSeparator(myFileMenu);
491 TL("Save Configuration"), "Ctrl+Shift+S", TL("Save current options as a configuration file."),
494 TL("Close"), "Ctrl+W", TL("Close the simulation."),
496 new FXMenuSeparator(myFileMenu);
497 // build recent files
500 new FXMenuSeparator(myFileMenu);
502 TL("&Quit"), "Ctrl+Q", TL("Quit the Application."),
503 nullptr, this, MID_HOTKEY_CTRL_Q_CLOSE);
504 // build edit menu
505 mySelectByPermissions = new FXMenuPane(this);
506 std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
507 for (const auto& vehicleClass : vehicleClasses) {
509 }
510 myEditMenu = new FXMenuPane(this);
513 TL("Edit Selected..."), "Ctrl+E", TL("Opens a dialog for editing the list of selected items."),
515 mySelectLanesMenuCascade = new FXMenuCascade(myEditMenu, TL("Select lanes which allow..."), GUIIconSubSys::getIcon(GUIIcon::FLAG), mySelectByPermissions);
516 mySelectLanesMenuCascade->setHelpText(TL("Opens a menu for selecting a vehicle class by which to selected lanes."));
517 new FXMenuSeparator(myEditMenu);
519 TL("Set Breakpoint"), "B", TL("Sets a breakpoint at the current simulation step"),
522 TL("Set Breakpoint with offset"), "Alt+B", TL("Sets a breakpoint at the current simulation step + offset configured in application settings"),
525 TL("Edit Breakpoints"), "Ctrl+B", TL("Opens a dialog for editing breakpoints."),
528 TL("Edit Visualisation"), "F9", TL("Opens a dialog for editing visualization settings."),
531 TL("Edit Viewport"), "Ctrl+I", TL("Opens a dialog for editing viewing area, zoom and rotation."),
533 new FXMenuSeparator(myEditMenu);
534 // add open in sumo options
535 myLoadAdditionalsInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load additionals in netedit"), TL("Load additionals in netedit."), this, MID_TOOLBAREDIT_LOADADDITIONALS);
536 myLoadAdditionalsInNetedit->setCheck(TRUE);
537 myLoadDemandInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load demand in netedit"), TL("Load demand in netedit."), this, MID_TOOLBAREDIT_LOADDEMAND);
538 myLoadDemandInNetedit->setCheck(FALSE);
540 TL("Open in netedit"), "Ctrl+T", TL("Opens current simulation in NETEDIT."),
543 TL("Open network in netedit"), "Ctrl+Shift+T", TL("Opens current network in NETEDIT."),
545 // build settings menu
546 mySettingsMenu = new FXMenuPane(this);
549 TL("Application Settings"), "Ctrl+H", TL("Open a Dialog for Application Settings editing."),
551 myGamingModeCheckbox = new FXMenuCheck(mySettingsMenu,
552 TL("Gaming Mode\tCtrl+G\tToggle gaming mode on/off."),
555 TL("Full Screen Mode"), "Ctrl+F", TL("Toggle full screen mode on/off."),
557 // build Locate menu
558 myLocatorMenu = new FXMenuPane(this);
561 TL("&Junctions"), "Shift+J", TL("Open a dialog for locating a Junction."),
564 TL("&Edges"), "Shift+E", TL("Open a dialog for locating an Edge."),
567 TL("&Vehicles"), "Shift+V", TL("Open a dialog for locating a Vehicle."),
570 TL("&Persons"), "Shift+P", TL("Open a dialog for locating a Person."),
573 TL("&Container"), "Shift+C", TL("Open a dialog for locating a Container."),
576 TL("&TLS"), "Shift+T", TL("Open a dialog for locating a Traffic Light."),
579 TL("&Additional"), "Shift+A", TL("Open a dialog for locating an Additional Structure."),
582 TL("P&oI"), "Shift+O", TL("Open a dialog for locating a Point of Interest."),
585 TL("Po&lygon"), "Shift+L", TL("Open a dialog for locating a Polygon."),
587 new FXMenuSeparator(myLocatorMenu);
588 GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Internal Structures"), TL("Show internal junctions and streets in locator dialog."), this, MID_LISTINTERNAL);
589 FXMenuCheck* listParking = GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Parking Vehicles"), TL("Show parking vehicles in locator dialog."), this, MID_LISTPARKING);
590 listParking->setCheck(myListParking);
591 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);
592 // build control menu
593 // the shortcut designator is not only at text in the submenu but also defines the real shortcut key assigned with it!
594 // secondary shortcuts (ctrl+A, ctrl+S, ctrl+D) are defined in GUIShortcutsSubSys::buildSUMOAccelerators
595 myControlMenu = new FXMenuPane(this);
596 GUIDesigns::buildFXMenuTitle(myMenuBar, TL("Simulation"), nullptr, myControlMenu);
598 TL("Run"), "A,space", TL("Start/ Resume the simulation."),
601 TLC("Simulation", "Stop"), "S,space", TL("Halt the simulation."),
604 TL("Step"), "D", TL("Perform one simulation step."),
607 TL("Delay+"), "PgUp", TL("Increase simulation step delay."), nullptr, this, MID_DELAY_INC);
609 TL("Delay-"), "PgDn", TL("Decrease simulation step delay."), nullptr, this, MID_DELAY_DEC);
611 TL("Save"), "", TL("Save the current simulation state to a file."),
614 TL("Load"), "", TL("Load simulation state for the current network from file."),
616 // build windows menu
617 myWindowMenu = new FXMenuPane(this);
619 GUIDesigns::buildFXMenuCommandShortcut(myWindowMenu, TL("Open new view"), "", TL("Open a new microscopic view."), GUIIconSubSys::getIcon(GUIIcon::MICROVIEW), this, MID_NEW_MICROVIEW);
620#ifdef HAVE_OSG
622#endif
624 TL("Tile &Horizontally"), "", TL("Tile the views horizontally."),
625 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_HORI), myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
627 TL("Tile &Vertically"), "", TL("Tile the views vertically."),
628 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_VERT), myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
630 TL("Cascade"), "", TL("Cascade the views."),
632 myMDIClient, FXMDIClient::ID_MDI_CASCADE);
634 TL("&Close"), "", TL("Close the selected view."),
635 nullptr, myMDIClient, FXMDIClient::ID_MDI_CLOSE);
636 FXMenuSeparator* sep2 = new FXMenuSeparator(myWindowMenu);
637 sep2->setTarget(myMDIClient);
638 sep2->setSelector(FXMDIClient::ID_MDI_ANY);
639 // for whatever reason, sonar complains in the next line that sep2 may leak, but fox does the cleanup
640 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_1); // NOSONAR
641 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_2);
642 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_3);
643 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_4);
644 GUIDesigns::buildFXMenuCommand(myWindowMenu, TL("&Others..."), nullptr, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
645
646 new FXMenuSeparator(myWindowMenu);
647 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Status Line"), TL("Toggle the Status Bar on/off."), myStatusbar, FXWindow::ID_TOGGLESHOWN);
648 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Message Window"), TL("Toggle the Message Window on/off."), myMessageWindow, FXWindow::ID_TOGGLESHOWN);
649 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Time"), TL("Toggle the Simulation Time on/off."), myToolBar3, FXWindow::ID_TOGGLESHOWN);
650 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Delay"), TL("Toggle the Simulation Delay Entry on/off."), myToolBar4, FXWindow::ID_TOGGLESHOWN);
652
653 new FXMenuSeparator(myWindowMenu);
655 TL("Clear Message Window"), "", TL("Clear the message window."),
657 // build windows menu
659 // build help menu
660 myHelpMenu = new FXMenuPane(this);
662 TL("&Help"),
663 nullptr, myHelpMenu);
664 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Online Documentation"), "F1", TL("Open Online documentation."),
665 nullptr, this, MID_HOTKEY_F1_ONLINEDOCUMENTATION);
666 new FXMenuSeparator(myHelpMenu);
667 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Changelog"), "", TL("Open Changelog."),
668 nullptr, this, MID_CHANGELOG);
669 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Hotkeys"), "", TL("Open Hotkeys."),
670 nullptr, this, MID_HOTKEYS);
671 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Tutorial"), "", TL("Open Tutorial."),
672 nullptr, this, MID_TUTORIAL);
673 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Feedback"), "", TL("Open feedback dialog."),
674 nullptr, this, MID_FEEDBACK);
675 new FXMenuSeparator(myHelpMenu);
676 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&About"), "F12", TL("About sumo-gui."),
678 // build SUMO Accelerators (hotkeys)
679 GUIShortcutsSubSys::buildAccelerators(getAccelTable(), this, true);
680}
681
682
683void
685 // file and simulation tool bar
686 {
687 myToolBarDrag1 = new FXToolBarShell(this, GUIDesignToolBar);
689 new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
690 // build file tools
691 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen simulation\tOpen a simulation (Configuration file)."),
693 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen network\tOpen a network."),
695 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tReload\tReloads the simulation / the network."),
697 }
698 // simulation toolbar
699 {
700 myToolBarDrag2 = new FXToolBarShell(this, GUIDesignToolBar);
702 new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
703 // build simulation tools
704 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tRun\tStart/Resume the loaded simulation."),
706 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStop\tHalt the running simulation."),
708 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStep\tPerform a single simulation step."),
710 }
711 // Simulation Step Display
712 {
713 myToolBarDrag3 = new FXToolBarShell(this, GUIDesignToolBar);
715 new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
716 new MFXButtonTooltip(myToolBar3, myStaticTooltipMenu, TL("Time:\tToggle between time formats\tToggle between seconds and hour:minute:seconds display."), nullptr, this, MID_TIME_TOGGLE, GUIDesignButtonToolbarText);
717
718 myLCDLabel = new MFXLCDLabel(myToolBar3, myStaticTooltipMenu, 16, nullptr, 0, JUSTIFY_RIGHT);
723 myLCDLabel->setText("----------------");
724 }
725 // Simulation Delay
726 {
727 myToolBarDrag4 = new FXToolBarShell(this, GUIDesignToolBar);
729 new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
730 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);
731 // create spinner for delay
732 mySimDelay = 0;
733 mySimDelayTarget = new FXDataTarget(mySimDelay);
735 // create slider
736 mySimDelaySlider = new FXSlider(myToolBar4, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSlider);
737 mySimDelaySlider->setRange(0, 1000);
738 mySimDelaySlider->setHeadSize(10);
739 mySimDelaySlider->setIncrement(50);
740 mySimDelaySlider->setTickDelta(100);
741 mySimDelaySlider->setValue((int)mySimDelay);
742 //mySimDelayTarget->setNumberFormat(0);
743 //mySimDelayTarget->setIncrements(1, 10, 10);
744 mySimDelaySpinner->setIncrement(10);
745 mySimDelaySpinner->setRange(0, 10000);
746 mySimDelaySpinner->setValue(mySimDelay);
747 }
748 // Scale traffic (flows and incrementally loaded vehicles)
749 {
750 myToolBarDrag8 = new FXToolBarShell(this, GUIDesignToolBar);
752 new FXToolBarGrip(myToolBar8, myToolBar8, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
753 myScaleTrafficTooltip = new MFXLabelTooltip(myToolBar8, myStaticTooltipMenu, TL("Scale Traffic:"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
754 myScaleTrafficTooltip->setHelpText(TL("Scale traffic volume from running flows and from vehicles that are loaded incrementally from route files."));
756 myDemandScaleSpinner->setIncrement(0.5);
757 myDemandScaleSpinner->setRange(0, 1000);
758 myDemandScaleSpinner->setValue(1);
759 }
760 // Views
761 {
762 myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBar);
764 new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
765 // build view tools
766 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new view") + std::string("\t") + TL("Open a new microscopic view.")).c_str(),
768#ifdef HAVE_OSG
769 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new 3D view") + std::string("\t") + TL("Open a new 3D view.")).c_str(),
771#endif
772 }
774 {
775 // total waitingTime
776 myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBar);
778 new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
779 GUIDesigns::buildFXLabel(myToolBar6, TL("Waiting Time:"), "", TL("Time spent waiting accumulated for all vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
780 myWaitingTimeLabel = new MFXLCDLabel(myToolBar6, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
785 myWaitingTimeLabel->setText("-------------");
786 // idealistic time loss
787 myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBar);
789 new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
790 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);
791 myTimeLossLabel = new MFXLCDLabel(myToolBar7, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
796 myTimeLossLabel->setText("-------------");
797 // total driving distance
798 myToolBarDrag9 = new FXToolBarShell(this, GUIDesignToolBar);
800 new FXToolBarGrip(myToolBar9, myToolBar9, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
801 GUIDesigns::buildFXLabel(myToolBar9, TL("Distance (km):"), "", TL("Total distance driven by DRT vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
802 myTotalDistanceLabel = new MFXLCDLabel(myToolBar9, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
807 myTotalDistanceLabel->setText("-------------");
808 // emergency vehicle counts
809 myToolBarDrag10 = new FXToolBarShell(this, GUIDesignToolBar);
811 new FXToolBarGrip(myToolBar10, myToolBar10, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
812 GUIDesigns::buildFXLabel(myToolBar10, TL("Emergency Vehicle waiting time:"), "", TL("Time spent waiting accumulated for emergency vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
813 myEmergencyVehicleLabel = new MFXLCDLabel(myToolBar10, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
818 myEmergencyVehicleLabel->setText("-------------");
819 }
820}
821
822
823void
824GUIApplicationWindow::buildRecentNetworks(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentNetworks) {
825 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
826 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_1);
827 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_2);
828 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_3);
829 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_4);
830 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_5);
831 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_6);
832 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_7);
833 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_8);
834 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_9);
835 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_10);
836 new FXMenuSeparator(fileMenuRecentNetworks); // NOSONAR, Fox does the cleanup
837 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("Cl&ear Recent Networks"), nullptr, &myRecentNetworks, FXRecentFiles::ID_CLEAR);
838 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("No Recent Networks"), nullptr, &myRecentNetworks, MFXRecentNetworks::ID_NOFILES);
839 // set target
840 myRecentNetworks.setTarget(this);
841 myRecentNetworks.setSelector(MID_RECENTFILE);
842 new FXMenuCascade(fileMenu, TL("Recent Networks"), nullptr, fileMenuRecentNetworks);
843}
844
845
846void
847GUIApplicationWindow::buildRecentConfigs(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentConfigs) {
848 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
849 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_1);
850 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_2);
851 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_3);
852 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_4);
853 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_5);
854 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_6);
855 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_7);
856 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_8);
857 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_9);
858 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_10);
859 new FXMenuSeparator(fileMenuRecentConfigs); // NOSONAR, Fox does the cleanup
860 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("Cl&ear Recent Configs"), nullptr, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
861 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("No Recent Configs"), nullptr, &myRecentConfigs, MFXRecentNetworks::ID_NOFILES);
862 // set target
863 myRecentConfigs.setTarget(this);
864 myRecentConfigs.setSelector(MID_RECENTFILE);
865 new FXMenuCascade(fileMenu, TL("Recent Configs"), nullptr, fileMenuRecentConfigs);
866}
867
868
869long
870GUIApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
872 getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
873 getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
874 getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
875 getApp()->reg().writeIntEntry("gui", "alternateSimDelay", (int)myAlternateSimDelay);
877 getApp()->exit(0);
878 return 1;
879}
880
881
882long
883GUIApplicationWindow::onCmdEditChosen(FXObject* menu, FXSelector, void*) {
884 FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
885 if (mc->getText() == StringUtils::replace(TL("Edit Selected..."), "&", "").c_str()) {
887 chooser->create();
888 chooser->show();
889 } else {
891 const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
892 for (MSEdgeVector::const_iterator i = MSEdge::getAllEdges().begin(); i != MSEdge::getAllEdges().end(); ++i) {
893 const std::vector<MSLane*>& lanes = (*i)->getLanes();
894 for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
895 GUILane* lane = dynamic_cast<GUILane*>(*it);
896 assert(lane != 0);
897 if ((lane->getPermissions() & svc) != 0) {
898 gSelected.select(lane->getGlID());
899 }
900 }
901 }
902 if (myMDIClient->numChildren() > 0) {
903 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
904 if (w != nullptr) {
905 // color by selection
907 }
908 }
909 }
911 }
912 return 1;
913}
914
915
916long
917GUIApplicationWindow::onCmdEditBreakpoints(FXObject*, FXSelector, void*) {
918 if (myBreakpointDialog == nullptr) {
920 } else {
921 myBreakpointDialog->restore();
922 myBreakpointDialog->setFocus();
923 myBreakpointDialog->raise();
924 }
925 return 1;
926}
927
928
929long
930GUIApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
931 if (!myGLWindows.empty()) {
932 myGLWindows[0]->getView()->showViewportEditor();
933 }
934 return 1;
935}
936
937
938long
939GUIApplicationWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
940 if (!myGLWindows.empty()) {
941 myGLWindows[0]->getView()->showViewschemeEditor();
942 }
943 return 1;
944}
945
946
947long
948GUIApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
949 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html");
950 return 1;
951}
952
953
954long
955GUIApplicationWindow::onCmdChangelog(FXObject*, FXSelector, void*) {
956 // update in every version
957 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/ChangeLog.html");
958 return 1;
959}
960
961
962long
963GUIApplicationWindow::onCmdHotkeys(FXObject*, FXSelector, void*) {
964 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html#keyboard_shortcuts");
965 return 1;
966}
967
968
969long
970GUIApplicationWindow::onCmdTutorial(FXObject*, FXSelector, void*) {
971 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/Tutorials/index.html");
972 return 1;
973}
974
975
976long
977GUIApplicationWindow::onCmdOpenInNetedit(FXObject* sender, FXSelector, void* ptr) {
978 if (myGLWindows.empty()) {
979 return 1;
980 }
981 bool onlyNet;
982 if (sender == myOpenNetInNetedit) {
983 onlyNet = true;
984 } else if (sender == myOpenInNetedit) {
985 onlyNet = false;
986 } else {
987 // we have to check (menu-item) sender first because ptr is only valid when
988 // triggered via hotkey
989 FXEvent* e = (FXEvent*) ptr;
990 onlyNet = (e->state & SHIFTMASK) != 0;
991 }
992 FXRegistry reg("SUMO netedit", "netedit");
993 reg.read();
994 const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
995 reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
996 reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
997 reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
998 reg.write();
999 std::string netedit = "netedit";
1000 const char* sumoPath = getenv("SUMO_HOME");
1001 if (sumoPath != nullptr) {
1002 std::string newPath = std::string(sumoPath) + "/bin/netedit";
1003 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1004 netedit = "\"" + newPath + "\"";
1005 }
1006 }
1007 // declare command for calling netedit using the viewport saved in registry
1008 std::string cmd = netedit + " --registry-viewport";
1009 // continue depending if we're loading only a network or the entire sumo config
1010 if (myLoadAdditionalsInNetedit->shown() && !onlyNet) {
1011 cmd += " --sumocfg-file \"" + OptionsCont::getOptions().getString("configuration-file") + "\"";
1012 // check if ignore additional or demand elements
1013 if (myLoadAdditionalsInNetedit->getCheck() == FALSE) {
1014 cmd += " --ignore.additionalelements";
1015 }
1016 if (myLoadDemandInNetedit->getCheck() == FALSE) {
1017 cmd += " --ignore.routeelements";
1018 }
1019 } else {
1020 cmd += " -s \"" + OptionsCont::getOptions().getString("net-file") + "\"";
1021 }
1022 // start in background
1023#ifndef WIN32
1024 cmd = cmd + " &";
1025#else
1026 // see "help start" for the parameters
1027 cmd = "start /B \"\" " + cmd;
1028#endif
1029 WRITE_MESSAGEF(TL("Running %."), cmd);
1030 // yay! fun with dangerous commands... Never use this over the internet
1032 return 1;
1033}
1034
1035
1036long
1037GUIApplicationWindow::onCmdNewWindow(FXObject*, FXSelector, void*) {
1038 FXRegistry reg("SUMO sumo-gui", "sumo-gui");
1039 std::string sumo_gui = "sumo-gui";
1040 const char* sumoPath = getenv("SUMO_HOME");
1041 if (sumoPath != nullptr) {
1042 std::string newPath = std::string(sumoPath) + "/bin/sumo_gui";
1043 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1044 sumo_gui = "\"" + newPath + "\"";
1045 }
1046 }
1047 std::string cmd = sumo_gui;
1048 // start in background
1049#ifndef WIN32
1050 cmd = cmd + " &";
1051#else
1052 // see "help start" for the parameters
1053 cmd = "start /B \"\" " + cmd;
1054#endif
1055 WRITE_MESSAGEF(TL("Running %."), cmd);
1056 // yay! fun with dangerous commands... Never use this over the internet
1058 return 1;
1059}
1060
1061
1062long
1064 // get the new file name
1065 FXFileDialog opendialog(this, TL("Open Simulation Configuration"));
1067 opendialog.setSelectMode(SELECTFILE_EXISTING);
1068 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1069 if (gCurrentFolder.length() != 0) {
1070 opendialog.setDirectory(gCurrentFolder);
1071 }
1072 if (opendialog.execute()) {
1073 gCurrentFolder = opendialog.getDirectory();
1074 std::string file = opendialog.getFilename().text();
1075 loadConfigOrNet(file);
1076 myRecentConfigs.appendFile(file.c_str());
1077 }
1078 return 1;
1079}
1080
1081
1082long
1083GUIApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
1084 // get the new file name
1085 FXFileDialog opendialog(this, TL("Open Network"));
1086 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1087 opendialog.setSelectMode(SELECTFILE_EXISTING);
1088 opendialog.setPatternList(SUMOXMLDefinitions::NetFileExtensions.getMultilineString().c_str());
1089 if (gCurrentFolder.length() != 0) {
1090 opendialog.setDirectory(gCurrentFolder);
1091 }
1092 if (opendialog.execute()) {
1093 gCurrentFolder = opendialog.getDirectory();
1094 std::string file = opendialog.getFilename().text();
1095 loadConfigOrNet(file);
1096 myRecentNetworks.appendFile(file.c_str());
1097 }
1098 return 1;
1099}
1100
1101
1102long
1103GUIApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
1104 // get the shape file name
1105 FXFileDialog opendialog(this, TL("Open Shapes"));
1106 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_SHAPES));
1107 opendialog.setSelectMode(SELECTFILE_EXISTING);
1108 opendialog.setPatternList(SUMOXMLDefinitions::ShapesFileExtensions.getMultilineString().c_str());
1109 if (gCurrentFolder.length() != 0) {
1110 opendialog.setDirectory(gCurrentFolder);
1111 }
1112 if (opendialog.execute()) {
1113 gCurrentFolder = opendialog.getDirectory();
1114 std::string file = opendialog.getFilename().text();
1115
1116 dynamic_cast<GUIShapeContainer&>(myRunThread->getNet().getShapeContainer()).allowReplacement();
1118 if (!XMLSubSys::runParser(handler, file, false)) {
1119 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1120 }
1121 update();
1122 if (myMDIClient->numChildren() > 0) {
1123 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1124 if (w != nullptr) {
1125 w->getView()->update();
1126 }
1127 }
1128 }
1129 return 1;
1130}
1131
1132
1133long
1134GUIApplicationWindow::onCmdOpenEdgeData(FXObject*, FXSelector, void*) {
1135 // get the shape file name
1136 FXFileDialog opendialog(this, TL("Open EdgeData"));
1137 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1138 opendialog.setSelectMode(SELECTFILE_EXISTING);
1139 opendialog.setPatternList(SUMOXMLDefinitions::EdgeDataFileExtensions.getMultilineString().c_str());
1140 if (gCurrentFolder.length() != 0) {
1141 opendialog.setDirectory(gCurrentFolder);
1142 }
1143 if (opendialog.execute()) {
1144 gCurrentFolder = opendialog.getDirectory();
1145 std::string file = opendialog.getFilename().text();
1146 if (!GUINet::getGUIInstance()->loadEdgeData(file)) {
1147 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1148 }
1149 update();
1150 if (myMDIClient->numChildren() > 0) {
1151 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1152 if (w != nullptr) {
1153 w->getView()->update();
1154 }
1155 }
1156 }
1157 return 1;
1158}
1159
1160
1161long
1162GUIApplicationWindow::onCmdReload(FXObject* sender, FXSelector sel, void*) {
1163 if (!myAmLoading && (sender == nullptr || TraCIServer::getInstance() == nullptr)) {
1165 getApp()->beginWaitCursor();
1166 myAmLoading = true;
1167 myIsReload = sender != nullptr || sel == 1;
1169 myLoadThread->start();
1170 if (sender == nullptr) {
1171 setStatusBarText(sel == 1 ? TL("Auto-Reloading.") : TL("TraCI-Loading."));
1172 } else {
1173 setStatusBarText(TL("Reloading."));
1174 }
1175 update();
1176 }
1177 return 1;
1178}
1179
1180
1181long
1182GUIApplicationWindow::onCmdQuickReload(FXObject*, FXSelector, void*) {
1183 if (!myAmLoading) {
1184 setStatusBarText(TL("Quick-Reloading."));
1186 }
1187 return 1;
1188}
1189
1190
1191long
1192GUIApplicationWindow::onCmdOpenRecent(FXObject* /* sender */, FXSelector, void* ptr) {
1193 if (myAmLoading) {
1194 myStatusbar->getStatusLine()->setText(TL("Already loading!"));
1195 return 1;
1196 }
1197 std::string file((const char*)ptr);
1198 loadConfigOrNet(file);
1199 return 1;
1200}
1201
1202
1203long
1204GUIApplicationWindow::onCmdSaveConfig(FXObject*, FXSelector, void*) {
1205 // get the new file name
1206 FXFileDialog opendialog(this, TL("Save SUMO Configuration"));
1207 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1208 opendialog.setSelectMode(SELECTFILE_ANY);
1209 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1210 if (gCurrentFolder.length() != 0) {
1211 opendialog.setDirectory(gCurrentFolder);
1212 }
1213 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1214 return 1;
1215 }
1216 const std::string file = MFXUtils::assureExtension(opendialog).text();
1217 std::ofstream out(StringUtils::transcodeToLocal(file));
1218 if (out.good()) {
1219 OptionsCont::getOptions().writeConfiguration(out, true, false, false, file, true);
1220 setStatusBarText(TLF("Configuration saved to %.", file));
1221 } else {
1222 setStatusBarText(TLF("Could not save configuration to %.", file));
1223 }
1224 out.close();
1225 return 1;
1226}
1227
1228
1229long
1230GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
1232 return 1;
1233}
1234
1235
1236long
1237GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
1238 sender->handle(this,
1239 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1240 ptr);
1241 return 1;
1242}
1243
1244
1245long
1246GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
1247 sender->handle(this,
1249 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1250 ptr);
1251 return 1;
1252}
1253
1254
1255long
1256GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
1257 sender->handle(this,
1258 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1259 ptr);
1260 return 1;
1261}
1262
1263
1264long
1265GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
1266 sender->handle(this,
1268 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1269 ptr);
1270 return 1;
1271}
1272
1273
1274long
1275GUIApplicationWindow::onCmdStart(FXObject*, FXSelector, void*) {
1276 // check whether a net was loaded successfully
1277 if (!myRunThread->networkAvailable()) {
1278 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1279 return 1;
1280 }
1281 // check whether it was started before and paused;
1282 if (!myWasStarted) {
1283 myRunThread->begin();
1284 myWasStarted = true;
1285 }
1287 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1288 return 1;
1289}
1290
1291
1292long
1293GUIApplicationWindow::onCmdStop(FXObject*, FXSelector, void*) {
1294 myRunThread->stop();
1295 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1296 return 1;
1297}
1298
1299
1300long
1301GUIApplicationWindow::onCmdStep(FXObject*, FXSelector, void*) {
1302 // check whether a net was loaded successfully
1303 if (!myRunThread->networkAvailable()) {
1304 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1305 return 1;
1306 }
1307 // check whether it was started before and paused;
1308 if (!myWasStarted) {
1309 myRunThread->begin();
1310 myWasStarted = true;
1311 }
1313 return 1;
1314}
1315
1316
1317long
1318GUIApplicationWindow::onCmdSaveState(FXObject*, FXSelector, void*) {
1319 // get the new file name
1320 FXFileDialog opendialog(this, TL("Save Simulation State"));
1321 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1322 opendialog.setSelectMode(SELECTFILE_ANY);
1323 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1324 if (gCurrentFolder.length() != 0) {
1325 opendialog.setDirectory(gCurrentFolder);
1326 }
1327 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1328 return 1;
1329 }
1330 const std::string file = MFXUtils::assureExtension(opendialog).text();
1331 MSStateHandler::saveState(file, MSNet::getInstance()->getCurrentTimeStep(), false);
1332 setStatusBarText(TLF("Simulation state saved to '%'.", file));
1333 return 1;
1334}
1335
1336
1337long
1338GUIApplicationWindow::onCmdLoadState(FXObject*, FXSelector, void*) {
1339 // get the new file name
1340 FXFileDialog opendialog(this, TL("Load Simulation State"));
1341 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN));
1342 opendialog.setSelectMode(SELECTFILE_ANY);
1343 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1344 if (gCurrentFolder.length() != 0) {
1345 opendialog.setDirectory(gCurrentFolder);
1346 }
1347 if (opendialog.execute() && FXStat::exists(opendialog.getFilename())) {
1348 gCurrentFolder = opendialog.getDirectory();
1349 const std::string file = opendialog.getFilename().text();
1350 try {
1351 MSNet::getInstance()->loadState(file, true);
1352 setStatusBarText(TLF("State loaded from '%'.", file));
1353 } catch (ProcessError& e) {
1354 setStatusBarText(TLF("Failed to load state from '%' (%).", file, e.what()));
1355 }
1356 }
1357 return 1;
1358}
1359
1360
1361long
1362GUIApplicationWindow::onCmdTimeToggle(FXObject*, FXSelector, void*) {
1363 // toggle show time as HMS
1368 }
1369 return 1;
1370}
1371
1372
1373long
1374GUIApplicationWindow::onCmdDelayInc(FXObject*, FXSelector, void*) {
1375 if (mySimDelay < 10) {
1376 mySimDelay = 10;
1377 } else if (mySimDelay >= 20 && mySimDelay < 50) {
1378 mySimDelay = 50;
1379 } else if (mySimDelay >= 200 && mySimDelay < 500) {
1380 mySimDelay = 500;
1381 } else {
1382 mySimDelay *= 2;
1383 }
1384 if (mySimDelay > 1000) {
1385 // setting high delay by pressing the key too often is hard to recover from
1386 mySimDelay = 1000;
1387 }
1388 mySimDelaySlider->setValue((int)mySimDelay);
1389 mySimDelaySpinner->setValue(mySimDelay);
1390 return 1;
1391}
1392
1393
1394long
1395GUIApplicationWindow::onCmdDelayDec(FXObject*, FXSelector, void*) {
1396 if (mySimDelay <= 10) {
1397 mySimDelay = 0;
1398 } else if (mySimDelay > 20 && mySimDelay <= 50) {
1399 mySimDelay = 20;
1400 } else if (mySimDelay > 200 && mySimDelay <= 500) {
1401 mySimDelay = 200;
1402 } else {
1403 mySimDelay /= 2;
1404 }
1405 mySimDelaySlider->setValue((int)mySimDelay);
1406 mySimDelaySpinner->setValue(mySimDelay);
1407 return 1;
1408}
1409
1410
1411long
1412GUIApplicationWindow::onCmdDelayToggle(FXObject*, FXSelector, void*) {
1413 const double tmp = myAlternateSimDelay;
1415 mySimDelay = tmp;
1416 return 1;
1417}
1418
1419
1420long
1421GUIApplicationWindow::onCmdDemandScale(FXObject*, FXSelector, void*) {
1424 }
1425 return 1;
1426}
1427
1428
1429long
1430GUIApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
1432 return 1;
1433}
1434
1435
1436long
1437GUIApplicationWindow::onCmdBreakpoint(FXObject*, FXSelector, void*) {
1438 // see updateTimeLCD for the DELTA_T
1441 }
1442 return 1;
1443}
1444
1445
1446long
1447GUIApplicationWindow::onCmdBreakpointEarly(FXObject*, FXSelector, void*) {
1448 // see updateTimeLCD for the DELTA_T
1451 }
1452 return 1;
1453}
1454
1455
1456long
1457GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
1458 sender->handle(this,
1460 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1461 ptr);
1463 // bind start simulation with space key
1465 }
1466 return 1;
1467}
1468
1469
1470long
1471GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
1472 sender->handle(this,
1474 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1475 ptr);
1477 // bind stop simulation with space key
1479 }
1480 return 1;
1481}
1482
1483
1484long
1485GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
1486 sender->handle(this,
1488 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1489 ptr);
1490 return 1;
1491}
1492
1493
1494long
1495GUIApplicationWindow::onUpdNeedsNetwork(FXObject* sender, FXSelector, void* ptr) {
1496 // check if there is a loaded network and gui isn't loading
1498 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1499 // enable certain elements manually
1500 mySelectLanesMenuCascade->enable();
1501 myScaleTrafficTooltip->setTipText(TL("Scale number of vehicles in simulation"));
1502 } else {
1503 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1504 // disable certain elements manually
1505 mySelectLanesMenuCascade->disable();
1506 myScaleTrafficTooltip->setTipText("");
1507 }
1508 return 1;
1509}
1510
1511
1512long
1513GUIApplicationWindow::onUpdNeedsSumoConfig(FXObject* sender, FXSelector, void* ptr) {
1514 // check if there is a loaded network and gui isn't loading
1515 if (myRunThread->networkAvailable() && !myAmLoading && OptionsCont::getOptions().isSet("configuration-file")) {
1516 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1517 sender->handle(this, FXSEL(SEL_COMMAND, ID_SHOW), ptr);
1518 myOpenInNetedit->setText(TL("Open sumo config in netedit"));
1519 } else {
1520 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1521 sender->handle(this, FXSEL(SEL_COMMAND, ID_HIDE), ptr);
1522 myOpenInNetedit->setText(TL("Open network in netedit"));
1523 }
1524 return 1;
1525}
1526
1527
1528long
1529GUIApplicationWindow::onUpdTraCIStatus(FXObject* /*sender*/, FXSelector, void* /*ptr*/) {
1531 myTraCiFrame->show();
1532 } else {
1533 myTraCiFrame->hide();
1534 }
1535 return 1;
1536}
1537
1538
1539long
1540GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
1541 if (myMDIClient->numChildren() > 0) {
1542 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1543 if (w != nullptr) {
1544 w->onCmdLocate(nullptr, sel, nullptr);
1545 }
1546 }
1547 return 1;
1548}
1549
1550
1551long
1552GUIApplicationWindow::onCmdShowStats(FXObject*, FXSelector, void*) {
1553 if (myMDIClient->numChildren() > 0) {
1554 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1556 }
1557 return 1;
1558}
1559
1560
1561long
1562GUIApplicationWindow::onCmdAppSettings(FXObject*, FXSelector, void*) {
1564 d->create();
1565 d->show(PLACEMENT_OWNER);
1566 return 1;
1567}
1568
1569
1570long
1571GUIApplicationWindow::onCmdGaming(FXObject*, FXSelector, void*) {
1572 if (myGLWindows.empty()) {
1573 return 1;
1574 }
1576 myGLWindows[0]->getView()->editVisualisationSettings()->gaming = myAmGaming;
1577 if (myAmGaming) {
1578 myGamingModeCheckbox->setCheck(TRUE);
1579 myMenuBar->hide();
1580 myStatusbar->hide();
1581 myToolBar1->hide();
1582 myToolBar2->hide();
1583 myToolBar4->hide();
1584 myToolBar5->hide();
1585 myToolBar6->show();
1586 myToolBar8->hide();
1587 myToolBar10->show();
1588 if (myTLSGame) {
1589 myToolBar7->show();
1590 } else {
1591 myToolBar9->show();
1592 }
1593 myMessageWindow->hide();
1599 } else {
1600 myGamingModeCheckbox->setCheck(FALSE);
1601 myMenuBar->show();
1602 myStatusbar->show();
1603 myToolBar1->show();
1604 myToolBar2->show();
1605 myToolBar4->show();
1606 myToolBar5->show();
1607 myToolBar6->hide();
1608 myToolBar7->hide();
1609 myToolBar8->show();
1610 myToolBar9->hide();
1611 myToolBar10->hide();
1612 myMessageWindow->show();
1614 }
1615 if (myMDIClient->numChildren() > 0) {
1616 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1617 if (w != nullptr) {
1619 }
1620 }
1621 update();
1622 return 1;
1623}
1624
1625
1626long
1628 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1629 if (w != nullptr) {
1630 // show or hide grid depending of myNetworkViewOptions.menuCheckToggleGrid
1633 } else {
1635 }
1636 w->getView()->update();
1637 }
1638 return 1;
1639}
1640
1641
1642long
1644 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1645 if (w != nullptr) {
1646 // toggle secondary shape visualization
1648 w->getView()->update();
1649 }
1650 return 1;
1651}
1652
1653
1654long
1655GUIApplicationWindow::onCmdFullScreen(FXObject*, FXSelector, void*) {
1656 if (myGLWindows.empty()) {
1657 return 1;
1658 }
1660 if (myAmFullScreen) {
1661 getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1662 getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1663 getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1664 getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1665 maximize();
1666 setDecorations(DECOR_NONE);
1667 place(PLACEMENT_MAXIMIZED);
1668 myMenuBar->hide();
1669 myStatusbar->hide();
1670 myToolBar1->hide();
1671 myToolBar2->hide();
1672 myToolBar3->hide();
1673 myToolBar4->hide();
1674 myToolBar5->hide();
1675 myToolBar6->hide();
1676 myToolBar7->hide();
1677 myToolBar8->hide();
1678 myMessageWindow->hide();
1679 if (myMDIClient->numChildren() > 0) {
1680 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1681 if (w != nullptr) {
1682 w->setToolBarVisibility(false);
1683 }
1684 }
1685 update();
1686 } else {
1687 place(PLACEMENT_VISIBLE);
1688 setDecorations(DECOR_ALL);
1689 restore();
1690 myToolBar3->show();
1692 onCmdGaming(nullptr, 0, nullptr);
1693 setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
1694 setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1695 setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
1696 setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
1697 }
1698 return 1;
1699}
1700
1701
1702long
1703GUIApplicationWindow::onCmdListInternal(FXObject*, FXSelector, void*) {
1705 return 1;
1706}
1707
1708
1709long
1710GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) {
1712 return 1;
1713}
1714
1715long
1716GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) {
1718 return 1;
1719}
1720
1721
1722long
1723GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) {
1725 return 1;
1726}
1727
1728
1729#ifdef HAVE_OSG
1730long
1731GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1733 return 1;
1734}
1735#endif
1736
1737
1738long
1739GUIApplicationWindow::onCmdFeedback(FXObject*, FXSelector, void*) {
1740 // create and open feedback dialog
1741 GUIDialog_Feedback* feedback = new GUIDialog_Feedback(this);
1742 feedback->create();
1743 feedback->show(PLACEMENT_OWNER);
1744 return 1;
1745}
1746
1747
1748long
1749GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
1750 GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this);
1751 about->create();
1752 about->show(PLACEMENT_OWNER);
1753 return 1;
1754}
1755
1756
1757long
1758GUIApplicationWindow::onCmdHallOfFame(FXObject*, FXSelector, void*) {
1760 hall->create();
1761 hall->show(PLACEMENT_OWNER);
1762 return 1;
1763}
1764
1765
1766long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1767 FXEvent* event = (FXEvent*)ptr;
1768 FXString string = GUIUserIO::clipped.c_str();
1769 setDNDData(FROM_CLIPBOARD, event->target, string);
1770 return 1;
1771}
1772
1773
1774long
1775GUIApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
1776 eventOccurred();
1777 return 1;
1778}
1779
1780
1781long
1782GUIApplicationWindow::onRunThreadEvent(FXObject*, FXSelector, void*) {
1783 eventOccurred();
1784 return 1;
1785}
1786
1787
1788void
1790 while (!myEvents.empty()) {
1791 // get the next event
1792 GUIEvent* e = myEvents.top();
1793 myEvents.pop();
1794 // process
1795 switch (e->getOwnType()) {
1798 setFocus();
1799 break;
1801 if (myRunThread->networkAvailable()) { // avoid race-condition related crash if reload was pressed
1803 }
1804 break;
1812 break;
1814 GUIEvent_AddView* ave = dynamic_cast<GUIEvent_AddView*>(e);
1816 if (ave->getSchemeName() != "") {
1817 MFXComboBoxIcon* sCombo = v->getColoringSchemesCombo();
1818 int index = sCombo->findItem(ave->getSchemeName().c_str());
1819 if (index >= 0) {
1820 sCombo->setCurrentItem(index);
1821 }
1822 v->setColorScheme(ave->getSchemeName());
1823 }
1824 break;
1825 }
1827 GUIEvent_CloseView* ave = dynamic_cast<GUIEvent_CloseView*>(e);
1828 removeViewByID(ave->getCaption());
1829 break;
1830 }
1833 break;
1834 default:
1835 break;
1836 }
1837 delete e;
1838 }
1839 myToolBar2->forceRefresh();
1840 myToolBar3->forceRefresh();
1841}
1842
1843
1844void
1846 myAmLoading = false;
1848 // check whether the loading was successful
1849 if (ec->myNet == nullptr) {
1850 if (ec->myFile.size() > 0) {
1851 // report failure
1852 setStatusBarText(TLF("Loading of '%' failed!", ec->myFile));
1855 getApp()->exit(1);
1856 }
1857 }
1858 } else {
1859 // initialise simulation thread
1860 if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1863 getApp()->exit(1);
1864 }
1865 } else {
1866 // report success
1867 setStatusBarText(TLF("'%' loaded.", ec->myFile));
1869 myWasStarted = false;
1871 // initialise views
1872 myViewNumber = 0;
1874 // check/record settings file modification time
1875 long long mTime = myGuiSettingsFileMTime;
1876 if (ec->mySettingsFiles.size() > 0) {
1877 for (std::string fname : ec->mySettingsFiles) {
1878 mTime = MAX2(mTime, SysUtils::getModifiedTime(fname));
1879 }
1880 }
1881 // always reload if settings were modified or to restore multiple views
1882 if (!myIsReload) {
1884 }
1885 if (ec->mySettingsFiles.size() > 0 && (!myIsReload || myGuiSettingsFileMTime < mTime || ec->mySettingsFiles.size() > 1)) {
1886 // open a view for each file and apply settings
1887 for (std::string fname : ec->mySettingsFiles) {
1888 GUISettingsHandler settings(fname);
1889 GUISUMOViewParent::ViewType vt = defaultType;
1890 if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
1892 }
1893 if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
1895 }
1896 GUISUMOAbstractView* view = openNewView(vt);
1897 if (view == nullptr) {
1898 break;
1899 }
1900 if (settings.getSettingName() != "") {
1901 view->setColorScheme(settings.getSettingName());
1902 MFXComboBoxIcon* sCombo = view->getColoringSchemesCombo();
1903 int index = sCombo->findItem(settings.getSettingName().c_str());
1904 if (index >= 0) {
1905 sCombo->setCurrentItem(index);
1906 }
1907 }
1908 view->addDecals(settings.getDecals());
1909 settings.applyViewport(view);
1910 settings.setSnapshots(view);
1911 if (settings.getDelay() > 0.) {
1912 mySimDelay = settings.getDelay();
1913 }
1914 if (settings.getBreakpoints().size() > 0) {
1916 myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
1917 myRunThread->getBreakpointLock().unlock();
1918 }
1919 myJamSounds = settings.getEventDistribution("jam");
1920 myCollisionSounds = settings.getEventDistribution("collision");
1921 if (settings.getJamSoundTime() > 0) {
1922 myJamSoundTime = settings.getJamSoundTime();
1923 }
1924 for (const std::string& tlsID : settings.getTrackers()) {
1925 if (MSNet::getInstance()->getTLSControl().knows(tlsID)) {
1928 if (tllW) {
1929 tllW->begin2TrackPhases(this);
1930 }
1931 } else {
1932 WRITE_WARNINGF("Tracker for unknown tlLogic '%' in settings file '%'", tlsID, fname);
1933 }
1934 }
1935 }
1936 } else {
1937 openNewView(defaultType);
1938 }
1939 myGuiSettingsFileMTime = mTime;
1940 if (!OptionsCont::getOptions().isDefault("delay")) {
1941 setDelay(OptionsCont::getOptions().getFloat("delay"));
1942 mySimDelaySlider->setValue((int)mySimDelay);
1943 mySimDelaySpinner->setValue(mySimDelay);
1944 }
1945 if (!OptionsCont::getOptions().isDefault("breakpoints") && !myIsReload) {
1946 std::vector<SUMOTime> breakpoints;
1947 for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
1948 SUMOTime t = string2time(val);
1949 // round down to nearest reachable time step
1950 t -= t % DELTA_T;
1951 breakpoints.push_back(t);
1952 }
1953 std::sort(breakpoints.begin(), breakpoints.end());
1955 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1956 myRunThread->getBreakpointLock().unlock();
1957 }
1958 if (!OptionsCont::getOptions().isDefault("selection-file")) {
1959 delete myDynamicSelection;
1960 myDynamicSelection = new std::stringstream();
1961 std::string msg = gSelected.load(OptionsCont::getOptions().getString("selection-file"), GLO_MAX, myDynamicSelection);
1962 if (msg != "") {
1963 WRITE_ERRORF("Errors while loading selection: %", msg.c_str());
1964 }
1965 if (!myDynamicSelection->str().empty()) {
1966 std::string dummy;
1967 int numNotFound = 0;
1968 while (myDynamicSelection->good()) {
1969 (*myDynamicSelection) >> dummy;
1970 numNotFound++;
1971 }
1972 myDynamicSelection->clear(); // first clear error state before seek works
1973 myDynamicSelection->seekg(0);
1974 // @note for some reason the last line is read twice
1975 WRITE_MESSAGEF("% dynamic objects not present while loading selection", numNotFound - 1);
1976 }
1977 }
1978 myTLSGame = OptionsCont::getOptions().getString("game.mode") == "tls";
1979 if (OptionsCont::getOptions().getBool("game")) {
1980 if (myTLSGame) {
1981 setTitle(TL("SUMO Interactive Traffic Light"));
1982 } else {
1983 setTitle(TL("SUMO Interactive Demand-Responsive-Transport"));
1984 }
1985 onCmdGaming(nullptr, 0, nullptr);
1986 } else {
1987 // set simulation name on the caption
1988 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str()));
1989 }
1990 if (ec->myViewportFromRegistry) {
1991 Position off;
1992 off.set(getApp()->reg().readRealEntry("viewport", "x"),
1993 getApp()->reg().readRealEntry("viewport", "y"),
1994 getApp()->reg().readRealEntry("viewport", "z"));
1995 Position p(off.x(), off.y(), 0);
1996 GUISUMOAbstractView* view = myGLWindows[0]->getView();
1997 view->setViewportFromToRot(off, p, 0);
1998 }
1999 // set simulation step begin information
2000 myLCDLabel->setText("----------------");
2001 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2002 (*it)->setText("-");
2003 }
2004 // initialize scale from options unless already set in the UI
2005 if (myDemandScaleSpinner->getValue() == 1 || !OptionsCont::getOptions().isDefault("scale")) {
2007 }
2010 }
2011 }
2012 getApp()->endWaitCursor();
2013 // start if wished
2015 onCmdStart(nullptr, 0, nullptr);
2016 }
2017 update();
2018}
2019
2020
2021void
2023#ifdef WIN32
2024 long t = SysUtils::getCurrentMillis();
2025 // only skip if the simulation is running
2026 if (t - myLastStepEventMillis < MIN_DRAW_DELAY && myRunThread->simulationIsStopable()) {
2027 // do not try to redraw with more than 50FPS (#6371)
2028 return;
2029 }
2031#endif
2033 const int running = myRunThread->getNet().getVehicleControl().getRunningVehicleNo();
2034 const int backlog = myRunThread->getNet().getInsertionControl().getWaitingVehicleNo();
2035 if (backlog > running) {
2036 if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::GREENVEHICLE)) {
2038 }
2039 } else {
2040 if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::YELLOWVEHICLE)) {
2042 }
2043 }
2044 myStatButtons.front()->setText(toString(running).c_str());
2045 if (myRunThread->getNet().hasPersons()) {
2046 if (!myStatButtons[1]->shown()) {
2047 myStatButtons[1]->show();
2048 }
2050 }
2051 if (myRunThread->getNet().hasContainers()) {
2052 if (!myStatButtons[2]->shown()) {
2053 myStatButtons[2]->show();
2054 }
2056 }
2057 if (myAmGaming) {
2058 if (myTLSGame) {
2060 } else {
2062 }
2063 }
2065 getApp()->forceRefresh(); // restores keyboard focus
2066 }
2067 // try to load dynamic selection
2068 if (myDynamicSelection != nullptr) {
2069 std::stringstream tmp;
2071 if (tmp.str().empty()) {
2072 delete myDynamicSelection;
2073 myDynamicSelection = nullptr;
2074 } else {
2075 myDynamicSelection->str(tmp.str());
2076 myDynamicSelection->clear(); // first clear error state before seek works
2077 myDynamicSelection->seekg(0);
2078 }
2079 }
2081 update();
2082}
2083
2084
2085void
2087 GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
2089 setStatusBarText(ec->getMsg());
2090 } else {
2092 }
2093}
2094
2095
2096void
2099 onCmdStop(nullptr, 0, nullptr);
2100 if (ec->getReason() == MSNet::SIMSTATE_LOADING) {
2101 onCmdReload(nullptr, 0, nullptr);
2102 } else if (GUIGlobals::gQuitOnEnd) {
2104 getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
2105 } else if (GUIGlobals::gDemoAutoReload) {
2106 onCmdReload(nullptr, 1, nullptr);
2107 } else if (!myHaveNotifiedAboutSimEnd) {
2108 // GUIRunThread::deleteSim() triggers the final message to the log file
2109 // (this will never reach the GUI but we cannot use WRITE_MESSAGE here
2110 // to avoid a duplicate log entry)
2112 TLF("Simulation ended at time: %. (%)",
2114 // build the text
2115 const std::string text = TLF("Simulation ended at time: %.", time2string(ec->getTimeStep())) + "\n" +
2116 TL("Reason:") + MSNet::getStateMessage(ec->getReason()) + "\n" +
2117 TL("Do you want to close all open files and views?");
2118 FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, TL("Simulation ended"), "%s", text.c_str());
2119 if (answer == 1) { //1:yes, 2:no, 4:esc
2121 } else {
2124 update();
2125 }
2127 }
2128}
2129
2130
2131void
2136#ifdef HAVE_DANGEROUS_SOUNDS // disable user-configurable command execution for public build
2137 if (myJamSounds.getOverallProb() > 0) {
2138 // play honking sound if some vehicle is waiting too long
2139 for (; it != end; ++it) {
2140 // XXX use impatience instead of waiting time ?
2141 if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
2142 const std::string cmd = myJamSounds.get(&myGamingRNG);
2143 if (cmd != "") {
2144 // yay! fun with dangerous commands... Never use this over the internet
2146 // one sound per simulation step is enough
2147 break;
2148 }
2149 }
2150 }
2151 }
2154 if (myPreviousCollisionNumber != collisions) {
2155 const std::string cmd = myCollisionSounds.get(&myGamingRNG);
2156 if (cmd != "") {
2157 // yay! fun with dangerous commands... Never use this over the internet
2159 }
2160 myPreviousCollisionNumber = collisions;
2161 }
2162 }
2163#endif
2164 // update performance indicators
2165 for (it = vc.loadedVehBegin(); it != end; ++it) {
2166 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2167 assert(veh != 0);
2168 if (veh->isOnRoad() && !veh->isStopped()) {
2169 const double vmax = veh->getLane()->getVehicleMaxSpeed(veh);
2170 if (veh->getSpeed() < SUMO_const_haltingSpeed) {
2172 if (veh->getVClass() == SVC_EMERGENCY) {
2174 }
2175 }
2176 myTimeLoss += TIME2STEPS(TS * (vmax - veh->getSpeed()) / vmax); // may be negative with speedFactor > 1
2177 }
2178
2179 }
2183}
2184
2185
2186void
2188 // update performance indicators
2192
2195 for (auto it = vc.loadedVehBegin(); it != end; ++it) {
2196 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2197 assert(veh != 0);
2198 if (veh->isOnRoad() && !veh->isStopped()) {
2200 }
2201 }
2203}
2204
2205
2206void
2208 if (!myAmLoading) {
2210 getApp()->beginWaitCursor();
2211 myAmLoading = true;
2212 myIsReload = false;
2214 gSchemeStorage.saveViewport(0, 0, -1, 0); // recenter view
2216 if (file.size() > 0) {
2217 setStatusBarText(TLF("Loading '%'.", file));
2218 }
2219 update();
2220 }
2221}
2222
2223
2226 if (!myRunThread->networkAvailable()) {
2227 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
2228 return nullptr;
2229 }
2230 GUISUMOAbstractView* oldView = nullptr;
2231 if (myMDIClient->numChildren() > 0) {
2232 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2233 if (w != nullptr) {
2234 oldView = w->getView();
2235 }
2236 }
2237 if (caption == "") {
2238 caption = "View #" + toString(myViewNumber++);
2239 }
2240 FXuint opts = MDI_TRACKING;
2241 GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
2242 this, GUIIconSubSys::getIcon(GUIIcon::SUMO_MINI), opts, 10, 10, 200, 100);
2244 if (oldView != nullptr) {
2245 // copy viewport
2246 oldView->copyViewportTo(v);
2247 }
2248 w->create();
2249 if (myMDIClient->numChildren() == 1) {
2250 w->maximize();
2251 } else {
2252 myMDIClient->vertical(true);
2253 }
2254 myMDIClient->setActiveChild(w);
2255
2256 return v;
2257}
2258
2259
2260FXGLCanvas*
2262 if (myMDIClient->numChildren() == 0) {
2263 return nullptr;
2264 }
2265 GUISUMOViewParent* share_tmp1 =
2266 static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
2267 return share_tmp1->getBuildGLCanvas();
2268}
2269
2270
2271void
2273 myTrackerLock.lock();
2274 myLCDLabel->setText("----------------");
2275 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2276 (*it)->setText("-");
2277 if (it != myStatButtons.begin()) {
2278 (*it)->hide();
2279 }
2280 }
2281 // delete the simulation
2283 // reset the caption
2284 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
2285 // remove trackers and other external windows (must be delayed until deleteSim)
2286 while (!myGLWindows.empty()) {
2287 delete myGLWindows.front();
2288 }
2289 // make a copy because deleting modifyes the vector;
2290 std::vector<FXMainWindow*> trackerWindows = myTrackerWindows;
2291 for (FXMainWindow* const window : trackerWindows) {
2292 delete window;
2293 }
2294 myTrackerWindows.clear();
2295 // clear selected items
2296 gSelected.clear();
2297 // add a separator to the log
2299 myTrackerLock.unlock();
2300 // remove coordinate information
2301 myGeoCoordinate->setText(TL("N/A"));
2302 myCartesianCoordinate->setText(TL("N/A"));
2303 if (myTestCoordinate) {
2304 myTestCoordinate->setText(TL("N/A"));
2305 }
2306 //
2309 update();
2310}
2311
2312
2313FXCursor*
2315 return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
2316}
2317
2318
2323
2324
2325double
2329
2330
2331void
2333 loadConfigOrNet("");
2334 if (wait) {
2335 while (myAmLoading) {
2336 myRunThread->sleep(50);
2337 }
2338 }
2339}
2340
2341
2342void
2344 myStatusbar->getStatusLine()->setText(text.c_str());
2345 myStatusbar->getStatusLine()->setNormalText(text.c_str());
2346}
2347
2348
2349void
2351 myRecentNetworks.appendFile(f);
2352}
2353
2354
2355void
2357 myRecentConfigs.appendFile(f);
2358}
2359
2360
2361void
2363 if (myShowTimeAsHMS) {
2364 myLCDLabel->setToolTipText("HH:MM:SS");
2365 if (myAmGaming) {
2367 myTimeLossLabel->setToolTipText("HH:MM:SS");
2369 }
2370 } else {
2371 myLCDLabel->setToolTipText(TL("seconds"));
2372 if (myAmGaming) {
2374 myTimeLossLabel->setToolTipText(TL("seconds"));
2376 }
2377 }
2378}
2379
2380
2381void
2383 time -= DELTA_T; // synchronize displayed time with netstate output
2384 if (time < 0) {
2385 myLCDLabel->setText("----------------");
2386 return;
2387 }
2388 if (myAmGaming) {
2389 // show time counting backwards
2390 time = myRunThread->getSimEndTime() - time;
2391 }
2392 std::ostringstream str;
2393 str << std::setfill('0');
2394 const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0;
2395 if (myShowTimeAsHMS) {
2396 SUMOTime day = time / 86400000;
2397 if (day > 0) {
2398 str << day << '-';
2399 time %= 86400000;
2400 }
2401 str << std::setw(2);
2402 str << time / 3600000 << '-';
2403 time %= 3600000;
2404 str << std::setw(2) << time / 60000 << '-';
2405 time %= 60000;
2406 }
2407 str << std::setw(2) << time / 1000;
2408 if (!hideFraction) {
2409 str << '.' << std::setw(3) << time % 1000;
2410 }
2411 myLCDLabel->setText(str.str().c_str());
2412}
2413
2414
2415void
2417 if (press != nullptr) {
2418 myHotkeyPress[key] = press;
2419 }
2420 if (release != nullptr) {
2421 myHotkeyRelease[key] = release;
2422 }
2423}
2424
2425
2426long
2427GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* ptr) {
2428 FXEvent* e = (FXEvent*) ptr;
2429 // PgUp and PgDown switch between widgets by default and binding them via menu shortcuts does not work reliably
2430 // so we must intercept them before FXMainWindow can handle it
2431 if (e->code == FX::KEY_Page_Up) {
2432 onCmdDelayInc(nullptr, 0, nullptr);
2433 } else if (e->code == FX::KEY_Page_Down) {
2434 onCmdDelayDec(nullptr, 0, nullptr);
2435 } else {
2436 // disable hotkeys without modifiers for the game
2437 const bool ignoreSimple = myAmGaming && (e->state & (CONTROLMASK | SHIFTMASK | ALTMASK)) == 0;
2438 const long handled = ignoreSimple ? 0 : FXMainWindow::onKeyPress(o, sel, ptr);
2439 if (handled == 0 && myMDIClient->numChildren() > 0) {
2440 auto it = myHotkeyPress.find(e->code);
2441 if (it != myHotkeyPress.end()) {
2442 it->second->execute(SIMSTEP);
2443 }
2444 if (!ignoreSimple) {
2445 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2446 if (w != nullptr) {
2447 w->onKeyPress(nullptr, sel, ptr);
2448 }
2449 }
2450 }
2451 }
2452 return 0;
2453}
2454
2455
2456long
2457GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* ptr) {
2458 const long handled = FXMainWindow::onKeyRelease(o, sel, ptr);
2459 if (handled == 0 && myMDIClient->numChildren() > 0) {
2460 FXEvent* e = (FXEvent*) ptr;
2461 auto it = myHotkeyRelease.find(e->code);
2462 if (it != myHotkeyRelease.end()) {
2463 it->second->execute(SIMSTEP);
2464 }
2465 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2466 if (w != nullptr) {
2467 w->onKeyRelease(nullptr, sel, ptr);
2468 }
2469 }
2470 return 0;
2471}
2472
2473
2474double
2476 return mySimDelay;
2477}
2478
2479
2480void
2482 mySimDelay = delay;
2483}
2484
2485
2486void
2488 myEventMutex.lock();
2489 myEvents.push_back(event);
2491 //myEventCondition.wait(myEventMutex);
2492 myEventMutex.unlock();
2493}
2494
2495
2496void
2497GUIApplicationWindow::setBreakpoints(const std::vector<SUMOTime>& breakpoints) {
2498 if (myRunThread != nullptr) {
2500 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
2501 myRunThread->getBreakpointLock().unlock();
2503 }
2504}
2505
2506
2507void
2509 const SUMOTime begin = string2time(OptionsCont::getOptions().getString("begin"));
2510 if (time >= begin) {
2511 // ensure breakpoint is valid
2512 time -= (time - begin) % DELTA_T;
2513 std::vector<SUMOTime> breakpoints = retrieveBreakpoints();
2514 if (std::find(breakpoints.begin(), breakpoints.end(), time) == breakpoints.end()) {
2515 breakpoints.push_back(time);
2516 std::sort(breakpoints.begin(), breakpoints.end());
2517 setBreakpoints(breakpoints);
2518 setStatusBarText(TLF("Set breakpoint at %", time2string(time)));
2519 }
2520 }
2521}
2522
2523
2524const std::vector<SUMOTime>
2527 std::vector<SUMOTime> result = myRunThread->getBreakpoints();
2528 myRunThread->getBreakpointLock().unlock();
2529 return result;
2530}
2531
2532
2533void
2537
2538/****************************************************************************/
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:683
@ 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:657
@ 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:685
@ 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:403
@ MID_HOTKEY_CTRL_I_EDITVIEWPORT
Open viewport editor.
Definition GUIAppEnum.h:99
@ 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_LANGUAGE_HU
change language to hungarian
@ 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:661
@ 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_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:401
@ MID_HOTKEYS
hotkeys button
Definition GUIAppEnum.h:659
@ MID_TIMELINK_BREAKPOINT
Set breakpionts from messages - Option.
Definition GUIAppEnum.h:573
@ 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:395
@ MID_DELAY_DEC
decrease sim delay
Definition GUIAppEnum.h:399
@ MID_LISTPARKING
Definition GUIAppEnum.h:361
@ MID_NEW_OSGVIEW
Open a new microscopic 3D view.
Definition GUIAppEnum.h:340
@ MID_LANGUAGE_JA
change language to japanese
@ MID_FEEDBACK
feedback button
Definition GUIAppEnum.h:663
@ 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:397
@ 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
FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[]
#define MIN_DRAW_DELAY
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 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.
@ EDITVIEWPORT
@ CLEARMESSAGEWINDOW
@ NETEDIT_MINI
@ GREENVEHICLE
@ LOCATEVEHICLE
@ LOCATEPERSON
@ WINDOWS_TILE_VERT
@ GREENCONTAINER
@ WINDOWS_CASCADE
@ OPEN
open icons
@ LOCATECONTAINER
@ LOCATEJUNCTION
@ APP_BREAKPOINTS
@ SAVE_SUMOCONFIG
@ WINDOWS_TILE_HORI
@ YELLOWVEHICLE
@ OPEN_SUMOCONFIG
@ SAVE
save icons
@ KEY_SPACE
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:38
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:91
#define SPEED2DIST(x)
Definition SUMOTime.h:45
#define SIMSTEP
Definition SUMOTime.h:61
#define TS
Definition SUMOTime.h:42
#define TIME2STEPS(x)
Definition SUMOTime.h:57
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
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:46
#define TLC(context, string)
Definition Translation.h:47
Base (microsim) event class.
Definition Command.h:50
void setSelector(FXSelector sel)
set the selector
void setTarget(FXObject *tgt)
set the target
static bool isReadable(std::string path)
Checks whether the given file is readable.
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
FXMenuPane * myFileMenuRecentConfigs
FXMenu pane for recent configs.
long onCmdStop(FXObject *, FXSelector, void *)
Called on "stop".
MFXRecentNetworks myRecentNetworks
List of recent networks.
MFXLCDLabel * myTimeLossLabel
time loss label
double myJamSoundTime
waiting time after which vehicles trigger jam sounds
FXRealSpinner * myDemandScaleSpinner
the demand scale
long onCmdTutorial(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Tutorial
virtual void setDelay(double delay)
Sets the delay of the parent application in milliseconds.
MFXLCDLabel * myEmergencyVehicleLabel
emergency vehicle label
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
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
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.
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)
std::vector< FXMainWindow * > myTrackerWindows
list of tracker windows
FXMenuPane * myLanguageMenu
Language menu common to all applications.
bool myListTeleporting
information whether the locator should list teleporting vehicles
FXLabel * myCartesianCoordinate
Labels for the current cartesian, geo-coordinate and test coordinates.
std::map< std::string, std::string > myOnlineMaps
online mapping services for the context menu
MFXStaticToolTip * myStaticTooltipMenu
static toolTip used in menus
FXMDIClient * myMDIClient
The multi view panel.
FXHorizontalFrame * myTraCiFrame
frames for coordinates
void buildLanguageMenu(FXMenuBar *menuBar)
long onCmdChangeLanguage(FXObject *, FXSelector, void *)
bool listParking() const
return whether to list parking vehicles
FXHorizontalFrame * myGeoFrame
FXHorizontalFrame * myTestFrame
FXHorizontalFrame * myCartesianFrame
FXLabel * myTestCoordinate
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
FXDockSite * myTopDock
dock sites
bool myListInternal
information whether the locator should list internal structures
void storeWindowSizeAndPos()
record window position and size in registry
bool myAmFullScreen
FOX need this.
FXLabel * myGeoCoordinate
FXStatusBar * myStatusbar
The status bar.
void updateChildren(int msg=MID_SIMSTEP)
update childrens
FXGLVisual * myGLVisual
The gl-visual used.
bool myAmGaming
information whether the gui is currently in gaming mode
std::vector< GUIGlChildWindow * > myGLWindows
list of GLWindows
long onUpdChangeLanguage(FXObject *, FXSelector, void *)
A logging window for the gui.
void addSeparator()
Adds a a separator to this log window.
void clear()
Clears the window.
void appendMsg(GUIEventType eType, const std::string &msg)
Adds new text to the window.
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:801
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 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
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
GUIPerspectiveChanger & getChanger() const
get changer
virtual void setViewportFromToRot(const Position &lookFrom, const Position &lookAt, double rotation)
applies the given viewport settings
GUIVisualizationSettings * editVisualisationSettings() const
edit visualization settings (allow modify VisualizationSetings, use carefully)
virtual void copyViewportTo(GUISUMOAbstractView *view)
copy the viewport to the given view
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 initTextures(FXApp *a)
Initiate GUITextureSubSys for textures.
static void clearTextures()
clears loaded 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.
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 push_back(T what)
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:145
static FXString getTitleText(const FXString &appname, FXString filename="")
Returns the title text in dependence to an optional file name.
Definition MFXUtils.cpp:61
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:40
static FXString assureExtension(const FXFileDialog &openDialog)
Corrects missing extension.
Definition MFXUtils.cpp:70
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:1096
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition MSLane.h:619
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition MSLane.h:574
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
Definition MSNet.cpp:1761
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:186
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition MSNet.h:465
@ 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:991
void quickReload()
reset state to the beginning without reloading the network
Definition MSNet.cpp:1740
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:334
bool hasContainers() const
Returns whether containers are simulated.
Definition MSNet.h:425
bool hasPersons() const
Returns whether persons are simulated.
Definition MSNet.h:409
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition MSNet.h:445
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition MSNet.h:515
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:392
static void initGUIThreadRNG()
initialize RNG for the gui thread
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
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition MSVehicle.h: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.
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:189
static const RGBColor RED
named colors
Definition RGBColor.h:188
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 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.
static std::string transcodeToLocal(const std::string &utf8String)
convert a string from UTF-8 to the local codepage
A few system-specific functions.
Definition SysUtils.h:30
static unsigned long runHiddenCommand(const std::string &cmd)
run a shell command without popping up any windows (particuarly on win32)
Definition SysUtils.cpp:69
static long long getModifiedTime(const std::string &fname)
@brie get modified time
Definition SysUtils.cpp:109
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition SysUtils.cpp:44
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.
@ SEL_THREAD_EVENT
Definition fxexdefs.h:173
@ SEL_THREAD
Definition fxexdefs.h:155