Eclipse SUMO - Simulation of Urban MObility
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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>
38#include <netload/NLHandler.h>
65#include <utils/xml/XMLSubSys.h>
66
70#include "GUIGlobals.h"
71#include "GUILoadThread.h"
72#include "GUIRunThread.h"
78
79
80#define MIN_DRAW_DELAY 20
81//#define HAVE_DANGEROUS_SOUNDS
82
83// ===========================================================================
84// FOX-declarations
85// ===========================================================================
86FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[] = {
87 // close
91 FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GUIApplicationWindow::onCmdQuit),
92 // toolbar
108 // gaming
118 // OSG
119#ifdef HAVE_OSG
120 FXMAPFUNC(SEL_COMMAND, MID_NEW_OSGVIEW, GUIApplicationWindow::onCmdNewOSG),
122
123#endif
124 // Time
131 FXMAPFUNC(SEL_COMMAND, MID_DELAY_INC, GUIApplicationWindow::onCmdDelayInc),
132 FXMAPFUNC(SEL_COMMAND, MID_DELAY_DEC, GUIApplicationWindow::onCmdDelayDec),
133 FXMAPFUNC(SEL_COMMAND, MID_SIMSAVE, GUIApplicationWindow::onCmdSaveState),
134 FXMAPFUNC(SEL_COMMAND, MID_SIMLOAD, GUIApplicationWindow::onCmdLoadState),
141 // Stats
145 // these functions do not assign shortcut keys to commands, but rather affect the button enable status upon other events (e.g. simulation loaded)
146 // since those events are invoked through pseudo key events (?), the same key shortcuts as in cmd must be supplied as well
175 FXMAPFUNC(SEL_COMMAND, MID_HOTKEYS, GUIApplicationWindow::onCmdHotkeys),
176 FXMAPFUNC(SEL_COMMAND, MID_TUTORIAL, GUIApplicationWindow::onCmdTutorial),
178 FXMAPFUNC(SEL_COMMAND, MID_FEEDBACK, GUIApplicationWindow::onCmdFeedback),
180 // forward requests to the active view
199 // languages
220 // keys
221 FXMAPFUNC(SEL_KEYPRESS, 0, GUIApplicationWindow::onKeyPress),
222 FXMAPFUNC(SEL_KEYRELEASE, 0, GUIApplicationWindow::onKeyRelease),
223 // clipboard
224 FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GUIApplicationWindow::onClipboardRequest),
225 // events
230};
231
232// Object implementation
233FXIMPLEMENT(GUIApplicationWindow, FXMainWindow, GUIApplicationWindowMap, ARRAYNUMBER(GUIApplicationWindowMap))
234
235// ===========================================================================
236// static members
237// ===========================================================================
239
240
241// ===========================================================================
242// member method definitions
243// ===========================================================================
244#ifdef _MSC_VER
245#pragma warning(push)
246#pragma warning(disable: 4355) // mask warning about "this" in initializers
247#endif
249 GUIMainWindow(a),
250 myFileMenuRecentNetworks(new FXMenuPane(this)),
251 myFileMenuRecentConfigs(new FXMenuPane(this)),
252 myRecentNetworks(a, "networks"),
253 myRecentConfigs(a, "configs"),
254 myLastStepEventMillis(SysUtils::getCurrentMillis() - MIN_DRAW_DELAY) {
255 // init icons
257 // init Textures
259 // init cursors
261 // disable tooltips
262 a->setTooltipTime(1000000000);
263 a->setTooltipPause(1000000000);
264}
265#ifdef _MSC_VER
266#pragma warning(pop)
267#endif
268
269
274
275
276void
278 // don't do this twice
279 if (hadDependentBuild) {
280 return;
281 }
282 hadDependentBuild = true;
283 setTarget(this);
284 setSelector(MID_WINDOW);
285 // build menu bar
286 myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBar);
288 new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
290 // build the thread - io
295 // build the status bar
296 myStatusbar = new FXStatusBar(this, GUIDesignStatusBar);
297 {
298 // build TraCi info
300 auto button = GUIDesigns::buildFXButton(myTraCiFrame, "TraCI", "", "", nullptr, this, MID_TRACI_STATUS, GUIDesignButtonStatusBarFixed);
301 button->setBackColor(FXRGBA(253, 255, 206, 255));
302 if (TraCIServer::getInstance() == nullptr) {
303 myTraCiFrame->hide();
304 }
305 // build geo coordiantes
307 myGeoCoordinate = GUIDesigns::buildFXLabel(myGeoFrame, TL("N/A"), "", TL("Original coordinate (before coordinate transformation in netconvert)"), nullptr, LAYOUT_CENTER_Y);
308 // build cartesian coordinates
310 myCartesianCoordinate = GUIDesigns::buildFXLabel(myCartesianFrame, TL("N/A"), "", TL("Network coordinate"), nullptr, LAYOUT_CENTER_Y);
311 // build buttons
314 myStatButtons.back()->hide();
316 myStatButtons.back()->hide();
317 }
318 // make the window a mdi-window
319 myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
321 myMDIMenu = new FXMDIMenu(this, myMDIClient);
322 new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
323 new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
324 new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
325 new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
326 // build the message window
328 // fill menu and tool bar
329 fillMenuBar();
330 myToolBar6->hide();
331 myToolBar7->hide();
332 myToolBar9->hide();
333 myToolBar10->hide();
334 // build additional threads
335 myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent, isLibsumo);
337 // set the status bar
338 setStatusBarText(TL("Ready."));
339 // set the caption
340 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
341 // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
342 myRunThread->start();
345}
346
347
348void
351 gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
352 FXMainWindow::create();
353 myMenuBarDrag->create();
354 myToolBarDrag1->create();
355 myToolBarDrag2->create();
356 myToolBarDrag3->create();
357 myToolBarDrag4->create();
358 myToolBarDrag5->create();
359 myToolBarDrag6->create();
360 myToolBarDrag7->create();
361 myFileMenu->create();
362 mySelectByPermissions->create();
363 myEditMenu->create();
364 mySettingsMenu->create();
365 myLocatorMenu->create();
366 myControlMenu->create();
367 myWindowMenu->create();
368 myLanguageMenu->create();
369 myHelpMenu->create();
370 FXint textWidth = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
371 myCartesianFrame->setWidth(textWidth);
372 myGeoFrame->setWidth(textWidth);
373 if (myTestFrame) {
374 myTestFrame->setWidth(textWidth);
375 }
376
377 show(PLACEMENT_DEFAULT);
378 if (!OptionsCont::getOptions().isSet("window-size")) {
379 if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
380 maximize();
381 }
382 }
383 myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
384 myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
385 const std::string& onlineMaps = getApp()->reg().readStringEntry("gui", "onlineMaps", "");
386 for (const std::string& entry : StringTokenizer(onlineMaps, "\n").getVector()) {
387 const std::vector<std::string> split = StringTokenizer(entry, "\t").getVector();
388 if (split.size() == 2) {
389 myOnlineMaps[split[0]] = split[1];
390 }
391 }
392 if (myOnlineMaps.empty()) {
393 myOnlineMaps["GeoHack"] = "https://geohack.toolforge.org/geohack.php?params=%lat;%lon_scale:1000";
394 myOnlineMaps["Google Maps"] = "https://www.google.com/maps?ll=%lat,%lon&t=h&z=18";
395 myOnlineMaps["OSM"] = "https://www.openstreetmap.org/?mlat=%lat&mlon=%lon&zoom=18&layers=M";
396 }
398}
399
400
403 myRunThread->join();
405 // close icons
408 // delete visual
409 delete myGLVisual;
410 // delete some non-parented windows
411 delete myToolBarDrag1;
412 delete mySimDelayTarget;
413 // delete rest of elements
416 delete myRunThread;
417 delete myFileMenu;
418 delete myEditMenu;
420 delete mySettingsMenu;
421 delete myLocatorMenu;
422 delete myControlMenu;
423 delete myLanguageMenu;
424 delete myWindowMenu;
425 delete myHelpMenu;
426 delete myLoadThread;
427
428 while (!myEvents.empty()) {
429 // get the next event
430 GUIEvent* e = myEvents.top();
431 myEvents.pop();
432 delete e;
433 }
434 for (auto item : myHotkeyPress) {
435 delete item.second;
436 }
437 for (auto item : myHotkeyRelease) {
438 delete item.second;
439 }
440}
441
442
443void
445 FXMainWindow::detach();
446 myMenuBarDrag->detach();
447 myToolBarDrag1->detach();
448}
449
450
451void
452GUIApplicationWindow::addToWindowsMenu(FXMenuPane* /*menuPane*/) {
453 // unused, implement in children
454}
455
456
457void
459 // build file menu
460 myFileMenu = new FXMenuPane(this);
463 TL("New Window"), "Ctrl+Shift+N", TL("Open a new sumo-gui window."),
464 nullptr, this, MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW);
465 new FXMenuSeparator(myFileMenu);
467 TL("&Open Simulation..."), "Ctrl+O", TL("Open a simulation (Configuration file)."),
470 TL("Open &Network..."), "Ctrl+N", TL("Open a network."),
473 TL("Open Shapes "), "Ctrl+P", TL("Load POIs and Polygons for visualization."),
476 TL("Open EdgeData "), "Ctrl+U", TL("Load edge related data for visualization."),
479 TL("&Reload"), "Ctrl+R", TL("Reloads the simulation / the network."),
482 TL("Quick-Reload"), "Ctrl+0", TL("Reloads the simulation (but not network)."),
484 new FXMenuSeparator(myFileMenu);
486 TL("Save Configuration"), "Ctrl+Shift+S", TL("Save current options as a configuration file."),
489 TL("Close"), "Ctrl+W", TL("Close the simulation."),
491 new FXMenuSeparator(myFileMenu);
492 // build recent files
495 new FXMenuSeparator(myFileMenu);
497 TL("&Quit"), "Ctrl+Q", TL("Quit the Application."),
498 nullptr, this, MID_HOTKEY_CTRL_Q_CLOSE);
499 // build edit menu
500 mySelectByPermissions = new FXMenuPane(this);
501 std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
502 for (const auto& vehicleClass : vehicleClasses) {
504 }
505 myEditMenu = new FXMenuPane(this);
508 TL("Edit Selected..."), "Ctrl+E", TL("Opens a dialog for editing the list of selected items."),
510 mySelectLanesMenuCascade = new FXMenuCascade(myEditMenu, TL("Select lanes which allow..."), GUIIconSubSys::getIcon(GUIIcon::FLAG), mySelectByPermissions);
511 mySelectLanesMenuCascade->setHelpText(TL("Opens a menu for selecting a vehicle class by which to selected lanes."));
512 new FXMenuSeparator(myEditMenu);
514 TL("Set Breakpoint"), "B", TL("Sets a breakpoint at the current simulation step"),
517 TL("Set Breakpoint with offset"), "Alt+B", TL("Sets a breakpoint at the current simulation step + offset configured in application settings"),
520 TL("Edit Breakpoints"), "Ctrl+B", TL("Opens a dialog for editing breakpoints."),
523 TL("Edit Visualisation"), "F9", TL("Opens a dialog for editing visualization settings."),
526 TL("Edit Viewport"), "Ctrl+I", TL("Opens a dialog for editing viewing area, zoom and rotation."),
528 new FXMenuSeparator(myEditMenu);
529 // add open in sumo options
530 myLoadAdditionalsInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load additionals in netedit"), TL("Load additionals in netedit."), this, MID_TOOLBAREDIT_LOADADDITIONALS);
531 myLoadAdditionalsInNetedit->setCheck(TRUE);
532 myLoadDemandInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load demand in netedit"), TL("Load demand in netedit."), this, MID_TOOLBAREDIT_LOADDEMAND);
533 myLoadDemandInNetedit->setCheck(FALSE);
535 TL("Open in netedit"), "Ctrl+T", TL("Opens current simulation in NETEDIT."),
537 // build settings menu
538 mySettingsMenu = new FXMenuPane(this);
541 TL("Application Settings"), "Ctrl+H", TL("Open a Dialog for Application Settings editing."),
543 myGamingModeCheckbox = new FXMenuCheck(mySettingsMenu,
544 TL("Gaming Mode\tCtrl+G\tToggle gaming mode on/off."),
547 TL("Full Screen Mode"), "Ctrl+F", TL("Toggle full screen mode on/off."),
549 // build Locate menu
550 myLocatorMenu = new FXMenuPane(this);
553 TL("&Junctions"), "Shift+J", TL("Open a dialog for locating a Junction."),
556 TL("&Edges"), "Shift+E", TL("Open a dialog for locating an Edge."),
559 TL("&Vehicles"), "Shift+V", TL("Open a dialog for locating a Vehicle."),
562 TL("&Persons"), "Shift+P", TL("Open a dialog for locating a Person."),
565 TL("&Container"), "Shift+C", TL("Open a dialog for locating a Container."),
568 TL("&TLS"), "Shift+T", TL("Open a dialog for locating a Traffic Light."),
571 TL("&Additional"), "Shift+A", TL("Open a dialog for locating an Additional Structure."),
574 TL("P&oI"), "Shift+O", TL("Open a dialog for locating a Point of Interest."),
577 TL("Po&lygon"), "Shift+L", TL("Open a dialog for locating a Polygon."),
579 new FXMenuSeparator(myLocatorMenu);
580 GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Internal Structures"), TL("Show internal junctions and streets in locator dialog."), this, MID_LISTINTERNAL);
581 FXMenuCheck* listParking = GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Parking Vehicles"), TL("Show parking vehicles in locator dialog."), this, MID_LISTPARKING);
582 listParking->setCheck(myListParking);
583 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);
584 // build control menu
585 // the shortcut designator is not only at text in the submenu but also defines the real shortcut key assigned with it!
586 // secondary shortcuts (ctrl+A, ctrl+S, ctrl+D) are defined in GUIShortcutsSubSys::buildSUMOAccelerators
587 myControlMenu = new FXMenuPane(this);
588 GUIDesigns::buildFXMenuTitle(myMenuBar, TL("Simulation"), nullptr, myControlMenu);
590 TL("Run"), "A,space", TL("Start/ Resume the simulation."),
593 TLC("Simulation", "Stop"), "S,space", TL("Halt the simulation."),
596 TL("Step"), "D", TL("Perform one simulation step."),
599 TL("Delay+"), "PgUp", TL("Increase simulation step delay."), nullptr, this, MID_DELAY_INC);
601 TL("Delay-"), "PgDn", TL("Decrease simulation step delay."), nullptr, this, MID_DELAY_DEC);
603 TL("Save"), "", TL("Save the current simulation state to a file."),
606 TL("Load"), "", TL("Load simulation state for the current network from file."),
608 // build windows menu
609 myWindowMenu = new FXMenuPane(this);
611 GUIDesigns::buildFXMenuCommandShortcut(myWindowMenu, TL("Open new view"), "", TL("Open a new microscopic view."), GUIIconSubSys::getIcon(GUIIcon::MICROVIEW), this, MID_NEW_MICROVIEW);
612#ifdef HAVE_OSG
614#endif
616 TL("Tile &Horizontally"), "", TL("Tile the views horizontally."),
617 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_HORI), myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
619 TL("Tile &Vertically"), "", TL("Tile the views vertically."),
620 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_VERT), myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
622 TL("Cascade"), "", TL("Cascade the views."),
624 myMDIClient, FXMDIClient::ID_MDI_CASCADE);
626 TL("&Close"), "", TL("Close the selected view."),
627 nullptr, myMDIClient, FXMDIClient::ID_MDI_CLOSE);
628 FXMenuSeparator* sep2 = new FXMenuSeparator(myWindowMenu);
629 sep2->setTarget(myMDIClient);
630 sep2->setSelector(FXMDIClient::ID_MDI_ANY);
631 // for whatever reason, sonar complains in the next line that sep2 may leak, but fox does the cleanup
632 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_1); // NOSONAR
633 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_2);
634 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_3);
635 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_4);
636 GUIDesigns::buildFXMenuCommand(myWindowMenu, TL("&Others..."), nullptr, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
637
638 new FXMenuSeparator(myWindowMenu);
639 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Status Line"), TL("Toggle the Status Bar on/off."), myStatusbar, FXWindow::ID_TOGGLESHOWN);
640 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Message Window"), TL("Toggle the Message Window on/off."), myMessageWindow, FXWindow::ID_TOGGLESHOWN);
641 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Time"), TL("Toggle the Simulation Time on/off."), myToolBar3, FXWindow::ID_TOGGLESHOWN);
642 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Delay"), TL("Toggle the Simulation Delay Entry on/off."), myToolBar4, FXWindow::ID_TOGGLESHOWN);
644
645 new FXMenuSeparator(myWindowMenu);
647 TL("Clear Message Window"), "", TL("Clear the message window."),
649 // build windows menu
651 // build help menu
652 myHelpMenu = new FXMenuPane(this);
654 TL("&Help"),
655 nullptr, myHelpMenu);
656 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Online Documentation"), "F1", TL("Open Online documentation."),
657 nullptr, this, MID_HOTKEY_F1_ONLINEDOCUMENTATION);
658 new FXMenuSeparator(myHelpMenu);
659 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Changelog"), "", TL("Open Changelog."),
660 nullptr, this, MID_CHANGELOG);
661 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Hotkeys"), "", TL("Open Hotkeys."),
662 nullptr, this, MID_HOTKEYS);
663 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Tutorial"), "", TL("Open Tutorial."),
664 nullptr, this, MID_TUTORIAL);
665 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Feedback"), "", TL("Open feedback dialog."),
666 nullptr, this, MID_FEEDBACK);
667 new FXMenuSeparator(myHelpMenu);
668 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&About"), "F12", TL("About sumo-gui."),
670 // build SUMO Accelerators (hotkeys)
671 GUIShortcutsSubSys::buildAccelerators(getAccelTable(), this, true);
672}
673
674
675void
677 // file and simulation tool bar
678 {
679 myToolBarDrag1 = new FXToolBarShell(this, GUIDesignToolBar);
681 new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
682 // build file tools
683 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen simulation\tOpen a simulation (Configuration file)."),
685 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen network\tOpen a network."),
687 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tReload\tReloads the simulation / the network."),
689 }
690 // simulation toolbar
691 {
692 myToolBarDrag2 = new FXToolBarShell(this, GUIDesignToolBar);
694 new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
695 // build simulation tools
696 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tRun\tStart/Resume the loaded simulation."),
698 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStop\tHalt the running simulation."),
700 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStep\tPerform a single simulation step."),
702 }
703 // Simulation Step Display
704 {
705 myToolBarDrag3 = new FXToolBarShell(this, GUIDesignToolBar);
707 new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
708 new MFXButtonTooltip(myToolBar3, myStaticTooltipMenu, TL("Time:\tToggle between time formats\tToggle between seconds and hour:minute:seconds display."), nullptr, this, MID_TIME_TOGGLE, GUIDesignButtonToolbarText);
709
710 myLCDLabel = new MFXLCDLabel(myToolBar3, myStaticTooltipMenu, 16, nullptr, 0, JUSTIFY_RIGHT);
715 myLCDLabel->setText("----------------");
716 }
717 // Simulation Delay
718 {
719 myToolBarDrag4 = new FXToolBarShell(this, GUIDesignToolBar);
721 new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
722 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);
723 // create spinner for delay
724 mySimDelay = 0;
725 mySimDelayTarget = new FXDataTarget(mySimDelay);
727 // create slider
728 mySimDelaySlider = new FXSlider(myToolBar4, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSlider);
729 mySimDelaySlider->setRange(0, 1000);
730 mySimDelaySlider->setHeadSize(10);
731 mySimDelaySlider->setIncrement(50);
732 mySimDelaySlider->setTickDelta(100);
733 mySimDelaySlider->setValue((int)mySimDelay);
734 //mySimDelayTarget->setNumberFormat(0);
735 //mySimDelayTarget->setIncrements(1, 10, 10);
736 mySimDelaySpinner->setIncrement(10);
737 mySimDelaySpinner->setRange(0, 10000);
738 mySimDelaySpinner->setValue(mySimDelay);
739 }
740 // Scale traffic (flows and incrementally loaded vehicles)
741 {
742 myToolBarDrag8 = new FXToolBarShell(this, GUIDesignToolBar);
744 new FXToolBarGrip(myToolBar8, myToolBar8, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
745 myScaleTrafficTooltip = new MFXLabelTooltip(myToolBar8, myStaticTooltipMenu, TL("Scale Traffic:"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
746 myScaleTrafficTooltip->setHelpText(TL("Scale traffic volume from running flows and from vehicles that are loaded incrementally from route files."));
748 myDemandScaleSpinner->setIncrement(0.5);
749 myDemandScaleSpinner->setRange(0, 1000);
750 myDemandScaleSpinner->setValue(1);
751 }
752 // Views
753 {
754 myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBar);
756 new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
757 // build view tools
758 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new view") + std::string("\t") + TL("Open a new microscopic view.")).c_str(),
760#ifdef HAVE_OSG
761 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new 3D view") + std::string("\t") + TL("Open a new 3D view.")).c_str(),
763#endif
764 }
766 {
767 // total waitingTime
768 myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBar);
770 new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
771 GUIDesigns::buildFXLabel(myToolBar6, TL("Waiting Time:"), "", TL("Time spent waiting accumulated for all vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
772 myWaitingTimeLabel = new MFXLCDLabel(myToolBar6, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
777 myWaitingTimeLabel->setText("-------------");
778 // idealistic time loss
779 myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBar);
781 new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
782 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);
783 myTimeLossLabel = new MFXLCDLabel(myToolBar7, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
788 myTimeLossLabel->setText("-------------");
789 // total driving distance
790 myToolBarDrag9 = new FXToolBarShell(this, GUIDesignToolBar);
792 new FXToolBarGrip(myToolBar9, myToolBar9, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
793 GUIDesigns::buildFXLabel(myToolBar9, TL("Distance (km):"), "", TL("Total distance driven by DRT vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
794 myTotalDistanceLabel = new MFXLCDLabel(myToolBar9, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
799 myTotalDistanceLabel->setText("-------------");
800 // emergency vehicle counts
801 myToolBarDrag10 = new FXToolBarShell(this, GUIDesignToolBar);
803 new FXToolBarGrip(myToolBar10, myToolBar10, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
804 GUIDesigns::buildFXLabel(myToolBar10, TL("Emergency Vehicle waiting time:"), "", TL("Time spent waiting accumulated for emergency vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
805 myEmergencyVehicleLabel = new MFXLCDLabel(myToolBar10, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
810 myEmergencyVehicleLabel->setText("-------------");
811 }
812}
813
814
815void
816GUIApplicationWindow::buildRecentNetworks(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentNetworks) {
817 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
818 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_1);
819 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_2);
820 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_3);
821 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_4);
822 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_5);
823 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_6);
824 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_7);
825 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_8);
826 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_9);
827 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_10);
828 new FXMenuSeparator(fileMenuRecentNetworks); // NOSONAR, Fox does the cleanup
829 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("Cl&ear Recent Networks"), nullptr, &myRecentNetworks, FXRecentFiles::ID_CLEAR);
830 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("No Recent Networks"), nullptr, &myRecentNetworks, MFXRecentNetworks::ID_NOFILES);
831 // set target
832 myRecentNetworks.setTarget(this);
833 myRecentNetworks.setSelector(MID_RECENTFILE);
834 new FXMenuCascade(fileMenu, TL("Recent Networks"), nullptr, fileMenuRecentNetworks);
835}
836
837
838void
839GUIApplicationWindow::buildRecentConfigs(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentConfigs) {
840 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
841 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_1);
842 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_2);
843 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_3);
844 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_4);
845 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_5);
846 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_6);
847 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_7);
848 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_8);
849 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_9);
850 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_10);
851 new FXMenuSeparator(fileMenuRecentConfigs); // NOSONAR, Fox does the cleanup
852 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("Cl&ear Recent Configs"), nullptr, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
853 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("No Recent Configs"), nullptr, &myRecentConfigs, MFXRecentNetworks::ID_NOFILES);
854 // set target
855 myRecentConfigs.setTarget(this);
856 myRecentConfigs.setSelector(MID_RECENTFILE);
857 new FXMenuCascade(fileMenu, TL("Recent Configs"), nullptr, fileMenuRecentConfigs);
858}
859
860
861long
862GUIApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
864 getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
865 getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
866 getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
867 getApp()->reg().writeIntEntry("gui", "alternateSimDelay", (int)myAlternateSimDelay);
869 getApp()->exit(0);
870 return 1;
871}
872
873
874long
875GUIApplicationWindow::onCmdEditChosen(FXObject* menu, FXSelector, void*) {
876 FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
877 if (mc->getText() == StringUtils::replace(TL("Edit Selected..."), "&", "").c_str()) {
878 GUIDialog_GLChosenEditor* chooser =
880 chooser->create();
881 chooser->show();
882 } else {
884 const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
885 for (MSEdgeVector::const_iterator i = MSEdge::getAllEdges().begin(); i != MSEdge::getAllEdges().end(); ++i) {
886 const std::vector<MSLane*>& lanes = (*i)->getLanes();
887 for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
888 GUILane* lane = dynamic_cast<GUILane*>(*it);
889 assert(lane != 0);
890 if ((lane->getPermissions() & svc) != 0) {
891 gSelected.select(lane->getGlID());
892 }
893 }
894 }
895 if (myMDIClient->numChildren() > 0) {
896 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
897 if (w != nullptr) {
898 // color by selection
900 }
901 }
902 }
904 }
905 return 1;
906}
907
908
909long
910GUIApplicationWindow::onCmdEditBreakpoints(FXObject*, FXSelector, void*) {
911 if (myBreakpointDialog == nullptr) {
913 } else {
914 myBreakpointDialog->restore();
915 myBreakpointDialog->setFocus();
916 myBreakpointDialog->raise();
917 }
918 return 1;
919}
920
921
922long
923GUIApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
924 if (!myGLWindows.empty()) {
925 myGLWindows[0]->getView()->showViewportEditor();
926 }
927 return 1;
928}
929
930
931long
932GUIApplicationWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
933 if (!myGLWindows.empty()) {
934 myGLWindows[0]->getView()->showViewschemeEditor();
935 }
936 return 1;
937}
938
939
940long
941GUIApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
942 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html");
943 return 1;
944}
945
946
947long
948GUIApplicationWindow::onCmdChangelog(FXObject*, FXSelector, void*) {
949 // update in every version
950 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/ChangeLog.html");
951 return 1;
952}
953
954
955long
956GUIApplicationWindow::onCmdHotkeys(FXObject*, FXSelector, void*) {
957 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html#keyboard_shortcuts");
958 return 1;
959}
960
961
962long
963GUIApplicationWindow::onCmdTutorial(FXObject*, FXSelector, void*) {
964 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/Tutorials/index.html");
965 return 1;
966}
967
968
969long
970GUIApplicationWindow::onCmdOpenInNetedit(FXObject*, FXSelector, void*) {
971 if (myGLWindows.empty()) {
972 return 1;
973 }
974 FXRegistry reg("SUMO netedit", "netedit");
975 reg.read();
976 const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
977 reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
978 reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
979 reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
980 reg.write();
981 std::string netedit = "netedit";
982 const char* sumoPath = getenv("SUMO_HOME");
983 if (sumoPath != nullptr) {
984 std::string newPath = std::string(sumoPath) + "/bin/netedit";
985 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
986 netedit = "\"" + newPath + "\"";
987 }
988 }
989 // declare command for calling netedit using the viewport saved in registry
990 std::string cmd = netedit + " --registry-viewport";
991 // continue depending if we're loading only a network or the entire sumo config
992 if (myLoadAdditionalsInNetedit->shown()) {
993 cmd += " --sumocfg-file \"" + OptionsCont::getOptions().getString("configuration-file") + "\"";
994 // check if ignore additional or demand elements
995 if (myLoadAdditionalsInNetedit->getCheck() == FALSE) {
996 cmd += " --ignore.additionalelements";
997 }
998 if (myLoadDemandInNetedit->getCheck() == FALSE) {
999 cmd += " --ignore.routeelements";
1000 }
1001 } else {
1002 cmd += " -s \"" + OptionsCont::getOptions().getString("net-file") + "\"";
1003 }
1004 // start in background
1005#ifndef WIN32
1006 cmd = cmd + " &";
1007#else
1008 // see "help start" for the parameters
1009 cmd = "start /B \"\" " + cmd;
1010#endif
1011 WRITE_MESSAGEF(TL("Running %."), cmd);
1012 // yay! fun with dangerous commands... Never use this over the internet
1014 return 1;
1015}
1016
1017
1018long
1019GUIApplicationWindow::onCmdNewWindow(FXObject*, FXSelector, void*) {
1020 FXRegistry reg("SUMO sumo-gui", "sumo-gui");
1021 std::string sumo_gui = "sumo-gui";
1022 const char* sumoPath = getenv("SUMO_HOME");
1023 if (sumoPath != nullptr) {
1024 std::string newPath = std::string(sumoPath) + "/bin/sumo_gui";
1025 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1026 sumo_gui = "\"" + newPath + "\"";
1027 }
1028 }
1029 std::string cmd = sumo_gui;
1030 // start in background
1031#ifndef WIN32
1032 cmd = cmd + " &";
1033#else
1034 // see "help start" for the parameters
1035 cmd = "start /B \"\" " + cmd;
1036#endif
1037 WRITE_MESSAGEF(TL("Running %."), cmd);
1038 // yay! fun with dangerous commands... Never use this over the internet
1040 return 1;
1041}
1042
1043
1044long
1046 // get the new file name
1047 FXFileDialog opendialog(this, TL("Open Simulation Configuration"));
1049 opendialog.setSelectMode(SELECTFILE_EXISTING);
1050 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1051 if (gCurrentFolder.length() != 0) {
1052 opendialog.setDirectory(gCurrentFolder);
1053 }
1054 if (opendialog.execute()) {
1055 gCurrentFolder = opendialog.getDirectory();
1056 std::string file = opendialog.getFilename().text();
1057 loadConfigOrNet(file);
1058 myRecentConfigs.appendFile(file.c_str());
1059 }
1060 return 1;
1061}
1062
1063
1064long
1065GUIApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
1066 // get the new file name
1067 FXFileDialog opendialog(this, TL("Open Network"));
1068 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1069 opendialog.setSelectMode(SELECTFILE_EXISTING);
1070 opendialog.setPatternList(SUMOXMLDefinitions::NetFileExtensions.getMultilineString().c_str());
1071 if (gCurrentFolder.length() != 0) {
1072 opendialog.setDirectory(gCurrentFolder);
1073 }
1074 if (opendialog.execute()) {
1075 gCurrentFolder = opendialog.getDirectory();
1076 std::string file = opendialog.getFilename().text();
1077 loadConfigOrNet(file);
1078 myRecentNetworks.appendFile(file.c_str());
1079 }
1080 return 1;
1081}
1082
1083
1084long
1085GUIApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
1086 // get the shape file name
1087 FXFileDialog opendialog(this, TL("Open Shapes"));
1088 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_SHAPES));
1089 opendialog.setSelectMode(SELECTFILE_EXISTING);
1090 opendialog.setPatternList(SUMOXMLDefinitions::ShapesFileExtensions.getMultilineString().c_str());
1091 if (gCurrentFolder.length() != 0) {
1092 opendialog.setDirectory(gCurrentFolder);
1093 }
1094 if (opendialog.execute()) {
1095 gCurrentFolder = opendialog.getDirectory();
1096 std::string file = opendialog.getFilename().text();
1097
1098 dynamic_cast<GUIShapeContainer&>(myRunThread->getNet().getShapeContainer()).allowReplacement();
1100 if (!XMLSubSys::runParser(handler, file, false)) {
1101 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1102 }
1103 update();
1104 if (myMDIClient->numChildren() > 0) {
1105 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1106 if (w != nullptr) {
1107 w->getView()->update();
1108 }
1109 }
1110 }
1111 return 1;
1112}
1113
1114
1115long
1116GUIApplicationWindow::onCmdOpenEdgeData(FXObject*, FXSelector, void*) {
1117 // get the shape file name
1118 FXFileDialog opendialog(this, TL("Open EdgeData"));
1119 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1120 opendialog.setSelectMode(SELECTFILE_EXISTING);
1121 opendialog.setPatternList(SUMOXMLDefinitions::EdgeDataFileExtensions.getMultilineString().c_str());
1122 if (gCurrentFolder.length() != 0) {
1123 opendialog.setDirectory(gCurrentFolder);
1124 }
1125 if (opendialog.execute()) {
1126 gCurrentFolder = opendialog.getDirectory();
1127 std::string file = opendialog.getFilename().text();
1128 if (!GUINet::getGUIInstance()->loadEdgeData(file)) {
1129 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1130 }
1131 update();
1132 if (myMDIClient->numChildren() > 0) {
1133 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1134 if (w != nullptr) {
1135 w->getView()->update();
1136 }
1137 }
1138 }
1139 return 1;
1140}
1141
1142
1143long
1144GUIApplicationWindow::onCmdReload(FXObject* sender, FXSelector sel, void*) {
1145 if (!myAmLoading && (sender == nullptr || TraCIServer::getInstance() == nullptr)) {
1147 getApp()->beginWaitCursor();
1148 myAmLoading = true;
1149 myIsReload = sender != nullptr || sel == 1;
1151 myLoadThread->start();
1152 if (sender == nullptr) {
1153 setStatusBarText(sel == 1 ? TL("Auto-Reloading.") : TL("TraCI-Loading."));
1154 } else {
1155 setStatusBarText(TL("Reloading."));
1156 }
1157 update();
1158 }
1159 return 1;
1160}
1161
1162
1163long
1164GUIApplicationWindow::onCmdQuickReload(FXObject*, FXSelector, void*) {
1165 if (!myAmLoading) {
1166 setStatusBarText(TL("Quick-Reloading."));
1168 }
1169 return 1;
1170}
1171
1172
1173long
1174GUIApplicationWindow::onCmdOpenRecent(FXObject* /* sender */, FXSelector, void* ptr) {
1175 if (myAmLoading) {
1176 myStatusbar->getStatusLine()->setText(TL("Already loading!"));
1177 return 1;
1178 }
1179 std::string file((const char*)ptr);
1180 loadConfigOrNet(file);
1181 return 1;
1182}
1183
1184
1185long
1186GUIApplicationWindow::onCmdSaveConfig(FXObject*, FXSelector, void*) {
1187 // get the new file name
1188 FXFileDialog opendialog(this, TL("Save SUMO Configuration"));
1189 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1190 opendialog.setSelectMode(SELECTFILE_ANY);
1191 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1192 if (gCurrentFolder.length() != 0) {
1193 opendialog.setDirectory(gCurrentFolder);
1194 }
1195 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1196 return 1;
1197 }
1198 const std::string file = MFXUtils::assureExtension(opendialog).text();
1199 std::ofstream out(StringUtils::transcodeToLocal(file));
1200 if (out.good()) {
1201 OptionsCont::getOptions().writeConfiguration(out, true, false, false, file, true);
1202 setStatusBarText(TLF("Configuration saved to %.", file));
1203 } else {
1204 setStatusBarText(TLF("Could not save configuration to %.", file));
1205 }
1206 out.close();
1207 return 1;
1208}
1209
1210
1211long
1212GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
1214 return 1;
1215}
1216
1217
1218long
1219GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
1220 sender->handle(this,
1221 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1222 ptr);
1223 return 1;
1224}
1225
1226
1227long
1228GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
1229 sender->handle(this,
1231 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1232 ptr);
1233 return 1;
1234}
1235
1236
1237long
1238GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
1239 sender->handle(this,
1240 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1241 ptr);
1242 return 1;
1243}
1244
1245
1246long
1247GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
1248 sender->handle(this,
1250 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1251 ptr);
1252 return 1;
1253}
1254
1255
1256long
1257GUIApplicationWindow::onCmdStart(FXObject*, FXSelector, void*) {
1258 // check whether a net was loaded successfully
1259 if (!myRunThread->networkAvailable()) {
1260 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1261 return 1;
1262 }
1263 // check whether it was started before and paused;
1264 if (!myWasStarted) {
1265 myRunThread->begin();
1266 myWasStarted = true;
1267 }
1269 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1270 return 1;
1271}
1272
1273
1274long
1275GUIApplicationWindow::onCmdStop(FXObject*, FXSelector, void*) {
1276 myRunThread->stop();
1277 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1278 return 1;
1279}
1280
1281
1282long
1283GUIApplicationWindow::onCmdStep(FXObject*, FXSelector, void*) {
1284 // check whether a net was loaded successfully
1285 if (!myRunThread->networkAvailable()) {
1286 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1287 return 1;
1288 }
1289 // check whether it was started before and paused;
1290 if (!myWasStarted) {
1291 myRunThread->begin();
1292 myWasStarted = true;
1293 }
1295 return 1;
1296}
1297
1298
1299long
1300GUIApplicationWindow::onCmdSaveState(FXObject*, FXSelector, void*) {
1301 // get the new file name
1302 FXFileDialog opendialog(this, TL("Save Simulation State"));
1303 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1304 opendialog.setSelectMode(SELECTFILE_ANY);
1305 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1306 if (gCurrentFolder.length() != 0) {
1307 opendialog.setDirectory(gCurrentFolder);
1308 }
1309 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1310 return 1;
1311 }
1312 const std::string file = MFXUtils::assureExtension(opendialog).text();
1313 MSStateHandler::saveState(file, MSNet::getInstance()->getCurrentTimeStep(), false);
1314 setStatusBarText(TLF("Simulation state saved to '%'.", file));
1315 return 1;
1316}
1317
1318
1319long
1320GUIApplicationWindow::onCmdLoadState(FXObject*, FXSelector, void*) {
1321 // get the new file name
1322 FXFileDialog opendialog(this, TL("Load Simulation State"));
1323 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN));
1324 opendialog.setSelectMode(SELECTFILE_ANY);
1325 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1326 if (gCurrentFolder.length() != 0) {
1327 opendialog.setDirectory(gCurrentFolder);
1328 }
1329 if (opendialog.execute() && FXStat::exists(opendialog.getFilename())) {
1330 gCurrentFolder = opendialog.getDirectory();
1331 const std::string file = opendialog.getFilename().text();
1332 try {
1333 MSNet::getInstance()->loadState(file, true);
1334 setStatusBarText(TLF("State loaded from '%'.", file));
1335 } catch (ProcessError& e) {
1336 setStatusBarText(TLF("Failed to load state from '%' (%).", file, e.what()));
1337 }
1338 }
1339 return 1;
1340}
1341
1342
1343long
1344GUIApplicationWindow::onCmdTimeToggle(FXObject*, FXSelector, void*) {
1345 // toggle show time as HMS
1350 }
1351 return 1;
1352}
1353
1354
1355long
1356GUIApplicationWindow::onCmdDelayInc(FXObject*, FXSelector, void*) {
1357 if (mySimDelay < 10) {
1358 mySimDelay = 10;
1359 } else if (mySimDelay >= 20 && mySimDelay < 50) {
1360 mySimDelay = 50;
1361 } else if (mySimDelay >= 200 && mySimDelay < 500) {
1362 mySimDelay = 500;
1363 } else {
1364 mySimDelay *= 2;
1365 }
1366 if (mySimDelay > 1000) {
1367 // setting high delay by pressing the key too often is hard to recover from
1368 mySimDelay = 1000;
1369 }
1370 mySimDelaySlider->setValue((int)mySimDelay);
1371 mySimDelaySpinner->setValue(mySimDelay);
1372 return 1;
1373}
1374
1375
1376long
1377GUIApplicationWindow::onCmdDelayDec(FXObject*, FXSelector, void*) {
1378 if (mySimDelay <= 10) {
1379 mySimDelay = 0;
1380 } else if (mySimDelay > 20 && mySimDelay <= 50) {
1381 mySimDelay = 20;
1382 } else if (mySimDelay > 200 && mySimDelay <= 500) {
1383 mySimDelay = 200;
1384 } else {
1385 mySimDelay /= 2;
1386 }
1387 mySimDelaySlider->setValue((int)mySimDelay);
1388 mySimDelaySpinner->setValue(mySimDelay);
1389 return 1;
1390}
1391
1392
1393long
1394GUIApplicationWindow::onCmdDelayToggle(FXObject*, FXSelector, void*) {
1395 const double tmp = myAlternateSimDelay;
1397 mySimDelay = tmp;
1398 return 1;
1399}
1400
1401
1402long
1403GUIApplicationWindow::onCmdDemandScale(FXObject*, FXSelector, void*) {
1406 }
1407 return 1;
1408}
1409
1410
1411long
1412GUIApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
1414 return 1;
1415}
1416
1417
1418long
1419GUIApplicationWindow::onCmdBreakpoint(FXObject*, FXSelector, void*) {
1420 // see updateTimeLCD for the DELTA_T
1423 }
1424 return 1;
1425}
1426
1427
1428long
1429GUIApplicationWindow::onCmdBreakpointEarly(FXObject*, FXSelector, void*) {
1430 // see updateTimeLCD for the DELTA_T
1433 }
1434 return 1;
1435}
1436
1437
1438long
1439GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
1440 sender->handle(this,
1442 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1443 ptr);
1445 // bind start simulation with space key
1447 }
1448 return 1;
1449}
1450
1451
1452long
1453GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
1454 sender->handle(this,
1456 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1457 ptr);
1459 // bind stop simulation with space key
1461 }
1462 return 1;
1463}
1464
1465
1466long
1467GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
1468 sender->handle(this,
1470 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1471 ptr);
1472 return 1;
1473}
1474
1475
1476long
1477GUIApplicationWindow::onUpdNeedsNetwork(FXObject* sender, FXSelector, void* ptr) {
1478 // check if there is a loaded network and gui isn't loading
1480 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1481 // enable certain elements manually
1482 mySelectLanesMenuCascade->enable();
1483 myScaleTrafficTooltip->setTipText(TL("Scale number of vehicles in simulation"));
1484 } else {
1485 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1486 // disable certain elements manually
1487 mySelectLanesMenuCascade->disable();
1488 myScaleTrafficTooltip->setTipText("");
1489 }
1490 return 1;
1491}
1492
1493
1494long
1495GUIApplicationWindow::onUpdNeedsSumoConfig(FXObject* sender, FXSelector, void* ptr) {
1496 // check if there is a loaded network and gui isn't loading
1497 if (myRunThread->networkAvailable() && !myAmLoading && OptionsCont::getOptions().isSet("configuration-file")) {
1498 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1499 sender->handle(this, FXSEL(SEL_COMMAND, ID_SHOW), ptr);
1500 myOpenInNetedit->setText(TL("Open sumo config in netedit"));
1501 } else {
1502 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1503 sender->handle(this, FXSEL(SEL_COMMAND, ID_HIDE), ptr);
1504 myOpenInNetedit->setText(TL("Open network in netedit"));
1505 }
1506 return 1;
1507}
1508
1509
1510long
1511GUIApplicationWindow::onUpdTraCIStatus(FXObject* /*sender*/, FXSelector, void* /*ptr*/) {
1513 myTraCiFrame->show();
1514 } else {
1515 myTraCiFrame->hide();
1516 }
1517 return 1;
1518}
1519
1520
1521long
1522GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
1523 if (myMDIClient->numChildren() > 0) {
1524 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1525 if (w != nullptr) {
1526 w->onCmdLocate(nullptr, sel, nullptr);
1527 }
1528 }
1529 return 1;
1530}
1531
1532
1533long
1534GUIApplicationWindow::onCmdShowStats(FXObject*, FXSelector, void*) {
1535 if (myMDIClient->numChildren() > 0) {
1536 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1538 }
1539 return 1;
1540}
1541
1542
1543long
1544GUIApplicationWindow::onCmdAppSettings(FXObject*, FXSelector, void*) {
1546 d->create();
1547 d->show(PLACEMENT_OWNER);
1548 return 1;
1549}
1550
1551
1552long
1553GUIApplicationWindow::onCmdGaming(FXObject*, FXSelector, void*) {
1554 if (myGLWindows.empty()) {
1555 return 1;
1556 }
1558 myGLWindows[0]->getView()->editVisualisationSettings()->gaming = myAmGaming;
1559 if (myAmGaming) {
1560 myGamingModeCheckbox->setCheck(TRUE);
1561 myMenuBar->hide();
1562 myStatusbar->hide();
1563 myToolBar1->hide();
1564 myToolBar2->hide();
1565 myToolBar4->hide();
1566 myToolBar5->hide();
1567 myToolBar6->show();
1568 myToolBar8->hide();
1569 myToolBar10->show();
1570 if (myTLSGame) {
1571 myToolBar7->show();
1572 } else {
1573 myToolBar9->show();
1574 }
1575 myMessageWindow->hide();
1581 } else {
1582 myGamingModeCheckbox->setCheck(FALSE);
1583 myMenuBar->show();
1584 myStatusbar->show();
1585 myToolBar1->show();
1586 myToolBar2->show();
1587 myToolBar4->show();
1588 myToolBar5->show();
1589 myToolBar6->hide();
1590 myToolBar7->hide();
1591 myToolBar8->show();
1592 myToolBar9->hide();
1593 myToolBar10->hide();
1594 myMessageWindow->show();
1596 }
1597 if (myMDIClient->numChildren() > 0) {
1598 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1599 if (w != nullptr) {
1601 }
1602 }
1603 update();
1604 return 1;
1605}
1606
1607
1608long
1610 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1611 if (w != nullptr) {
1612 // show or hide grid depending of myNetworkViewOptions.menuCheckToggleGrid
1615 } else {
1617 }
1618 w->getView()->update();
1619 }
1620 return 1;
1621}
1622
1623
1624long
1626 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1627 if (w != nullptr) {
1628 // toggle secondary shape visualization
1630 w->getView()->update();
1631 }
1632 return 1;
1633}
1634
1635
1636long
1637GUIApplicationWindow::onCmdFullScreen(FXObject*, FXSelector, void*) {
1638 if (myGLWindows.empty()) {
1639 return 1;
1640 }
1642 if (myAmFullScreen) {
1643 getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1644 getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1645 getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1646 getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1647 maximize();
1648 setDecorations(DECOR_NONE);
1649 place(PLACEMENT_MAXIMIZED);
1650 myMenuBar->hide();
1651 myStatusbar->hide();
1652 myToolBar1->hide();
1653 myToolBar2->hide();
1654 myToolBar3->hide();
1655 myToolBar4->hide();
1656 myToolBar5->hide();
1657 myToolBar6->hide();
1658 myToolBar7->hide();
1659 myToolBar8->hide();
1660 myMessageWindow->hide();
1661 if (myMDIClient->numChildren() > 0) {
1662 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1663 if (w != nullptr) {
1664 w->setToolBarVisibility(false);
1665 }
1666 }
1667 update();
1668 } else {
1669 place(PLACEMENT_VISIBLE);
1670 setDecorations(DECOR_ALL);
1671 restore();
1672 myToolBar3->show();
1674 onCmdGaming(nullptr, 0, nullptr);
1675 setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
1676 setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1677 setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
1678 setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
1679 }
1680 return 1;
1681}
1682
1683
1684long
1685GUIApplicationWindow::onCmdListInternal(FXObject*, FXSelector, void*) {
1687 return 1;
1688}
1689
1690
1691long
1692GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) {
1694 return 1;
1695}
1696
1697long
1698GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) {
1700 return 1;
1701}
1702
1703
1704long
1705GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) {
1707 return 1;
1708}
1709
1710
1711#ifdef HAVE_OSG
1712long
1713GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1715 return 1;
1716}
1717#endif
1718
1719
1720long
1721GUIApplicationWindow::onCmdFeedback(FXObject*, FXSelector, void*) {
1722 // create and open feedback dialog
1723 GUIDialog_Feedback* feedback = new GUIDialog_Feedback(this);
1724 feedback->create();
1725 feedback->show(PLACEMENT_OWNER);
1726 return 1;
1727}
1728
1729
1730long
1731GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
1732 GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this);
1733 about->create();
1734 about->show(PLACEMENT_OWNER);
1735 return 1;
1736}
1737
1738
1739long
1740GUIApplicationWindow::onCmdHallOfFame(FXObject*, FXSelector, void*) {
1742 hall->create();
1743 hall->show(PLACEMENT_OWNER);
1744 return 1;
1745}
1746
1747
1748long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1749 FXEvent* event = (FXEvent*)ptr;
1750 FXString string = GUIUserIO::clipped.c_str();
1751 setDNDData(FROM_CLIPBOARD, event->target, string);
1752 return 1;
1753}
1754
1755
1756long
1757GUIApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
1758 eventOccurred();
1759 return 1;
1760}
1761
1762
1763long
1764GUIApplicationWindow::onRunThreadEvent(FXObject*, FXSelector, void*) {
1765 eventOccurred();
1766 return 1;
1767}
1768
1769
1770void
1772 while (!myEvents.empty()) {
1773 // get the next event
1774 GUIEvent* e = myEvents.top();
1775 myEvents.pop();
1776 // process
1777 switch (e->getOwnType()) {
1780 setFocus();
1781 break;
1783 if (myRunThread->networkAvailable()) { // avoid race-condition related crash if reload was pressed
1785 }
1786 break;
1794 break;
1796 GUIEvent_AddView* ave = dynamic_cast<GUIEvent_AddView*>(e);
1798 if (ave->getSchemeName() != "") {
1799 MFXComboBoxIcon* sCombo = v->getColoringSchemesCombo();
1800 int index = sCombo->findItem(ave->getSchemeName().c_str());
1801 if (index >= 0) {
1802 sCombo->setCurrentItem(index);
1803 }
1804 v->setColorScheme(ave->getSchemeName());
1805 }
1806 break;
1807 }
1809 GUIEvent_CloseView* ave = dynamic_cast<GUIEvent_CloseView*>(e);
1810 removeViewByID(ave->getCaption());
1811 break;
1812 }
1815 break;
1816 default:
1817 break;
1818 }
1819 delete e;
1820 }
1821 myToolBar2->forceRefresh();
1822 myToolBar3->forceRefresh();
1823}
1824
1825
1826void
1828 myAmLoading = false;
1830 // check whether the loading was successfull
1831 if (ec->myNet == nullptr) {
1832 // report failure
1833 setStatusBarText(TLF("Loading of '%' failed!", ec->myFile));
1836 getApp()->exit(1);
1837 }
1838 } else {
1839 // initialise simulation thread
1840 if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1843 getApp()->exit(1);
1844 }
1845 } else {
1846 // report success
1847 setStatusBarText(TLF("'%' loaded.", ec->myFile));
1849 myWasStarted = false;
1851 // initialise views
1852 myViewNumber = 0;
1854 // check/record settings file modification time
1855 long long mTime = myGuiSettingsFileMTime;
1856 if (ec->mySettingsFiles.size() > 0) {
1857 for (std::string fname : ec->mySettingsFiles) {
1858 mTime = MAX2(mTime, SysUtils::getModifiedTime(fname));
1859 }
1860 }
1861 // always reload if settings were modified or to restore multiple views
1862 if (!myIsReload) {
1864 }
1865 if (ec->mySettingsFiles.size() > 0 && (!myIsReload || myGuiSettingsFileMTime < mTime || ec->mySettingsFiles.size() > 1)) {
1866 // open a view for each file and apply settings
1867 for (std::string fname : ec->mySettingsFiles) {
1868 GUISettingsHandler settings(fname);
1869 GUISUMOViewParent::ViewType vt = defaultType;
1870 if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
1872 }
1873 if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
1875 }
1876 GUISUMOAbstractView* view = openNewView(vt);
1877 if (view == nullptr) {
1878 break;
1879 }
1880 if (settings.getSettingName() != "") {
1881 view->setColorScheme(settings.getSettingName());
1882 MFXComboBoxIcon* sCombo = view->getColoringSchemesCombo();
1883 int index = sCombo->findItem(settings.getSettingName().c_str());
1884 if (index >= 0) {
1885 sCombo->setCurrentItem(index);
1886 }
1887 }
1888 view->addDecals(settings.getDecals());
1889 settings.applyViewport(view);
1890 settings.setSnapshots(view);
1891 if (settings.getDelay() > 0.) {
1892 mySimDelay = settings.getDelay();
1893 }
1894 if (settings.getBreakpoints().size() > 0) {
1896 myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
1897 myRunThread->getBreakpointLock().unlock();
1898 }
1899 myJamSounds = settings.getEventDistribution("jam");
1900 myCollisionSounds = settings.getEventDistribution("collision");
1901 if (settings.getJamSoundTime() > 0) {
1902 myJamSoundTime = settings.getJamSoundTime();
1903 }
1904 }
1905 } else {
1906 openNewView(defaultType);
1907 }
1908 myGuiSettingsFileMTime = mTime;
1909 if (!OptionsCont::getOptions().isDefault("delay")) {
1910 setDelay(OptionsCont::getOptions().getFloat("delay"));
1911 mySimDelaySlider->setValue((int)mySimDelay);
1912 mySimDelaySpinner->setValue(mySimDelay);
1913 }
1914 if (!OptionsCont::getOptions().isDefault("breakpoints") && !myIsReload) {
1915 std::vector<SUMOTime> breakpoints;
1916 for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
1917 SUMOTime t = string2time(val);
1918 // round down to nearest reachable time step
1919 t -= t % DELTA_T;
1920 breakpoints.push_back(t);
1921 }
1922 std::sort(breakpoints.begin(), breakpoints.end());
1924 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1925 myRunThread->getBreakpointLock().unlock();
1926 }
1927 if (!OptionsCont::getOptions().isDefault("selection-file")) {
1928 delete myDynamicSelection;
1929 myDynamicSelection = new std::stringstream();
1930 std::string msg = gSelected.load(OptionsCont::getOptions().getString("selection-file"), GLO_MAX, myDynamicSelection);
1931 if (msg != "") {
1932 WRITE_ERRORF("Errors while loading selection: %", msg.c_str());
1933 }
1934 if (!myDynamicSelection->str().empty()) {
1935 std::string dummy;
1936 int numNotFound = 0;
1937 while (myDynamicSelection->good()) {
1938 (*myDynamicSelection) >> dummy;
1939 numNotFound++;
1940 }
1941 myDynamicSelection->clear(); // first clear error state before seek works
1942 myDynamicSelection->seekg(0);
1943 // @note for some reason the last line is read twice
1944 WRITE_MESSAGEF("% dynamic objects not present while loading selection", numNotFound - 1);
1945 }
1946 }
1947 myTLSGame = OptionsCont::getOptions().getString("game.mode") == "tls";
1948 if (OptionsCont::getOptions().getBool("game")) {
1949 if (myTLSGame) {
1950 setTitle(TL("SUMO Interactive Traffic Light"));
1951 } else {
1952 setTitle(TL("SUMO Interactive Demand-Responsive-Transport"));
1953 }
1954 onCmdGaming(nullptr, 0, nullptr);
1955 } else {
1956 // set simulation name on the caption
1957 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str()));
1958 }
1959 if (ec->myViewportFromRegistry) {
1960 Position off;
1961 off.set(getApp()->reg().readRealEntry("viewport", "x"),
1962 getApp()->reg().readRealEntry("viewport", "y"),
1963 getApp()->reg().readRealEntry("viewport", "z"));
1964 Position p(off.x(), off.y(), 0);
1965 GUISUMOAbstractView* view = myGLWindows[0]->getView();
1966 view->setViewportFromToRot(off, p, 0);
1967 }
1968 // set simulation step begin information
1969 myLCDLabel->setText("----------------");
1970 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
1971 (*it)->setText("-");
1972 }
1973 // initialize scale from options unless already set in the UI
1974 if (myDemandScaleSpinner->getValue() == 1 || !OptionsCont::getOptions().isDefault("scale")) {
1976 }
1978 }
1979 }
1980 getApp()->endWaitCursor();
1981 // start if wished
1983 onCmdStart(nullptr, 0, nullptr);
1984 }
1985 update();
1986}
1987
1988
1989void
1991#ifdef WIN32
1992 long t = SysUtils::getCurrentMillis();
1993 // only skip if the simulation is running
1994 if (t - myLastStepEventMillis < MIN_DRAW_DELAY && myRunThread->simulationIsStopable()) {
1995 // do not try to redraw with more than 50FPS (#6371)
1996 return;
1997 }
1999#endif
2001 const int running = myRunThread->getNet().getVehicleControl().getRunningVehicleNo();
2002 const int backlog = myRunThread->getNet().getInsertionControl().getWaitingVehicleNo();
2003 if (backlog > running) {
2004 if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::GREENVEHICLE)) {
2006 }
2007 } else {
2008 if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::YELLOWVEHICLE)) {
2010 }
2011 }
2012 myStatButtons.front()->setText(toString(running).c_str());
2013 if (myRunThread->getNet().hasPersons()) {
2014 if (!myStatButtons[1]->shown()) {
2015 myStatButtons[1]->show();
2016 }
2018 }
2019 if (myRunThread->getNet().hasContainers()) {
2020 if (!myStatButtons[2]->shown()) {
2021 myStatButtons[2]->show();
2022 }
2024 }
2025 if (myAmGaming) {
2026 if (myTLSGame) {
2028 } else {
2030 }
2031 }
2033 getApp()->forceRefresh(); // restores keyboard focus
2034 }
2035 // try to load dynamic selection
2036 if (myDynamicSelection != nullptr) {
2037 std::stringstream tmp;
2039 if (tmp.str().empty()) {
2040 delete myDynamicSelection;
2041 myDynamicSelection = nullptr;
2042 } else {
2043 myDynamicSelection->str(tmp.str());
2044 myDynamicSelection->clear(); // first clear error state before seek works
2045 myDynamicSelection->seekg(0);
2046 }
2047 }
2049 update();
2050}
2051
2052
2053void
2055 GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
2057 setStatusBarText(ec->getMsg());
2058 } else {
2060 }
2061}
2062
2063
2064void
2067 onCmdStop(nullptr, 0, nullptr);
2068 if (ec->getReason() == MSNet::SIMSTATE_LOADING) {
2069 onCmdReload(nullptr, 0, nullptr);
2070 } else if (GUIGlobals::gQuitOnEnd) {
2072 getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
2073 } else if (GUIGlobals::gDemoAutoReload) {
2074 onCmdReload(nullptr, 1, nullptr);
2075 } else if (!myHaveNotifiedAboutSimEnd) {
2076 // GUIRunThread::deleteSim() triggers the final message to the log file
2077 // (this will never reach the GUI but we cannot use WRITE_MESSAGE here
2078 // to avoid a duplicate log entry)
2080 TLF("Simulation ended at time: %. (%)",
2082 // build the text
2083 const std::string text = TLF("Simulation ended at time: %.", time2string(ec->getTimeStep())) + "\n" +
2084 TL("Reason:") + MSNet::getStateMessage(ec->getReason()) + "\n" +
2085 TL("Do you want to close all open files and views?");
2086 FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, TL("Simulation ended"), "%s", text.c_str());
2087 if (answer == 1) { //1:yes, 2:no, 4:esc
2089 } else {
2092 update();
2093 }
2095 }
2096}
2097
2098
2099void
2104#ifdef HAVE_DANGEROUS_SOUNDS // disable user-configurable command execution for public build
2105 if (myJamSounds.getOverallProb() > 0) {
2106 // play honking sound if some vehicle is waiting too long
2107 for (; it != end; ++it) {
2108 // XXX use impatience instead of waiting time ?
2109 if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
2110 const std::string cmd = myJamSounds.get(&myGamingRNG);
2111 if (cmd != "") {
2112 // yay! fun with dangerous commands... Never use this over the internet
2114 // one sound per simulation step is enough
2115 break;
2116 }
2117 }
2118 }
2119 }
2122 if (myPreviousCollisionNumber != collisions) {
2123 const std::string cmd = myCollisionSounds.get(&myGamingRNG);
2124 if (cmd != "") {
2125 // yay! fun with dangerous commands... Never use this over the internet
2127 }
2128 myPreviousCollisionNumber = collisions;
2129 }
2130 }
2131#endif
2132 // update performance indicators
2133 for (it = vc.loadedVehBegin(); it != end; ++it) {
2134 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2135 assert(veh != 0);
2136 if (veh->isOnRoad() && !veh->isStopped()) {
2137 const double vmax = veh->getLane()->getVehicleMaxSpeed(veh);
2138 if (veh->getSpeed() < SUMO_const_haltingSpeed) {
2140 if (veh->getVClass() == SVC_EMERGENCY) {
2142 }
2143 }
2144 myTimeLoss += TIME2STEPS(TS * (vmax - veh->getSpeed()) / vmax); // may be negative with speedFactor > 1
2145 }
2146
2147 }
2151}
2152
2153
2154void
2156 // update performance indicators
2160
2163 for (auto it = vc.loadedVehBegin(); it != end; ++it) {
2164 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2165 assert(veh != 0);
2166 if (veh->isOnRoad() && !veh->isStopped()) {
2168 }
2169 }
2171}
2172
2173
2174void
2176 if (!myAmLoading) {
2178 getApp()->beginWaitCursor();
2179 myAmLoading = true;
2180 myIsReload = false;
2182 gSchemeStorage.saveViewport(0, 0, -1, 0); // recenter view
2184 setStatusBarText(TLF("Loading '%'.", file));
2185 update();
2186 }
2187}
2188
2189
2192 if (!myRunThread->networkAvailable()) {
2193 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
2194 return nullptr;
2195 }
2196 GUISUMOAbstractView* oldView = nullptr;
2197 if (myMDIClient->numChildren() > 0) {
2198 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2199 if (w != nullptr) {
2200 oldView = w->getView();
2201 }
2202 }
2203 if (caption == "") {
2204 caption = "View #" + toString(myViewNumber++);
2205 }
2206 FXuint opts = MDI_TRACKING;
2207 GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
2208 this, GUIIconSubSys::getIcon(GUIIcon::SUMO_MINI), opts, 10, 10, 200, 100);
2210 if (oldView != nullptr) {
2211 // copy viewport
2212 oldView->copyViewportTo(v);
2213 }
2214 w->create();
2215 if (myMDIClient->numChildren() == 1) {
2216 w->maximize();
2217 } else {
2218 myMDIClient->vertical(true);
2219 }
2220 myMDIClient->setActiveChild(w);
2221
2222 return v;
2223}
2224
2225
2226FXGLCanvas*
2228 if (myMDIClient->numChildren() == 0) {
2229 return nullptr;
2230 }
2231 GUISUMOViewParent* share_tmp1 =
2232 static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
2233 return share_tmp1->getBuildGLCanvas();
2234}
2235
2236
2237void
2239 myTrackerLock.lock();
2240 myLCDLabel->setText("----------------");
2241 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2242 (*it)->setText("-");
2243 if (it != myStatButtons.begin()) {
2244 (*it)->hide();
2245 }
2246 }
2247 // delete the simulation
2249 // reset the caption
2250 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
2251 // remove trackers and other external windows (must be delayed until deleteSim)
2252 while (!myGLWindows.empty()) {
2253 delete myGLWindows.front();
2254 }
2255 // make a copy because deleting modifyes the vector;
2256 std::vector<FXMainWindow*> trackerWindows = myTrackerWindows;
2257 for (FXMainWindow* const window : trackerWindows) {
2258 delete window;
2259 }
2260 myTrackerWindows.clear();
2261 // clear selected items
2262 gSelected.clear();
2263 // add a separator to the log
2265 myTrackerLock.unlock();
2266 // remove coordinate information
2267 myGeoCoordinate->setText(TL("N/A"));
2268 myCartesianCoordinate->setText(TL("N/A"));
2269 if (myTestCoordinate) {
2270 myTestCoordinate->setText(TL("N/A"));
2271 }
2272 //
2275 update();
2276}
2277
2278
2279FXCursor*
2281 return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
2282}
2283
2284
2289
2290
2291double
2295
2296
2297void
2299 loadConfigOrNet("");
2300 if (wait) {
2301 while (myAmLoading) {
2302 myRunThread->sleep(50);
2303 }
2304 }
2305}
2306
2307
2308void
2310 myStatusbar->getStatusLine()->setText(text.c_str());
2311 myStatusbar->getStatusLine()->setNormalText(text.c_str());
2312}
2313
2314
2315void
2317 myRecentNetworks.appendFile(f);
2318}
2319
2320
2321void
2323 myRecentConfigs.appendFile(f);
2324}
2325
2326
2327void
2329 if (myShowTimeAsHMS) {
2330 myLCDLabel->setToolTipText("HH:MM:SS");
2331 if (myAmGaming) {
2333 myTimeLossLabel->setToolTipText("HH:MM:SS");
2335 }
2336 } else {
2337 myLCDLabel->setToolTipText(TL("seconds"));
2338 if (myAmGaming) {
2340 myTimeLossLabel->setToolTipText(TL("seconds"));
2342 }
2343 }
2344}
2345
2346
2347void
2349 time -= DELTA_T; // synchronize displayed time with netstate output
2350 if (time < 0) {
2351 myLCDLabel->setText("----------------");
2352 return;
2353 }
2354 if (myAmGaming) {
2355 // show time counting backwards
2356 time = myRunThread->getSimEndTime() - time;
2357 }
2358 std::ostringstream str;
2359 str << std::setfill('0');
2360 const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0;
2361 if (myShowTimeAsHMS) {
2362 SUMOTime day = time / 86400000;
2363 if (day > 0) {
2364 str << day << '-';
2365 time %= 86400000;
2366 }
2367 str << std::setw(2);
2368 str << time / 3600000 << '-';
2369 time %= 3600000;
2370 str << std::setw(2) << time / 60000 << '-';
2371 time %= 60000;
2372 }
2373 str << std::setw(2) << time / 1000;
2374 if (!hideFraction) {
2375 str << '.' << std::setw(3) << time % 1000;
2376 }
2377 myLCDLabel->setText(str.str().c_str());
2378}
2379
2380
2381void
2383 if (press != nullptr) {
2384 myHotkeyPress[key] = press;
2385 }
2386 if (release != nullptr) {
2387 myHotkeyRelease[key] = release;
2388 }
2389}
2390
2391
2392long
2393GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* ptr) {
2394 FXEvent* e = (FXEvent*) ptr;
2395 // PgUp and PgDown switch between widgets by default and binding them via menu shortcuts does not work reliably
2396 // so we must intercept them before FXMainWindow can handle it
2397 if (e->code == FX::KEY_Page_Up) {
2398 onCmdDelayInc(nullptr, 0, nullptr);
2399 } else if (e->code == FX::KEY_Page_Down) {
2400 onCmdDelayDec(nullptr, 0, nullptr);
2401 } else {
2402 // disable hotkeys without modifiers for the game
2403 const bool ignoreSimple = myAmGaming && (e->state & (CONTROLMASK | SHIFTMASK | ALTMASK)) == 0;
2404 const long handled = ignoreSimple ? 0 : FXMainWindow::onKeyPress(o, sel, ptr);
2405 if (handled == 0 && myMDIClient->numChildren() > 0) {
2406 auto it = myHotkeyPress.find(e->code);
2407 if (it != myHotkeyPress.end()) {
2408 it->second->execute(SIMSTEP);
2409 }
2410 if (!ignoreSimple) {
2411 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2412 if (w != nullptr) {
2413 w->onKeyPress(nullptr, sel, ptr);
2414 }
2415 }
2416 }
2417 }
2418 return 0;
2419}
2420
2421
2422long
2423GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* ptr) {
2424 const long handled = FXMainWindow::onKeyRelease(o, sel, ptr);
2425 if (handled == 0 && myMDIClient->numChildren() > 0) {
2426 FXEvent* e = (FXEvent*) ptr;
2427 auto it = myHotkeyRelease.find(e->code);
2428 if (it != myHotkeyRelease.end()) {
2429 it->second->execute(SIMSTEP);
2430 }
2431 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2432 if (w != nullptr) {
2433 w->onKeyRelease(nullptr, sel, ptr);
2434 }
2435 }
2436 return 0;
2437}
2438
2439
2440double
2442 return mySimDelay;
2443}
2444
2445
2446void
2448 mySimDelay = delay;
2449}
2450
2451
2452void
2454 myEventMutex.lock();
2455 myEvents.push_back(event);
2457 //myEventCondition.wait(myEventMutex);
2458 myEventMutex.unlock();
2459}
2460
2461
2462void
2463GUIApplicationWindow::setBreakpoints(const std::vector<SUMOTime>& breakpoints) {
2464 if (myRunThread != nullptr) {
2466 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
2467 myRunThread->getBreakpointLock().unlock();
2469 }
2470}
2471
2472
2473void
2475 const SUMOTime begin = string2time(OptionsCont::getOptions().getString("begin"));
2476 if (time >= begin) {
2477 // ensure breakpoint is valid
2478 time -= (time - begin) % DELTA_T;
2479 std::vector<SUMOTime> breakpoints = retrieveBreakpoints();
2480 if (std::find(breakpoints.begin(), breakpoints.end(), time) == breakpoints.end()) {
2481 breakpoints.push_back(time);
2482 std::sort(breakpoints.begin(), breakpoints.end());
2483 setBreakpoints(breakpoints);
2484 setStatusBarText(TLF("Set breakpoint at %", time2string(time)));
2485 }
2486 }
2487}
2488
2489
2490const std::vector<SUMOTime>
2493 std::vector<SUMOTime> result = myRunThread->getBreakpoints();
2494 myRunThread->getBreakpointLock().unlock();
2495 return result;
2496}
2497
2498
2499void
2503
2504/****************************************************************************/
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:666
The main window of the SUMO-gui.
long onCmdDelayInc(FXObject *, FXSelector, void *)
Called on "delay inc".
long onUpdReload(FXObject *, FXSelector, void *)
Determines whether reloading is enabled.
long onCmdShowStats(FXObject *, FXSelector, void *)
Called on commands from the statistic buttons.
FXToolBarShell * myToolBarDrag2
long onCmdTimeToggle(FXObject *, FXSelector, void *)
Called on "time toggle".
virtual void sendBlockingEvent(GUIEvent *event)
Sends an event from the application thread to the GUI and waits until it is handled.
GUIDialog_Breakpoints * myBreakpointDialog
breakpoint dialog
FXEX::MFXThreadEvent myLoadThreadEvent
io-event with the load-thread
void handleEvent_Message(GUIEvent *e)
called when event "message" ocurred
GUILoadThread * myLoadThread
the thread that loads simulations
MFXLabelTooltip * myScaleTrafficTooltip
the demand scale label
void handleEvent_SimulationEnded(GUIEvent *e)
called when event "simulation ended" ocurred
FXMenuCheck * myGamingModeCheckbox
menu checkbox to activate game mode
int myViewNumber
The current view number.
FXToolBarShell * myToolBarDrag4
long onCmdAbout(FXObject *, FXSelector, void *)
Shows the about dialog.
SUMOTime myWaitingTime
waiting time
long onCmdFeedback(FXObject *, FXSelector, void *)
Shows the feedback dialog.
long onClipboardRequest(FXObject *sender, FXSelector sel, void *ptr)
Somebody wants our clipped text.
long onUpdTraCIStatus(FXObject *, FXSelector, void *)
Determines whether traci is active.
long onUpdStep(FXObject *, FXSelector, void *)
Determines whether "step" is enabled.
bool myAmLoading
information whether the gui is currently loading and the load-options shall be greyed out
long onCmdAppSettings(FXObject *, FXSelector, void *)
Opens the application settings menu (Settings->Application Settings...)
long onKeyPress(FXObject *o, FXSelector sel, void *data)
called when a key is pressed
void handleEvent_SimulationLoaded(GUIEvent *e)
called when event "simulation loaded" ocurred
long onCmdBreakpoint(FXObject *, FXSelector, void *)
Called to set a breakpoint via hotkey.
FXToolBarShell * myToolBarDrag9
FXRealSpinner * mySimDelaySpinner
Simulation delay spinner.
long onCmdBreakpointEarly(FXObject *, FXSelector, void *)
Called to set an early breakpoint via hotkey.
long onCmdChangelog(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Changelog
long onCmdOpenInNetedit(FXObject *, FXSelector, void *)
Called on menu Edit->open in Netedit.
void handleEvent_SimulationStep(GUIEvent *e)
called when event "simulation step" ocurred
bool myHaveNotifiedAboutSimEnd
whether the simulation end was already announced
void setStatusBarText(const std::string &text)
set status bar text
FXToolBarShell * myToolBarDrag10
FXMenuPane * myFileMenuRecentConfigs
FXMenu pane for recent configs.
long onCmdStop(FXObject *, FXSelector, void *)
Called on "stop".
MFXRecentNetworks myRecentNetworks
List of recent networks.
MFXLCDLabel * myTimeLossLabel
time loss label
double myJamSoundTime
waiting time after which vehicles trigger jam sounds
FXRealSpinner * myDemandScaleSpinner
the demand scale
long onCmdTutorial(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Tutorial
virtual void setDelay(double delay)
Sets the delay of the parent application in milliseconds.
MFXLCDLabel * myEmergencyVehicleLabel
emergency vehicle label
std::stringstream * myDynamicSelection
FXToolBarShell * myToolBarDrag7
double mySimDelay
the simulation delay in milliseconds
void addRecentConfig(const FX::FXString &f)
add recent config to recent file list
SUMOTime getCurrentSimTime() const
get current simulation time
long onUpdAddView(FXObject *, FXSelector, void *)
Determines whether adding a view is enabled.
FXToolBarShell * myToolBarDrag1
for some menu detaching fun
long onCmdEditViewScheme(FXObject *, FXSelector, void *)
Called on menu Edit->Visualization.
long onRunThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the simulation thread.
MFXLCDLabel * myTotalDistanceLabel
total distance label
bool hadDependentBuild
flag to mark if GUIApplicationWIndow has depend build
SUMOTime myEmergencyVehicleCount
emergency vehicle count
FXMenuPane * myFileMenuRecentNetworks
FXMenu pane for recent networks.
FXCursor * getDefaultCursor()
get default cursor
SUMOTime myTimeLoss
time loss
void checkGamingEventsDRT()
handles additional game-related events (DRT)
FXMDIMenu * myMDIMenu
The menu used for the MDI-windows.
GUIApplicationWindow(FXApp *a)
Constructor.
void updateTimeLCDTooltip()
update LCD timer tooltip
long onCmdListTeleporting(FXObject *, FXSelector, void *)
Toggle listing of teleporting vehicles.
long onCmdNewWindow(FXObject *, FXSelector, void *)
Called on menu File->New Window.
long onCmdStep(FXObject *, FXSelector, void *)
Called on "step".
FXMutex myEventMutex
the mutex for the waiting semaphore
double getTrackerInterval() const
get tracker interval
long onCmdClose(FXObject *, FXSelector, void *)
Called on menu File->Close.
virtual void buildToolBars()
Builds the tool bar.
long onCmdDelayToggle(FXObject *, FXSelector, void *)
Called on "delay toggle".
FXMenuCheck * myLoadAdditionalsInNetedit
menuCheck for enable/disable load additionals in netedit
void buildRecentNetworks(FXMenuPane *fileMenu, FXMenuPane *fileMenuRecentNetworks)
build recent networks
FXMenuPane * myFileMenu
the submenus
long onCmdToggleSecondaryShape(FXObject *, FXSelector, void *)
Toggle draw junction shape.
virtual double getDelay() const
Returns the simulation delay in miliseconds.
long onCmdStart(FXObject *, FXSelector, void *)
Called on "play".
GUIMessageWindow * myMessageWindow
A window to display messages, warnings and error in.
GUIRunThread * getRunner()
get run thread
void loadConfigOrNet(const std::string &file)
starts to load a simulation
FXToolBar * myToolBar1
The application tool bar.
bool myWasStarted
the information whether the simulation was started before
FXSplitter * myMainSplitter
The splitter that divides the main window into views and the log window.
long onCmdListParking(FXObject *, FXSelector, void *)
Toggle listing of parking vehicles.
long onUpdNeedsSumoConfig(FXObject *, FXSelector, void *)
Determines whether some buttons which require an sumoConfig may be shown.
void loadOnStartup(const bool wait=false)
config or net on startup
void addBreakpoint(SUMOTime time)
Adds the given breakpoint.
long onCmdListInternal(FXObject *, FXSelector, void *)
Toggle listing of internal structures.
bool myTLSGame
flag for enable TLS gameMode
FXEX::MFXThreadEvent myRunThreadEvent
io-event with the run-thread
void dependentBuild(const bool isLibsumo)
build dependt
long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
long onCmdEditBreakpoints(FXObject *, FXSelector, void *)
Called on menu Edit->Edit Breakpoints.
long onCmdOpenShapes(FXObject *, FXSelector, void *)
Called on menu File->Load Shapes.
FXToolBarShell * myMenuBarDrag
const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve list of breakpoints
long onCmdQuit(FXObject *, FXSelector, void *)
Called by FOX if the application shall be closed (Called either by FileMenu->Quit,...
FXToolBarShell * myToolBarDrag8
long onUpdStart(FXObject *sender, FXSelector, void *ptr)
Determines whether "play" is enabled.
GUISUMOAbstractView * openNewView(GUISUMOViewParent::ViewType vt=GUISUMOViewParent::VIEW_2D_OPENGL, std::string caption="")
opens a new simulation display
FXGLCanvas * getBuildGLCanvas() const
get build GLCanvas
RandomDistributor< std::string > myJamSounds
random list of jam sounds
long onCmdNewView(FXObject *, FXSelector, void *)
Called if a new view shall be opened (2D view)
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:1086
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition MSLane.h:614
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:1712
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:1691
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:325
bool hasContainers() const
Returns whether containers are simulated.
Definition MSNet.h:416
bool hasPersons() const
Returns whether persons are simulated.
Definition MSNet.h:400
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition MSNet.h:436
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition MSNet.h:506
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:383
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