Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIApplicationWindow.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
22// The main window of the SUMO-gui.
23/****************************************************************************/
24#include <config.h>
25
26#ifdef HAVE_VERSION_H
27#include <version.h>
28#endif
29
30#include <fxkeys.h>
31
32#include <guisim/GUILane.h>
33#include <guisim/GUINet.h>
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#define STAT_VEHS 0
87#define STAT_DELAYED 1
88#define STAT_TELEPORTS 2
89#define STAT_PERSONS 3
90#define STAT_CONTAINERS 4
91
92// ===========================================================================
93// FOX-declarations
94// ===========================================================================
95FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[] = {
96 // close
100 FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GUIApplicationWindow::onCmdQuit),
101 // toolbar
118 // gaming
128 // OSG
129#ifdef HAVE_OSG
130 FXMAPFUNC(SEL_COMMAND, MID_NEW_OSGVIEW, GUIApplicationWindow::onCmdNewOSG),
132
133#endif
134 // Time
141 FXMAPFUNC(SEL_COMMAND, MID_DELAY_INC, GUIApplicationWindow::onCmdDelayInc),
142 FXMAPFUNC(SEL_COMMAND, MID_DELAY_DEC, GUIApplicationWindow::onCmdDelayDec),
143 FXMAPFUNC(SEL_COMMAND, MID_SIMSAVE, GUIApplicationWindow::onCmdSaveState),
144 FXMAPFUNC(SEL_COMMAND, MID_SIMLOAD, GUIApplicationWindow::onCmdLoadState),
151 // Stats
155 // these functions do not assign shortcut keys to commands, but rather affect the button enable status upon other events (e.g. simulation loaded)
156 // since those events are invoked through pseudo key events (?), the same key shortcuts as in cmd must be supplied as well
186 FXMAPFUNC(SEL_COMMAND, MID_HOTKEYS, GUIApplicationWindow::onCmdHotkeys),
187 FXMAPFUNC(SEL_COMMAND, MID_TUTORIAL, GUIApplicationWindow::onCmdTutorial),
189 FXMAPFUNC(SEL_COMMAND, MID_FEEDBACK, GUIApplicationWindow::onCmdFeedback),
191 // forward requests to the active view
210 // languages
231 // keys
232 FXMAPFUNC(SEL_KEYPRESS, 0, GUIApplicationWindow::onKeyPress),
233 FXMAPFUNC(SEL_KEYRELEASE, 0, GUIApplicationWindow::onKeyRelease),
234 // clipboard
235 FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GUIApplicationWindow::onClipboardRequest),
236 // events
241};
242
243// Object implementation
244FXIMPLEMENT(GUIApplicationWindow, FXMainWindow, GUIApplicationWindowMap, ARRAYNUMBER(GUIApplicationWindowMap))
245
246// ===========================================================================
247// static members
248// ===========================================================================
250
251
252// ===========================================================================
253// member method definitions
254// ===========================================================================
255#ifdef _MSC_VER
256#pragma warning(push)
257#pragma warning(disable: 4355) // mask warning about "this" in initializers
258#endif
260 GUIMainWindow(a),
261 myFileMenuRecentNetworks(new FXMenuPane(this)),
262 myFileMenuRecentConfigs(new FXMenuPane(this)),
263 myRecentNetworks(a, "networks"),
264 myRecentConfigs(a, "configs"),
265 myLastStepEventMillis(SysUtils::getCurrentMillis() - MIN_DRAW_DELAY) {
266 // init icons
268 // init Textures
270 // init cursors
272 // disable tooltips
273 a->setTooltipTime(1000000000);
274 a->setTooltipPause(1000000000);
275}
276#ifdef _MSC_VER
277#pragma warning(pop)
278#endif
279
280
285
286
287void
289 // don't do this twice
290 if (hadDependentBuild) {
291 return;
292 }
293 hadDependentBuild = true;
294 setTarget(this);
295 setSelector(MID_WINDOW);
296 // build menu bar
297 myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBar);
299 new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
301 // build the thread - io
306 // build the status bar
307 myStatusbar = new FXStatusBar(this, GUIDesignStatusBar);
308 {
309 // build TraCi info
311 auto button = GUIDesigns::buildFXButton(myTraCiFrame, "TraCI", "", "", nullptr, this, MID_TRACI_STATUS, GUIDesignButtonStatusBarFixed);
312 button->setBackColor(FXRGBA(253, 255, 206, 255));
313 if (TraCIServer::getInstance() == nullptr) {
314 myTraCiFrame->hide();
315 }
316 // build geo coordiantes
318 myGeoCoordinate = GUIDesigns::buildFXLabel(myGeoFrame, TL("N/A"), "", TL("Original coordinate (before coordinate transformation in netconvert)"), nullptr, LAYOUT_CENTER_Y);
319 // build cartesian coordinates
321 myCartesianCoordinate = GUIDesigns::buildFXLabel(myCartesianFrame, TL("N/A"), "", TL("Network coordinate"), nullptr, LAYOUT_CENTER_Y);
322 // build buttons
323 std::vector<std::string> help({
324 TL("number of running vehicles"),
325 TL("number of insertion backlogged vehicles"),
326 TL("percentage of teleports per departed vehicles"),
327 TL("number of active persons"),
328 TL("number of active containers")});
329
332 myStatButtons.back()->hide();
334 myStatButtons.back()->hide();
336 myStatButtons.back()->hide();
338 myStatButtons.back()->hide();
339 }
340 // make the window a mdi-window
341 myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
343 myMDIMenu = new FXMDIMenu(this, myMDIClient);
344 new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
345 new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
346 new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
347 new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
348 // build the message window
350 // fill menu and tool bar
351 fillMenuBar();
352 myToolBar6->hide();
353 myToolBar7->hide();
354 myToolBar9->hide();
355 myToolBar10->hide();
356 // build additional threads
357 myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent, isLibsumo);
359 // set the status bar
360 setStatusBarText(TL("Ready."));
361 // set the caption
362 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
363 // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
364 myRunThread->start();
367}
368
369
370void
373 gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
374 FXMainWindow::create();
375 myMenuBarDrag->create();
376 myToolBarDrag1->create();
377 myToolBarDrag2->create();
378 myToolBarDrag3->create();
379 myToolBarDrag4->create();
380 myToolBarDrag5->create();
381 myToolBarDrag6->create();
382 myToolBarDrag7->create();
383 myFileMenu->create();
384 mySelectByPermissions->create();
385 myEditMenu->create();
386 mySettingsMenu->create();
387 myLocatorMenu->create();
388 myControlMenu->create();
389 myWindowMenu->create();
390 myLanguageMenu->create();
391 myHelpMenu->create();
392 FXint textWidth = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
393 myCartesianFrame->setWidth(textWidth);
394 myGeoFrame->setWidth(textWidth);
395 if (myTestFrame) {
396 myTestFrame->setWidth(textWidth);
397 }
398
399 show(PLACEMENT_DEFAULT);
400 if (!OptionsCont::getOptions().isSet("window-size")) {
401 if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
402 maximize();
403 }
404 }
405 myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
406 myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
407 const std::string& onlineMaps = getApp()->reg().readStringEntry("gui", "onlineMaps", "");
408 for (const std::string& entry : StringTokenizer(onlineMaps, "\n").getVector()) {
409 const std::vector<std::string> split = StringTokenizer(entry, "\t").getVector();
410 if (split.size() == 2) {
411 myOnlineMaps[split[0]] = split[1];
412 }
413 }
414 if (myOnlineMaps.empty()) {
415 myOnlineMaps["GeoHack"] = "https://geohack.toolforge.org/geohack.php?params=%lat;%lon_scale:1000";
416 myOnlineMaps["Google Maps"] = "https://www.google.com/maps/search/?api=1&query=%lat,%lon&zoom=19";
417 myOnlineMaps["OSM"] = "https://www.openstreetmap.org/?mlat=%lat&mlon=%lon&zoom=18&layers=M";
418 }
420}
421
422
425 myRunThread->join();
427 // close icons
430 // delete visual
431 delete myGLVisual;
432 // delete some non-parented windows
433 delete myToolBarDrag1;
434 delete mySimDelayTarget;
435 // delete rest of elements
438 delete myRunThread;
439 delete myFileMenu;
440 delete myEditMenu;
442 delete mySettingsMenu;
443 delete myLocatorMenu;
444 delete myControlMenu;
445 delete myLanguageMenu;
446 delete myWindowMenu;
447 delete myHelpMenu;
448 delete myLoadThread;
449
450 while (!myEvents.empty()) {
451 // get the next event
452 GUIEvent* e = myEvents.top();
453 myEvents.pop();
454 delete e;
455 }
456 for (auto item : myHotkeyPress) {
457 delete item.second;
458 }
459 for (auto item : myHotkeyRelease) {
460 delete item.second;
461 }
462}
463
464
465void
467 FXMainWindow::detach();
468 myMenuBarDrag->detach();
469 myToolBarDrag1->detach();
470}
471
472
473void
474GUIApplicationWindow::addToWindowsMenu(FXMenuPane* /*menuPane*/) {
475 // unused, implement in children
476}
477
478
479void
481 // build file menu
482 myFileMenu = new FXMenuPane(this);
485 TL("New Window"), "Ctrl+Shift+N", TL("Open a new sumo-gui window."),
486 nullptr, this, MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW);
487 new FXMenuSeparator(myFileMenu);
489 TL("&Open Simulation..."), "Ctrl+O", TL("Open a simulation (Configuration file)."),
492 TL("Open &Network..."), "Ctrl+N", TL("Open a network."),
495 TL("Open Shapes "), "Ctrl+P", TL("Load POIs and Polygons for visualization."),
498 TL("Open EdgeData "), "Ctrl+U", TL("Load edge related data for visualization."),
501 TL("&Reload"), "Ctrl+R", TL("Reloads the simulation / the network."),
504 TL("Quick-Reload"), "Ctrl+0", TL("Reloads the simulation (but not network)."),
506 new FXMenuSeparator(myFileMenu);
508 TL("Save Configuration"), "Ctrl+Shift+S", TL("Save current options as a configuration file."),
511 TL("Close"), "Ctrl+W", TL("Close the simulation."),
513 new FXMenuSeparator(myFileMenu);
514 // build recent files
517 new FXMenuSeparator(myFileMenu);
519 TL("&Quit"), "Ctrl+Q", TL("Quit the Application."),
520 nullptr, this, MID_HOTKEY_CTRL_Q_CLOSE);
521 // build edit menu
522 mySelectByPermissions = new FXMenuPane(this);
523 std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
524 for (const auto& vehicleClass : vehicleClasses) {
526 }
527 myEditMenu = new FXMenuPane(this);
530 TL("Edit Selected..."), "Ctrl+E", TL("Opens a dialog for editing the list of selected items."),
532 mySelectLanesMenuCascade = new FXMenuCascade(myEditMenu, TL("Select lanes which allow..."), GUIIconSubSys::getIcon(GUIIcon::FLAG), mySelectByPermissions);
533 mySelectLanesMenuCascade->setHelpText(TL("Opens a menu for selecting a vehicle class by which to selected lanes."));
534 new FXMenuSeparator(myEditMenu);
536 TL("Set Breakpoint"), "B", TL("Sets a breakpoint at the current simulation step"),
539 TL("Set Breakpoint with offset"), "Alt+B", TL("Sets a breakpoint at the current simulation step + offset configured in application settings"),
542 TL("Edit Breakpoints"), "Ctrl+B", TL("Opens a dialog for editing breakpoints."),
545 TL("Edit Visualisation"), "F9", TL("Opens a dialog for editing visualization settings."),
548 TL("Edit Viewport"), "Ctrl+I", TL("Opens a dialog for editing viewing area, zoom and rotation."),
550 new FXMenuSeparator(myEditMenu);
551 // add open in sumo options
552 myLoadAdditionalsInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load additionals in netedit"), TL("Load additionals in netedit."), this, MID_TOOLBAREDIT_LOADADDITIONALS);
553 myLoadAdditionalsInNetedit->setCheck(TRUE);
554 myLoadDemandInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load demand in netedit"), TL("Load demand in netedit."), this, MID_TOOLBAREDIT_LOADDEMAND);
555 myLoadDemandInNetedit->setCheck(FALSE);
557 TL("Open in netedit"), "Ctrl+T", TL("Opens current simulation in NETEDIT."),
560 TL("Open network in netedit"), "Ctrl+Shift+T", TL("Opens current network in NETEDIT."),
562 // build settings menu
563 mySettingsMenu = new FXMenuPane(this);
566 TL("Application Settings"), "Ctrl+H", TL("Open a Dialog for Application Settings editing."),
568 myGamingModeCheckbox = new FXMenuCheck(mySettingsMenu,
569 TL("Gaming Mode\tCtrl+G\tToggle gaming mode on/off."),
572 TL("Full Screen Mode"), "Ctrl+F", TL("Toggle full screen mode on/off."),
574 // build Locate menu
575 myLocatorMenu = new FXMenuPane(this);
578 TL("&Junctions"), "Shift+J", TL("Open a dialog for locating a Junction."),
581 TL("&Edges"), "Shift+E", TL("Open a dialog for locating an Edge."),
584 TL("&Vehicles"), "Shift+V", TL("Open a dialog for locating a Vehicle."),
587 TL("&Persons"), "Shift+P", TL("Open a dialog for locating a Person."),
590 TL("&Container"), "Shift+C", TL("Open a dialog for locating a Container."),
593 TL("&TLS"), "Shift+T", TL("Open a dialog for locating a Traffic Light."),
596 TL("&Additional"), "Shift+A", TL("Open a dialog for locating an Additional Structure."),
599 TL("P&oI"), "Shift+O", TL("Open a dialog for locating a Point of Interest."),
602 TL("Po&lygon"), "Shift+L", TL("Open a dialog for locating a Polygon."),
604 new FXMenuSeparator(myLocatorMenu);
605 GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Internal Structures"), TL("Show internal junctions and streets in locator dialog."), this, MID_LISTINTERNAL);
606 FXMenuCheck* listParking = GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Parking Vehicles"), TL("Show parking vehicles in locator dialog."), this, MID_LISTPARKING);
607 listParking->setCheck(myListParking);
608 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);
609 // build control menu
610 // the shortcut designator is not only at text in the submenu but also defines the real shortcut key assigned with it!
611 // secondary shortcuts (ctrl+A, ctrl+S, ctrl+D) are defined in GUIShortcutsSubSys::buildSUMOAccelerators
612 myControlMenu = new FXMenuPane(this);
613 GUIDesigns::buildFXMenuTitle(myMenuBar, TL("Simulation"), nullptr, myControlMenu);
615 TL("Run"), "A,space", TL("Start/ Resume the simulation."),
618 TLC("Simulation", "Stop"), "S,space", TL("Halt the simulation."),
621 TL("Step"), "D", TL("Perform one simulation step."),
624 TL("Delay+"), "PgUp", TL("Increase simulation step delay."), nullptr, this, MID_DELAY_INC);
626 TL("Delay-"), "PgDn", TL("Decrease simulation step delay."), nullptr, this, MID_DELAY_DEC);
628 TL("Save"), "", TL("Save the current simulation state to a file."),
631 TL("Load"), "", TL("Load simulation state for the current network from file."),
633 // build windows menu
634 myWindowMenu = new FXMenuPane(this);
636 GUIDesigns::buildFXMenuCommandShortcut(myWindowMenu, TL("Open new view"), "", TL("Open a new microscopic view."), GUIIconSubSys::getIcon(GUIIcon::MICROVIEW), this, MID_NEW_MICROVIEW);
637#ifdef HAVE_OSG
639#endif
641 TL("Tile &Horizontally"), "", TL("Tile the views horizontally."),
642 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_HORI), myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
644 TL("Tile &Vertically"), "", TL("Tile the views vertically."),
645 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_VERT), myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
647 TL("Cascade"), "", TL("Cascade the views."),
649 myMDIClient, FXMDIClient::ID_MDI_CASCADE);
651 TL("&Close"), "", TL("Close the selected view."),
652 nullptr, myMDIClient, FXMDIClient::ID_MDI_CLOSE);
653 FXMenuSeparator* sep2 = new FXMenuSeparator(myWindowMenu);
654 sep2->setTarget(myMDIClient);
655 sep2->setSelector(FXMDIClient::ID_MDI_ANY);
656 // for whatever reason, sonar complains in the next line that sep2 may leak, but fox does the cleanup
657 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_1); // NOSONAR
658 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_2);
659 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_3);
660 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_4);
661 GUIDesigns::buildFXMenuCommand(myWindowMenu, TL("&Others..."), nullptr, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
662
663 new FXMenuSeparator(myWindowMenu);
664 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Status Line"), TL("Toggle the Status Bar on/off."), myStatusbar, FXWindow::ID_TOGGLESHOWN);
665 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Message Window"), TL("Toggle the Message Window on/off."), myMessageWindow, FXWindow::ID_TOGGLESHOWN);
666 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Time"), TL("Toggle the Simulation Time on/off."), myToolBar3, FXWindow::ID_TOGGLESHOWN);
667 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Delay"), TL("Toggle the Simulation Delay Entry on/off."), myToolBar4, FXWindow::ID_TOGGLESHOWN);
669
670 new FXMenuSeparator(myWindowMenu);
672 TL("Clear Message Window"), "", TL("Clear the message window."),
674 // build windows menu
676 // build help menu
677 myHelpMenu = new FXMenuPane(this);
679 TL("&Help"),
680 nullptr, myHelpMenu);
681 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Online Documentation"), "F1", TL("Open Online documentation."),
682 nullptr, this, MID_HOTKEY_F1_ONLINEDOCUMENTATION);
683 new FXMenuSeparator(myHelpMenu);
684 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Changelog"), "", TL("Open Changelog."),
685 nullptr, this, MID_CHANGELOG);
686 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Hotkeys"), "", TL("Open Hotkeys."),
687 nullptr, this, MID_HOTKEYS);
688 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Tutorial"), "", TL("Open Tutorial."),
689 nullptr, this, MID_TUTORIAL);
690 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Feedback"), "", TL("Open feedback dialog."),
691 nullptr, this, MID_FEEDBACK);
692 new FXMenuSeparator(myHelpMenu);
693 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&About"), "F12", TL("About sumo-gui."),
695 // build SUMO Accelerators (hotkeys)
696 GUIShortcutsSubSys::buildAccelerators(getAccelTable(), this, true);
697}
698
699
700void
702 // file and simulation tool bar
703 {
704 myToolBarDrag1 = new FXToolBarShell(this, GUIDesignToolBar);
706 new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
707 // build file tools
708 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen simulation\tOpen a simulation (Configuration file)."),
710 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen network\tOpen a network."),
712 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tReload\tReloads the simulation / the network."),
714 }
715 // simulation toolbar
716 {
717 myToolBarDrag2 = new FXToolBarShell(this, GUIDesignToolBar);
719 new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
720 // build simulation tools
721 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tRun\tStart/Resume the loaded simulation."),
723 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStop\tHalt the running simulation."),
725 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStep\tPerform a single simulation step."),
727 }
728 // Simulation Step Display
729 {
730 myToolBarDrag3 = new FXToolBarShell(this, GUIDesignToolBar);
732 new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
733 new MFXButtonTooltip(myToolBar3, myStaticTooltipMenu, TL("Time:\tToggle between time formats\tToggle between seconds and hour:minute:seconds display."), nullptr, this, MID_TIME_TOGGLE, GUIDesignButtonToolbarText);
734
735 myLCDLabel = new MFXLCDLabel(myToolBar3, myStaticTooltipMenu, 16, nullptr, 0, JUSTIFY_RIGHT);
740 myLCDLabel->setText("----------------");
741 }
742 // Simulation Delay
743 {
744 myToolBarDrag4 = new FXToolBarShell(this, GUIDesignToolBar);
746 new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
747 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);
748 // create spinner for delay
749 mySimDelay = 0;
750 mySimDelayTarget = new FXDataTarget(mySimDelay);
752 // create slider
753 mySimDelaySlider = new FXSlider(myToolBar4, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSlider);
754 mySimDelaySlider->setRange(0, 1000);
755 mySimDelaySlider->setHeadSize(10);
756 mySimDelaySlider->setIncrement(50);
757 mySimDelaySlider->setTickDelta(100);
758 mySimDelaySlider->setValue((int)mySimDelay);
759 //mySimDelayTarget->setNumberFormat(0);
760 //mySimDelayTarget->setIncrements(1, 10, 10);
761 mySimDelaySpinner->setIncrement(10);
762 mySimDelaySpinner->setRange(0, 10000);
763 mySimDelaySpinner->setValue(mySimDelay);
764 }
765 // Scale traffic (flows and incrementally loaded vehicles)
766 {
767 myToolBarDrag8 = new FXToolBarShell(this, GUIDesignToolBar);
769 new FXToolBarGrip(myToolBar8, myToolBar8, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
770 myScaleTrafficTooltip = new MFXLabelTooltip(myToolBar8, myStaticTooltipMenu, TL("Scale Traffic:"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
771 myScaleTrafficTooltip->setHelpText(TL("Scale traffic volume from running flows and from vehicles that are loaded incrementally from route files."));
773 myDemandScaleSpinner->setIncrement(0.5);
774 myDemandScaleSpinner->setRange(0, 1000);
775 myDemandScaleSpinner->setValue(1);
776 }
777 // Views
778 {
779 myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBar);
781 new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
782 // build view tools
783 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new view") + std::string("\t") + TL("Open a new microscopic view.")).c_str(),
785#ifdef HAVE_OSG
786 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new 3D view") + std::string("\t") + TL("Open a new 3D view.")).c_str(),
788#endif
789 }
791 {
792 // total waitingTime
793 myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBar);
795 new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
796 GUIDesigns::buildFXLabel(myToolBar6, TL("Waiting Time:"), "", TL("Time spent waiting accumulated for all vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
797 myWaitingTimeLabel = new MFXLCDLabel(myToolBar6, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
802 myWaitingTimeLabel->setText("-------------");
803 // idealistic time loss
804 myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBar);
806 new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
807 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);
808 myTimeLossLabel = new MFXLCDLabel(myToolBar7, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
813 myTimeLossLabel->setText("-------------");
814 // total driving distance
815 myToolBarDrag9 = new FXToolBarShell(this, GUIDesignToolBar);
817 new FXToolBarGrip(myToolBar9, myToolBar9, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
818 GUIDesigns::buildFXLabel(myToolBar9, TL("Distance (km):"), "", TL("Total distance driven by DRT vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
819 myTotalDistanceLabel = new MFXLCDLabel(myToolBar9, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
824 myTotalDistanceLabel->setText("-------------");
825 // emergency vehicle counts
826 myToolBarDrag10 = new FXToolBarShell(this, GUIDesignToolBar);
828 new FXToolBarGrip(myToolBar10, myToolBar10, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
829 GUIDesigns::buildFXLabel(myToolBar10, TL("Emergency Vehicle waiting time:"), "", TL("Time spent waiting accumulated for emergency vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
830 myEmergencyVehicleLabel = new MFXLCDLabel(myToolBar10, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
835 myEmergencyVehicleLabel->setText("-------------");
836 }
837}
838
839
840void
841GUIApplicationWindow::buildRecentNetworks(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentNetworks) {
842 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
843 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_1);
844 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_2);
845 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_3);
846 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_4);
847 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_5);
848 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_6);
849 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_7);
850 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_8);
851 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_9);
852 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_10);
853 new FXMenuSeparator(fileMenuRecentNetworks); // NOSONAR, Fox does the cleanup
854 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("Cl&ear Recent Networks"), nullptr, &myRecentNetworks, FXRecentFiles::ID_CLEAR);
855 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("No Recent Networks"), nullptr, &myRecentNetworks, MFXRecentNetworks::ID_NOFILES);
856 // set target
857 myRecentNetworks.setTarget(this);
858 myRecentNetworks.setSelector(MID_RECENTFILE);
859 new FXMenuCascade(fileMenu, TL("Recent Networks"), nullptr, fileMenuRecentNetworks);
860}
861
862
863void
864GUIApplicationWindow::buildRecentConfigs(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentConfigs) {
865 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
866 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_1);
867 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_2);
868 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_3);
869 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_4);
870 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_5);
871 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_6);
872 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_7);
873 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_8);
874 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_9);
875 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_10);
876 new FXMenuSeparator(fileMenuRecentConfigs); // NOSONAR, Fox does the cleanup
877 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("Cl&ear Recent Configs"), nullptr, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
878 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("No Recent Configs"), nullptr, &myRecentConfigs, MFXRecentNetworks::ID_NOFILES);
879 // set target
880 myRecentConfigs.setTarget(this);
881 myRecentConfigs.setSelector(MID_RECENTFILE);
882 new FXMenuCascade(fileMenu, TL("Recent Configs"), nullptr, fileMenuRecentConfigs);
883}
884
885
886long
887GUIApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
889 getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
890 getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
891 getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
892 getApp()->reg().writeIntEntry("gui", "alternateSimDelay", (int)myAlternateSimDelay);
894 getApp()->exit(0);
895 return 1;
896}
897
898
899long
900GUIApplicationWindow::onCmdEditChosen(FXObject* menu, FXSelector, void*) {
901 FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
902 if (mc->getText() == StringUtils::replace(TL("Edit Selected..."), "&", "").c_str()) {
904 chooser->create();
905 chooser->show();
906 } else {
908 const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
909 for (MSEdgeVector::const_iterator i = MSEdge::getAllEdges().begin(); i != MSEdge::getAllEdges().end(); ++i) {
910 const std::vector<MSLane*>& lanes = (*i)->getLanes();
911 for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
912 GUILane* lane = dynamic_cast<GUILane*>(*it);
913 assert(lane != 0);
914 if ((lane->getPermissions() & svc) != 0) {
915 gSelected.select(lane->getGlID());
916 }
917 }
918 }
919 if (myMDIClient->numChildren() > 0) {
920 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
921 if (w != nullptr) {
922 // color by selection
924 }
925 }
926 }
928 }
929 return 1;
930}
931
932
933long
934GUIApplicationWindow::onCmdEditBreakpoints(FXObject*, FXSelector, void*) {
935 if (myBreakpointDialog == nullptr) {
937 } else {
938 myBreakpointDialog->restore();
939 myBreakpointDialog->setFocus();
940 myBreakpointDialog->raise();
941 }
942 return 1;
943}
944
945
946long
947GUIApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
948 if (!myGLWindows.empty()) {
949 myGLWindows[0]->getView()->showViewportEditor();
950 }
951 return 1;
952}
953
954
955long
956GUIApplicationWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
957 if (!myGLWindows.empty()) {
958 myGLWindows[0]->getView()->showViewschemeEditor();
959 }
960 return 1;
961}
962
963
964long
965GUIApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
966 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html");
967 return 1;
968}
969
970
971long
972GUIApplicationWindow::onCmdChangelog(FXObject*, FXSelector, void*) {
973 // update in every version
974 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/ChangeLog.html");
975 return 1;
976}
977
978
979long
980GUIApplicationWindow::onCmdHotkeys(FXObject*, FXSelector, void*) {
981 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html#keyboard_shortcuts");
982 return 1;
983}
984
985
986long
987GUIApplicationWindow::onCmdTutorial(FXObject*, FXSelector, void*) {
988 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/Tutorials/index.html");
989 return 1;
990}
991
992
993long
994GUIApplicationWindow::onCmdOpenInNetedit(FXObject* sender, FXSelector, void* ptr) {
995 if (myGLWindows.empty()) {
996 return 1;
997 }
998 bool onlyNet;
999 if (sender == myOpenNetInNetedit) {
1000 onlyNet = true;
1001 } else if (sender == myOpenInNetedit) {
1002 onlyNet = false;
1003 } else {
1004 // we have to check (menu-item) sender first because ptr is only valid when
1005 // triggered via hotkey
1006 FXEvent* e = (FXEvent*) ptr;
1007 onlyNet = (e->state & SHIFTMASK) != 0;
1008 }
1009 FXRegistry reg("SUMO netedit", "netedit");
1010 reg.read();
1011 const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
1012 reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
1013 reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
1014 reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
1015 reg.write();
1016 std::string netedit = "netedit";
1017 const char* sumoPath = getenv("SUMO_HOME");
1018 if (sumoPath != nullptr) {
1019 std::string newPath = std::string(sumoPath) + "/bin/netedit";
1020 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1021 netedit = "\"" + newPath + "\"";
1022 }
1023 }
1024 // declare command for calling netedit using the viewport saved in registry
1025 std::string cmd = netedit + " --registry-viewport";
1026 // continue depending if we're loading only a network or the entire sumo config
1027 if (myLoadAdditionalsInNetedit->shown() && !onlyNet) {
1028 cmd += " --sumocfg-file \"" + OptionsCont::getOptions().getString("configuration-file") + "\"";
1029 // check if ignore additional or demand elements
1030 if (myLoadAdditionalsInNetedit->getCheck() == FALSE) {
1031 cmd += " --ignore.additionalelements";
1032 }
1033 if (myLoadDemandInNetedit->getCheck() == FALSE) {
1034 cmd += " --ignore.routeelements";
1035 }
1036 } else {
1037 cmd += " -s \"" + OptionsCont::getOptions().getString("net-file") + "\"";
1038 }
1039 // start in background
1040#ifndef WIN32
1041 cmd = cmd + " &";
1042#else
1043 // see "help start" for the parameters
1044 cmd = "start /B \"\" " + cmd;
1045#endif
1046 WRITE_MESSAGEF(TL("Running %."), cmd);
1047 // yay! fun with dangerous commands... Never use this over the internet
1049 return 1;
1050}
1051
1052
1053long
1054GUIApplicationWindow::onCmdNewWindow(FXObject*, FXSelector, void*) {
1055 FXRegistry reg("SUMO sumo-gui", "sumo-gui");
1056 std::string sumo_gui = "sumo-gui";
1057 const char* sumoPath = getenv("SUMO_HOME");
1058 if (sumoPath != nullptr) {
1059 std::string newPath = std::string(sumoPath) + "/bin/sumo_gui";
1060 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1061 sumo_gui = "\"" + newPath + "\"";
1062 }
1063 }
1064 std::string cmd = sumo_gui;
1065 // start in background
1066#ifndef WIN32
1067 cmd = cmd + " &";
1068#else
1069 // see "help start" for the parameters
1070 cmd = "start /B \"\" " + cmd;
1071#endif
1072 WRITE_MESSAGEF(TL("Running %."), cmd);
1073 // yay! fun with dangerous commands... Never use this over the internet
1075 return 1;
1076}
1077
1078
1079long
1081 // get the new file name
1082 FXFileDialog opendialog(this, TL("Open Simulation Configuration"));
1084 opendialog.setSelectMode(SELECTFILE_EXISTING);
1085 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1086 if (gCurrentFolder.length() != 0) {
1087 opendialog.setDirectory(gCurrentFolder);
1088 }
1089 if (opendialog.execute()) {
1090 gCurrentFolder = opendialog.getDirectory();
1091 std::string file = opendialog.getFilename().text();
1092 loadConfigOrNet(file);
1093 myRecentConfigs.appendFile(file.c_str());
1094 }
1095 return 1;
1096}
1097
1098
1099long
1100GUIApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
1101 // get the new file name
1102 FXFileDialog opendialog(this, TL("Open Network"));
1103 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1104 opendialog.setSelectMode(SELECTFILE_EXISTING);
1105 opendialog.setPatternList(SUMOXMLDefinitions::NetFileExtensions.getMultilineString().c_str());
1106 if (gCurrentFolder.length() != 0) {
1107 opendialog.setDirectory(gCurrentFolder);
1108 }
1109 if (opendialog.execute()) {
1110 gCurrentFolder = opendialog.getDirectory();
1111 std::string file = opendialog.getFilename().text();
1112 loadConfigOrNet(file);
1113 myRecentNetworks.appendFile(file.c_str());
1114 }
1115 return 1;
1116}
1117
1118
1119long
1120GUIApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
1121 // get the shape file name
1122 FXFileDialog opendialog(this, TL("Open Shapes"));
1123 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_SHAPES));
1124 opendialog.setSelectMode(SELECTFILE_EXISTING);
1125 opendialog.setPatternList(SUMOXMLDefinitions::ShapesFileExtensions.getMultilineString().c_str());
1126 if (gCurrentFolder.length() != 0) {
1127 opendialog.setDirectory(gCurrentFolder);
1128 }
1129 if (opendialog.execute()) {
1130 gCurrentFolder = opendialog.getDirectory();
1131 std::string file = opendialog.getFilename().text();
1132
1133 dynamic_cast<GUIShapeContainer&>(myRunThread->getNet().getShapeContainer()).allowReplacement();
1135 if (!XMLSubSys::runParser(handler, file, false)) {
1136 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1137 }
1138 update();
1139 if (myMDIClient->numChildren() > 0) {
1140 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1141 if (w != nullptr) {
1142 w->getView()->update();
1143 }
1144 }
1145 }
1146 return 1;
1147}
1148
1149
1150long
1151GUIApplicationWindow::onCmdOpenEdgeData(FXObject*, FXSelector, void*) {
1152 // get the shape file name
1153 FXFileDialog opendialog(this, TL("Open EdgeData"));
1154 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1155 opendialog.setSelectMode(SELECTFILE_EXISTING);
1156 opendialog.setPatternList(SUMOXMLDefinitions::EdgeDataFileExtensions.getMultilineString().c_str());
1157 if (gCurrentFolder.length() != 0) {
1158 opendialog.setDirectory(gCurrentFolder);
1159 }
1160 if (opendialog.execute()) {
1161 gCurrentFolder = opendialog.getDirectory();
1162 std::string file = opendialog.getFilename().text();
1163 if (!GUINet::getGUIInstance()->loadEdgeData(file)) {
1164 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1165 }
1166 update();
1167 if (myMDIClient->numChildren() > 0) {
1168 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1169 if (w != nullptr) {
1170 w->getView()->update();
1171 }
1172 }
1173 }
1174 return 1;
1175}
1176
1177
1178long
1179GUIApplicationWindow::onCmdReload(FXObject* sender, FXSelector sel, void*) {
1180 if (!myAmLoading && (sender == nullptr || TraCIServer::getInstance() == nullptr)) {
1182 getApp()->beginWaitCursor();
1183 myAmLoading = true;
1184 myIsReload = sender != nullptr || sel == 1;
1186 myLoadThread->start();
1187 if (sender == nullptr) {
1188 setStatusBarText(sel == 1 ? TL("Auto-Reloading.") : TL("TraCI-Loading."));
1189 } else {
1190 setStatusBarText(TL("Reloading."));
1191 }
1192 update();
1193 }
1194 return 1;
1195}
1196
1197
1198long
1199GUIApplicationWindow::onCmdQuickReload(FXObject*, FXSelector, void*) {
1200 if (!myAmLoading) {
1201 setStatusBarText(TL("Quick-Reloading."));
1203 }
1204 return 1;
1205}
1206
1207
1208long
1209GUIApplicationWindow::onCmdOpenRecent(FXObject* /* sender */, FXSelector, void* ptr) {
1210 if (myAmLoading) {
1211 myStatusbar->getStatusLine()->setText(TL("Already loading!"));
1212 return 1;
1213 }
1214 std::string file((const char*)ptr);
1215 loadConfigOrNet(file);
1216 return 1;
1217}
1218
1219
1220long
1221GUIApplicationWindow::onCmdSaveConfig(FXObject*, FXSelector, void*) {
1222 // get the new file name
1223 FXFileDialog opendialog(this, TL("Save SUMO Configuration"));
1224 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1225 opendialog.setSelectMode(SELECTFILE_ANY);
1226 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1227 if (gCurrentFolder.length() != 0) {
1228 opendialog.setDirectory(gCurrentFolder);
1229 }
1230 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1231 return 1;
1232 }
1233 const std::string file = MFXUtils::assureExtension(opendialog).text();
1234 std::ofstream out(XMLSubSys::transcodeToLocal(file));
1235 if (out.good()) {
1236 OptionsCont::getOptions().writeConfiguration(out, true, false, false, file, true);
1237 setStatusBarText(TLF("Configuration saved to %.", file));
1238 } else {
1239 setStatusBarText(TLF("Could not save configuration to %.", file));
1240 }
1241 out.close();
1242 return 1;
1243}
1244
1245
1246long
1247GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
1249 return 1;
1250}
1251
1252
1253long
1254GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
1255 sender->handle(this,
1256 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1257 ptr);
1258 return 1;
1259}
1260
1261
1262long
1263GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
1264 sender->handle(this,
1266 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1267 ptr);
1268 return 1;
1269}
1270
1271
1272long
1273GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
1274 sender->handle(this,
1275 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1276 ptr);
1277 return 1;
1278}
1279
1280
1281long
1282GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
1283 sender->handle(this,
1285 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1286 ptr);
1287 return 1;
1288}
1289
1290
1291long
1292GUIApplicationWindow::onCmdStart(FXObject*, FXSelector, void*) {
1293 // check whether a net was loaded successfully
1294 if (!myRunThread->networkAvailable()) {
1295 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1296 return 1;
1297 }
1298 // check whether it was started before and paused;
1299 if (!myWasStarted) {
1300 myRunThread->begin();
1301 myWasStarted = true;
1302 }
1304 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1305 return 1;
1306}
1307
1308
1309long
1310GUIApplicationWindow::onCmdStop(FXObject*, FXSelector, void*) {
1311 myRunThread->stop();
1312 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1313 return 1;
1314}
1315
1316
1317long
1318GUIApplicationWindow::onCmdStep(FXObject*, FXSelector, void*) {
1319 // check whether a net was loaded successfully
1320 if (!myRunThread->networkAvailable()) {
1321 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1322 return 1;
1323 }
1324 // check whether it was started before and paused;
1325 if (!myWasStarted) {
1326 myRunThread->begin();
1327 myWasStarted = true;
1328 }
1330 return 1;
1331}
1332
1333
1334long
1335GUIApplicationWindow::onCmdSaveState(FXObject*, FXSelector, void*) {
1336 // get the new file name
1337 FXFileDialog opendialog(this, TL("Save Simulation State"));
1338 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1339 opendialog.setSelectMode(SELECTFILE_ANY);
1340 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1341 if (gCurrentFolder.length() != 0) {
1342 opendialog.setDirectory(gCurrentFolder);
1343 }
1344 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1345 return 1;
1346 }
1347 const std::string file = MFXUtils::assureExtension(opendialog).text();
1348 MSStateHandler::saveState(file, MSNet::getInstance()->getCurrentTimeStep(), false);
1349 setStatusBarText(TLF("Simulation state saved to '%'.", file));
1350 return 1;
1351}
1352
1353
1354long
1355GUIApplicationWindow::onCmdLoadState(FXObject*, FXSelector, void*) {
1356 // get the new file name
1357 FXFileDialog opendialog(this, TL("Load Simulation State"));
1358 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN));
1359 opendialog.setSelectMode(SELECTFILE_ANY);
1360 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1361 if (gCurrentFolder.length() != 0) {
1362 opendialog.setDirectory(gCurrentFolder);
1363 }
1364 if (opendialog.execute() && FXStat::exists(opendialog.getFilename())) {
1365 gCurrentFolder = opendialog.getDirectory();
1366 const std::string file = opendialog.getFilename().text();
1367 try {
1368 MSNet::getInstance()->loadState(file, true);
1369 setStatusBarText(TLF("State loaded from '%'.", file));
1370 } catch (ProcessError& e) {
1371 setStatusBarText(TLF("Failed to load state from '%' (%).", file, e.what()));
1372 }
1373 }
1374 return 1;
1375}
1376
1377
1378long
1379GUIApplicationWindow::onCmdTimeToggle(FXObject*, FXSelector, void*) {
1380 // toggle show time as HMS
1385 }
1386 return 1;
1387}
1388
1389
1390long
1391GUIApplicationWindow::onCmdDelayInc(FXObject*, FXSelector, void*) {
1392 if (mySimDelay < 10) {
1393 mySimDelay = 10;
1394 } else if (mySimDelay >= 20 && mySimDelay < 50) {
1395 mySimDelay = 50;
1396 } else if (mySimDelay >= 200 && mySimDelay < 500) {
1397 mySimDelay = 500;
1398 } else {
1399 mySimDelay *= 2;
1400 }
1401 if (mySimDelay > 1000) {
1402 // setting high delay by pressing the key too often is hard to recover from
1403 mySimDelay = 1000;
1404 }
1405 mySimDelaySlider->setValue((int)mySimDelay);
1406 mySimDelaySpinner->setValue(mySimDelay);
1407 return 1;
1408}
1409
1410
1411long
1412GUIApplicationWindow::onCmdDelayDec(FXObject*, FXSelector, void*) {
1413 if (mySimDelay <= 10) {
1414 mySimDelay = 0;
1415 } else if (mySimDelay > 20 && mySimDelay <= 50) {
1416 mySimDelay = 20;
1417 } else if (mySimDelay > 200 && mySimDelay <= 500) {
1418 mySimDelay = 200;
1419 } else {
1420 mySimDelay /= 2;
1421 }
1422 mySimDelaySlider->setValue((int)mySimDelay);
1423 mySimDelaySpinner->setValue(mySimDelay);
1424 return 1;
1425}
1426
1427
1428long
1429GUIApplicationWindow::onCmdDelayToggle(FXObject*, FXSelector, void*) {
1430 const double tmp = myAlternateSimDelay;
1432 mySimDelay = tmp;
1433 return 1;
1434}
1435
1436
1437long
1438GUIApplicationWindow::onCmdDemandScale(FXObject*, FXSelector, void*) {
1441 }
1442 return 1;
1443}
1444
1445
1446long
1447GUIApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
1449 return 1;
1450}
1451
1452
1453long
1454GUIApplicationWindow::onCmdBreakpoint(FXObject*, FXSelector, void*) {
1455 // see updateTimeLCD for the DELTA_T
1458 }
1459 return 1;
1460}
1461
1462
1463long
1464GUIApplicationWindow::onCmdBreakpointEarly(FXObject*, FXSelector, void*) {
1465 // see updateTimeLCD for the DELTA_T
1468 }
1469 return 1;
1470}
1471
1472
1473long
1474GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
1475 sender->handle(this,
1477 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1478 ptr);
1480 // bind start simulation with space key
1482 }
1483 return 1;
1484}
1485
1486
1487long
1488GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
1489 sender->handle(this,
1491 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1492 ptr);
1494 // bind stop simulation with space key
1496 }
1497 return 1;
1498}
1499
1500
1501long
1502GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
1503 sender->handle(this,
1505 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1506 ptr);
1507 return 1;
1508}
1509
1510
1511long
1512GUIApplicationWindow::onUpdNeedsNetwork(FXObject* sender, FXSelector, void* ptr) {
1513 // check if there is a loaded network and gui isn't loading
1515 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1516 // enable certain elements manually
1517 mySelectLanesMenuCascade->enable();
1518 myScaleTrafficTooltip->setTipText(TL("Scale number of vehicles in simulation"));
1519 } else {
1520 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1521 // disable certain elements manually
1522 mySelectLanesMenuCascade->disable();
1523 myScaleTrafficTooltip->setTipText("");
1524 }
1525 return 1;
1526}
1527
1528
1529long
1530GUIApplicationWindow::onUpdNeedsSumoConfig(FXObject* sender, FXSelector, void* ptr) {
1531 // check if there is a loaded network and gui isn't loading
1532 if (myRunThread->networkAvailable() && !myAmLoading && OptionsCont::getOptions().isSet("configuration-file")) {
1533 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1534 sender->handle(this, FXSEL(SEL_COMMAND, ID_SHOW), ptr);
1535 myOpenInNetedit->setText(TL("Open sumo config in netedit"));
1536 } else {
1537 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1538 sender->handle(this, FXSEL(SEL_COMMAND, ID_HIDE), ptr);
1539 myOpenInNetedit->setText(TL("Open network in netedit"));
1540 }
1541 return 1;
1542}
1543
1544
1545long
1546GUIApplicationWindow::onUpdTraCIStatus(FXObject* /*sender*/, FXSelector, void* /*ptr*/) {
1548 myTraCiFrame->show();
1549 } else {
1550 myTraCiFrame->hide();
1551 }
1552 return 1;
1553}
1554
1555
1556long
1557GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
1558 if (myMDIClient->numChildren() > 0) {
1559 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1560 if (w != nullptr) {
1561 w->onCmdLocate(nullptr, sel, nullptr);
1562 }
1563 }
1564 return 1;
1565}
1566
1567
1568long
1569GUIApplicationWindow::onCmdShowStats(FXObject*, FXSelector, void*) {
1570 if (myMDIClient->numChildren() > 0) {
1571 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1573 }
1574 return 1;
1575}
1576
1577
1578long
1579GUIApplicationWindow::onCmdAppSettings(FXObject*, FXSelector, void*) {
1581 d->create();
1582 d->show(PLACEMENT_OWNER);
1583 return 1;
1584}
1585
1586
1587long
1588GUIApplicationWindow::onCmdGaming(FXObject*, FXSelector, void*) {
1589 if (myGLWindows.empty()) {
1590 return 1;
1591 }
1593 myGLWindows[0]->getView()->editVisualisationSettings()->gaming = myAmGaming;
1594 if (myAmGaming) {
1595 myGamingModeCheckbox->setCheck(TRUE);
1596 myMenuBar->hide();
1597 myStatusbar->hide();
1598 myToolBar1->hide();
1599 myToolBar2->hide();
1600 myToolBar4->hide();
1601 myToolBar5->hide();
1602 myToolBar6->show();
1603 myToolBar8->hide();
1604 myToolBar10->show();
1605 if (myTLSGame) {
1606 myToolBar7->show();
1607 } else {
1608 myToolBar9->show();
1609 }
1610 myMessageWindow->hide();
1616 } else {
1617 myGamingModeCheckbox->setCheck(FALSE);
1618 myMenuBar->show();
1619 myStatusbar->show();
1620 myToolBar1->show();
1621 myToolBar2->show();
1622 myToolBar4->show();
1623 myToolBar5->show();
1624 myToolBar6->hide();
1625 myToolBar7->hide();
1626 myToolBar8->show();
1627 myToolBar9->hide();
1628 myToolBar10->hide();
1629 myMessageWindow->show();
1631 }
1632 if (myMDIClient->numChildren() > 0) {
1633 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1634 if (w != nullptr) {
1636 }
1637 }
1638 update();
1639 return 1;
1640}
1641
1642
1643long
1645 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1646 if (w != nullptr) {
1647 // show or hide grid depending of myNetworkViewOptions.menuCheckToggleGrid
1650 } else {
1652 }
1653 w->getView()->update();
1654 }
1655 return 1;
1656}
1657
1658
1659long
1661 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1662 if (w != nullptr) {
1663 // toggle secondary shape visualization
1665 w->getView()->update();
1666 }
1667 return 1;
1668}
1669
1670
1671long
1672GUIApplicationWindow::onCmdFullScreen(FXObject*, FXSelector, void*) {
1673 if (myGLWindows.empty()) {
1674 return 1;
1675 }
1677 if (myAmFullScreen) {
1678 getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1679 getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1680 getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1681 getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1682 maximize();
1683 setDecorations(DECOR_NONE);
1684 place(PLACEMENT_MAXIMIZED);
1685 myMenuBar->hide();
1686 myStatusbar->hide();
1687 myToolBar1->hide();
1688 myToolBar2->hide();
1689 myToolBar3->hide();
1690 myToolBar4->hide();
1691 myToolBar5->hide();
1692 myToolBar6->hide();
1693 myToolBar7->hide();
1694 myToolBar8->hide();
1695 myMessageWindow->hide();
1696 if (myMDIClient->numChildren() > 0) {
1697 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1698 if (w != nullptr) {
1699 w->setToolBarVisibility(false);
1700 }
1701 }
1702 update();
1703 } else {
1704 place(PLACEMENT_VISIBLE);
1705 setDecorations(DECOR_ALL);
1706 restore();
1707 myToolBar3->show();
1709 onCmdGaming(nullptr, 0, nullptr);
1710 setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
1711 setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1712 setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
1713 setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
1714 }
1715 return 1;
1716}
1717
1718
1719long
1720GUIApplicationWindow::onCmdListInternal(FXObject*, FXSelector, void*) {
1722 return 1;
1723}
1724
1725
1726long
1727GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) {
1729 return 1;
1730}
1731
1732long
1733GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) {
1735 return 1;
1736}
1737
1738
1739long
1740GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) {
1742 return 1;
1743}
1744
1745
1746#ifdef HAVE_OSG
1747long
1748GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1750 return 1;
1751}
1752#endif
1753
1754
1755long
1756GUIApplicationWindow::onCmdFeedback(FXObject*, FXSelector, void*) {
1757 // create and open feedback dialog
1758 GUIDialog_Feedback* feedback = new GUIDialog_Feedback(this);
1759 feedback->create();
1760 feedback->show(PLACEMENT_OWNER);
1761 return 1;
1762}
1763
1764
1765long
1766GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
1767 GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this);
1768 about->create();
1769 about->show(PLACEMENT_OWNER);
1770 return 1;
1771}
1772
1773
1774long
1775GUIApplicationWindow::onCmdHallOfFame(FXObject*, FXSelector, void*) {
1777 hall->create();
1778 hall->show(PLACEMENT_OWNER);
1779 return 1;
1780}
1781
1782
1783long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1784 FXEvent* event = (FXEvent*)ptr;
1785 FXString string = GUIUserIO::clipped.c_str();
1786 setDNDData(FROM_CLIPBOARD, event->target, string);
1787 return 1;
1788}
1789
1790
1791long
1792GUIApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
1793 eventOccurred();
1794 return 1;
1795}
1796
1797
1798long
1799GUIApplicationWindow::onRunThreadEvent(FXObject*, FXSelector, void*) {
1800 eventOccurred();
1801 return 1;
1802}
1803
1804
1805void
1807 while (!myEvents.empty()) {
1808 // get the next event
1809 GUIEvent* e = myEvents.top();
1810 myEvents.pop();
1811 // process
1812 switch (e->getOwnType()) {
1815 setFocus();
1816 break;
1818 if (myRunThread->networkAvailable()) { // avoid race-condition related crash if reload was pressed
1820 }
1821 break;
1829 break;
1831 GUIEvent_AddView* ave = dynamic_cast<GUIEvent_AddView*>(e);
1833 if (ave->getSchemeName() != "") {
1834 MFXComboBoxIcon* sCombo = v->getColoringSchemesCombo();
1835 int index = sCombo->findItem(ave->getSchemeName().c_str());
1836 if (index >= 0) {
1837 sCombo->setCurrentItem(index);
1838 }
1839 v->setColorScheme(ave->getSchemeName());
1840 }
1841 break;
1842 }
1844 GUIEvent_CloseView* ave = dynamic_cast<GUIEvent_CloseView*>(e);
1845 removeViewByID(ave->getCaption());
1846 break;
1847 }
1850 break;
1851 default:
1852 break;
1853 }
1854 delete e;
1855 }
1856 myToolBar2->forceRefresh();
1857 myToolBar3->forceRefresh();
1858}
1859
1860
1861void
1863 myAmLoading = false;
1865 // check whether the loading was successful
1866 if (ec->myNet == nullptr) {
1867 // report failure
1868 setStatusBarText(TLF("Loading of '%' failed!", ec->myFile));
1871 getApp()->exit(1);
1872 }
1873 } else {
1874 // initialise simulation thread
1875 if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1878 getApp()->exit(1);
1879 }
1880 } else {
1881 // report success
1882 setStatusBarText(TLF("'%' loaded.", ec->myFile));
1884 myWasStarted = false;
1886 // initialise views
1887 myViewNumber = 0;
1889 // check/record settings file modification time
1890 long long mTime = myGuiSettingsFileMTime;
1891 if (ec->mySettingsFiles.size() > 0) {
1892 for (std::string fname : ec->mySettingsFiles) {
1893 mTime = MAX2(mTime, SysUtils::getModifiedTime(fname));
1894 }
1895 }
1896 // always reload if settings were modified or to restore multiple views
1897 if (!myIsReload) {
1899 }
1900 if (ec->mySettingsFiles.size() > 0 && (!myIsReload || myGuiSettingsFileMTime < mTime || ec->mySettingsFiles.size() > 1)) {
1901 // open a view for each file and apply settings
1902 for (std::string fname : ec->mySettingsFiles) {
1903 GUISettingsHandler settings(getApp(), fname);
1904 GUISUMOViewParent::ViewType vt = defaultType;
1905 if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
1907 }
1908 if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
1910 }
1911 GUISUMOAbstractView* view = openNewView(vt);
1912 if (view == nullptr) {
1913 break;
1914 }
1915 if (settings.getSettingName() != "") {
1916 view->setColorScheme(settings.getSettingName());
1917 MFXComboBoxIcon* sCombo = view->getColoringSchemesCombo();
1918 int index = sCombo->findItem(settings.getSettingName().c_str());
1919 if (index >= 0) {
1920 sCombo->setCurrentItem(index);
1921 }
1922 }
1923 view->addDecals(settings.getDecals());
1924 settings.applyViewport(view);
1925 settings.setSnapshots(view);
1926 if (settings.getDelay() > 0.) {
1927 mySimDelay = settings.getDelay();
1928 }
1929 if (settings.getBreakpoints().size() > 0) {
1931 myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
1932 myRunThread->getBreakpointLock().unlock();
1933 }
1934 myJamSounds = settings.getEventDistribution("jam");
1935 myCollisionSounds = settings.getEventDistribution("collision");
1936 if (settings.getJamSoundTime() > 0) {
1937 myJamSoundTime = settings.getJamSoundTime();
1938 }
1939 for (const std::string& tlsID : settings.getTrackers()) {
1940 if (MSNet::getInstance()->getTLSControl().knows(tlsID)) {
1943 if (tllW) {
1944 tllW->begin2TrackPhases(this);
1945 }
1946 } else {
1947 WRITE_WARNINGF("Tracker for unknown tlLogic '%' in settings file '%'", tlsID, fname);
1948 }
1949 }
1950 }
1951 } else {
1952 openNewView(defaultType);
1953 }
1954 myGuiSettingsFileMTime = mTime;
1955 if (!OptionsCont::getOptions().isDefault("delay")) {
1956 setDelay(OptionsCont::getOptions().getFloat("delay"));
1957 mySimDelaySlider->setValue((int)mySimDelay);
1958 mySimDelaySpinner->setValue(mySimDelay);
1959 }
1960 if (!OptionsCont::getOptions().isDefault("breakpoints") && !myIsReload) {
1961 std::vector<SUMOTime> breakpoints;
1962 for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
1963 SUMOTime t = string2time(val);
1964 // round down to nearest reachable time step
1965 t -= t % DELTA_T;
1966 breakpoints.push_back(t);
1967 }
1968 std::sort(breakpoints.begin(), breakpoints.end());
1970 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1971 myRunThread->getBreakpointLock().unlock();
1972 }
1973 if (!OptionsCont::getOptions().isDefault("selection-file")) {
1974 delete myDynamicSelection;
1975 myDynamicSelection = new std::stringstream();
1976 std::string msg = gSelected.load(OptionsCont::getOptions().getString("selection-file"), GLO_MAX, myDynamicSelection);
1977 if (msg != "") {
1978 WRITE_ERRORF("Errors while loading selection: %", msg.c_str());
1979 }
1980 if (!myDynamicSelection->str().empty()) {
1981 std::string dummy;
1982 int numNotFound = 0;
1983 while (myDynamicSelection->good()) {
1984 (*myDynamicSelection) >> dummy;
1985 numNotFound++;
1986 }
1987 myDynamicSelection->clear(); // first clear error state before seek works
1988 myDynamicSelection->seekg(0);
1989 // @note for some reason the last line is read twice
1990 WRITE_MESSAGEF("% dynamic objects not present while loading selection", numNotFound - 1);
1991 }
1992 }
1993 myTLSGame = OptionsCont::getOptions().getString("game.mode") == "tls";
1994 if (OptionsCont::getOptions().getBool("game")) {
1995 if (myTLSGame) {
1996 setTitle(TL("SUMO Interactive Traffic Light"));
1997 } else {
1998 setTitle(TL("SUMO Interactive Demand-Responsive-Transport"));
1999 }
2000 onCmdGaming(nullptr, 0, nullptr);
2001 } else {
2002 // set simulation name on the caption
2003 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str()));
2004 }
2005 if (ec->myViewportFromRegistry) {
2006 Position off;
2007 off.set(getApp()->reg().readRealEntry("viewport", "x"),
2008 getApp()->reg().readRealEntry("viewport", "y"),
2009 getApp()->reg().readRealEntry("viewport", "z"));
2010 Position p(off.x(), off.y(), 0);
2011 GUISUMOAbstractView* view = myGLWindows[0]->getView();
2012 view->setViewportFromToRot(off, p, 0);
2013 }
2014 // set simulation step begin information
2015 myLCDLabel->setText("----------------");
2016 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2017 (*it)->setText("-");
2018 }
2019 // initialize scale from options unless already set in the UI
2020 if (myDemandScaleSpinner->getValue() == 1 || !OptionsCont::getOptions().isDefault("scale")) {
2022 }
2024 }
2025 }
2026 getApp()->endWaitCursor();
2027 // start if wished
2029 onCmdStart(nullptr, 0, nullptr);
2030 }
2031 update();
2032}
2033
2034
2035void
2037#ifdef WIN32
2038 long t = SysUtils::getCurrentMillis();
2039 // only skip if the simulation is running
2040 if (t - myLastStepEventMillis < MIN_DRAW_DELAY && myRunThread->simulationIsStopable()) {
2041 // do not try to redraw with more than 50FPS (#6371)
2042 return;
2043 }
2045#endif
2047 FXButton* vehStats = myStatButtons[STAT_VEHS];
2048 FXButton* delayStats = myStatButtons[STAT_DELAYED];
2049 FXButton* teleStats = myStatButtons[STAT_TELEPORTS];
2050 FXButton* personStats = myStatButtons[STAT_PERSONS];
2051 FXButton* containerStats = myStatButtons[STAT_CONTAINERS];
2052
2053 const int running = myRunThread->getNet().getVehicleControl().getRunningVehicleNo();
2054 const int backlog = myRunThread->getNet().getInsertionControl().getWaitingVehicleNo();
2055 const int teleports = myRunThread->getNet().getVehicleControl().getTeleportCount();
2056 const int departed = myRunThread->getNet().getVehicleControl().getDepartedVehicleNo();
2057 if (backlog > running) {
2058 if (vehStats->getIcon() == GUIIconSubSys::getIcon(GUIIcon::GREENVEHICLE)) {
2060 }
2061 } else {
2062 if (vehStats->getIcon() == GUIIconSubSys::getIcon(GUIIcon::YELLOWVEHICLE)) {
2064 }
2065 }
2066 vehStats->setText(toString(running).c_str());
2067 if (backlog > 0) {
2068 if (!delayStats->shown()) {
2069 delayStats->show();
2070 }
2071 delayStats->setText(toString(backlog).c_str());
2072 } else {
2073 if (delayStats->shown()) {
2074 delayStats->hide();
2075 }
2076 }
2077 if (teleports > 0) {
2078 if (!teleStats->shown()) {
2079 teleStats->show();
2080 }
2081 teleStats->setText((toString(100.00 * teleports / departed) + "%").c_str());
2082 }
2083 if (myRunThread->getNet().hasPersons()) {
2084 if (!personStats->shown()) {
2085 personStats->show();
2086 }
2087 personStats->setText(toString(myRunThread->getNet().getPersonControl().getRunningNumber()).c_str());
2088 }
2089 if (myRunThread->getNet().hasContainers()) {
2090 if (!containerStats->shown()) {
2091 containerStats->show();
2092 }
2093 containerStats->setText(toString(myRunThread->getNet().getContainerControl().getRunningNumber()).c_str());
2094 }
2095 if (myAmGaming) {
2096 if (myTLSGame) {
2098 } else {
2100 }
2101 }
2103 getApp()->forceRefresh(); // restores keyboard focus
2104 }
2105 // try to load dynamic selection
2106 if (myDynamicSelection != nullptr) {
2107 std::stringstream tmp;
2109 if (tmp.str().empty()) {
2110 delete myDynamicSelection;
2111 myDynamicSelection = nullptr;
2112 } else {
2113 myDynamicSelection->str(tmp.str());
2114 myDynamicSelection->clear(); // first clear error state before seek works
2115 myDynamicSelection->seekg(0);
2116 }
2117 }
2119 update();
2120}
2121
2122
2123void
2125 GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
2127 setStatusBarText(ec->getMsg());
2128 } else {
2130 }
2131}
2132
2133
2134void
2137 onCmdStop(nullptr, 0, nullptr);
2138 if (ec->getReason() == MSNet::SIMSTATE_LOADING) {
2139 onCmdReload(nullptr, 0, nullptr);
2140 } else if (GUIGlobals::gQuitOnEnd) {
2142 getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
2143 } else if (GUIGlobals::gDemoAutoReload) {
2144 onCmdReload(nullptr, 1, nullptr);
2145 } else if (!myHaveNotifiedAboutSimEnd) {
2146 // GUIRunThread::deleteSim() triggers the final message to the log file
2147 // (this will never reach the GUI but we cannot use WRITE_MESSAGE here
2148 // to avoid a duplicate log entry)
2150 TLF("Simulation ended at time: %. (%)",
2152 // build the text
2153 const std::string text = TLF("Simulation ended at time: %.", time2string(ec->getTimeStep())) + "\n" +
2154 TL("Reason:") + MSNet::getStateMessage(ec->getReason()) + "\n" +
2155 TL("Do you want to close all open files and views?");
2156 FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, TL("Simulation ended"), "%s", text.c_str());
2157 if (answer == 1) { //1:yes, 2:no, 4:esc
2159 } else {
2162 update();
2163 }
2165 }
2166}
2167
2168
2169void
2174#ifdef HAVE_DANGEROUS_SOUNDS // disable user-configurable command execution for public build
2175 if (myJamSounds.getOverallProb() > 0) {
2176 // play honking sound if some vehicle is waiting too long
2177 for (; it != end; ++it) {
2178 // XXX use impatience instead of waiting time ?
2179 if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
2180 const std::string cmd = myJamSounds.get(&myGamingRNG);
2181 if (cmd != "") {
2182 // yay! fun with dangerous commands... Never use this over the internet
2184 // one sound per simulation step is enough
2185 break;
2186 }
2187 }
2188 }
2189 }
2192 if (myPreviousCollisionNumber != collisions) {
2193 const std::string cmd = myCollisionSounds.get(&myGamingRNG);
2194 if (cmd != "") {
2195 // yay! fun with dangerous commands... Never use this over the internet
2197 }
2198 myPreviousCollisionNumber = collisions;
2199 }
2200 }
2201#endif
2202 // update performance indicators
2203 for (it = vc.loadedVehBegin(); it != end; ++it) {
2204 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2205 assert(veh != 0);
2206 if (veh->isOnRoad() && !veh->isStopped()) {
2207 const double vmax = veh->getLane()->getVehicleMaxSpeed(veh);
2208 if (veh->getSpeed() < SUMO_const_haltingSpeed) {
2210 if (veh->getVClass() == SVC_EMERGENCY) {
2212 }
2213 }
2214 myTimeLoss += TIME2STEPS(TS * (vmax - veh->getSpeed()) / vmax); // may be negative with speedFactor > 1
2215 }
2216
2217 }
2221}
2222
2223
2224void
2226 // update performance indicators
2230
2233 for (auto it = vc.loadedVehBegin(); it != end; ++it) {
2234 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2235 assert(veh != 0);
2236 if (veh->isOnRoad() && !veh->isStopped()) {
2238 }
2239 }
2241}
2242
2243
2244void
2246 if (!myAmLoading) {
2248 getApp()->beginWaitCursor();
2249 myAmLoading = true;
2250 myIsReload = false;
2252 gSchemeStorage.saveViewport(0, 0, -1, 0); // recenter view
2254 setStatusBarText(TLF("Loading '%'.", file));
2255 update();
2256 }
2257}
2258
2259
2262 if (!myRunThread->networkAvailable()) {
2263 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
2264 return nullptr;
2265 }
2266 GUISUMOAbstractView* oldView = nullptr;
2267 if (myMDIClient->numChildren() > 0) {
2268 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2269 if (w != nullptr) {
2270 oldView = w->getView();
2271 }
2272 }
2273 if (caption == "") {
2274 caption = "View #" + toString(myViewNumber++);
2275 }
2276 FXuint opts = MDI_TRACKING;
2277 GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
2278 this, GUIIconSubSys::getIcon(GUIIcon::SUMO_MINI), opts, 10, 10, 200, 100);
2280 if (oldView != nullptr) {
2281 // copy viewport
2282 oldView->copyViewportTo(v);
2283 }
2284 w->create();
2285 if (myMDIClient->numChildren() == 1) {
2286 w->maximize();
2287 } else {
2288 myMDIClient->vertical(true);
2289 }
2290 myMDIClient->setActiveChild(w);
2291
2292 return v;
2293}
2294
2295
2296FXGLCanvas*
2298 if (myMDIClient->numChildren() == 0) {
2299 return nullptr;
2300 }
2301 GUISUMOViewParent* share_tmp1 =
2302 static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
2303 return share_tmp1->getBuildGLCanvas();
2304}
2305
2306
2307void
2309 myTrackerLock.lock();
2310 myLCDLabel->setText("----------------");
2311 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2312 (*it)->setText("-");
2313 if (it != myStatButtons.begin()) {
2314 (*it)->hide();
2315 }
2316 }
2317 // save decals and viewport
2318 for (GUIGlChildWindow* window : myGLWindows) {
2319 GUISUMOAbstractView* view = window->getView();
2322 view->getChanger().getZPos(), view->getChanger().getRotation());
2323 }
2324 // delete the simulation
2326 // reset the caption
2327 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
2328 // clear decals and release GPU textures
2329 for (GUIGlChildWindow* window : myGLWindows) {
2330 GUISUMOAbstractView* view = window->getView();
2331 if (view->makeCurrent()) {
2332 view->clearDecals();
2336 view->makeNonCurrent();
2337 }
2338 }
2339 // remove trackers and other external windows (must be delayed until deleteSim)
2340 while (!myGLWindows.empty()) {
2341 delete myGLWindows.front();
2342 }
2343 // make a copy because deleting modifyes the vector;
2344 std::vector<FXMainWindow*> trackerWindows = myTrackerWindows;
2345 for (FXMainWindow* const window : trackerWindows) {
2346 delete window;
2347 }
2348 myTrackerWindows.clear();
2349 // clear selected items
2350 gSelected.clear();
2351 // add a separator to the log
2353 myTrackerLock.unlock();
2354 // remove coordinate information
2355 myGeoCoordinate->setText(TL("N/A"));
2356 myCartesianCoordinate->setText(TL("N/A"));
2357 if (myTestCoordinate) {
2358 myTestCoordinate->setText(TL("N/A"));
2359 }
2360 update();
2361}
2362
2363
2364FXCursor*
2366 return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
2367}
2368
2369
2374
2375
2376double
2380
2381
2382void
2384 loadConfigOrNet("");
2385 if (wait) {
2386 while (myAmLoading) {
2387 myRunThread->sleep(50);
2388 }
2389 }
2390}
2391
2392
2393void
2395 myStatusbar->getStatusLine()->setText(text.c_str());
2396 myStatusbar->getStatusLine()->setNormalText(text.c_str());
2397}
2398
2399
2400void
2402 myRecentNetworks.appendFile(f);
2403}
2404
2405
2406void
2408 myRecentConfigs.appendFile(f);
2409}
2410
2411
2412void
2414 if (myShowTimeAsHMS) {
2415 myLCDLabel->setToolTipText("HH:MM:SS");
2416 if (myAmGaming) {
2418 myTimeLossLabel->setToolTipText("HH:MM:SS");
2420 }
2421 } else {
2422 myLCDLabel->setToolTipText(TL("seconds"));
2423 if (myAmGaming) {
2425 myTimeLossLabel->setToolTipText(TL("seconds"));
2427 }
2428 }
2429}
2430
2431
2432void
2434 time -= DELTA_T; // synchronize displayed time with netstate output
2435 if (time < 0) {
2436 myLCDLabel->setText("----------------");
2437 return;
2438 }
2439 if (myAmGaming) {
2440 // show time counting backwards
2441 time = myRunThread->getSimEndTime() - time;
2442 }
2443 std::ostringstream str;
2444 str << std::setfill('0');
2445 const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0;
2446 if (myShowTimeAsHMS) {
2447 SUMOTime day = time / SUMOTime_DAY;
2448 if (day > 0) {
2449 str << day << '-';
2450 time %= SUMOTime_DAY;
2451 }
2452 str << std::setw(2);
2453 str << time / SUMOTime_HOUR << '-';
2454 time %= SUMOTime_HOUR;
2455 str << std::setw(2) << time / SUMOTime_MINUTE << '-';
2456 time %= SUMOTime_MINUTE;
2457 }
2458 str << std::setw(2) << time / 1000;
2459 if (!hideFraction) {
2460 str << '.' << std::setw(3) << time % 1000;
2461 }
2462 myLCDLabel->setText(str.str().c_str());
2463}
2464
2465
2466void
2468 if (press != nullptr) {
2469 myHotkeyPress[key] = press;
2470 }
2471 if (release != nullptr) {
2472 myHotkeyRelease[key] = release;
2473 }
2474}
2475
2476
2477long
2478GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* ptr) {
2479 FXEvent* e = (FXEvent*) ptr;
2480 // PgUp and PgDown switch between widgets by default and binding them via menu shortcuts does not work reliably
2481 // so we must intercept them before FXMainWindow can handle it
2482 if (e->code == FX::KEY_Page_Up) {
2483 onCmdDelayInc(nullptr, 0, nullptr);
2484 } else if (e->code == FX::KEY_Page_Down) {
2485 onCmdDelayDec(nullptr, 0, nullptr);
2486 } else {
2487 // disable hotkeys without modifiers for the game
2488 const bool ignoreSimple = myAmGaming && (e->state & (CONTROLMASK | SHIFTMASK | ALTMASK)) == 0;
2489 const long handled = ignoreSimple ? 0 : FXMainWindow::onKeyPress(o, sel, ptr);
2490 if (handled == 0 && myMDIClient->numChildren() > 0) {
2491 auto it = myHotkeyPress.find(e->code);
2492 if (it != myHotkeyPress.end()) {
2493 it->second->execute(SIMSTEP);
2494 }
2495 if (!ignoreSimple) {
2496 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2497 if (w != nullptr) {
2498 w->onKeyPress(nullptr, sel, ptr);
2499 }
2500 }
2501 }
2502 }
2503 return 0;
2504}
2505
2506
2507long
2508GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* ptr) {
2509 const long handled = FXMainWindow::onKeyRelease(o, sel, ptr);
2510 if (handled == 0 && myMDIClient->numChildren() > 0) {
2511 FXEvent* e = (FXEvent*) ptr;
2512 auto it = myHotkeyRelease.find(e->code);
2513 if (it != myHotkeyRelease.end()) {
2514 it->second->execute(SIMSTEP);
2515 }
2516 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2517 if (w != nullptr) {
2518 w->onKeyRelease(nullptr, sel, ptr);
2519 }
2520 }
2521 return 0;
2522}
2523
2524
2525double
2527 return mySimDelay;
2528}
2529
2530
2531void
2533 mySimDelay = delay;
2534}
2535
2536
2537void
2539 myEventMutex.lock();
2540 myEvents.push_back(event);
2542 //myEventCondition.wait(myEventMutex);
2543 myEventMutex.unlock();
2544}
2545
2546
2547void
2548GUIApplicationWindow::setBreakpoints(const std::vector<SUMOTime>& breakpoints) {
2549 if (myRunThread != nullptr) {
2551 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
2552 myRunThread->getBreakpointLock().unlock();
2554 }
2555}
2556
2557
2558void
2560 const SUMOTime begin = string2time(OptionsCont::getOptions().getString("begin"));
2561 if (time >= begin) {
2562 // ensure breakpoint is valid
2563 time -= (time - begin) % DELTA_T;
2564 std::vector<SUMOTime> breakpoints = retrieveBreakpoints();
2565 if (std::find(breakpoints.begin(), breakpoints.end(), time) == breakpoints.end()) {
2566 breakpoints.push_back(time);
2567 std::sort(breakpoints.begin(), breakpoints.end());
2568 setBreakpoints(breakpoints);
2569 setStatusBarText(TLF("Set breakpoint at %", time2string(time)));
2570 }
2571 }
2572}
2573
2574
2575const std::vector<SUMOTime>
2578 std::vector<SUMOTime> result = myRunThread->getBreakpoints();
2579 myRunThread->getBreakpointLock().unlock();
2580 return result;
2581}
2582
2583
2584void
2588
2589/****************************************************************************/
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:687
@ 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:661
@ 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:689
@ 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_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:665
@ 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:663
@ MID_TIMELINK_BREAKPOINT
Set breakpionts from messages - Option.
Definition GUIAppEnum.h:577
@ 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:667
@ 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
@ MID_LANGUAGE_KO
change language to korean
#define STAT_CONTAINERS
FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[]
#define STAT_DELAYED
#define MIN_DRAW_DELAY
#define STAT_PERSONS
#define STAT_TELEPORTS
#define STAT_VEHS
GUICompleteSchemeStorage gSchemeStorage
#define GUIDesignSlider
Definition GUIDesigns.h:536
#define GUIDesignSpinDial
Definition GUIDesigns.h:516
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
Definition GUIDesigns.h:480
#define GUIDesignButtonStatusBarFixed
button rectangular with thick and raise frame with a width of 100
Definition GUIDesigns.h:124
#define GUIDesignMDIButtonLeft
Definition GUIDesigns.h:220
#define GUIDesignToolBarRaisedSameTop
design for first toolbar shell positioned in the same position of dock
Definition GUIDesigns.h:486
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition GUIDesigns.h:144
#define GUIDesignHorizontalFrameStatusBar
Horizontal frame used in status bar.
Definition GUIDesigns.h:359
#define GUIDesignToolBar
design for default toolbar
Definition GUIDesigns.h:465
#define GUIDesignSplitter
Definition GUIDesigns.h:505
#define GUIDesignSplitterMDI
MDI Splitter.
Definition GUIDesigns.h:508
#define 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.
@ INSERTION_DELAY
@ 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:48
#define SUMOTime_MINUTE
Definition SUMOTime.h:39
#define SIMSTEP
Definition SUMOTime.h:64
#define SUMOTime_DAY
Definition SUMOTime.h:37
#define SUMOTime_HOUR
Definition SUMOTime.h:38
#define TS
Definition SUMOTime.h:45
#define TIME2STEPS(x)
Definition SUMOTime.h:60
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:49
#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.
void saveDecals(const std::vector< GUISUMOAbstractView::Decal > &decals)
Makes the given decals the default.
static void close()
close GUICursorSubSys
static void initCursors(FXApp *a)
Initiate GUICursorSubSys.
static FXLabel * buildFXLabel(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXuint opts, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
Construct label with given text and icon.
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXMenuTitle * buildFXMenuTitle(FXComposite *p, const std::string &text, FXIcon *icon, FXMenuPane *menuPane)
build menu title
static FXMenuCommand * buildFXMenuCommandRecentFile(FXComposite *p, const std::string &text, FXObject *tgt, FXSelector sel)
build menu command (for recent files)
static FXMenuCheck * buildFXMenuCheckbox(FXComposite *p, const std::string &text, const std::string &info, FXObject *tgt, FXSelector sel)
build menu checkbox
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
static FXMenuCommand * buildFXMenuCommandShortcut(FXComposite *p, const std::string &text, const std::string &shortcut, const std::string &info, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
The application's "About" - dialog.
void create()
Creates the widget.
The dialog to change the application (gui) settings.
Editor for simulation breakpoints.
The application's "Feedback" dialog.
void create()
Creates the widget.
Editor for the list of chosen objects.
The SUMO User Conference "Hall of Fame" - dialog / easter egg.
void create()
Creates the widget.
const std::string & getCaption() const
const std::string & getSchemeName() const
const std::string & getCaption() const
const std::string & getMsg() const
Returns the message.
Event sent when the simulation is over.
MSNet::SimulationState getReason() const
Returns the reason the simulation has ended due.
SUMOTime getTimeStep() const
Returns the time step the simulation has ended at.
const SUMOTime myBegin
the time the simulation shall start with
const std::vector< std::string > mySettingsFiles
the name of the settings file to load
const bool myOsgView
whether to load the OpenSceneGraph view
const SUMOTime myEnd
the time the simulation shall end with
const bool myViewportFromRegistry
whether loading viewport from registry
const std::string myFile
the name of the loaded file
GUIEventType getOwnType() const
returns the event type
Definition GUIEvent.h:89
virtual void create()
create GUIGlChildWindow
GUISUMOAbstractView * getView() const
return GUISUMOAbstractView
virtual FXGLCanvas * getBuildGLCanvas() const
get build GL Canvas
GUIGlID getGlID() const
Returns the numerical id of the object.
static double gTrackerInterval
the aggregation period for tracker windows in seconds
Definition GUIGlobals.h:46
static bool gRunAfterLoad
the simulation shall start direct after loading
Definition GUIGlobals.h:37
static bool gQuitOnEnd
the window shall be closed when the simulation has ended
Definition GUIGlobals.h:40
static bool gDemoAutoReload
the simulation shall reload when it has ended (demo)
Definition GUIGlobals.h:43
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static void initIcons(FXApp *a)
Initiate GUIIconSubSys.
static void close()
close GUIIconSubSys
Representation of a lane in the micro simulation (gui-version)
Definition GUILane.h:60
void loadConfigOrNet(const std::string &file)
begins the loading of the given file
const std::string & getFileName() const
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call
bool myListParking
information whether the locator should list parking vehicles
void removeViewByID(const std::string &id)
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:814
GUITrafficLightLogicWrapper * getTLLWrapper(MSTrafficLightLogic *tll)
Definition GUINet.cpp:226
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition GUINet.cpp:486
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition GUINet.cpp:581
MSTransportableControl & getContainerControl() override
Returns the container control.
Definition GUINet.cpp:139
virtual double getRotation() const =0
Returns the rotation of the canvas stored in this changer.
virtual double getXPos() const =0
Returns the x-offset of the field to show stored in this changer.
virtual double getYPos() const =0
Returns the y-offset of the field to show stored in this changer.
virtual double getZPos() const =0
Returns the camera height corresponding to the current zoom factor.
void singleStep()
called when the user presses the "single step"-button
GUINet & getNet() const
returns the loaded network
virtual void begin()
starts the simulation (execution of one step after another)
SUMOTime getSimBegin()
get simulation begin time
void resume()
called when the user presses the "resume"-button
virtual bool simulationIsStartable() const
check if simulation is startable
bool networkAvailable() const
returns the information whether a network has been loaded
virtual bool simulationIsStepable() const
check if simulation is stepable
std::vector< SUMOTime > & getBreakpoints()
get list of breakpoints
virtual bool init(GUINet *net, SUMOTime start, SUMOTime end)
initialises the thread with the new simulation
FXMutex & getBreakpointLock()
get breakpoint lock
SUMOTime getSimEndTime() const
get simulation end time
virtual bool simulationIsStopable() const
check if simulation is stopableo
virtual void deleteSim()
deletes the existing simulation
void stop()
halts the simulation execution
void prepareDestruction()
halts the thread before it shall be deleted
MFXComboBoxIcon * getColoringSchemesCombo()
get coloring schemes combo
void addDecals(const std::vector< Decal > &decals)
add decals
void processPendingTextureDeletes()
process pending texture deletions
FXbool makeCurrent()
A reimplementation due to some internal reasons.
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
GUIPerspectiveChanger & getChanger() const
get changer
std::vector< Decal > & getDecals()
The list of decals to show.
void clearDecals()
clear all decals
virtual void setViewportFromToRot(const Position &lookFrom, const Position &lookAt, double rotation)
applies the given viewport settings
GUIVisualizationSettings * editVisualisationSettings() const
edit visualization settings (allow modify VisualizationSetings, use carefully)
virtual void copyViewportTo(GUISUMOAbstractView *view)
copy the viewport to the given view
virtual bool setColorScheme(const std::string &)
set color scheme
A single child window which contains a view of the simulation area.
ViewType
Available view types.
@ VIEW_3D_OSG
plain 3D OSG view (
@ VIEW_2D_OPENGL
plain 2D openGL view (
virtual GUISUMOAbstractView * init(FXGLCanvas *share, GUINet &net, ViewType type)
"Initialises" this window by building the contents
long onCmdLocate(FXObject *, FXSelector, void *)
locator-callback
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
void setToolBarVisibility(const bool value)
about toggled gaming status
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
void clear()
Clears the list of selected objects.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
std::string load(const std::string &filename, GUIGlObjectType type=GLO_MAX, std::ostream *dynamicNotFound=nullptr)
Loads a selection list (optionally with restricted type)
An XML-handler for visualisation schemes.
double getDelay() const
Returns the parsed delay.
const std::string & getSettingName() const
std::vector< std::string > getTrackers()
RandomDistributor< std::string > getEventDistribution(const std::string &id)
const std::string & getViewType() const
Returns the parsed view type.
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
const std::vector< SUMOTime > & getBreakpoints() const
Returns the parsed breakpoints.
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
Storage for geometrical objects extended by mutexes.
static void buildAccelerators(FXAccelTable *accelTable, FXObject *target, const bool sumogui)
build accelerators
static void changeAccelerator(FXAccelTable *accelTable, FXObject *target, GUIShortcut keysym, long msg)
change accelerator (used for toggle dynamically binding space key with start/end simulation)
static void resetTextures()
Reset textures.
static void initTextures(FXApp *a)
Initiate GUITextureSubSys for textures.
void begin2TrackPhases(GUIMainWindow *app=nullptr)
Builds a GUITLLogicPhasesTrackerWindow which will receive new phases.
static std::string clipped
Definition GUIUserIO.h:58
bool drawJunctionShape
whether the shape of the junction should be drawn
bool secondaryShape
whether secondary lane shape shall be drawn
GUIColorer laneColorer
The lane colorer.
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:146
static FXString getTitleText(const FXString &appname, FXString filename="")
Returns the title text in dependence to an optional file name.
Definition MFXUtils.cpp:62
static FXbool userPermitsOverwritingWhenFileExists(FXWindow *const parent, const FXString &file)
Returns true if either the file given by its name does not exist or the user allows overwriting it.
Definition MFXUtils.cpp:41
static FXString assureExtension(const FXFileDialog &openDialog)
Corrects missing extension.
Definition MFXUtils.cpp:71
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
bool isStopped() const
Returns whether the vehicle is at a stop.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition MSEdge.cpp:1128
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition MSLane.h:640
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition MSLane.h:575
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
Definition MSNet.cpp:1835
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:199
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition MSNet.h:475
@ SIMSTATE_LOADING
The simulation is loading.
Definition MSNet.h:96
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
Definition MSNet.h:106
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition MSNet.cpp:1029
void quickReload()
reset state to the beginning without reloading the network
Definition MSNet.cpp:1814
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:334
bool hasContainers() const
Returns whether containers are simulated.
Definition MSNet.h:435
bool hasPersons() const
Returns whether persons are simulated.
Definition MSNet.h:419
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition MSNet.h:455
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition MSNet.h:525
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:402
static void saveState(const std::string &file, SUMOTime step, bool usePrefix=true)
Saves the current state.
MSTrafficLightLogic * getActive() const
bool knows(const std::string &id) const
Returns the information whether the named tls is stored.
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
The parent class for traffic light logics.
int getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
int getWaitingForVehicleNumber() const
Returns the number of transportables waiting for a ride.
The class responsible for building and deletion of vehicles.
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
void setScale(double scale)
sets the demand scaling factor
int getCollisionCount() const
return the number of collisions
int getDepartedVehicleNo() const
Returns the number of inserted vehicles.
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
int getTeleportCount() const
return the number of teleports (including collisions)
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition MSVehicle.h:605
const MSLane * getLane() const
Returns the lane the vehicle is on.
Definition MSVehicle.h:581
double getSpeed() const
Returns the vehicle's current speed.
Definition MSVehicle.h:490
The XML-Handler for shapes loading network loading.
Definition NLHandler.h:55
void writeConfiguration(std::ostream &os, const bool filled, const bool complete, const bool addComments, const std::string &relativeTo="", const bool forceRelative=false, const bool inComment=false, const std::string &indent="") const
Writes the configuration.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
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:199
static const RGBColor RED
named colors
Definition RGBColor.h:198
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.
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:70
static long long getModifiedTime(const std::string &fname)
@brie get modified time
Definition SysUtils.cpp:110
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition SysUtils.cpp:45
static TraCIServer * getInstance()
Definition TraCIServer.h:68
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.
static std::string transcodeToLocal(const std::string &utf8String)
convert a string from UTF-8 to the local codepage
@ SEL_THREAD_EVENT
Definition fxexdefs.h:173
@ SEL_THREAD
Definition fxexdefs.h:155