Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIApplicationWindow.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
22// The main window of the SUMO-gui.
23/****************************************************************************/
24#include <config.h>
25
26#ifdef HAVE_VERSION_H
27#include <version.h>
28#endif
29
30#include <fxkeys.h>
31
32#include <guisim/GUILane.h>
33#include <guisim/GUINet.h>
39#include <netload/NLHandler.h>
66#include <utils/xml/XMLSubSys.h>
67
71#include "GUIGlobals.h"
72#include "GUILoadThread.h"
73#include "GUIRunThread.h"
79
80
81#define MIN_DRAW_DELAY 20
82//#define HAVE_DANGEROUS_SOUNDS
83
84// ===========================================================================
85// FOX-declarations
86// ===========================================================================
87FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[] = {
88 // close
92 FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GUIApplicationWindow::onCmdQuit),
93 // toolbar
109 // gaming
119 // OSG
120#ifdef HAVE_OSG
121 FXMAPFUNC(SEL_COMMAND, MID_NEW_OSGVIEW, GUIApplicationWindow::onCmdNewOSG),
123
124#endif
125 // Time
132 FXMAPFUNC(SEL_COMMAND, MID_DELAY_INC, GUIApplicationWindow::onCmdDelayInc),
133 FXMAPFUNC(SEL_COMMAND, MID_DELAY_DEC, GUIApplicationWindow::onCmdDelayDec),
134 FXMAPFUNC(SEL_COMMAND, MID_SIMSAVE, GUIApplicationWindow::onCmdSaveState),
135 FXMAPFUNC(SEL_COMMAND, MID_SIMLOAD, GUIApplicationWindow::onCmdLoadState),
142 // Stats
146 // these functions do not assign shortcut keys to commands, but rather affect the button enable status upon other events (e.g. simulation loaded)
147 // since those events are invoked through pseudo key events (?), the same key shortcuts as in cmd must be supplied as well
176 FXMAPFUNC(SEL_COMMAND, MID_HOTKEYS, GUIApplicationWindow::onCmdHotkeys),
177 FXMAPFUNC(SEL_COMMAND, MID_TUTORIAL, GUIApplicationWindow::onCmdTutorial),
179 FXMAPFUNC(SEL_COMMAND, MID_FEEDBACK, GUIApplicationWindow::onCmdFeedback),
181 // forward requests to the active view
200 // languages
221 // keys
222 FXMAPFUNC(SEL_KEYPRESS, 0, GUIApplicationWindow::onKeyPress),
223 FXMAPFUNC(SEL_KEYRELEASE, 0, GUIApplicationWindow::onKeyRelease),
224 // clipboard
225 FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GUIApplicationWindow::onClipboardRequest),
226 // events
231};
232
233// Object implementation
234FXIMPLEMENT(GUIApplicationWindow, FXMainWindow, GUIApplicationWindowMap, ARRAYNUMBER(GUIApplicationWindowMap))
235
236// ===========================================================================
237// static members
238// ===========================================================================
240
241
242// ===========================================================================
243// member method definitions
244// ===========================================================================
245#ifdef _MSC_VER
246#pragma warning(push)
247#pragma warning(disable: 4355) // mask warning about "this" in initializers
248#endif
250 GUIMainWindow(a),
251 myFileMenuRecentNetworks(new FXMenuPane(this)),
252 myFileMenuRecentConfigs(new FXMenuPane(this)),
253 myRecentNetworks(a, "networks"),
254 myRecentConfigs(a, "configs"),
255 myLastStepEventMillis(SysUtils::getCurrentMillis() - MIN_DRAW_DELAY) {
256 // init icons
258 // init Textures
260 // init cursors
262 // disable tooltips
263 a->setTooltipTime(1000000000);
264 a->setTooltipPause(1000000000);
265}
266#ifdef _MSC_VER
267#pragma warning(pop)
268#endif
269
270
275
276
277void
279 // don't do this twice
280 if (hadDependentBuild) {
281 return;
282 }
283 hadDependentBuild = true;
284 setTarget(this);
285 setSelector(MID_WINDOW);
286 // build menu bar
287 myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBar);
289 new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
291 // build the thread - io
296 // build the status bar
297 myStatusbar = new FXStatusBar(this, GUIDesignStatusBar);
298 {
299 // build TraCi info
301 auto button = GUIDesigns::buildFXButton(myTraCiFrame, "TraCI", "", "", nullptr, this, MID_TRACI_STATUS, GUIDesignButtonStatusBarFixed);
302 button->setBackColor(FXRGBA(253, 255, 206, 255));
303 if (TraCIServer::getInstance() == nullptr) {
304 myTraCiFrame->hide();
305 }
306 // build geo coordiantes
308 myGeoCoordinate = GUIDesigns::buildFXLabel(myGeoFrame, TL("N/A"), "", TL("Original coordinate (before coordinate transformation in netconvert)"), nullptr, LAYOUT_CENTER_Y);
309 // build cartesian coordinates
311 myCartesianCoordinate = GUIDesigns::buildFXLabel(myCartesianFrame, TL("N/A"), "", TL("Network coordinate"), nullptr, LAYOUT_CENTER_Y);
312 // build buttons
315 myStatButtons.back()->hide();
317 myStatButtons.back()->hide();
318 }
319 // make the window a mdi-window
320 myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
322 myMDIMenu = new FXMDIMenu(this, myMDIClient);
323 new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
324 new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
325 new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
326 new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
327 // build the message window
329 // fill menu and tool bar
330 fillMenuBar();
331 myToolBar6->hide();
332 myToolBar7->hide();
333 myToolBar9->hide();
334 myToolBar10->hide();
335 // build additional threads
336 myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent, isLibsumo);
338 // set the status bar
339 setStatusBarText(TL("Ready."));
340 // set the caption
341 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
342 // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
343 myRunThread->start();
346}
347
348
349void
352 gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
353 FXMainWindow::create();
354 myMenuBarDrag->create();
355 myToolBarDrag1->create();
356 myToolBarDrag2->create();
357 myToolBarDrag3->create();
358 myToolBarDrag4->create();
359 myToolBarDrag5->create();
360 myToolBarDrag6->create();
361 myToolBarDrag7->create();
362 myFileMenu->create();
363 mySelectByPermissions->create();
364 myEditMenu->create();
365 mySettingsMenu->create();
366 myLocatorMenu->create();
367 myControlMenu->create();
368 myWindowMenu->create();
369 myLanguageMenu->create();
370 myHelpMenu->create();
371 FXint textWidth = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
372 myCartesianFrame->setWidth(textWidth);
373 myGeoFrame->setWidth(textWidth);
374 if (myTestFrame) {
375 myTestFrame->setWidth(textWidth);
376 }
377
378 show(PLACEMENT_DEFAULT);
379 if (!OptionsCont::getOptions().isSet("window-size")) {
380 if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
381 maximize();
382 }
383 }
384 myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
385 myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
386 const std::string& onlineMaps = getApp()->reg().readStringEntry("gui", "onlineMaps", "");
387 for (const std::string& entry : StringTokenizer(onlineMaps, "\n").getVector()) {
388 const std::vector<std::string> split = StringTokenizer(entry, "\t").getVector();
389 if (split.size() == 2) {
390 myOnlineMaps[split[0]] = split[1];
391 }
392 }
393 if (myOnlineMaps.empty()) {
394 myOnlineMaps["GeoHack"] = "https://geohack.toolforge.org/geohack.php?params=%lat;%lon_scale:1000";
395 myOnlineMaps["Google Maps"] = "https://www.google.com/maps?ll=%lat,%lon&t=h&z=18";
396 myOnlineMaps["OSM"] = "https://www.openstreetmap.org/?mlat=%lat&mlon=%lon&zoom=18&layers=M";
397 }
399}
400
401
404 myRunThread->join();
406 // close icons
409 // delete visual
410 delete myGLVisual;
411 // delete some non-parented windows
412 delete myToolBarDrag1;
413 delete mySimDelayTarget;
414 // delete rest of elements
417 delete myRunThread;
418 delete myFileMenu;
419 delete myEditMenu;
421 delete mySettingsMenu;
422 delete myLocatorMenu;
423 delete myControlMenu;
424 delete myLanguageMenu;
425 delete myWindowMenu;
426 delete myHelpMenu;
427 delete myLoadThread;
428
429 while (!myEvents.empty()) {
430 // get the next event
431 GUIEvent* e = myEvents.top();
432 myEvents.pop();
433 delete e;
434 }
435 for (auto item : myHotkeyPress) {
436 delete item.second;
437 }
438 for (auto item : myHotkeyRelease) {
439 delete item.second;
440 }
441}
442
443
444void
446 FXMainWindow::detach();
447 myMenuBarDrag->detach();
448 myToolBarDrag1->detach();
449}
450
451
452void
453GUIApplicationWindow::addToWindowsMenu(FXMenuPane* /*menuPane*/) {
454 // unused, implement in children
455}
456
457
458void
460 // build file menu
461 myFileMenu = new FXMenuPane(this);
464 TL("New Window"), "Ctrl+Shift+N", TL("Open a new sumo-gui window."),
465 nullptr, this, MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW);
466 new FXMenuSeparator(myFileMenu);
468 TL("&Open Simulation..."), "Ctrl+O", TL("Open a simulation (Configuration file)."),
471 TL("Open &Network..."), "Ctrl+N", TL("Open a network."),
474 TL("Open Shapes "), "Ctrl+P", TL("Load POIs and Polygons for visualization."),
477 TL("Open EdgeData "), "Ctrl+U", TL("Load edge related data for visualization."),
480 TL("&Reload"), "Ctrl+R", TL("Reloads the simulation / the network."),
483 TL("Quick-Reload"), "Ctrl+0", TL("Reloads the simulation (but not network)."),
485 new FXMenuSeparator(myFileMenu);
487 TL("Save Configuration"), "Ctrl+Shift+S", TL("Save current options as a configuration file."),
490 TL("Close"), "Ctrl+W", TL("Close the simulation."),
492 new FXMenuSeparator(myFileMenu);
493 // build recent files
496 new FXMenuSeparator(myFileMenu);
498 TL("&Quit"), "Ctrl+Q", TL("Quit the Application."),
499 nullptr, this, MID_HOTKEY_CTRL_Q_CLOSE);
500 // build edit menu
501 mySelectByPermissions = new FXMenuPane(this);
502 std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
503 for (const auto& vehicleClass : vehicleClasses) {
505 }
506 myEditMenu = new FXMenuPane(this);
509 TL("Edit Selected..."), "Ctrl+E", TL("Opens a dialog for editing the list of selected items."),
511 mySelectLanesMenuCascade = new FXMenuCascade(myEditMenu, TL("Select lanes which allow..."), GUIIconSubSys::getIcon(GUIIcon::FLAG), mySelectByPermissions);
512 mySelectLanesMenuCascade->setHelpText(TL("Opens a menu for selecting a vehicle class by which to selected lanes."));
513 new FXMenuSeparator(myEditMenu);
515 TL("Set Breakpoint"), "B", TL("Sets a breakpoint at the current simulation step"),
518 TL("Set Breakpoint with offset"), "Alt+B", TL("Sets a breakpoint at the current simulation step + offset configured in application settings"),
521 TL("Edit Breakpoints"), "Ctrl+B", TL("Opens a dialog for editing breakpoints."),
524 TL("Edit Visualisation"), "F9", TL("Opens a dialog for editing visualization settings."),
527 TL("Edit Viewport"), "Ctrl+I", TL("Opens a dialog for editing viewing area, zoom and rotation."),
529 new FXMenuSeparator(myEditMenu);
530 // add open in sumo options
531 myLoadAdditionalsInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load additionals in netedit"), TL("Load additionals in netedit."), this, MID_TOOLBAREDIT_LOADADDITIONALS);
532 myLoadAdditionalsInNetedit->setCheck(TRUE);
533 myLoadDemandInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load demand in netedit"), TL("Load demand in netedit."), this, MID_TOOLBAREDIT_LOADDEMAND);
534 myLoadDemandInNetedit->setCheck(FALSE);
536 TL("Open in netedit"), "Ctrl+T", TL("Opens current simulation in NETEDIT."),
538 // build settings menu
539 mySettingsMenu = new FXMenuPane(this);
542 TL("Application Settings"), "Ctrl+H", TL("Open a Dialog for Application Settings editing."),
544 myGamingModeCheckbox = new FXMenuCheck(mySettingsMenu,
545 TL("Gaming Mode\tCtrl+G\tToggle gaming mode on/off."),
548 TL("Full Screen Mode"), "Ctrl+F", TL("Toggle full screen mode on/off."),
550 // build Locate menu
551 myLocatorMenu = new FXMenuPane(this);
554 TL("&Junctions"), "Shift+J", TL("Open a dialog for locating a Junction."),
557 TL("&Edges"), "Shift+E", TL("Open a dialog for locating an Edge."),
560 TL("&Vehicles"), "Shift+V", TL("Open a dialog for locating a Vehicle."),
563 TL("&Persons"), "Shift+P", TL("Open a dialog for locating a Person."),
566 TL("&Container"), "Shift+C", TL("Open a dialog for locating a Container."),
569 TL("&TLS"), "Shift+T", TL("Open a dialog for locating a Traffic Light."),
572 TL("&Additional"), "Shift+A", TL("Open a dialog for locating an Additional Structure."),
575 TL("P&oI"), "Shift+O", TL("Open a dialog for locating a Point of Interest."),
578 TL("Po&lygon"), "Shift+L", TL("Open a dialog for locating a Polygon."),
580 new FXMenuSeparator(myLocatorMenu);
581 GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Internal Structures"), TL("Show internal junctions and streets in locator dialog."), this, MID_LISTINTERNAL);
582 FXMenuCheck* listParking = GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Parking Vehicles"), TL("Show parking vehicles in locator dialog."), this, MID_LISTPARKING);
583 listParking->setCheck(myListParking);
584 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);
585 // build control menu
586 // the shortcut designator is not only at text in the submenu but also defines the real shortcut key assigned with it!
587 // secondary shortcuts (ctrl+A, ctrl+S, ctrl+D) are defined in GUIShortcutsSubSys::buildSUMOAccelerators
588 myControlMenu = new FXMenuPane(this);
589 GUIDesigns::buildFXMenuTitle(myMenuBar, TL("Simulation"), nullptr, myControlMenu);
591 TL("Run"), "A,space", TL("Start/ Resume the simulation."),
594 TLC("Simulation", "Stop"), "S,space", TL("Halt the simulation."),
597 TL("Step"), "D", TL("Perform one simulation step."),
600 TL("Delay+"), "PgUp", TL("Increase simulation step delay."), nullptr, this, MID_DELAY_INC);
602 TL("Delay-"), "PgDn", TL("Decrease simulation step delay."), nullptr, this, MID_DELAY_DEC);
604 TL("Save"), "", TL("Save the current simulation state to a file."),
607 TL("Load"), "", TL("Load simulation state for the current network from file."),
609 // build windows menu
610 myWindowMenu = new FXMenuPane(this);
612 GUIDesigns::buildFXMenuCommandShortcut(myWindowMenu, TL("Open new view"), "", TL("Open a new microscopic view."), GUIIconSubSys::getIcon(GUIIcon::MICROVIEW), this, MID_NEW_MICROVIEW);
613#ifdef HAVE_OSG
615#endif
617 TL("Tile &Horizontally"), "", TL("Tile the views horizontally."),
618 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_HORI), myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
620 TL("Tile &Vertically"), "", TL("Tile the views vertically."),
621 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_VERT), myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
623 TL("Cascade"), "", TL("Cascade the views."),
625 myMDIClient, FXMDIClient::ID_MDI_CASCADE);
627 TL("&Close"), "", TL("Close the selected view."),
628 nullptr, myMDIClient, FXMDIClient::ID_MDI_CLOSE);
629 FXMenuSeparator* sep2 = new FXMenuSeparator(myWindowMenu);
630 sep2->setTarget(myMDIClient);
631 sep2->setSelector(FXMDIClient::ID_MDI_ANY);
632 // for whatever reason, sonar complains in the next line that sep2 may leak, but fox does the cleanup
633 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_1); // NOSONAR
634 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_2);
635 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_3);
636 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_4);
637 GUIDesigns::buildFXMenuCommand(myWindowMenu, TL("&Others..."), nullptr, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
638
639 new FXMenuSeparator(myWindowMenu);
640 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Status Line"), TL("Toggle the Status Bar on/off."), myStatusbar, FXWindow::ID_TOGGLESHOWN);
641 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Message Window"), TL("Toggle the Message Window on/off."), myMessageWindow, FXWindow::ID_TOGGLESHOWN);
642 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Time"), TL("Toggle the Simulation Time on/off."), myToolBar3, FXWindow::ID_TOGGLESHOWN);
643 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Delay"), TL("Toggle the Simulation Delay Entry on/off."), myToolBar4, FXWindow::ID_TOGGLESHOWN);
645
646 new FXMenuSeparator(myWindowMenu);
648 TL("Clear Message Window"), "", TL("Clear the message window."),
650 // build windows menu
652 // build help menu
653 myHelpMenu = new FXMenuPane(this);
655 TL("&Help"),
656 nullptr, myHelpMenu);
657 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Online Documentation"), "F1", TL("Open Online documentation."),
658 nullptr, this, MID_HOTKEY_F1_ONLINEDOCUMENTATION);
659 new FXMenuSeparator(myHelpMenu);
660 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Changelog"), "", TL("Open Changelog."),
661 nullptr, this, MID_CHANGELOG);
662 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Hotkeys"), "", TL("Open Hotkeys."),
663 nullptr, this, MID_HOTKEYS);
664 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Tutorial"), "", TL("Open Tutorial."),
665 nullptr, this, MID_TUTORIAL);
666 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Feedback"), "", TL("Open feedback dialog."),
667 nullptr, this, MID_FEEDBACK);
668 new FXMenuSeparator(myHelpMenu);
669 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&About"), "F12", TL("About sumo-gui."),
671 // build SUMO Accelerators (hotkeys)
672 GUIShortcutsSubSys::buildAccelerators(getAccelTable(), this, true);
673}
674
675
676void
678 // file and simulation tool bar
679 {
680 myToolBarDrag1 = new FXToolBarShell(this, GUIDesignToolBar);
682 new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
683 // build file tools
684 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen simulation\tOpen a simulation (Configuration file)."),
686 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen network\tOpen a network."),
688 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tReload\tReloads the simulation / the network."),
690 }
691 // simulation toolbar
692 {
693 myToolBarDrag2 = new FXToolBarShell(this, GUIDesignToolBar);
695 new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
696 // build simulation tools
697 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tRun\tStart/Resume the loaded simulation."),
699 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStop\tHalt the running simulation."),
701 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStep\tPerform a single simulation step."),
703 }
704 // Simulation Step Display
705 {
706 myToolBarDrag3 = new FXToolBarShell(this, GUIDesignToolBar);
708 new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
709 new MFXButtonTooltip(myToolBar3, myStaticTooltipMenu, TL("Time:\tToggle between time formats\tToggle between seconds and hour:minute:seconds display."), nullptr, this, MID_TIME_TOGGLE, GUIDesignButtonToolbarText);
710
711 myLCDLabel = new MFXLCDLabel(myToolBar3, myStaticTooltipMenu, 16, nullptr, 0, JUSTIFY_RIGHT);
716 myLCDLabel->setText("----------------");
717 }
718 // Simulation Delay
719 {
720 myToolBarDrag4 = new FXToolBarShell(this, GUIDesignToolBar);
722 new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
723 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);
724 // create spinner for delay
725 mySimDelay = 0;
726 mySimDelayTarget = new FXDataTarget(mySimDelay);
728 // create slider
729 mySimDelaySlider = new FXSlider(myToolBar4, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSlider);
730 mySimDelaySlider->setRange(0, 1000);
731 mySimDelaySlider->setHeadSize(10);
732 mySimDelaySlider->setIncrement(50);
733 mySimDelaySlider->setTickDelta(100);
734 mySimDelaySlider->setValue((int)mySimDelay);
735 //mySimDelayTarget->setNumberFormat(0);
736 //mySimDelayTarget->setIncrements(1, 10, 10);
737 mySimDelaySpinner->setIncrement(10);
738 mySimDelaySpinner->setRange(0, 10000);
739 mySimDelaySpinner->setValue(mySimDelay);
740 }
741 // Scale traffic (flows and incrementally loaded vehicles)
742 {
743 myToolBarDrag8 = new FXToolBarShell(this, GUIDesignToolBar);
745 new FXToolBarGrip(myToolBar8, myToolBar8, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
746 myScaleTrafficTooltip = new MFXLabelTooltip(myToolBar8, myStaticTooltipMenu, TL("Scale Traffic:"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
747 myScaleTrafficTooltip->setHelpText(TL("Scale traffic volume from running flows and from vehicles that are loaded incrementally from route files."));
749 myDemandScaleSpinner->setIncrement(0.5);
750 myDemandScaleSpinner->setRange(0, 1000);
751 myDemandScaleSpinner->setValue(1);
752 }
753 // Views
754 {
755 myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBar);
757 new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
758 // build view tools
759 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new view") + std::string("\t") + TL("Open a new microscopic view.")).c_str(),
761#ifdef HAVE_OSG
762 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new 3D view") + std::string("\t") + TL("Open a new 3D view.")).c_str(),
764#endif
765 }
767 {
768 // total waitingTime
769 myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBar);
771 new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
772 GUIDesigns::buildFXLabel(myToolBar6, TL("Waiting Time:"), "", TL("Time spent waiting accumulated for all vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
773 myWaitingTimeLabel = new MFXLCDLabel(myToolBar6, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
778 myWaitingTimeLabel->setText("-------------");
779 // idealistic time loss
780 myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBar);
782 new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
783 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);
784 myTimeLossLabel = new MFXLCDLabel(myToolBar7, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
789 myTimeLossLabel->setText("-------------");
790 // total driving distance
791 myToolBarDrag9 = new FXToolBarShell(this, GUIDesignToolBar);
793 new FXToolBarGrip(myToolBar9, myToolBar9, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
794 GUIDesigns::buildFXLabel(myToolBar9, TL("Distance (km):"), "", TL("Total distance driven by DRT vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
795 myTotalDistanceLabel = new MFXLCDLabel(myToolBar9, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
800 myTotalDistanceLabel->setText("-------------");
801 // emergency vehicle counts
802 myToolBarDrag10 = new FXToolBarShell(this, GUIDesignToolBar);
804 new FXToolBarGrip(myToolBar10, myToolBar10, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
805 GUIDesigns::buildFXLabel(myToolBar10, TL("Emergency Vehicle waiting time:"), "", TL("Time spent waiting accumulated for emergency vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
806 myEmergencyVehicleLabel = new MFXLCDLabel(myToolBar10, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
811 myEmergencyVehicleLabel->setText("-------------");
812 }
813}
814
815
816void
817GUIApplicationWindow::buildRecentNetworks(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentNetworks) {
818 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
819 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_1);
820 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_2);
821 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_3);
822 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_4);
823 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_5);
824 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_6);
825 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_7);
826 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_8);
827 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_9);
828 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_10);
829 new FXMenuSeparator(fileMenuRecentNetworks); // NOSONAR, Fox does the cleanup
830 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("Cl&ear Recent Networks"), nullptr, &myRecentNetworks, FXRecentFiles::ID_CLEAR);
831 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("No Recent Networks"), nullptr, &myRecentNetworks, MFXRecentNetworks::ID_NOFILES);
832 // set target
833 myRecentNetworks.setTarget(this);
834 myRecentNetworks.setSelector(MID_RECENTFILE);
835 new FXMenuCascade(fileMenu, TL("Recent Networks"), nullptr, fileMenuRecentNetworks);
836}
837
838
839void
840GUIApplicationWindow::buildRecentConfigs(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentConfigs) {
841 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
842 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_1);
843 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_2);
844 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_3);
845 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_4);
846 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_5);
847 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_6);
848 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_7);
849 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_8);
850 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_9);
851 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_10);
852 new FXMenuSeparator(fileMenuRecentConfigs); // NOSONAR, Fox does the cleanup
853 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("Cl&ear Recent Configs"), nullptr, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
854 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("No Recent Configs"), nullptr, &myRecentConfigs, MFXRecentNetworks::ID_NOFILES);
855 // set target
856 myRecentConfigs.setTarget(this);
857 myRecentConfigs.setSelector(MID_RECENTFILE);
858 new FXMenuCascade(fileMenu, TL("Recent Configs"), nullptr, fileMenuRecentConfigs);
859}
860
861
862long
863GUIApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
865 getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
866 getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
867 getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
868 getApp()->reg().writeIntEntry("gui", "alternateSimDelay", (int)myAlternateSimDelay);
870 getApp()->exit(0);
871 return 1;
872}
873
874
875long
876GUIApplicationWindow::onCmdEditChosen(FXObject* menu, FXSelector, void*) {
877 FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
878 if (mc->getText() == StringUtils::replace(TL("Edit Selected..."), "&", "").c_str()) {
879 GUIDialog_GLChosenEditor* chooser =
881 chooser->create();
882 chooser->show();
883 } else {
885 const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
886 for (MSEdgeVector::const_iterator i = MSEdge::getAllEdges().begin(); i != MSEdge::getAllEdges().end(); ++i) {
887 const std::vector<MSLane*>& lanes = (*i)->getLanes();
888 for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
889 GUILane* lane = dynamic_cast<GUILane*>(*it);
890 assert(lane != 0);
891 if ((lane->getPermissions() & svc) != 0) {
892 gSelected.select(lane->getGlID());
893 }
894 }
895 }
896 if (myMDIClient->numChildren() > 0) {
897 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
898 if (w != nullptr) {
899 // color by selection
901 }
902 }
903 }
905 }
906 return 1;
907}
908
909
910long
911GUIApplicationWindow::onCmdEditBreakpoints(FXObject*, FXSelector, void*) {
912 if (myBreakpointDialog == nullptr) {
914 } else {
915 myBreakpointDialog->restore();
916 myBreakpointDialog->setFocus();
917 myBreakpointDialog->raise();
918 }
919 return 1;
920}
921
922
923long
924GUIApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
925 if (!myGLWindows.empty()) {
926 myGLWindows[0]->getView()->showViewportEditor();
927 }
928 return 1;
929}
930
931
932long
933GUIApplicationWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
934 if (!myGLWindows.empty()) {
935 myGLWindows[0]->getView()->showViewschemeEditor();
936 }
937 return 1;
938}
939
940
941long
942GUIApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
943 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html");
944 return 1;
945}
946
947
948long
949GUIApplicationWindow::onCmdChangelog(FXObject*, FXSelector, void*) {
950 // update in every version
951 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/ChangeLog.html");
952 return 1;
953}
954
955
956long
957GUIApplicationWindow::onCmdHotkeys(FXObject*, FXSelector, void*) {
958 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html#keyboard_shortcuts");
959 return 1;
960}
961
962
963long
964GUIApplicationWindow::onCmdTutorial(FXObject*, FXSelector, void*) {
965 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/Tutorials/index.html");
966 return 1;
967}
968
969
970long
971GUIApplicationWindow::onCmdOpenInNetedit(FXObject*, FXSelector, void*) {
972 if (myGLWindows.empty()) {
973 return 1;
974 }
975 FXRegistry reg("SUMO netedit", "netedit");
976 reg.read();
977 const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
978 reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
979 reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
980 reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
981 reg.write();
982 std::string netedit = "netedit";
983 const char* sumoPath = getenv("SUMO_HOME");
984 if (sumoPath != nullptr) {
985 std::string newPath = std::string(sumoPath) + "/bin/netedit";
986 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
987 netedit = "\"" + newPath + "\"";
988 }
989 }
990 // declare command for calling netedit using the viewport saved in registry
991 std::string cmd = netedit + " --registry-viewport";
992 // continue depending if we're loading only a network or the entire sumo config
993 if (myLoadAdditionalsInNetedit->shown()) {
994 cmd += " --sumocfg-file \"" + OptionsCont::getOptions().getString("configuration-file") + "\"";
995 // check if ignore additional or demand elements
996 if (myLoadAdditionalsInNetedit->getCheck() == FALSE) {
997 cmd += " --ignore.additionalelements";
998 }
999 if (myLoadDemandInNetedit->getCheck() == FALSE) {
1000 cmd += " --ignore.routeelements";
1001 }
1002 } else {
1003 cmd += " -s \"" + OptionsCont::getOptions().getString("net-file") + "\"";
1004 }
1005 // start in background
1006#ifndef WIN32
1007 cmd = cmd + " &";
1008#else
1009 // see "help start" for the parameters
1010 cmd = "start /B \"\" " + cmd;
1011#endif
1012 WRITE_MESSAGEF(TL("Running %."), cmd);
1013 // yay! fun with dangerous commands... Never use this over the internet
1015 return 1;
1016}
1017
1018
1019long
1020GUIApplicationWindow::onCmdNewWindow(FXObject*, FXSelector, void*) {
1021 FXRegistry reg("SUMO sumo-gui", "sumo-gui");
1022 std::string sumo_gui = "sumo-gui";
1023 const char* sumoPath = getenv("SUMO_HOME");
1024 if (sumoPath != nullptr) {
1025 std::string newPath = std::string(sumoPath) + "/bin/sumo_gui";
1026 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1027 sumo_gui = "\"" + newPath + "\"";
1028 }
1029 }
1030 std::string cmd = sumo_gui;
1031 // start in background
1032#ifndef WIN32
1033 cmd = cmd + " &";
1034#else
1035 // see "help start" for the parameters
1036 cmd = "start /B \"\" " + cmd;
1037#endif
1038 WRITE_MESSAGEF(TL("Running %."), cmd);
1039 // yay! fun with dangerous commands... Never use this over the internet
1041 return 1;
1042}
1043
1044
1045long
1047 // get the new file name
1048 FXFileDialog opendialog(this, TL("Open Simulation Configuration"));
1050 opendialog.setSelectMode(SELECTFILE_EXISTING);
1051 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1052 if (gCurrentFolder.length() != 0) {
1053 opendialog.setDirectory(gCurrentFolder);
1054 }
1055 if (opendialog.execute()) {
1056 gCurrentFolder = opendialog.getDirectory();
1057 std::string file = opendialog.getFilename().text();
1058 loadConfigOrNet(file);
1059 myRecentConfigs.appendFile(file.c_str());
1060 }
1061 return 1;
1062}
1063
1064
1065long
1066GUIApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
1067 // get the new file name
1068 FXFileDialog opendialog(this, TL("Open Network"));
1069 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1070 opendialog.setSelectMode(SELECTFILE_EXISTING);
1071 opendialog.setPatternList(SUMOXMLDefinitions::NetFileExtensions.getMultilineString().c_str());
1072 if (gCurrentFolder.length() != 0) {
1073 opendialog.setDirectory(gCurrentFolder);
1074 }
1075 if (opendialog.execute()) {
1076 gCurrentFolder = opendialog.getDirectory();
1077 std::string file = opendialog.getFilename().text();
1078 loadConfigOrNet(file);
1079 myRecentNetworks.appendFile(file.c_str());
1080 }
1081 return 1;
1082}
1083
1084
1085long
1086GUIApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
1087 // get the shape file name
1088 FXFileDialog opendialog(this, TL("Open Shapes"));
1089 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_SHAPES));
1090 opendialog.setSelectMode(SELECTFILE_EXISTING);
1091 opendialog.setPatternList(SUMOXMLDefinitions::ShapesFileExtensions.getMultilineString().c_str());
1092 if (gCurrentFolder.length() != 0) {
1093 opendialog.setDirectory(gCurrentFolder);
1094 }
1095 if (opendialog.execute()) {
1096 gCurrentFolder = opendialog.getDirectory();
1097 std::string file = opendialog.getFilename().text();
1098
1099 dynamic_cast<GUIShapeContainer&>(myRunThread->getNet().getShapeContainer()).allowReplacement();
1101 if (!XMLSubSys::runParser(handler, file, false)) {
1102 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1103 }
1104 update();
1105 if (myMDIClient->numChildren() > 0) {
1106 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1107 if (w != nullptr) {
1108 w->getView()->update();
1109 }
1110 }
1111 }
1112 return 1;
1113}
1114
1115
1116long
1117GUIApplicationWindow::onCmdOpenEdgeData(FXObject*, FXSelector, void*) {
1118 // get the shape file name
1119 FXFileDialog opendialog(this, TL("Open EdgeData"));
1120 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1121 opendialog.setSelectMode(SELECTFILE_EXISTING);
1122 opendialog.setPatternList(SUMOXMLDefinitions::EdgeDataFileExtensions.getMultilineString().c_str());
1123 if (gCurrentFolder.length() != 0) {
1124 opendialog.setDirectory(gCurrentFolder);
1125 }
1126 if (opendialog.execute()) {
1127 gCurrentFolder = opendialog.getDirectory();
1128 std::string file = opendialog.getFilename().text();
1129 if (!GUINet::getGUIInstance()->loadEdgeData(file)) {
1130 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1131 }
1132 update();
1133 if (myMDIClient->numChildren() > 0) {
1134 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1135 if (w != nullptr) {
1136 w->getView()->update();
1137 }
1138 }
1139 }
1140 return 1;
1141}
1142
1143
1144long
1145GUIApplicationWindow::onCmdReload(FXObject* sender, FXSelector sel, void*) {
1146 if (!myAmLoading && (sender == nullptr || TraCIServer::getInstance() == nullptr)) {
1148 getApp()->beginWaitCursor();
1149 myAmLoading = true;
1150 myIsReload = sender != nullptr || sel == 1;
1152 myLoadThread->start();
1153 if (sender == nullptr) {
1154 setStatusBarText(sel == 1 ? TL("Auto-Reloading.") : TL("TraCI-Loading."));
1155 } else {
1156 setStatusBarText(TL("Reloading."));
1157 }
1158 update();
1159 }
1160 return 1;
1161}
1162
1163
1164long
1165GUIApplicationWindow::onCmdQuickReload(FXObject*, FXSelector, void*) {
1166 if (!myAmLoading) {
1167 setStatusBarText(TL("Quick-Reloading."));
1169 }
1170 return 1;
1171}
1172
1173
1174long
1175GUIApplicationWindow::onCmdOpenRecent(FXObject* /* sender */, FXSelector, void* ptr) {
1176 if (myAmLoading) {
1177 myStatusbar->getStatusLine()->setText(TL("Already loading!"));
1178 return 1;
1179 }
1180 std::string file((const char*)ptr);
1181 loadConfigOrNet(file);
1182 return 1;
1183}
1184
1185
1186long
1187GUIApplicationWindow::onCmdSaveConfig(FXObject*, FXSelector, void*) {
1188 // get the new file name
1189 FXFileDialog opendialog(this, TL("Save SUMO Configuration"));
1190 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1191 opendialog.setSelectMode(SELECTFILE_ANY);
1192 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1193 if (gCurrentFolder.length() != 0) {
1194 opendialog.setDirectory(gCurrentFolder);
1195 }
1196 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1197 return 1;
1198 }
1199 const std::string file = MFXUtils::assureExtension(opendialog).text();
1200 std::ofstream out(StringUtils::transcodeToLocal(file));
1201 if (out.good()) {
1202 OptionsCont::getOptions().writeConfiguration(out, true, false, false, file, true);
1203 setStatusBarText(TLF("Configuration saved to %.", file));
1204 } else {
1205 setStatusBarText(TLF("Could not save configuration to %.", file));
1206 }
1207 out.close();
1208 return 1;
1209}
1210
1211
1212long
1213GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
1215 return 1;
1216}
1217
1218
1219long
1220GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
1221 sender->handle(this,
1222 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1223 ptr);
1224 return 1;
1225}
1226
1227
1228long
1229GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
1230 sender->handle(this,
1232 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1233 ptr);
1234 return 1;
1235}
1236
1237
1238long
1239GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
1240 sender->handle(this,
1241 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1242 ptr);
1243 return 1;
1244}
1245
1246
1247long
1248GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
1249 sender->handle(this,
1251 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1252 ptr);
1253 return 1;
1254}
1255
1256
1257long
1258GUIApplicationWindow::onCmdStart(FXObject*, FXSelector, void*) {
1259 // check whether a net was loaded successfully
1260 if (!myRunThread->networkAvailable()) {
1261 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1262 return 1;
1263 }
1264 // check whether it was started before and paused;
1265 if (!myWasStarted) {
1266 myRunThread->begin();
1267 myWasStarted = true;
1268 }
1270 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1271 return 1;
1272}
1273
1274
1275long
1276GUIApplicationWindow::onCmdStop(FXObject*, FXSelector, void*) {
1277 myRunThread->stop();
1278 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1279 return 1;
1280}
1281
1282
1283long
1284GUIApplicationWindow::onCmdStep(FXObject*, FXSelector, void*) {
1285 // check whether a net was loaded successfully
1286 if (!myRunThread->networkAvailable()) {
1287 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1288 return 1;
1289 }
1290 // check whether it was started before and paused;
1291 if (!myWasStarted) {
1292 myRunThread->begin();
1293 myWasStarted = true;
1294 }
1296 return 1;
1297}
1298
1299
1300long
1301GUIApplicationWindow::onCmdSaveState(FXObject*, FXSelector, void*) {
1302 // get the new file name
1303 FXFileDialog opendialog(this, TL("Save Simulation State"));
1304 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1305 opendialog.setSelectMode(SELECTFILE_ANY);
1306 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1307 if (gCurrentFolder.length() != 0) {
1308 opendialog.setDirectory(gCurrentFolder);
1309 }
1310 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1311 return 1;
1312 }
1313 const std::string file = MFXUtils::assureExtension(opendialog).text();
1314 MSStateHandler::saveState(file, MSNet::getInstance()->getCurrentTimeStep(), false);
1315 setStatusBarText(TLF("Simulation state saved to '%'.", file));
1316 return 1;
1317}
1318
1319
1320long
1321GUIApplicationWindow::onCmdLoadState(FXObject*, FXSelector, void*) {
1322 // get the new file name
1323 FXFileDialog opendialog(this, TL("Load Simulation State"));
1324 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN));
1325 opendialog.setSelectMode(SELECTFILE_ANY);
1326 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1327 if (gCurrentFolder.length() != 0) {
1328 opendialog.setDirectory(gCurrentFolder);
1329 }
1330 if (opendialog.execute() && FXStat::exists(opendialog.getFilename())) {
1331 gCurrentFolder = opendialog.getDirectory();
1332 const std::string file = opendialog.getFilename().text();
1333 try {
1334 MSNet::getInstance()->loadState(file, true);
1335 setStatusBarText(TLF("State loaded from '%'.", file));
1336 } catch (ProcessError& e) {
1337 setStatusBarText(TLF("Failed to load state from '%' (%).", file, e.what()));
1338 }
1339 }
1340 return 1;
1341}
1342
1343
1344long
1345GUIApplicationWindow::onCmdTimeToggle(FXObject*, FXSelector, void*) {
1346 // toggle show time as HMS
1351 }
1352 return 1;
1353}
1354
1355
1356long
1357GUIApplicationWindow::onCmdDelayInc(FXObject*, FXSelector, void*) {
1358 if (mySimDelay < 10) {
1359 mySimDelay = 10;
1360 } else if (mySimDelay >= 20 && mySimDelay < 50) {
1361 mySimDelay = 50;
1362 } else if (mySimDelay >= 200 && mySimDelay < 500) {
1363 mySimDelay = 500;
1364 } else {
1365 mySimDelay *= 2;
1366 }
1367 if (mySimDelay > 1000) {
1368 // setting high delay by pressing the key too often is hard to recover from
1369 mySimDelay = 1000;
1370 }
1371 mySimDelaySlider->setValue((int)mySimDelay);
1372 mySimDelaySpinner->setValue(mySimDelay);
1373 return 1;
1374}
1375
1376
1377long
1378GUIApplicationWindow::onCmdDelayDec(FXObject*, FXSelector, void*) {
1379 if (mySimDelay <= 10) {
1380 mySimDelay = 0;
1381 } else if (mySimDelay > 20 && mySimDelay <= 50) {
1382 mySimDelay = 20;
1383 } else if (mySimDelay > 200 && mySimDelay <= 500) {
1384 mySimDelay = 200;
1385 } else {
1386 mySimDelay /= 2;
1387 }
1388 mySimDelaySlider->setValue((int)mySimDelay);
1389 mySimDelaySpinner->setValue(mySimDelay);
1390 return 1;
1391}
1392
1393
1394long
1395GUIApplicationWindow::onCmdDelayToggle(FXObject*, FXSelector, void*) {
1396 const double tmp = myAlternateSimDelay;
1398 mySimDelay = tmp;
1399 return 1;
1400}
1401
1402
1403long
1404GUIApplicationWindow::onCmdDemandScale(FXObject*, FXSelector, void*) {
1407 }
1408 return 1;
1409}
1410
1411
1412long
1413GUIApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
1415 return 1;
1416}
1417
1418
1419long
1420GUIApplicationWindow::onCmdBreakpoint(FXObject*, FXSelector, void*) {
1421 // see updateTimeLCD for the DELTA_T
1424 }
1425 return 1;
1426}
1427
1428
1429long
1430GUIApplicationWindow::onCmdBreakpointEarly(FXObject*, FXSelector, void*) {
1431 // see updateTimeLCD for the DELTA_T
1434 }
1435 return 1;
1436}
1437
1438
1439long
1440GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
1441 sender->handle(this,
1443 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1444 ptr);
1446 // bind start simulation with space key
1448 }
1449 return 1;
1450}
1451
1452
1453long
1454GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
1455 sender->handle(this,
1457 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1458 ptr);
1460 // bind stop simulation with space key
1462 }
1463 return 1;
1464}
1465
1466
1467long
1468GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
1469 sender->handle(this,
1471 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1472 ptr);
1473 return 1;
1474}
1475
1476
1477long
1478GUIApplicationWindow::onUpdNeedsNetwork(FXObject* sender, FXSelector, void* ptr) {
1479 // check if there is a loaded network and gui isn't loading
1481 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1482 // enable certain elements manually
1483 mySelectLanesMenuCascade->enable();
1484 myScaleTrafficTooltip->setTipText(TL("Scale number of vehicles in simulation"));
1485 } else {
1486 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1487 // disable certain elements manually
1488 mySelectLanesMenuCascade->disable();
1489 myScaleTrafficTooltip->setTipText("");
1490 }
1491 return 1;
1492}
1493
1494
1495long
1496GUIApplicationWindow::onUpdNeedsSumoConfig(FXObject* sender, FXSelector, void* ptr) {
1497 // check if there is a loaded network and gui isn't loading
1498 if (myRunThread->networkAvailable() && !myAmLoading && OptionsCont::getOptions().isSet("configuration-file")) {
1499 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1500 sender->handle(this, FXSEL(SEL_COMMAND, ID_SHOW), ptr);
1501 myOpenInNetedit->setText(TL("Open sumo config in netedit"));
1502 } else {
1503 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1504 sender->handle(this, FXSEL(SEL_COMMAND, ID_HIDE), ptr);
1505 myOpenInNetedit->setText(TL("Open network in netedit"));
1506 }
1507 return 1;
1508}
1509
1510
1511long
1512GUIApplicationWindow::onUpdTraCIStatus(FXObject* /*sender*/, FXSelector, void* /*ptr*/) {
1514 myTraCiFrame->show();
1515 } else {
1516 myTraCiFrame->hide();
1517 }
1518 return 1;
1519}
1520
1521
1522long
1523GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
1524 if (myMDIClient->numChildren() > 0) {
1525 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1526 if (w != nullptr) {
1527 w->onCmdLocate(nullptr, sel, nullptr);
1528 }
1529 }
1530 return 1;
1531}
1532
1533
1534long
1535GUIApplicationWindow::onCmdShowStats(FXObject*, FXSelector, void*) {
1536 if (myMDIClient->numChildren() > 0) {
1537 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1539 }
1540 return 1;
1541}
1542
1543
1544long
1545GUIApplicationWindow::onCmdAppSettings(FXObject*, FXSelector, void*) {
1547 d->create();
1548 d->show(PLACEMENT_OWNER);
1549 return 1;
1550}
1551
1552
1553long
1554GUIApplicationWindow::onCmdGaming(FXObject*, FXSelector, void*) {
1555 if (myGLWindows.empty()) {
1556 return 1;
1557 }
1559 myGLWindows[0]->getView()->editVisualisationSettings()->gaming = myAmGaming;
1560 if (myAmGaming) {
1561 myGamingModeCheckbox->setCheck(TRUE);
1562 myMenuBar->hide();
1563 myStatusbar->hide();
1564 myToolBar1->hide();
1565 myToolBar2->hide();
1566 myToolBar4->hide();
1567 myToolBar5->hide();
1568 myToolBar6->show();
1569 myToolBar8->hide();
1570 myToolBar10->show();
1571 if (myTLSGame) {
1572 myToolBar7->show();
1573 } else {
1574 myToolBar9->show();
1575 }
1576 myMessageWindow->hide();
1582 } else {
1583 myGamingModeCheckbox->setCheck(FALSE);
1584 myMenuBar->show();
1585 myStatusbar->show();
1586 myToolBar1->show();
1587 myToolBar2->show();
1588 myToolBar4->show();
1589 myToolBar5->show();
1590 myToolBar6->hide();
1591 myToolBar7->hide();
1592 myToolBar8->show();
1593 myToolBar9->hide();
1594 myToolBar10->hide();
1595 myMessageWindow->show();
1597 }
1598 if (myMDIClient->numChildren() > 0) {
1599 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1600 if (w != nullptr) {
1602 }
1603 }
1604 update();
1605 return 1;
1606}
1607
1608
1609long
1611 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1612 if (w != nullptr) {
1613 // show or hide grid depending of myNetworkViewOptions.menuCheckToggleGrid
1616 } else {
1618 }
1619 w->getView()->update();
1620 }
1621 return 1;
1622}
1623
1624
1625long
1627 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1628 if (w != nullptr) {
1629 // toggle secondary shape visualization
1631 w->getView()->update();
1632 }
1633 return 1;
1634}
1635
1636
1637long
1638GUIApplicationWindow::onCmdFullScreen(FXObject*, FXSelector, void*) {
1639 if (myGLWindows.empty()) {
1640 return 1;
1641 }
1643 if (myAmFullScreen) {
1644 getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1645 getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1646 getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1647 getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1648 maximize();
1649 setDecorations(DECOR_NONE);
1650 place(PLACEMENT_MAXIMIZED);
1651 myMenuBar->hide();
1652 myStatusbar->hide();
1653 myToolBar1->hide();
1654 myToolBar2->hide();
1655 myToolBar3->hide();
1656 myToolBar4->hide();
1657 myToolBar5->hide();
1658 myToolBar6->hide();
1659 myToolBar7->hide();
1660 myToolBar8->hide();
1661 myMessageWindow->hide();
1662 if (myMDIClient->numChildren() > 0) {
1663 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1664 if (w != nullptr) {
1665 w->setToolBarVisibility(false);
1666 }
1667 }
1668 update();
1669 } else {
1670 place(PLACEMENT_VISIBLE);
1671 setDecorations(DECOR_ALL);
1672 restore();
1673 myToolBar3->show();
1675 onCmdGaming(nullptr, 0, nullptr);
1676 setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
1677 setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1678 setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
1679 setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
1680 }
1681 return 1;
1682}
1683
1684
1685long
1686GUIApplicationWindow::onCmdListInternal(FXObject*, FXSelector, void*) {
1688 return 1;
1689}
1690
1691
1692long
1693GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) {
1695 return 1;
1696}
1697
1698long
1699GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) {
1701 return 1;
1702}
1703
1704
1705long
1706GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) {
1708 return 1;
1709}
1710
1711
1712#ifdef HAVE_OSG
1713long
1714GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1716 return 1;
1717}
1718#endif
1719
1720
1721long
1722GUIApplicationWindow::onCmdFeedback(FXObject*, FXSelector, void*) {
1723 // create and open feedback dialog
1724 GUIDialog_Feedback* feedback = new GUIDialog_Feedback(this);
1725 feedback->create();
1726 feedback->show(PLACEMENT_OWNER);
1727 return 1;
1728}
1729
1730
1731long
1732GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
1733 GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this);
1734 about->create();
1735 about->show(PLACEMENT_OWNER);
1736 return 1;
1737}
1738
1739
1740long
1741GUIApplicationWindow::onCmdHallOfFame(FXObject*, FXSelector, void*) {
1743 hall->create();
1744 hall->show(PLACEMENT_OWNER);
1745 return 1;
1746}
1747
1748
1749long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1750 FXEvent* event = (FXEvent*)ptr;
1751 FXString string = GUIUserIO::clipped.c_str();
1752 setDNDData(FROM_CLIPBOARD, event->target, string);
1753 return 1;
1754}
1755
1756
1757long
1758GUIApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
1759 eventOccurred();
1760 return 1;
1761}
1762
1763
1764long
1765GUIApplicationWindow::onRunThreadEvent(FXObject*, FXSelector, void*) {
1766 eventOccurred();
1767 return 1;
1768}
1769
1770
1771void
1773 while (!myEvents.empty()) {
1774 // get the next event
1775 GUIEvent* e = myEvents.top();
1776 myEvents.pop();
1777 // process
1778 switch (e->getOwnType()) {
1781 setFocus();
1782 break;
1784 if (myRunThread->networkAvailable()) { // avoid race-condition related crash if reload was pressed
1786 }
1787 break;
1795 break;
1797 GUIEvent_AddView* ave = dynamic_cast<GUIEvent_AddView*>(e);
1799 if (ave->getSchemeName() != "") {
1800 MFXComboBoxIcon* sCombo = v->getColoringSchemesCombo();
1801 int index = sCombo->findItem(ave->getSchemeName().c_str());
1802 if (index >= 0) {
1803 sCombo->setCurrentItem(index);
1804 }
1805 v->setColorScheme(ave->getSchemeName());
1806 }
1807 break;
1808 }
1810 GUIEvent_CloseView* ave = dynamic_cast<GUIEvent_CloseView*>(e);
1811 removeViewByID(ave->getCaption());
1812 break;
1813 }
1816 break;
1817 default:
1818 break;
1819 }
1820 delete e;
1821 }
1822 myToolBar2->forceRefresh();
1823 myToolBar3->forceRefresh();
1824}
1825
1826
1827void
1829 myAmLoading = false;
1831 // check whether the loading was successfull
1832 if (ec->myNet == nullptr) {
1833 // report failure
1834 setStatusBarText(TLF("Loading of '%' failed!", ec->myFile));
1837 getApp()->exit(1);
1838 }
1839 } else {
1840 // initialise simulation thread
1841 if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1844 getApp()->exit(1);
1845 }
1846 } else {
1847 // report success
1848 setStatusBarText(TLF("'%' loaded.", ec->myFile));
1850 myWasStarted = false;
1852 // initialise views
1853 myViewNumber = 0;
1855 // check/record settings file modification time
1856 long long mTime = myGuiSettingsFileMTime;
1857 if (ec->mySettingsFiles.size() > 0) {
1858 for (std::string fname : ec->mySettingsFiles) {
1859 mTime = MAX2(mTime, SysUtils::getModifiedTime(fname));
1860 }
1861 }
1862 // always reload if settings were modified or to restore multiple views
1863 if (!myIsReload) {
1865 }
1866 if (ec->mySettingsFiles.size() > 0 && (!myIsReload || myGuiSettingsFileMTime < mTime || ec->mySettingsFiles.size() > 1)) {
1867 // open a view for each file and apply settings
1868 for (std::string fname : ec->mySettingsFiles) {
1869 GUISettingsHandler settings(fname);
1870 GUISUMOViewParent::ViewType vt = defaultType;
1871 if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
1873 }
1874 if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
1876 }
1877 GUISUMOAbstractView* view = openNewView(vt);
1878 if (view == nullptr) {
1879 break;
1880 }
1881 if (settings.getSettingName() != "") {
1882 view->setColorScheme(settings.getSettingName());
1883 MFXComboBoxIcon* sCombo = view->getColoringSchemesCombo();
1884 int index = sCombo->findItem(settings.getSettingName().c_str());
1885 if (index >= 0) {
1886 sCombo->setCurrentItem(index);
1887 }
1888 }
1889 view->addDecals(settings.getDecals());
1890 settings.applyViewport(view);
1891 settings.setSnapshots(view);
1892 if (settings.getDelay() > 0.) {
1893 mySimDelay = settings.getDelay();
1894 }
1895 if (settings.getBreakpoints().size() > 0) {
1897 myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
1898 myRunThread->getBreakpointLock().unlock();
1899 }
1900 myJamSounds = settings.getEventDistribution("jam");
1901 myCollisionSounds = settings.getEventDistribution("collision");
1902 if (settings.getJamSoundTime() > 0) {
1903 myJamSoundTime = settings.getJamSoundTime();
1904 }
1905 }
1906 } else {
1907 openNewView(defaultType);
1908 }
1909 myGuiSettingsFileMTime = mTime;
1910 if (!OptionsCont::getOptions().isDefault("delay")) {
1911 setDelay(OptionsCont::getOptions().getFloat("delay"));
1912 mySimDelaySlider->setValue((int)mySimDelay);
1913 mySimDelaySpinner->setValue(mySimDelay);
1914 }
1915 if (!OptionsCont::getOptions().isDefault("breakpoints") && !myIsReload) {
1916 std::vector<SUMOTime> breakpoints;
1917 for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
1918 SUMOTime t = string2time(val);
1919 // round down to nearest reachable time step
1920 t -= t % DELTA_T;
1921 breakpoints.push_back(t);
1922 }
1923 std::sort(breakpoints.begin(), breakpoints.end());
1925 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1926 myRunThread->getBreakpointLock().unlock();
1927 }
1928 if (!OptionsCont::getOptions().isDefault("selection-file")) {
1929 delete myDynamicSelection;
1930 myDynamicSelection = new std::stringstream();
1931 std::string msg = gSelected.load(OptionsCont::getOptions().getString("selection-file"), GLO_MAX, myDynamicSelection);
1932 if (msg != "") {
1933 WRITE_ERRORF("Errors while loading selection: %", msg.c_str());
1934 }
1935 if (!myDynamicSelection->str().empty()) {
1936 std::string dummy;
1937 int numNotFound = 0;
1938 while (myDynamicSelection->good()) {
1939 (*myDynamicSelection) >> dummy;
1940 numNotFound++;
1941 }
1942 myDynamicSelection->clear(); // first clear error state before seek works
1943 myDynamicSelection->seekg(0);
1944 // @note for some reason the last line is read twice
1945 WRITE_MESSAGEF("% dynamic objects not present while loading selection", numNotFound - 1);
1946 }
1947 }
1948 myTLSGame = OptionsCont::getOptions().getString("game.mode") == "tls";
1949 if (OptionsCont::getOptions().getBool("game")) {
1950 if (myTLSGame) {
1951 setTitle(TL("SUMO Interactive Traffic Light"));
1952 } else {
1953 setTitle(TL("SUMO Interactive Demand-Responsive-Transport"));
1954 }
1955 onCmdGaming(nullptr, 0, nullptr);
1956 } else {
1957 // set simulation name on the caption
1958 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str()));
1959 }
1960 if (ec->myViewportFromRegistry) {
1961 Position off;
1962 off.set(getApp()->reg().readRealEntry("viewport", "x"),
1963 getApp()->reg().readRealEntry("viewport", "y"),
1964 getApp()->reg().readRealEntry("viewport", "z"));
1965 Position p(off.x(), off.y(), 0);
1966 GUISUMOAbstractView* view = myGLWindows[0]->getView();
1967 view->setViewportFromToRot(off, p, 0);
1968 }
1969 // set simulation step begin information
1970 myLCDLabel->setText("----------------");
1971 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
1972 (*it)->setText("-");
1973 }
1974 // initialize scale from options unless already set in the UI
1975 if (myDemandScaleSpinner->getValue() == 1 || !OptionsCont::getOptions().isDefault("scale")) {
1977 }
1980 }
1981 }
1982 getApp()->endWaitCursor();
1983 // start if wished
1985 onCmdStart(nullptr, 0, nullptr);
1986 }
1987 update();
1988}
1989
1990
1991void
1993#ifdef WIN32
1994 long t = SysUtils::getCurrentMillis();
1995 // only skip if the simulation is running
1996 if (t - myLastStepEventMillis < MIN_DRAW_DELAY && myRunThread->simulationIsStopable()) {
1997 // do not try to redraw with more than 50FPS (#6371)
1998 return;
1999 }
2001#endif
2003 const int running = myRunThread->getNet().getVehicleControl().getRunningVehicleNo();
2004 const int backlog = myRunThread->getNet().getInsertionControl().getWaitingVehicleNo();
2005 if (backlog > running) {
2006 if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::GREENVEHICLE)) {
2008 }
2009 } else {
2010 if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::YELLOWVEHICLE)) {
2012 }
2013 }
2014 myStatButtons.front()->setText(toString(running).c_str());
2015 if (myRunThread->getNet().hasPersons()) {
2016 if (!myStatButtons[1]->shown()) {
2017 myStatButtons[1]->show();
2018 }
2020 }
2021 if (myRunThread->getNet().hasContainers()) {
2022 if (!myStatButtons[2]->shown()) {
2023 myStatButtons[2]->show();
2024 }
2026 }
2027 if (myAmGaming) {
2028 if (myTLSGame) {
2030 } else {
2032 }
2033 }
2035 getApp()->forceRefresh(); // restores keyboard focus
2036 }
2037 // try to load dynamic selection
2038 if (myDynamicSelection != nullptr) {
2039 std::stringstream tmp;
2041 if (tmp.str().empty()) {
2042 delete myDynamicSelection;
2043 myDynamicSelection = nullptr;
2044 } else {
2045 myDynamicSelection->str(tmp.str());
2046 myDynamicSelection->clear(); // first clear error state before seek works
2047 myDynamicSelection->seekg(0);
2048 }
2049 }
2051 update();
2052}
2053
2054
2055void
2057 GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
2059 setStatusBarText(ec->getMsg());
2060 } else {
2062 }
2063}
2064
2065
2066void
2069 onCmdStop(nullptr, 0, nullptr);
2070 if (ec->getReason() == MSNet::SIMSTATE_LOADING) {
2071 onCmdReload(nullptr, 0, nullptr);
2072 } else if (GUIGlobals::gQuitOnEnd) {
2074 getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
2075 } else if (GUIGlobals::gDemoAutoReload) {
2076 onCmdReload(nullptr, 1, nullptr);
2077 } else if (!myHaveNotifiedAboutSimEnd) {
2078 // GUIRunThread::deleteSim() triggers the final message to the log file
2079 // (this will never reach the GUI but we cannot use WRITE_MESSAGE here
2080 // to avoid a duplicate log entry)
2082 TLF("Simulation ended at time: %. (%)",
2084 // build the text
2085 const std::string text = TLF("Simulation ended at time: %.", time2string(ec->getTimeStep())) + "\n" +
2086 TL("Reason:") + MSNet::getStateMessage(ec->getReason()) + "\n" +
2087 TL("Do you want to close all open files and views?");
2088 FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, TL("Simulation ended"), "%s", text.c_str());
2089 if (answer == 1) { //1:yes, 2:no, 4:esc
2091 } else {
2094 update();
2095 }
2097 }
2098}
2099
2100
2101void
2106#ifdef HAVE_DANGEROUS_SOUNDS // disable user-configurable command execution for public build
2107 if (myJamSounds.getOverallProb() > 0) {
2108 // play honking sound if some vehicle is waiting too long
2109 for (; it != end; ++it) {
2110 // XXX use impatience instead of waiting time ?
2111 if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
2112 const std::string cmd = myJamSounds.get(&myGamingRNG);
2113 if (cmd != "") {
2114 // yay! fun with dangerous commands... Never use this over the internet
2116 // one sound per simulation step is enough
2117 break;
2118 }
2119 }
2120 }
2121 }
2124 if (myPreviousCollisionNumber != collisions) {
2125 const std::string cmd = myCollisionSounds.get(&myGamingRNG);
2126 if (cmd != "") {
2127 // yay! fun with dangerous commands... Never use this over the internet
2129 }
2130 myPreviousCollisionNumber = collisions;
2131 }
2132 }
2133#endif
2134 // update performance indicators
2135 for (it = vc.loadedVehBegin(); it != end; ++it) {
2136 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2137 assert(veh != 0);
2138 if (veh->isOnRoad() && !veh->isStopped()) {
2139 const double vmax = veh->getLane()->getVehicleMaxSpeed(veh);
2140 if (veh->getSpeed() < SUMO_const_haltingSpeed) {
2142 if (veh->getVClass() == SVC_EMERGENCY) {
2144 }
2145 }
2146 myTimeLoss += TIME2STEPS(TS * (vmax - veh->getSpeed()) / vmax); // may be negative with speedFactor > 1
2147 }
2148
2149 }
2153}
2154
2155
2156void
2158 // update performance indicators
2162
2165 for (auto it = vc.loadedVehBegin(); it != end; ++it) {
2166 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2167 assert(veh != 0);
2168 if (veh->isOnRoad() && !veh->isStopped()) {
2170 }
2171 }
2173}
2174
2175
2176void
2178 if (!myAmLoading) {
2180 getApp()->beginWaitCursor();
2181 myAmLoading = true;
2182 myIsReload = false;
2184 gSchemeStorage.saveViewport(0, 0, -1, 0); // recenter view
2186 setStatusBarText(TLF("Loading '%'.", file));
2187 update();
2188 }
2189}
2190
2191
2194 if (!myRunThread->networkAvailable()) {
2195 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
2196 return nullptr;
2197 }
2198 GUISUMOAbstractView* oldView = nullptr;
2199 if (myMDIClient->numChildren() > 0) {
2200 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2201 if (w != nullptr) {
2202 oldView = w->getView();
2203 }
2204 }
2205 if (caption == "") {
2206 caption = "View #" + toString(myViewNumber++);
2207 }
2208 FXuint opts = MDI_TRACKING;
2209 GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
2210 this, GUIIconSubSys::getIcon(GUIIcon::SUMO_MINI), opts, 10, 10, 200, 100);
2212 if (oldView != nullptr) {
2213 // copy viewport
2214 oldView->copyViewportTo(v);
2215 }
2216 w->create();
2217 if (myMDIClient->numChildren() == 1) {
2218 w->maximize();
2219 } else {
2220 myMDIClient->vertical(true);
2221 }
2222 myMDIClient->setActiveChild(w);
2223
2224 return v;
2225}
2226
2227
2228FXGLCanvas*
2230 if (myMDIClient->numChildren() == 0) {
2231 return nullptr;
2232 }
2233 GUISUMOViewParent* share_tmp1 =
2234 static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
2235 return share_tmp1->getBuildGLCanvas();
2236}
2237
2238
2239void
2241 myTrackerLock.lock();
2242 myLCDLabel->setText("----------------");
2243 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2244 (*it)->setText("-");
2245 if (it != myStatButtons.begin()) {
2246 (*it)->hide();
2247 }
2248 }
2249 // delete the simulation
2251 // reset the caption
2252 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
2253 // remove trackers and other external windows (must be delayed until deleteSim)
2254 while (!myGLWindows.empty()) {
2255 delete myGLWindows.front();
2256 }
2257 // make a copy because deleting modifyes the vector;
2258 std::vector<FXMainWindow*> trackerWindows = myTrackerWindows;
2259 for (FXMainWindow* const window : trackerWindows) {
2260 delete window;
2261 }
2262 myTrackerWindows.clear();
2263 // clear selected items
2264 gSelected.clear();
2265 // add a separator to the log
2267 myTrackerLock.unlock();
2268 // remove coordinate information
2269 myGeoCoordinate->setText(TL("N/A"));
2270 myCartesianCoordinate->setText(TL("N/A"));
2271 if (myTestCoordinate) {
2272 myTestCoordinate->setText(TL("N/A"));
2273 }
2274 //
2277 update();
2278}
2279
2280
2281FXCursor*
2283 return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
2284}
2285
2286
2291
2292
2293double
2297
2298
2299void
2301 loadConfigOrNet("");
2302 if (wait) {
2303 while (myAmLoading) {
2304 myRunThread->sleep(50);
2305 }
2306 }
2307}
2308
2309
2310void
2312 myStatusbar->getStatusLine()->setText(text.c_str());
2313 myStatusbar->getStatusLine()->setNormalText(text.c_str());
2314}
2315
2316
2317void
2319 myRecentNetworks.appendFile(f);
2320}
2321
2322
2323void
2325 myRecentConfigs.appendFile(f);
2326}
2327
2328
2329void
2331 if (myShowTimeAsHMS) {
2332 myLCDLabel->setToolTipText("HH:MM:SS");
2333 if (myAmGaming) {
2335 myTimeLossLabel->setToolTipText("HH:MM:SS");
2337 }
2338 } else {
2339 myLCDLabel->setToolTipText(TL("seconds"));
2340 if (myAmGaming) {
2342 myTimeLossLabel->setToolTipText(TL("seconds"));
2344 }
2345 }
2346}
2347
2348
2349void
2351 time -= DELTA_T; // synchronize displayed time with netstate output
2352 if (time < 0) {
2353 myLCDLabel->setText("----------------");
2354 return;
2355 }
2356 if (myAmGaming) {
2357 // show time counting backwards
2358 time = myRunThread->getSimEndTime() - time;
2359 }
2360 std::ostringstream str;
2361 str << std::setfill('0');
2362 const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0;
2363 if (myShowTimeAsHMS) {
2364 SUMOTime day = time / 86400000;
2365 if (day > 0) {
2366 str << day << '-';
2367 time %= 86400000;
2368 }
2369 str << std::setw(2);
2370 str << time / 3600000 << '-';
2371 time %= 3600000;
2372 str << std::setw(2) << time / 60000 << '-';
2373 time %= 60000;
2374 }
2375 str << std::setw(2) << time / 1000;
2376 if (!hideFraction) {
2377 str << '.' << std::setw(3) << time % 1000;
2378 }
2379 myLCDLabel->setText(str.str().c_str());
2380}
2381
2382
2383void
2385 if (press != nullptr) {
2386 myHotkeyPress[key] = press;
2387 }
2388 if (release != nullptr) {
2389 myHotkeyRelease[key] = release;
2390 }
2391}
2392
2393
2394long
2395GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* ptr) {
2396 FXEvent* e = (FXEvent*) ptr;
2397 // PgUp and PgDown switch between widgets by default and binding them via menu shortcuts does not work reliably
2398 // so we must intercept them before FXMainWindow can handle it
2399 if (e->code == FX::KEY_Page_Up) {
2400 onCmdDelayInc(nullptr, 0, nullptr);
2401 } else if (e->code == FX::KEY_Page_Down) {
2402 onCmdDelayDec(nullptr, 0, nullptr);
2403 } else {
2404 // disable hotkeys without modifiers for the game
2405 const bool ignoreSimple = myAmGaming && (e->state & (CONTROLMASK | SHIFTMASK | ALTMASK)) == 0;
2406 const long handled = ignoreSimple ? 0 : FXMainWindow::onKeyPress(o, sel, ptr);
2407 if (handled == 0 && myMDIClient->numChildren() > 0) {
2408 auto it = myHotkeyPress.find(e->code);
2409 if (it != myHotkeyPress.end()) {
2410 it->second->execute(SIMSTEP);
2411 }
2412 if (!ignoreSimple) {
2413 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2414 if (w != nullptr) {
2415 w->onKeyPress(nullptr, sel, ptr);
2416 }
2417 }
2418 }
2419 }
2420 return 0;
2421}
2422
2423
2424long
2425GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* ptr) {
2426 const long handled = FXMainWindow::onKeyRelease(o, sel, ptr);
2427 if (handled == 0 && myMDIClient->numChildren() > 0) {
2428 FXEvent* e = (FXEvent*) ptr;
2429 auto it = myHotkeyRelease.find(e->code);
2430 if (it != myHotkeyRelease.end()) {
2431 it->second->execute(SIMSTEP);
2432 }
2433 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2434 if (w != nullptr) {
2435 w->onKeyRelease(nullptr, sel, ptr);
2436 }
2437 }
2438 return 0;
2439}
2440
2441
2442double
2444 return mySimDelay;
2445}
2446
2447
2448void
2450 mySimDelay = delay;
2451}
2452
2453
2454void
2456 myEventMutex.lock();
2457 myEvents.push_back(event);
2459 //myEventCondition.wait(myEventMutex);
2460 myEventMutex.unlock();
2461}
2462
2463
2464void
2465GUIApplicationWindow::setBreakpoints(const std::vector<SUMOTime>& breakpoints) {
2466 if (myRunThread != nullptr) {
2468 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
2469 myRunThread->getBreakpointLock().unlock();
2471 }
2472}
2473
2474
2475void
2477 const SUMOTime begin = string2time(OptionsCont::getOptions().getString("begin"));
2478 if (time >= begin) {
2479 // ensure breakpoint is valid
2480 time -= (time - begin) % DELTA_T;
2481 std::vector<SUMOTime> breakpoints = retrieveBreakpoints();
2482 if (std::find(breakpoints.begin(), breakpoints.end(), time) == breakpoints.end()) {
2483 breakpoints.push_back(time);
2484 std::sort(breakpoints.begin(), breakpoints.end());
2485 setBreakpoints(breakpoints);
2486 setStatusBarText(TLF("Set breakpoint at %", time2string(time)));
2487 }
2488 }
2489}
2490
2491
2492const std::vector<SUMOTime>
2495 std::vector<SUMOTime> result = myRunThread->getBreakpoints();
2496 myRunThread->getBreakpointLock().unlock();
2497 return result;
2498}
2499
2500
2501void
2505
2506/****************************************************************************/
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:348
@ 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:358
@ MID_TOOLBAREDIT_LOADADDITIONALS
load additionals in sumo-gui/netedit after press ctrl+T
Definition GUIAppEnum.h:681
@ MID_NEW_MICROVIEW
Open a new microscopic view.
Definition GUIAppEnum.h:336
@ 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:246
@ 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:375
@ MID_LANGUAGE_TR
change language to turkish
@ MID_CHANGELOG
changelog button
Definition GUIAppEnum.h:655
@ 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:683
@ MID_HOTKEY_F1_ONLINEDOCUMENTATION
open online documentation
Definition GUIAppEnum.h:230
@ 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:328
@ MID_DEMAND_SCALE
scale traffic
Definition GUIAppEnum.h:401
@ MID_HOTKEY_CTRL_I_EDITVIEWPORT
Open viewport editor.
Definition GUIAppEnum.h:99
@ MID_RECENTFILE
Loads a file previously loaded.
Definition GUIAppEnum.h:318
@ 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:252
@ MID_LANGUAGE_HU
change language to hungarian
@ MID_HOTKEY_SHIFT_L_LOCATEPOLY
Locate polygons - button.
Definition GUIAppEnum.h:180
@ MID_HOTKEY_CTRL_K_OPENTLSPROGRAMS
Load file with TLS Programs.
Definition GUIAppEnum.h:103
@ MID_LANGUAGE_IT
change language to italian
@ MID_HOTKEY_SHIFT_E_LOCATEEDGE
Locate edge - button.
Definition GUIAppEnum.h:176
@ MID_HOTKEY_ALT_B_BREAKPOINT_EARLY
hotkey for setting a breakpoint ahead of the current time
Definition GUIAppEnum.h:165
@ MID_CLEARMESSAGEWINDOW
Clear simulation output.
Definition GUIAppEnum.h:367
@ MID_HOTKEY_CTRL_F_FULSCREENMODE
Fullscreen mode - menu entry.
Definition GUIAppEnum.h:93
@ MID_SIMSAVE
Save state to file.
Definition GUIAppEnum.h:326
@ MID_TUTORIAL
tutorial button
Definition GUIAppEnum.h:659
@ MID_LISTTELEPORTING
Definition GUIAppEnum.h:360
@ 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:369
@ ID_LOADTHREAD_EVENT
The loading thread.
Definition GUIAppEnum.h:346
@ 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:373
@ MID_DELAY_TOGGLE
toggle delay between alternative value
Definition GUIAppEnum.h:399
@ MID_HOTKEYS
hotkeys button
Definition GUIAppEnum.h:657
@ MID_TIMELINK_BREAKPOINT
Set breakpionts from messages - Option.
Definition GUIAppEnum.h:571
@ 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:393
@ MID_DELAY_DEC
decrease sim delay
Definition GUIAppEnum.h:397
@ MID_LISTPARKING
Definition GUIAppEnum.h:359
@ MID_NEW_OSGVIEW
Open a new microscopic 3D view.
Definition GUIAppEnum.h:338
@ MID_LANGUAGE_JA
change language to japanese
@ MID_FEEDBACK
feedback button
Definition GUIAppEnum.h:661
@ 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:254
@ 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:395
@ 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:371
@ MID_LANGUAGE_FR
change language to french
@ MID_WINDOW
Main window-ID.
Definition GUIAppEnum.h:298
FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[]
#define MIN_DRAW_DELAY
GUICompleteSchemeStorage gSchemeStorage
#define GUIDesignSlider
Definition GUIDesigns.h:505
#define GUIDesignSpinDial
Definition GUIDesigns.h:485
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
Definition GUIDesigns.h:449
#define GUIDesignButtonStatusBarFixed
button rectangular with thick and raise frame with a width of 100
Definition GUIDesigns.h:106
#define GUIDesignMDIButtonLeft
Definition GUIDesigns.h:218
#define GUIDesignToolBarRaisedSameTop
design for first toolbar shell positioned in the same position of dock
Definition GUIDesigns.h:455
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition GUIDesigns.h:123
#define GUIDesignHorizontalFrameStatusBar
Horizontal frame used in status bar.
Definition GUIDesigns.h:340
#define GUIDesignToolBar
design for default toolbar
Definition GUIDesigns.h:434
#define GUIDesignSplitter
Definition GUIDesigns.h:474
#define GUIDesignSplitterMDI
MDI Splitter.
Definition GUIDesigns.h:477
#define GUIDesignToolbarMenuBar
Definition GUIDesigns.h:428
#define GUIDesignToolBarRaisedNextTop
design for first toolbar shell positioned in the next-top position of dock
Definition GUIDesigns.h:452
#define GUIDesignButtonToolbarText
Definition GUIDesigns.h:120
#define GUIDesignMDIButtonRight
MDIButton oriented to right.
Definition GUIDesigns.h:221
#define GUIDesignStatusBar
design used in status bar
Definition GUIDesigns.h:446
@ SIMULATION_ENDED
Send when the simulation is over;.
@ MESSAGE_OCCURRED
send when a message occured
@ GLDEBUG_OCCURRED
send when a gldebug occured
@ ERROR_OCCURRED
send when a error occured
@ SIMULATION_STEP
send when a simulation step has been performed
@ ADD_VIEW
Send when a new should be opened (via TraCI)
@ CLOSE_VIEW
Send when a view should be closed (via TraCI)
@ SIMULATION_LOADED
send when a simulation has been loaded
@ STATUS_OCCURRED
send when a status change occured
@ DEBUG_OCCURRED
send when a debug occured
@ WARNING_OCCURRED
send when a warning occured
@ GLO_MAX
empty max
GUISelectedStorage gSelected
A global holder of selected objects.
FXString gCurrentFolder
The folder used as last.
@ EDITVIEWPORT
@ CLEARMESSAGEWINDOW
@ NETEDIT_MINI
@ GREENVEHICLE
@ LOCATEVEHICLE
@ LOCATEPERSON
@ WINDOWS_TILE_VERT
@ GREENCONTAINER
@ WINDOWS_CASCADE
@ OPEN
open icons
@ LOCATECONTAINER
@ LOCATEJUNCTION
@ APP_BREAKPOINTS
@ SAVE_SUMOCONFIG
@ WINDOWS_TILE_HORI
@ YELLOWVEHICLE
@ OPEN_SUMOCONFIG
@ SAVE
save icons
@ KEY_SPACE
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
#define WRITE_MESSAGEF(...)
Definition MsgHandler.h:290
#define WRITE_ERRORF(...)
Definition MsgHandler.h:297
#define TL(string)
Definition MsgHandler.h:305
#define TLF(string,...)
Definition MsgHandler.h:307
SUMOTime DELTA_T
Definition SUMOTime.cpp:38
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:91
#define SPEED2DIST(x)
Definition SUMOTime.h:45
#define SIMSTEP
Definition SUMOTime.h:61
#define TS
Definition SUMOTime.h:42
#define TIME2STEPS(x)
Definition SUMOTime.h:57
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_EMERGENCY
public emergency vehicles
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition StdDefs.h:58
T MAX2(T a, T b)
Definition StdDefs.h:82
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
#define TLC(context, string)
Definition Translation.h:47
Base (microsim) event class.
Definition Command.h:50
void setSelector(FXSelector sel)
set the selector
void setTarget(FXObject *tgt)
set the target
static bool isReadable(std::string path)
Checks whether the given file is readable.
static void resetFont()
to be called when the font context is invalidated
Definition GLHelper.cpp:670
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)
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 open simulation/network in netedit
long onCmdGaming(FXObject *, FXSelector, void *)
Toggle gaming mode.
void clearDecals()
Clear the default decals.
void saveViewport(const double x, const double y, const double z, const double rot)
Makes the given viewport the default.
static void close()
close GUICursorSubSys
static void initCursors(FXApp *a)
Initiate GUICursorSubSys.
static FXLabel * buildFXLabel(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXuint opts, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
Construct label with given text and icon.
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXMenuTitle * buildFXMenuTitle(FXComposite *p, const std::string &text, FXIcon *icon, FXMenuPane *menuPane)
build menu title
static FXMenuCommand * buildFXMenuCommandRecentFile(FXComposite *p, const std::string &text, FXObject *tgt, FXSelector sel)
build menu command (for recent files)
static FXMenuCheck * buildFXMenuCheckbox(FXComposite *p, const std::string &text, const std::string &info, FXObject *tgt, FXSelector sel)
build menu checkbox
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
static FXMenuCommand * buildFXMenuCommandShortcut(FXComposite *p, const std::string &text, const std::string &shortcut, const std::string &info, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
The application's "About" - dialog.
void create()
Creates the widget.
The dialog to change the application (gui) settings.
Editor for simulation breakpoints.
The application's "Feedback" dialog.
void create()
Creates the widget.
Editor for the list of chosen objects.
The SUMO User Conference "Hall of Fame" - dialog / easter egg.
void create()
Creates the widget.
const std::string & getCaption() const
const std::string & getSchemeName() const
const std::string & getCaption() const
const std::string & getMsg() const
Returns the message.
Event sent when the simulation is over.
MSNet::SimulationState getReason() const
Returns the reason the simulation has ended due.
SUMOTime getTimeStep() const
Returns the time step the simulation has ended at.
const SUMOTime myBegin
the time the simulation shall start with
const std::vector< std::string > mySettingsFiles
the name of the settings file to load
const bool myOsgView
whether to load the OpenSceneGraph view
const SUMOTime myEnd
the time the simulation shall end with
const bool myViewportFromRegistry
whether loading viewport from registry
const std::string myFile
the name of the loaded file
GUIEventType getOwnType() const
returns the event type
Definition GUIEvent.h:89
virtual void create()
create GUIGlChildWindow
GUISUMOAbstractView * getView() const
return GUISUMOAbstractView
virtual FXGLCanvas * getBuildGLCanvas() const
get build GL Canvas
GUIGlID getGlID() const
Returns the numerical id of the object.
static double gTrackerInterval
the aggregation period for tracker windows in seconds
Definition GUIGlobals.h:46
static bool gRunAfterLoad
the simulation shall start direct after loading
Definition GUIGlobals.h:37
static bool gQuitOnEnd
the window shall be closed when the simulation has ended
Definition GUIGlobals.h:40
static bool gDemoAutoReload
the simulation shall reload when it has ended (demo)
Definition GUIGlobals.h:43
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static void initIcons(FXApp *a)
Initiate GUIIconSubSys.
static void close()
close GUIIconSubSys
Representation of a lane in the micro simulation (gui-version)
Definition GUILane.h:60
void loadConfigOrNet(const std::string &file)
begins the loading of the given file
const std::string & getFileName() const
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call
bool myListParking
information whether the locator should list parking vehicles
void removeViewByID(const std::string &id)
std::vector< FXMainWindow * > myTrackerWindows
list of tracker windows
FXMenuPane * myLanguageMenu
Language menu common to all applications.
bool myListTeleporting
information whether the locator should list teleporting vehicles
FXLabel * myCartesianCoordinate
Labels for the current cartesian, geo-coordinate and test coordinates.
std::map< std::string, std::string > myOnlineMaps
online mapping services for the context menu
MFXStaticToolTip * myStaticTooltipMenu
static toolTip used in menus
FXMDIClient * myMDIClient
The multi view panel.
FXHorizontalFrame * myTraCiFrame
frames for coordinates
void buildLanguageMenu(FXMenuBar *menuBar)
long onCmdChangeLanguage(FXObject *, FXSelector, void *)
bool listParking() const
return whether to list parking vehicles
FXHorizontalFrame * myGeoFrame
FXHorizontalFrame * myTestFrame
FXHorizontalFrame * myCartesianFrame
FXLabel * myTestCoordinate
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
FXDockSite * myTopDock
dock sites
bool myListInternal
information whether the locator should list internal structures
void storeWindowSizeAndPos()
record window position and size in registry
bool myAmFullScreen
FOX need this.
FXLabel * myGeoCoordinate
FXStatusBar * myStatusbar
The status bar.
void updateChildren(int msg=MID_SIMSTEP)
update childrens
FXGLVisual * myGLVisual
The gl-visual used.
bool myAmGaming
information whether the gui is currently in gaming mode
std::vector< GUIGlChildWindow * > myGLWindows
list of GLWindows
long onUpdChangeLanguage(FXObject *, FXSelector, void *)
A logging window for the gui.
void addSeparator()
Adds a a separator to this log window.
void clear()
Clears the window.
void appendMsg(GUIEventType eType, const std::string &msg)
Adds new text to the window.
static SUMOTime getBreakPointOffset()
ask whether locate links is enabled
MSTransportableControl & getPersonControl() override
Returns the person control.
Definition GUINet.cpp:130
void flushOutputsAtEnd()
flush outputs once the simulation has reached its end
Definition GUINet.cpp:792
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition GUINet.cpp:477
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition GUINet.cpp:572
MSTransportableControl & getContainerControl() override
Returns the container control.
Definition GUINet.cpp:139
virtual double getXPos() const =0
Returns the x-offset of the field to show stored in this changer.
virtual double getYPos() const =0
Returns the y-offset of the field to show stored in this changer.
virtual double getZPos() const =0
Returns the camera height corresponding to the current zoom factor.
void singleStep()
called when the user presses the "single step"-button
GUINet & getNet() const
returns the loaded network
virtual void begin()
starts the simulation (execution of one step after another)
SUMOTime getSimBegin()
get simulation begin time
void resume()
called when the user presses the "resume"-button
virtual bool simulationIsStartable() const
check if simulation is startable
bool networkAvailable() const
returns the information whether a network has been loaded
virtual bool simulationIsStepable() const
check if simulation is stepable
std::vector< SUMOTime > & getBreakpoints()
get list of breakpoints
virtual bool init(GUINet *net, SUMOTime start, SUMOTime end)
initialises the thread with the new simulation
FXMutex & getBreakpointLock()
get breakpoint lock
SUMOTime getSimEndTime() const
get simulation end time
virtual bool simulationIsStopable() const
check if simulation is stopableo
virtual void deleteSim()
deletes the existing simulation
void stop()
halts the simulation execution
void prepareDestruction()
halts the thread before it shall be deleted
MFXComboBoxIcon * getColoringSchemesCombo()
get coloring schemes combo
void addDecals(const std::vector< Decal > &decals)
add decals
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
GUIPerspectiveChanger & getChanger() const
get changer
virtual void setViewportFromToRot(const Position &lookFrom, const Position &lookAt, double rotation)
applies the given viewport settings
GUIVisualizationSettings * editVisualisationSettings() const
edit visualization settings (allow modify VisualizationSetings, use carefully)
virtual void copyViewportTo(GUISUMOAbstractView *view)
copy the viewport to the given view
virtual bool setColorScheme(const std::string &)
set color scheme
A single child window which contains a view of the simulation area.
ViewType
Available view types.
@ VIEW_3D_OSG
plain 3D OSG view (
@ VIEW_2D_OPENGL
plain 2D openGL view (
virtual GUISUMOAbstractView * init(FXGLCanvas *share, GUINet &net, ViewType type)
"Initialises" this window by building the contents
long onCmdLocate(FXObject *, FXSelector, void *)
locator-callback
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
void setToolBarVisibility(const bool value)
about toggled gaming status
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
void clear()
Clears the list of selected objects.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
std::string load(const std::string &filename, GUIGlObjectType type=GLO_MAX, std::ostream *dynamicNotFound=nullptr)
Loads a selection list (optionally with restricted type)
An XML-handler for visualisation schemes.
double getDelay() const
Returns the parsed delay.
const std::string & getSettingName() const
RandomDistributor< std::string > getEventDistribution(const std::string &id)
const std::string & getViewType() const
Returns the parsed view type.
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
const std::vector< SUMOTime > & getBreakpoints() const
Returns the parsed breakpoints.
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
Storage for geometrical objects extended by mutexes.
static void buildAccelerators(FXAccelTable *accelTable, FXObject *target, const bool sumogui)
build accelerators
static void changeAccelerator(FXAccelTable *accelTable, FXObject *target, GUIShortcut keysym, long msg)
change accelerator (used for toggle dynamically binding space key with start/end simulation)
static void initTextures(FXApp *a)
Initiate GUITextureSubSys for textures.
static void clearTextures()
clears loaded textures
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
A widget which has the seven-segment display used as the drawing object for each letter in the label....
Definition MFXLCDLabel.h:34
void setVertical(const FXint len)
set segment vertical length - must be more than twice the segment width
void setGroove(const FXint w)
set groove width - must be less than segment width
void setThickness(const FXint w)
set segment width - must be less than half the segment length
void setToolTipText(const FXString &text)
set tooltip text
void setText(FXString lbl)
manipulate text in LCD label
void setHorizontal(const FXint len)
set segment horizontal length - must be more than twice the segment width
void setFgColor(FXColor clr)
set forground color
static void sleep(long ms)
void push_back(T what)
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:145
static FXString getTitleText(const FXString &appname, FXString filename="")
Returns the title text in dependence to an optional file name.
Definition MFXUtils.cpp:61
static FXbool userPermitsOverwritingWhenFileExists(FXWindow *const parent, const FXString &file)
Returns true if either the file given by its name does not exist or the user allows overwriting it.
Definition MFXUtils.cpp:40
static FXString assureExtension(const FXFileDialog &openDialog)
Corrects missing extension.
Definition MFXUtils.cpp:70
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
bool isStopped() const
Returns whether the vehicle is at a stop.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition MSEdge.cpp:1092
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition MSLane.h:619
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition MSLane.h:574
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
Definition MSNet.cpp:1711
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:186
@ 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:946
void quickReload()
reset state to the beginning without reloading the network
Definition MSNet.cpp:1690
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:326
bool hasContainers() const
Returns whether containers are simulated.
Definition MSNet.h:417
bool hasPersons() const
Returns whether persons are simulated.
Definition MSNet.h:401
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition MSNet.h:437
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition MSNet.h:507
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:384
static void initGUIThreadRNG()
initialize RNG for the gui thread
static void saveState(const std::string &file, SUMOTime step, bool usePrefix=true)
Saves the current state.
int getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
int getWaitingForVehicleNumber() const
Returns the number of transportables waiting for a ride.
The class responsible for building and deletion of vehicles.
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
void setScale(double scale)
sets the demand scaling factor
int getCollisionCount() const
return the number of collisions
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition MSVehicle.h:605
const MSLane * getLane() const
Returns the lane the vehicle is on.
Definition MSVehicle.h:581
double getSpeed() const
Returns the vehicle's current speed.
Definition MSVehicle.h:490
The XML-Handler for shapes loading network loading.
Definition NLHandler.h:55
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.
void writeConfiguration(std::ostream &os, const bool filled, const bool complete, const bool addComments, const std::string &relativeTo="", const bool forceRelative=false, const bool inComment=false) const
Writes the configuration.
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
void set(double x, double y)
set positions x and y
Definition Position.h:82
double x() const
Returns the x-position.
Definition Position.h:52
double y() const
Returns the y-position.
Definition Position.h:57
static const RGBColor GREEN
Definition RGBColor.h:189
static const RGBColor RED
named colors
Definition RGBColor.h:188
double getOverallProb() const
Return the sum of the probabilites assigned to the members.
T get(SumoRNG *which=nullptr) const
Draw a sample of the distribution.
static StringBijection< StateFileExtension > StateFileExtensions
state file extensions
static StringBijection< SumoConfigFileExtension > SumoConfigFileExtensions
sumo config file extensions
static StringBijection< EdgeDataFileExtension > EdgeDataFileExtensions
edgedata file extensions
static StringBijection< ShapesFileExtension > ShapesFileExtensions
additional file extensions
static StringBijection< NetFileExtension > NetFileExtensions
net file extensions
std::vector< std::string > getVector()
return vector of strings
static std::string replace(std::string str, const std::string &what, const std::string &by)
Replaces all occurrences of the second string by the third string within the first string.
static std::string transcodeToLocal(const std::string &utf8String)
convert a string from UTF-8 to the local codepage
A few system-specific functions.
Definition SysUtils.h:30
static unsigned long runHiddenCommand(const std::string &cmd)
run a shell command without popping up any windows (particuarly on win32)
Definition SysUtils.cpp:69
static long long getModifiedTime(const std::string &fname)
@brie get modified time
Definition SysUtils.cpp:109
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition SysUtils.cpp:44
static TraCIServer * getInstance()
Definition TraCIServer.h:68
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.
@ SEL_THREAD_EVENT
Definition fxexdefs.h:173
@ SEL_THREAD
Definition fxexdefs.h:155