Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIApplicationWindow.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2024 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
218 // keys
219 FXMAPFUNC(SEL_KEYPRESS, 0, GUIApplicationWindow::onKeyPress),
220 FXMAPFUNC(SEL_KEYRELEASE, 0, GUIApplicationWindow::onKeyRelease),
221 // clipboard
222 FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GUIApplicationWindow::onClipboardRequest),
223 // events
228};
229
230// Object implementation
231FXIMPLEMENT(GUIApplicationWindow, FXMainWindow, GUIApplicationWindowMap, ARRAYNUMBER(GUIApplicationWindowMap))
232
233// ===========================================================================
234// static members
235// ===========================================================================
236
238
239// ===========================================================================
240// member method definitions
241// ===========================================================================
242GUIApplicationWindow::GUIApplicationWindow(FXApp* a, const std::string& configPattern) :
243 GUIMainWindow(a),
244 myFileMenuRecentNetworks(new FXMenuPane(this)),
245 myFileMenuRecentConfigs(new FXMenuPane(this)),
246 myRecentNetworks(a, "networks"),
247 myRecentConfigs(a, "configs"),
248 myConfigPattern(configPattern),
249 myLastStepEventMillis(SysUtils::getCurrentMillis() - MIN_DRAW_DELAY) {
250 // init icons
252 // init Textures
254 // init cursors
256 // disable tooltips
257 a->setTooltipTime(1000000000);
258 a->setTooltipPause(1000000000);
259}
260
261
266
267
268void
270 // don't do this twice
271 if (hadDependentBuild) {
272 return;
273 }
274 hadDependentBuild = true;
275 setTarget(this);
276 setSelector(MID_WINDOW);
277 // build menu bar
278 myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBar);
280 new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
282 // build the thread - io
287 // build the status bar
288 myStatusbar = new FXStatusBar(this, GUIDesignStatusBar);
289 {
290 // build TraCi info
292 auto button = GUIDesigns::buildFXButton(myTraCiFrame, "TraCI", "", "", nullptr, this, MID_TRACI_STATUS, GUIDesignButtonStatusBarFixed);
293 button->setBackColor(FXRGBA(253, 255, 206, 255));
294 if (TraCIServer::getInstance() == nullptr) {
295 myTraCiFrame->hide();
296 }
297 // build geo coordiantes
299 myGeoCoordinate = GUIDesigns::buildFXLabel(myGeoFrame, TL("N/A"), "", TL("Original coordinate (before coordinate transformation in netconvert)"), nullptr, LAYOUT_CENTER_Y);
300 // build cartesian coordinates
302 myCartesianCoordinate = GUIDesigns::buildFXLabel(myCartesianFrame, TL("N/A"), "", TL("Network coordinate"), nullptr, LAYOUT_CENTER_Y);
303 // build buttons
306 myStatButtons.back()->hide();
308 myStatButtons.back()->hide();
309 }
310 // make the window a mdi-window
311 myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
313 myMDIMenu = new FXMDIMenu(this, myMDIClient);
314 new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
315 new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
316 new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
317 new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
318 // build the message window
320 // fill menu and tool bar
321 fillMenuBar();
322 myToolBar6->hide();
323 myToolBar7->hide();
324 myToolBar9->hide();
325 myToolBar10->hide();
326 // build additional threads
327 myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent, isLibsumo);
329 // set the status bar
330 setStatusBarText(TL("Ready."));
331 // set the caption
332 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
333 // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
334 myRunThread->start();
337}
338
339
340void
343 gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
344 FXMainWindow::create();
345 myMenuBarDrag->create();
346 myToolBarDrag1->create();
347 myToolBarDrag2->create();
348 myToolBarDrag3->create();
349 myToolBarDrag4->create();
350 myToolBarDrag5->create();
351 myToolBarDrag6->create();
352 myToolBarDrag7->create();
353 myFileMenu->create();
354 mySelectByPermissions->create();
355 myEditMenu->create();
356 mySettingsMenu->create();
357 myLocatorMenu->create();
358 myControlMenu->create();
359 myWindowMenu->create();
360 myLanguageMenu->create();
361 myHelpMenu->create();
362 FXint textWidth = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
363 myCartesianFrame->setWidth(textWidth);
364 myGeoFrame->setWidth(textWidth);
365 if (myTestFrame) {
366 myTestFrame->setWidth(textWidth);
367 }
368
369 show(PLACEMENT_DEFAULT);
370 if (!OptionsCont::getOptions().isSet("window-size")) {
371 if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
372 maximize();
373 }
374 }
375 myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
376 myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
377 const std::string& onlineMaps = getApp()->reg().readStringEntry("gui", "onlineMaps", "");
378 for (const std::string& entry : StringTokenizer(onlineMaps, "\n").getVector()) {
379 const std::vector<std::string> split = StringTokenizer(entry, "\t").getVector();
380 if (split.size() == 2) {
381 myOnlineMaps[split[0]] = split[1];
382 }
383 }
384 if (myOnlineMaps.empty()) {
385 myOnlineMaps["GeoHack"] = "https://geohack.toolforge.org/geohack.php?params=%lat;%lon_scale:1000";
386 myOnlineMaps["Google Maps"] = "https://www.google.com/maps?ll=%lat,%lon&t=h&z=18";
387 myOnlineMaps["OSM"] = "https://www.openstreetmap.org/?mlat=%lat&mlon=%lon&zoom=18&layers=M";
388 }
390}
391
392
395 myRunThread->join();
397 // close icons
400 // delete visual
401 delete myGLVisual;
402 // delete some non-parented windows
403 delete myToolBarDrag1;
404 delete mySimDelayTarget;
405 // delete rest of elements
408 delete myRunThread;
409 delete myFileMenu;
410 delete myEditMenu;
412 delete mySettingsMenu;
413 delete myLocatorMenu;
414 delete myControlMenu;
415 delete myLanguageMenu;
416 delete myWindowMenu;
417 delete myHelpMenu;
418 delete myLoadThread;
419
420 while (!myEvents.empty()) {
421 // get the next event
422 GUIEvent* e = myEvents.top();
423 myEvents.pop();
424 delete e;
425 }
426 for (auto item : myHotkeyPress) {
427 delete item.second;
428 }
429 for (auto item : myHotkeyRelease) {
430 delete item.second;
431 }
432}
433
434
435void
437 FXMainWindow::detach();
438 myMenuBarDrag->detach();
439 myToolBarDrag1->detach();
440}
441
442
443void
444GUIApplicationWindow::addToWindowsMenu(FXMenuPane* /*menuPane*/) {
445 // unused, implement in children
446}
447
448
449void
451 // build file menu
452 myFileMenu = new FXMenuPane(this);
455 TL("New Window"), "Ctrl+Shift+N", TL("Open a new sumo-gui window."),
456 nullptr, this, MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW);
457 new FXMenuSeparator(myFileMenu);
459 TL("&Open Simulation..."), "Ctrl+O", TL("Open a simulation (Configuration file)."),
462 TL("Open &Network..."), "Ctrl+N", TL("Open a network."),
465 TL("Open Shapes "), "Ctrl+P", TL("Load POIs and Polygons for visualization."),
468 TL("Open EdgeData "), "Ctrl+U", TL("Load edge related data for visualization."),
471 TL("&Reload"), "Ctrl+R", TL("Reloads the simulation / the network."),
474 TL("Quick-Reload"), "Ctrl+0", TL("Reloads the simulation (but not network)."),
476 new FXMenuSeparator(myFileMenu);
478 TL("Save Configuration"), "Ctrl+Shift+S", TL("Save current options as a configuration file."),
481 TL("Close"), "Ctrl+W", TL("Close the simulation."),
483 new FXMenuSeparator(myFileMenu);
484 // build recent files
487 new FXMenuSeparator(myFileMenu);
489 TL("&Quit"), "Ctrl+Q", TL("Quit the Application."),
490 nullptr, this, MID_HOTKEY_CTRL_Q_CLOSE);
491 // build edit menu
492 mySelectByPermissions = new FXMenuPane(this);
493 std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
494 for (const auto& vehicleClass : vehicleClasses) {
496 }
497 myEditMenu = new FXMenuPane(this);
500 TL("Edit Selected..."), "Ctrl+E", TL("Opens a dialog for editing the list of selected items."),
502 mySelectLanesMenuCascade = new FXMenuCascade(myEditMenu, TL("Select lanes which allow..."), GUIIconSubSys::getIcon(GUIIcon::FLAG), mySelectByPermissions);
503 mySelectLanesMenuCascade->setHelpText(TL("Opens a menu for selecting a vehicle class by which to selected lanes."));
504 new FXMenuSeparator(myEditMenu);
506 TL("Set Breakpoint"), "B", TL("Sets a breakpoint at the current simulation step"),
509 TL("Set Breakpoint with offset"), "Alt+B", TL("Sets a breakpoint at the current simulation step + offset configured in application settings"),
512 TL("Edit Breakpoints"), "Ctrl+B", TL("Opens a dialog for editing breakpoints."),
515 TL("Edit Visualisation"), "F9", TL("Opens a dialog for editing visualization settings."),
518 TL("Edit Viewport"), "Ctrl+I", TL("Opens a dialog for editing viewing area, zoom and rotation."),
520 new FXMenuSeparator(myEditMenu);
521 // add open in sumo options
522 myLoadAdditionalsInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load additionals in netedit"), TL("Load additionals in netedit."), this, MID_TOOLBAREDIT_LOADADDITIONALS);
523 myLoadAdditionalsInNetedit->setCheck(TRUE);
524 myLoadDemandInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load demand in netedit"), TL("Load demand in netedit."), this, MID_TOOLBAREDIT_LOADDEMAND);
525 myLoadDemandInNetedit->setCheck(FALSE);
527 TL("Open in netedit"), "Ctrl+T", TL("Opens current simulation in NETEDIT."),
529 // build settings menu
530 mySettingsMenu = new FXMenuPane(this);
533 TL("Application Settings"), "Ctrl+H", TL("Open a Dialog for Application Settings editing."),
535 myGamingModeCheckbox = new FXMenuCheck(mySettingsMenu,
536 TL("Gaming Mode\tCtrl+G\tToggle gaming mode on/off."),
539 TL("Full Screen Mode"), "Ctrl+F", TL("Toggle full screen mode on/off."),
541 // build Locate menu
542 myLocatorMenu = new FXMenuPane(this);
545 TL("&Junctions"), "Shift+J", TL("Open a dialog for locating a Junction."),
548 TL("&Edges"), "Shift+E", TL("Open a dialog for locating an Edge."),
551 TL("&Vehicles"), "Shift+V", TL("Open a dialog for locating a Vehicle."),
554 TL("&Persons"), "Shift+P", TL("Open a dialog for locating a Person."),
557 TL("&Container"), "Shift+C", TL("Open a dialog for locating a Container."),
560 TL("&TLS"), "Shift+T", TL("Open a dialog for locating a Traffic Light."),
563 TL("&Additional"), "Shift+A", TL("Open a dialog for locating an Additional Structure."),
566 TL("P&oI"), "Shift+O", TL("Open a dialog for locating a Point of Interest."),
569 TL("Po&lygon"), "Shift+L", TL("Open a dialog for locating a Polygon."),
571 new FXMenuSeparator(myLocatorMenu);
572 GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Internal Structures"), TL("Show internal junctions and streets in locator dialog."), this, MID_LISTINTERNAL);
573 FXMenuCheck* listParking = GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Parking Vehicles"), TL("Show parking vehicles in locator dialog."), this, MID_LISTPARKING);
574 listParking->setCheck(myListParking);
575 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);
576 // build control menu
577 // the shortcut designator is not only at text in the submenu but also defines the real shortcut key assigned with it!
578 // secondary shortcuts (ctrl+A, ctrl+S, ctrl+D) are defined in GUIShortcutsSubSys::buildSUMOAccelerators
579 myControlMenu = new FXMenuPane(this);
580 GUIDesigns::buildFXMenuTitle(myMenuBar, TL("Simulation"), nullptr, myControlMenu);
582 TL("Run"), "A,space", TL("Start/ Resume the simulation."),
585 TLC("Simulation", "Stop"), "S,space", TL("Halt the simulation."),
588 TL("Step"), "D", TL("Perform one simulation step."),
591 TL("Delay+"), "PgUp", TL("Increase simulation step delay."), nullptr, this, MID_DELAY_INC);
593 TL("Delay-"), "PgDn", TL("Decrease simulation step delay."), nullptr, this, MID_DELAY_DEC);
595 TL("Save"), "", TL("Save the current simulation state to a file."),
598 TL("Load"), "", TL("Load simulation state for the current network from file."),
600 // build windows menu
601 myWindowMenu = new FXMenuPane(this);
603 GUIDesigns::buildFXMenuCommandShortcut(myWindowMenu, TL("Open new view"), "", TL("Open a new microscopic view."), GUIIconSubSys::getIcon(GUIIcon::MICROVIEW), this, MID_NEW_MICROVIEW);
604#ifdef HAVE_OSG
606#endif
608 TL("Tile &Horizontally"), "", TL("Tile the views horizontally."),
609 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_HORI), myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
611 TL("Tile &Vertically"), "", TL("Tile the views vertically."),
612 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_VERT), myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
614 TL("Cascade"), "", TL("Cascade the views."),
616 myMDIClient, FXMDIClient::ID_MDI_CASCADE);
618 TL("&Close"), "", TL("Close the selected view."),
619 nullptr, myMDIClient, FXMDIClient::ID_MDI_CLOSE);
620 FXMenuSeparator* sep2 = new FXMenuSeparator(myWindowMenu);
621 sep2->setTarget(myMDIClient);
622 sep2->setSelector(FXMDIClient::ID_MDI_ANY);
623 // for whatever reason, sonar complains in the next line that sep2 may leak, but fox does the cleanup
624 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_1); // NOSONAR
625 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_2);
626 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_3);
627 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_4);
628 GUIDesigns::buildFXMenuCommand(myWindowMenu, TL("&Others..."), nullptr, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
629
630 new FXMenuSeparator(myWindowMenu);
631 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Status Line"), TL("Toggle the Status Bar on/off."), myStatusbar, FXWindow::ID_TOGGLESHOWN);
632 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Message Window"), TL("Toggle the Message Window on/off."), myMessageWindow, FXWindow::ID_TOGGLESHOWN);
633 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Time"), TL("Toggle the Simulation Time on/off."), myToolBar3, FXWindow::ID_TOGGLESHOWN);
634 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Delay"), TL("Toggle the Simulation Delay Entry on/off."), myToolBar4, FXWindow::ID_TOGGLESHOWN);
636
637 new FXMenuSeparator(myWindowMenu);
639 TL("Clear Message Window"), "", TL("Clear the message window."),
641 // build windows menu
643 // build help menu
644 myHelpMenu = new FXMenuPane(this);
646 TL("&Help"),
647 nullptr, myHelpMenu);
648 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Online Documentation"), "F1", TL("Open Online documentation."),
649 nullptr, this, MID_HOTKEY_F1_ONLINEDOCUMENTATION);
650 new FXMenuSeparator(myHelpMenu);
651 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Changelog"), "", TL("Open Changelog."),
652 nullptr, this, MID_CHANGELOG);
653 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Hotkeys"), "", TL("Open Hotkeys."),
654 nullptr, this, MID_HOTKEYS);
655 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Tutorial"), "", TL("Open Tutorial."),
656 nullptr, this, MID_TUTORIAL);
657 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Feedback"), "", TL("Open feedback dialog."),
658 nullptr, this, MID_FEEDBACK);
659 new FXMenuSeparator(myHelpMenu);
660 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&About"), "F12", TL("About sumo-gui."),
662 // build SUMO Accelerators (hotkeys)
663 GUIShortcutsSubSys::buildAccelerators(getAccelTable(), this, true);
664}
665
666
667void
669 // file and simulation tool bar
670 {
671 myToolBarDrag1 = new FXToolBarShell(this, GUIDesignToolBar);
673 new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
674 // build file tools
675 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen simulation\tOpen a simulation (Configuration file)."),
677 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen network\tOpen a network."),
679 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tReload\tReloads the simulation / the network."),
681 }
682 // simulation toolbar
683 {
684 myToolBarDrag2 = new FXToolBarShell(this, GUIDesignToolBar);
686 new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
687 // build simulation tools
688 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tRun\tStart/Resume the loaded simulation."),
690 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStop\tHalt the running simulation."),
692 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStep\tPerform a single simulation step."),
694 }
695 // Simulation Step Display
696 {
697 myToolBarDrag3 = new FXToolBarShell(this, GUIDesignToolBar);
699 new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
700 new MFXButtonTooltip(myToolBar3, myStaticTooltipMenu, TL("Time:\tToggle between time formats\tToggle between seconds and hour:minute:seconds display."), nullptr, this, MID_TIME_TOGGLE, GUIDesignButtonToolbarText);
701
702 myLCDLabel = new MFXLCDLabel(myToolBar3, myStaticTooltipMenu, 16, nullptr, 0, JUSTIFY_RIGHT);
707 myLCDLabel->setText("----------------");
708 }
709 // Simulation Delay
710 {
711 myToolBarDrag4 = new FXToolBarShell(this, GUIDesignToolBar);
713 new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
714 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);
715 // create spinner for delay
716 mySimDelay = 0;
717 mySimDelayTarget = new FXDataTarget(mySimDelay);
719 // create slider
720 mySimDelaySlider = new FXSlider(myToolBar4, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSlider);
721 mySimDelaySlider->setRange(0, 1000);
722 mySimDelaySlider->setHeadSize(10);
723 mySimDelaySlider->setIncrement(50);
724 mySimDelaySlider->setTickDelta(100);
725 mySimDelaySlider->setValue((int)mySimDelay);
726 //mySimDelayTarget->setNumberFormat(0);
727 //mySimDelayTarget->setIncrements(1, 10, 10);
728 mySimDelaySpinner->setIncrement(10);
729 mySimDelaySpinner->setRange(0, 10000);
730 mySimDelaySpinner->setValue(mySimDelay);
731 }
732 // Scale traffic (flows and incrementally loaded vehicles)
733 {
734 myToolBarDrag8 = new FXToolBarShell(this, GUIDesignToolBar);
736 new FXToolBarGrip(myToolBar8, myToolBar8, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
737 myScaleTrafficTooltip = new MFXLabelTooltip(myToolBar8, myStaticTooltipMenu, TL("Scale Traffic:"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
738 myScaleTrafficTooltip->setHelpText(TL("Scale traffic volume from running flows and from vehicles that are loaded incrementally from route files."));
740 myDemandScaleSpinner->setIncrement(0.5);
741 myDemandScaleSpinner->setRange(0, 1000);
742 myDemandScaleSpinner->setValue(1);
743 }
744 // Views
745 {
746 myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBar);
748 new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
749 // build view tools
750 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new view") + std::string("\t") + TL("Open a new microscopic view.")).c_str(),
752#ifdef HAVE_OSG
753 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new 3D view") + std::string("\t") + TL("Open a new 3D view.")).c_str(),
755#endif
756 }
758 {
759 // total waitingTime
760 myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBar);
762 new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
763 GUIDesigns::buildFXLabel(myToolBar6, TL("Waiting Time:"), "", TL("Time spent waiting accumulated for all vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
764 myWaitingTimeLabel = new MFXLCDLabel(myToolBar6, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
769 myWaitingTimeLabel->setText("-------------");
770 // idealistic time loss
771 myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBar);
773 new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
774 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);
775 myTimeLossLabel = new MFXLCDLabel(myToolBar7, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
780 myTimeLossLabel->setText("-------------");
781 // total driving distance
782 myToolBarDrag9 = new FXToolBarShell(this, GUIDesignToolBar);
784 new FXToolBarGrip(myToolBar9, myToolBar9, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
785 GUIDesigns::buildFXLabel(myToolBar9, TL("Distance (km):"), "", TL("Total distance driven by DRT vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
786 myTotalDistanceLabel = new MFXLCDLabel(myToolBar9, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
791 myTotalDistanceLabel->setText("-------------");
792 // emergency vehicle counts
793 myToolBarDrag10 = new FXToolBarShell(this, GUIDesignToolBar);
795 new FXToolBarGrip(myToolBar10, myToolBar10, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
796 GUIDesigns::buildFXLabel(myToolBar10, TL("Emergency Vehicle waiting time:"), "", TL("Time spent waiting accumulated for emergency vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
797 myEmergencyVehicleLabel = new MFXLCDLabel(myToolBar10, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
802 myEmergencyVehicleLabel->setText("-------------");
803 }
804}
805
806
807void
808GUIApplicationWindow::buildRecentNetworks(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentNetworks) {
809 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
810 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_1);
811 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_2);
812 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_3);
813 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_4);
814 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_5);
815 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_6);
816 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_7);
817 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_8);
818 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_9);
819 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_10);
820 new FXMenuSeparator(fileMenuRecentNetworks); // NOSONAR, Fox does the cleanup
821 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("Cl&ear Recent Networks"), nullptr, &myRecentNetworks, FXRecentFiles::ID_CLEAR);
822 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("No Recent Networks"), nullptr, &myRecentNetworks, MFXRecentNetworks::ID_NOFILES);
823 // set target
824 myRecentNetworks.setTarget(this);
825 myRecentNetworks.setSelector(MID_RECENTFILE);
826 new FXMenuCascade(fileMenu, TL("Recent Networks"), nullptr, fileMenuRecentNetworks);
827}
828
829
830void
831GUIApplicationWindow::buildRecentConfigs(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentConfigs) {
832 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
833 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_1);
834 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_2);
835 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_3);
836 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_4);
837 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_5);
838 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_6);
839 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_7);
840 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_8);
841 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_9);
842 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_10);
843 new FXMenuSeparator(fileMenuRecentConfigs); // NOSONAR, Fox does the cleanup
844 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("Cl&ear Recent Configs"), nullptr, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
845 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("No Recent Configs"), nullptr, &myRecentConfigs, MFXRecentNetworks::ID_NOFILES);
846 // set target
847 myRecentConfigs.setTarget(this);
848 myRecentConfigs.setSelector(MID_RECENTFILE);
849 new FXMenuCascade(fileMenu, TL("Recent Configs"), nullptr, fileMenuRecentConfigs);
850}
851
852
853long
854GUIApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
856 getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
857 getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
858 getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
859 getApp()->reg().writeIntEntry("gui", "alternateSimDelay", (int)myAlternateSimDelay);
861 getApp()->exit(0);
862 return 1;
863}
864
865
866long
867GUIApplicationWindow::onCmdEditChosen(FXObject* menu, FXSelector, void*) {
868 FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
869 if (mc->getText() == StringUtils::replace(TL("Edit Selected..."), "&", "").c_str()) {
870 GUIDialog_GLChosenEditor* chooser =
872 chooser->create();
873 chooser->show();
874 } else {
876 const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
877 for (MSEdgeVector::const_iterator i = MSEdge::getAllEdges().begin(); i != MSEdge::getAllEdges().end(); ++i) {
878 const std::vector<MSLane*>& lanes = (*i)->getLanes();
879 for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
880 GUILane* lane = dynamic_cast<GUILane*>(*it);
881 assert(lane != 0);
882 if ((lane->getPermissions() & svc) != 0) {
883 gSelected.select(lane->getGlID());
884 }
885 }
886 }
887 if (myMDIClient->numChildren() > 0) {
888 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
889 if (w != nullptr) {
890 // color by selection
892 }
893 }
894 }
896 }
897 return 1;
898}
899
900
901long
902GUIApplicationWindow::onCmdEditBreakpoints(FXObject*, FXSelector, void*) {
903 if (myBreakpointDialog == nullptr) {
905 } else {
906 myBreakpointDialog->restore();
907 myBreakpointDialog->setFocus();
908 myBreakpointDialog->raise();
909 }
910 return 1;
911}
912
913
914long
915GUIApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
916 if (!myGLWindows.empty()) {
917 myGLWindows[0]->getView()->showViewportEditor();
918 }
919 return 1;
920}
921
922
923long
924GUIApplicationWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
925 if (!myGLWindows.empty()) {
926 myGLWindows[0]->getView()->showViewschemeEditor();
927 }
928 return 1;
929}
930
931
932long
933GUIApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
934 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html");
935 return 1;
936}
937
938
939long
940GUIApplicationWindow::onCmdChangelog(FXObject*, FXSelector, void*) {
941 // update in every version
942 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/ChangeLog.html");
943 return 1;
944}
945
946
947long
948GUIApplicationWindow::onCmdHotkeys(FXObject*, FXSelector, void*) {
949 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html#keyboard_shortcuts");
950 return 1;
951}
952
953
954long
955GUIApplicationWindow::onCmdTutorial(FXObject*, FXSelector, void*) {
956 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/Tutorials/index.html");
957 return 1;
958}
959
960
961long
962GUIApplicationWindow::onCmdOpenInNetedit(FXObject*, FXSelector, void*) {
963 if (myGLWindows.empty()) {
964 return 1;
965 }
966 FXRegistry reg("SUMO netedit", "netedit");
967 reg.read();
968 const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
969 reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
970 reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
971 reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
972 reg.write();
973 std::string netedit = "netedit";
974 const char* sumoPath = getenv("SUMO_HOME");
975 if (sumoPath != nullptr) {
976 std::string newPath = std::string(sumoPath) + "/bin/netedit";
977 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
978 netedit = "\"" + newPath + "\"";
979 }
980 }
981 // declare command for calling netedit using the viewport saved in registry
982 std::string cmd = netedit + " --registry-viewport";
983 // continue depending if we're loading only a network or the entire sumo config
984 if (myLoadAdditionalsInNetedit->shown()) {
985 cmd += " --sumocfg-file \"" + OptionsCont::getOptions().getString("configuration-file") + "\"";
986 // check if ignore additional or demand elements
987 if (myLoadAdditionalsInNetedit->getCheck() == FALSE) {
988 cmd += " --ignore.additionalelements";
989 }
990 if (myLoadDemandInNetedit->getCheck() == FALSE) {
991 cmd += " --ignore.routeelements";
992 }
993 } else {
994 cmd += " -s \"" + OptionsCont::getOptions().getString("net-file") + "\"";
995 }
996 // start in background
997#ifndef WIN32
998 cmd = cmd + " &";
999#else
1000 // see "help start" for the parameters
1001 cmd = "start /B \"\" " + cmd;
1002#endif
1003 WRITE_MESSAGEF(TL("Running %."), cmd);
1004 // yay! fun with dangerous commands... Never use this over the internet
1006 return 1;
1007}
1008
1009
1010long
1011GUIApplicationWindow::onCmdNewWindow(FXObject*, FXSelector, void*) {
1012 FXRegistry reg("SUMO sumo-gui", "sumo-gui");
1013 std::string sumo_gui = "sumo-gui";
1014 const char* sumoPath = getenv("SUMO_HOME");
1015 if (sumoPath != nullptr) {
1016 std::string newPath = std::string(sumoPath) + "/bin/sumo_gui";
1017 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1018 sumo_gui = "\"" + newPath + "\"";
1019 }
1020 }
1021 std::string cmd = sumo_gui;
1022 // start in background
1023#ifndef WIN32
1024 cmd = cmd + " &";
1025#else
1026 // see "help start" for the parameters
1027 cmd = "start /B \"\" " + cmd;
1028#endif
1029 WRITE_MESSAGEF(TL("Running %."), cmd);
1030 // yay! fun with dangerous commands... Never use this over the internet
1032 return 1;
1033}
1034
1035
1036long
1038 // get the new file name
1039 FXFileDialog opendialog(this, TL("Open Simulation Configuration"));
1041 opendialog.setSelectMode(SELECTFILE_EXISTING);
1042 opendialog.setPatternList(myConfigPattern.c_str());
1043 if (gCurrentFolder.length() != 0) {
1044 opendialog.setDirectory(gCurrentFolder);
1045 }
1046 if (opendialog.execute()) {
1047 gCurrentFolder = opendialog.getDirectory();
1048 std::string file = opendialog.getFilename().text();
1049 loadConfigOrNet(file);
1050 myRecentConfigs.appendFile(file.c_str());
1051 }
1052 return 1;
1053}
1054
1055
1056long
1057GUIApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
1058 // get the new file name
1059 FXFileDialog opendialog(this, TL("Open Network"));
1060 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1061 opendialog.setSelectMode(SELECTFILE_EXISTING);
1062 opendialog.setPatternList("SUMO nets (*.net.xml,*.net.xml.gz)\nAll files (*)");
1063 if (gCurrentFolder.length() != 0) {
1064 opendialog.setDirectory(gCurrentFolder);
1065 }
1066 if (opendialog.execute()) {
1067 gCurrentFolder = opendialog.getDirectory();
1068 std::string file = opendialog.getFilename().text();
1069 loadConfigOrNet(file);
1070 myRecentNetworks.appendFile(file.c_str());
1071 }
1072 return 1;
1073}
1074
1075
1076long
1077GUIApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
1078 // get the shape file name
1079 FXFileDialog opendialog(this, TL("Open Shapes"));
1080 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_SHAPES));
1081 opendialog.setSelectMode(SELECTFILE_EXISTING);
1082 opendialog.setPatternList("Additional files (*.xml,*.xml.gz)\nAll files (*)");
1083 if (gCurrentFolder.length() != 0) {
1084 opendialog.setDirectory(gCurrentFolder);
1085 }
1086 if (opendialog.execute()) {
1087 gCurrentFolder = opendialog.getDirectory();
1088 std::string file = opendialog.getFilename().text();
1089
1090 dynamic_cast<GUIShapeContainer&>(myRunThread->getNet().getShapeContainer()).allowReplacement();
1092 if (!XMLSubSys::runParser(handler, file, false)) {
1093 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1094 }
1095 update();
1096 if (myMDIClient->numChildren() > 0) {
1097 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1098 if (w != nullptr) {
1099 w->getView()->update();
1100 }
1101 }
1102 }
1103 return 1;
1104}
1105
1106
1107long
1108GUIApplicationWindow::onCmdOpenEdgeData(FXObject*, FXSelector, void*) {
1109 // get the shape file name
1110 FXFileDialog opendialog(this, TL("Open EdgeData"));
1111 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1112 opendialog.setSelectMode(SELECTFILE_EXISTING);
1113 opendialog.setPatternList("EdgeData files (*.xml,*.xml.gz)\nAll files (*)");
1114 if (gCurrentFolder.length() != 0) {
1115 opendialog.setDirectory(gCurrentFolder);
1116 }
1117 if (opendialog.execute()) {
1118 gCurrentFolder = opendialog.getDirectory();
1119 std::string file = opendialog.getFilename().text();
1120 if (!GUINet::getGUIInstance()->loadEdgeData(file)) {
1121 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1122 }
1123 update();
1124 if (myMDIClient->numChildren() > 0) {
1125 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1126 if (w != nullptr) {
1127 w->getView()->update();
1128 }
1129 }
1130 }
1131 return 1;
1132}
1133
1134
1135long
1136GUIApplicationWindow::onCmdReload(FXObject* sender, FXSelector sel, void*) {
1137 if (!myAmLoading && (sender == nullptr || TraCIServer::getInstance() == nullptr)) {
1139 getApp()->beginWaitCursor();
1140 myAmLoading = true;
1141 myIsReload = sender != nullptr || sel == 1;
1143 myLoadThread->start();
1144 if (sender == nullptr) {
1145 setStatusBarText(sel == 1 ? TL("Auto-Reloading.") : TL("TraCI-Loading."));
1146 } else {
1147 setStatusBarText(TL("Reloading."));
1148 }
1149 update();
1150 }
1151 return 1;
1152}
1153
1154
1155long
1156GUIApplicationWindow::onCmdQuickReload(FXObject*, FXSelector, void*) {
1157 if (!myAmLoading) {
1158 setStatusBarText(TL("Quick-Reloading."));
1160 }
1161 return 1;
1162}
1163
1164
1165long
1166GUIApplicationWindow::onCmdOpenRecent(FXObject* /* sender */, FXSelector, void* ptr) {
1167 if (myAmLoading) {
1168 myStatusbar->getStatusLine()->setText(TL("Already loading!"));
1169 return 1;
1170 }
1171 std::string file((const char*)ptr);
1172 loadConfigOrNet(file);
1173 return 1;
1174}
1175
1176
1177long
1178GUIApplicationWindow::onCmdSaveConfig(FXObject*, FXSelector, void*) {
1179 // get the new file name
1180 FXFileDialog opendialog(this, TL("Save SUMO Configuration"));
1181 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1182 opendialog.setSelectMode(SELECTFILE_ANY);
1183 opendialog.setPatternList("Config (*.sumocfg)");
1184 if (gCurrentFolder.length() != 0) {
1185 opendialog.setDirectory(gCurrentFolder);
1186 }
1187 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1188 return 1;
1189 }
1190 std::string file = MFXUtils::assureExtension(opendialog.getFilename(),
1191 opendialog.getPatternText(opendialog.getCurrentPattern()).after('.').before(')')).text();
1192 std::ofstream out(StringUtils::transcodeToLocal(file));
1193 if (out.good()) {
1194 OptionsCont::getOptions().writeConfiguration(out, true, false, false, file, true);
1195 setStatusBarText(TLF("Configuration saved to %.", file));
1196 } else {
1197 setStatusBarText(TLF("Could not save configuration to %.", file));
1198 }
1199 out.close();
1200 return 1;
1201}
1202
1203
1204long
1205GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
1207 return 1;
1208}
1209
1210
1211long
1212GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
1213 sender->handle(this,
1214 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1215 ptr);
1216 return 1;
1217}
1218
1219
1220long
1221GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
1222 sender->handle(this,
1224 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1225 ptr);
1226 return 1;
1227}
1228
1229
1230long
1231GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
1232 sender->handle(this,
1233 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1234 ptr);
1235 return 1;
1236}
1237
1238
1239long
1240GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
1241 sender->handle(this,
1243 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1244 ptr);
1245 return 1;
1246}
1247
1248
1249long
1250GUIApplicationWindow::onCmdStart(FXObject*, FXSelector, void*) {
1251 // check whether a net was loaded successfully
1252 if (!myRunThread->networkAvailable()) {
1253 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1254 return 1;
1255 }
1256 // check whether it was started before and paused;
1257 if (!myWasStarted) {
1258 myRunThread->begin();
1259 myWasStarted = true;
1260 }
1262 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1263 return 1;
1264}
1265
1266
1267long
1268GUIApplicationWindow::onCmdStop(FXObject*, FXSelector, void*) {
1269 myRunThread->stop();
1270 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1271 return 1;
1272}
1273
1274
1275long
1276GUIApplicationWindow::onCmdStep(FXObject*, FXSelector, void*) {
1277 // check whether a net was loaded successfully
1278 if (!myRunThread->networkAvailable()) {
1279 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1280 return 1;
1281 }
1282 // check whether it was started before and paused;
1283 if (!myWasStarted) {
1284 myRunThread->begin();
1285 myWasStarted = true;
1286 }
1288 return 1;
1289}
1290
1291
1292long
1293GUIApplicationWindow::onCmdSaveState(FXObject*, FXSelector, void*) {
1294 // get the new file name
1295 FXFileDialog opendialog(this, TL("Save Simulation State"));
1296 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1297 opendialog.setSelectMode(SELECTFILE_ANY);
1298 opendialog.setPatternList("GZipped State (*.xml.gz)\nXML State (*.xml)");
1299 if (gCurrentFolder.length() != 0) {
1300 opendialog.setDirectory(gCurrentFolder);
1301 }
1302 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1303 return 1;
1304 }
1305
1306 const std::string file = MFXUtils::assureExtension(opendialog.getFilename(),
1307 opendialog.getPatternText(opendialog.getCurrentPattern()).after('.').before(')')).text();
1308 MSStateHandler::saveState(file, MSNet::getInstance()->getCurrentTimeStep(), false);
1309 setStatusBarText(TLF("Simulation state saved to '%'.", file));
1310 return 1;
1311}
1312
1313
1314long
1315GUIApplicationWindow::onCmdLoadState(FXObject*, FXSelector, void*) {
1316 // get the new file name
1317 FXFileDialog opendialog(this, TL("Load Simulation State"));
1318 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN));
1319 opendialog.setSelectMode(SELECTFILE_ANY);
1320 opendialog.setPatternList("GZipped State (*.xml.gz)\nXML State (*.xml)");
1321 if (gCurrentFolder.length() != 0) {
1322 opendialog.setDirectory(gCurrentFolder);
1323 }
1324 if (opendialog.execute() && FXStat::exists(opendialog.getFilename())) {
1325 gCurrentFolder = opendialog.getDirectory();
1326 const std::string file = opendialog.getFilename().text();
1327 try {
1328 MSNet::getInstance()->loadState(file, true);
1329 setStatusBarText(TLF("State loaded from '%'.", file));
1330 } catch (ProcessError& e) {
1331 setStatusBarText(TLF("Failed to load state from '%' (%).", file, e.what()));
1332 }
1333 }
1334 return 1;
1335}
1336
1337
1338long
1339GUIApplicationWindow::onCmdTimeToggle(FXObject*, FXSelector, void*) {
1340 // toggle show time as HMS
1345 }
1346 return 1;
1347}
1348
1349
1350long
1351GUIApplicationWindow::onCmdDelayInc(FXObject*, FXSelector, void*) {
1352 if (mySimDelay < 10) {
1353 mySimDelay = 10;
1354 } else if (mySimDelay >= 20 && mySimDelay < 50) {
1355 mySimDelay = 50;
1356 } else if (mySimDelay >= 200 && mySimDelay < 500) {
1357 mySimDelay = 500;
1358 } else {
1359 mySimDelay *= 2;
1360 }
1361 if (mySimDelay > 1000) {
1362 // setting high delay by pressing the key too often is hard to recover from
1363 mySimDelay = 1000;
1364 }
1365 mySimDelaySlider->setValue((int)mySimDelay);
1366 mySimDelaySpinner->setValue(mySimDelay);
1367 return 1;
1368}
1369
1370
1371long
1372GUIApplicationWindow::onCmdDelayDec(FXObject*, FXSelector, void*) {
1373 if (mySimDelay <= 10) {
1374 mySimDelay = 0;
1375 } else if (mySimDelay > 20 && mySimDelay <= 50) {
1376 mySimDelay = 20;
1377 } else if (mySimDelay > 200 && mySimDelay <= 500) {
1378 mySimDelay = 200;
1379 } else {
1380 mySimDelay /= 2;
1381 }
1382 mySimDelaySlider->setValue((int)mySimDelay);
1383 mySimDelaySpinner->setValue(mySimDelay);
1384 return 1;
1385}
1386
1387
1388long
1389GUIApplicationWindow::onCmdDelayToggle(FXObject*, FXSelector, void*) {
1390 const double tmp = myAlternateSimDelay;
1392 mySimDelay = tmp;
1393 return 1;
1394}
1395
1396
1397long
1398GUIApplicationWindow::onCmdDemandScale(FXObject*, FXSelector, void*) {
1401 }
1402 return 1;
1403}
1404
1405
1406long
1407GUIApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
1409 return 1;
1410}
1411
1412
1413long
1414GUIApplicationWindow::onCmdBreakpoint(FXObject*, FXSelector, void*) {
1415 // see updateTimeLCD for the DELTA_T
1418 }
1419 return 1;
1420}
1421
1422
1423long
1424GUIApplicationWindow::onCmdBreakpointEarly(FXObject*, FXSelector, void*) {
1425 // see updateTimeLCD for the DELTA_T
1428 }
1429 return 1;
1430}
1431
1432
1433long
1434GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
1435 sender->handle(this,
1437 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1438 ptr);
1440 // bind start simulation with space key
1442 }
1443 return 1;
1444}
1445
1446
1447long
1448GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
1449 sender->handle(this,
1451 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1452 ptr);
1454 // bind stop simulation with space key
1456 }
1457 return 1;
1458}
1459
1460
1461long
1462GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
1463 sender->handle(this,
1465 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1466 ptr);
1467 return 1;
1468}
1469
1470
1471long
1472GUIApplicationWindow::onUpdNeedsNetwork(FXObject* sender, FXSelector, void* ptr) {
1473 // check if there is a loaded network and gui isn't loading
1475 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1476 // enable certain elements manually
1477 mySelectLanesMenuCascade->enable();
1478 myScaleTrafficTooltip->setTipText(TL("Scale number of vehicles in simulation"));
1479 } else {
1480 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1481 // disable certain elements manually
1482 mySelectLanesMenuCascade->disable();
1483 myScaleTrafficTooltip->setTipText("");
1484 }
1485 return 1;
1486}
1487
1488
1489long
1490GUIApplicationWindow::onUpdNeedsSumoConfig(FXObject* sender, FXSelector, void* ptr) {
1491 // check if there is a loaded network and gui isn't loading
1492 if (myRunThread->networkAvailable() && !myAmLoading && OptionsCont::getOptions().isSet("configuration-file")) {
1493 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1494 sender->handle(this, FXSEL(SEL_COMMAND, ID_SHOW), ptr);
1495 myOpenInNetedit->setText(TL("Open sumo config in netedit"));
1496 } else {
1497 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1498 sender->handle(this, FXSEL(SEL_COMMAND, ID_HIDE), ptr);
1499 myOpenInNetedit->setText(TL("Open network in netedit"));
1500 }
1501 return 1;
1502}
1503
1504
1505long
1506GUIApplicationWindow::onUpdTraCIStatus(FXObject* /*sender*/, FXSelector, void* /*ptr*/) {
1508 myTraCiFrame->show();
1509 } else {
1510 myTraCiFrame->hide();
1511 }
1512 return 1;
1513}
1514
1515
1516long
1517GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
1518 if (myMDIClient->numChildren() > 0) {
1519 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1520 if (w != nullptr) {
1521 w->onCmdLocate(nullptr, sel, nullptr);
1522 }
1523 }
1524 return 1;
1525}
1526
1527
1528long
1529GUIApplicationWindow::onCmdShowStats(FXObject*, FXSelector, void*) {
1530 if (myMDIClient->numChildren() > 0) {
1531 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1533 }
1534 return 1;
1535}
1536
1537
1538long
1539GUIApplicationWindow::onCmdAppSettings(FXObject*, FXSelector, void*) {
1541 d->create();
1542 d->show(PLACEMENT_OWNER);
1543 return 1;
1544}
1545
1546
1547long
1548GUIApplicationWindow::onCmdGaming(FXObject*, FXSelector, void*) {
1549 if (myGLWindows.empty()) {
1550 return 1;
1551 }
1553 myGLWindows[0]->getView()->editVisualisationSettings()->gaming = myAmGaming;
1554 if (myAmGaming) {
1555 myGamingModeCheckbox->setCheck(TRUE);
1556 myMenuBar->hide();
1557 myStatusbar->hide();
1558 myToolBar1->hide();
1559 myToolBar2->hide();
1560 myToolBar4->hide();
1561 myToolBar5->hide();
1562 myToolBar6->show();
1563 myToolBar8->hide();
1564 myToolBar10->show();
1565 if (myTLSGame) {
1566 myToolBar7->show();
1567 } else {
1568 myToolBar9->show();
1569 }
1570 myMessageWindow->hide();
1576 } else {
1577 myGamingModeCheckbox->setCheck(FALSE);
1578 myMenuBar->show();
1579 myStatusbar->show();
1580 myToolBar1->show();
1581 myToolBar2->show();
1582 myToolBar4->show();
1583 myToolBar5->show();
1584 myToolBar6->hide();
1585 myToolBar7->hide();
1586 myToolBar8->show();
1587 myToolBar9->hide();
1588 myToolBar10->hide();
1589 myMessageWindow->show();
1591 }
1592 if (myMDIClient->numChildren() > 0) {
1593 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1594 if (w != nullptr) {
1596 }
1597 }
1598 update();
1599 return 1;
1600}
1601
1602
1603long
1605 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1606 if (w != nullptr) {
1607 // show or hide grid depending of myNetworkViewOptions.menuCheckToggleGrid
1610 } else {
1612 }
1613 w->getView()->update();
1614 }
1615 return 1;
1616}
1617
1618
1619long
1621 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1622 if (w != nullptr) {
1623 // toggle secondary shape visualization
1625 w->getView()->update();
1626 }
1627 return 1;
1628}
1629
1630
1631long
1632GUIApplicationWindow::onCmdFullScreen(FXObject*, FXSelector, void*) {
1633 if (myGLWindows.empty()) {
1634 return 1;
1635 }
1637 if (myAmFullScreen) {
1638 getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1639 getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1640 getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1641 getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1642 maximize();
1643 setDecorations(DECOR_NONE);
1644 place(PLACEMENT_MAXIMIZED);
1645 myMenuBar->hide();
1646 myStatusbar->hide();
1647 myToolBar1->hide();
1648 myToolBar2->hide();
1649 myToolBar3->hide();
1650 myToolBar4->hide();
1651 myToolBar5->hide();
1652 myToolBar6->hide();
1653 myToolBar7->hide();
1654 myToolBar8->hide();
1655 myMessageWindow->hide();
1656 if (myMDIClient->numChildren() > 0) {
1657 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1658 if (w != nullptr) {
1659 w->setToolBarVisibility(false);
1660 }
1661 }
1662 update();
1663 } else {
1664 place(PLACEMENT_VISIBLE);
1665 setDecorations(DECOR_ALL);
1666 restore();
1667 myToolBar3->show();
1669 onCmdGaming(nullptr, 0, nullptr);
1670 setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
1671 setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1672 setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
1673 setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
1674 }
1675 return 1;
1676}
1677
1678
1679long
1680GUIApplicationWindow::onCmdListInternal(FXObject*, FXSelector, void*) {
1682 return 1;
1683}
1684
1685
1686long
1687GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) {
1689 return 1;
1690}
1691
1692long
1693GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) {
1695 return 1;
1696}
1697
1698
1699long
1700GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) {
1702 return 1;
1703}
1704
1705
1706#ifdef HAVE_OSG
1707long
1708GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1710 return 1;
1711}
1712#endif
1713
1714
1715long
1716GUIApplicationWindow::onCmdFeedback(FXObject*, FXSelector, void*) {
1717 // create and open feedback dialog
1718 GUIDialog_Feedback* feedback = new GUIDialog_Feedback(this);
1719 feedback->create();
1720 feedback->show(PLACEMENT_OWNER);
1721 return 1;
1722}
1723
1724
1725long
1726GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
1727 GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this);
1728 about->create();
1729 about->show(PLACEMENT_OWNER);
1730 return 1;
1731}
1732
1733
1734long
1735GUIApplicationWindow::onCmdHallOfFame(FXObject*, FXSelector, void*) {
1737 hall->create();
1738 hall->show(PLACEMENT_OWNER);
1739 return 1;
1740}
1741
1742
1743long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1744 FXEvent* event = (FXEvent*)ptr;
1745 FXString string = GUIUserIO::clipped.c_str();
1746 setDNDData(FROM_CLIPBOARD, event->target, string);
1747 return 1;
1748}
1749
1750
1751long
1752GUIApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
1753 eventOccurred();
1754 return 1;
1755}
1756
1757
1758long
1759GUIApplicationWindow::onRunThreadEvent(FXObject*, FXSelector, void*) {
1760 eventOccurred();
1761 return 1;
1762}
1763
1764
1765void
1767 while (!myEvents.empty()) {
1768 // get the next event
1769 GUIEvent* e = myEvents.top();
1770 myEvents.pop();
1771 // process
1772 switch (e->getOwnType()) {
1775 setFocus();
1776 break;
1778 if (myRunThread->networkAvailable()) { // avoid race-condition related crash if reload was pressed
1780 }
1781 break;
1789 break;
1791 GUIEvent_AddView* ave = dynamic_cast<GUIEvent_AddView*>(e);
1793 if (ave->getSchemeName() != "") {
1794 MFXComboBoxIcon* sCombo = v->getColoringSchemesCombo();
1795 int index = sCombo->findItem(ave->getSchemeName().c_str());
1796 if (index >= 0) {
1797 sCombo->setCurrentItem(index);
1798 }
1799 v->setColorScheme(ave->getSchemeName());
1800 }
1801 break;
1802 }
1804 GUIEvent_CloseView* ave = dynamic_cast<GUIEvent_CloseView*>(e);
1805 removeViewByID(ave->getCaption());
1806 break;
1807 }
1810 break;
1811 default:
1812 break;
1813 }
1814 delete e;
1815 }
1816 myToolBar2->forceRefresh();
1817 myToolBar3->forceRefresh();
1818}
1819
1820
1821void
1823 myAmLoading = false;
1825 // check whether the loading was successfull
1826 if (ec->myNet == nullptr) {
1827 // report failure
1828 setStatusBarText(TLF("Loading of '%' failed!", ec->myFile));
1831 getApp()->exit(1);
1832 }
1833 } else {
1834 // initialise simulation thread
1835 if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1838 getApp()->exit(1);
1839 }
1840 } else {
1841 // report success
1842 setStatusBarText(TLF("'%' loaded.", ec->myFile));
1844 myWasStarted = false;
1846 // initialise views
1847 myViewNumber = 0;
1849 // check/record settings file modification time
1850 long long mTime = myGuiSettingsFileMTime;
1851 if (ec->mySettingsFiles.size() > 0) {
1852 for (std::string fname : ec->mySettingsFiles) {
1853 mTime = MAX2(mTime, SysUtils::getModifiedTime(fname));
1854 }
1855 }
1856 // always reload if settings were modified or to restore multiple views
1857 if (!myIsReload) {
1859 }
1860 if (ec->mySettingsFiles.size() > 0 && (!myIsReload || myGuiSettingsFileMTime < mTime || ec->mySettingsFiles.size() > 1)) {
1861 // open a view for each file and apply settings
1862 for (std::string fname : ec->mySettingsFiles) {
1863 GUISettingsHandler settings(fname);
1864 GUISUMOViewParent::ViewType vt = defaultType;
1865 if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
1867 }
1868 if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
1870 }
1871 GUISUMOAbstractView* view = openNewView(vt);
1872 if (view == nullptr) {
1873 break;
1874 }
1875 if (settings.getSettingName() != "") {
1876 view->setColorScheme(settings.getSettingName());
1877 MFXComboBoxIcon* sCombo = view->getColoringSchemesCombo();
1878 int index = sCombo->findItem(settings.getSettingName().c_str());
1879 if (index >= 0) {
1880 sCombo->setCurrentItem(index);
1881 }
1882 }
1883 view->addDecals(settings.getDecals());
1884 settings.applyViewport(view);
1885 settings.setSnapshots(view);
1886 if (settings.getDelay() > 0.) {
1887 mySimDelay = settings.getDelay();
1888 }
1889 if (settings.getBreakpoints().size() > 0) {
1891 myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
1892 myRunThread->getBreakpointLock().unlock();
1893 }
1894 myJamSounds = settings.getEventDistribution("jam");
1895 myCollisionSounds = settings.getEventDistribution("collision");
1896 if (settings.getJamSoundTime() > 0) {
1897 myJamSoundTime = settings.getJamSoundTime();
1898 }
1899 }
1900 } else {
1901 openNewView(defaultType);
1902 }
1903 myGuiSettingsFileMTime = mTime;
1904 if (!OptionsCont::getOptions().isDefault("delay")) {
1905 setDelay(OptionsCont::getOptions().getFloat("delay"));
1906 mySimDelaySlider->setValue((int)mySimDelay);
1907 mySimDelaySpinner->setValue(mySimDelay);
1908 }
1909 if (!OptionsCont::getOptions().isDefault("breakpoints") && !myIsReload) {
1910 std::vector<SUMOTime> breakpoints;
1911 for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
1912 SUMOTime t = string2time(val);
1913 // round down to nearest reachable time step
1914 t -= t % DELTA_T;
1915 breakpoints.push_back(t);
1916 }
1917 std::sort(breakpoints.begin(), breakpoints.end());
1919 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1920 myRunThread->getBreakpointLock().unlock();
1921 }
1922 if (!OptionsCont::getOptions().isDefault("selection-file")) {
1923 delete myDynamicSelection;
1924 myDynamicSelection = new std::stringstream();
1925 std::string msg = gSelected.load(OptionsCont::getOptions().getString("selection-file"), GLO_MAX, myDynamicSelection);
1926 if (msg != "") {
1927 WRITE_ERRORF("Errors while loading selection: %", msg.c_str());
1928 }
1929 if (!myDynamicSelection->str().empty()) {
1930 std::string dummy;
1931 int numNotFound = 0;
1932 while (myDynamicSelection->good()) {
1933 (*myDynamicSelection) >> dummy;
1934 numNotFound++;
1935 }
1936 myDynamicSelection->clear(); // first clear error state before seek works
1937 myDynamicSelection->seekg(0);
1938 // @note for some reason the last line is read twice
1939 WRITE_MESSAGEF("% dynamic objects not present while loading selection", numNotFound - 1);
1940 }
1941 }
1942 myTLSGame = OptionsCont::getOptions().getString("game.mode") == "tls";
1943 if (OptionsCont::getOptions().getBool("game")) {
1944 if (myTLSGame) {
1945 setTitle(TL("SUMO Interactive Traffic Light"));
1946 } else {
1947 setTitle(TL("SUMO Interactive Demand-Responsive-Transport"));
1948 }
1949 onCmdGaming(nullptr, 0, nullptr);
1950 } else {
1951 // set simulation name on the caption
1952 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str()));
1953 }
1954 if (ec->myViewportFromRegistry) {
1955 Position off;
1956 off.set(getApp()->reg().readRealEntry("viewport", "x"),
1957 getApp()->reg().readRealEntry("viewport", "y"),
1958 getApp()->reg().readRealEntry("viewport", "z"));
1959 Position p(off.x(), off.y(), 0);
1960 GUISUMOAbstractView* view = myGLWindows[0]->getView();
1961 view->setViewportFromToRot(off, p, 0);
1962 }
1963 // set simulation step begin information
1964 myLCDLabel->setText("----------------");
1965 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
1966 (*it)->setText("-");
1967 }
1968 // initialize scale from options unless already set in the UI
1969 if (myDemandScaleSpinner->getValue() == 1 || !OptionsCont::getOptions().isDefault("scale")) {
1971 }
1973 }
1974 }
1975 getApp()->endWaitCursor();
1976 // start if wished
1978 onCmdStart(nullptr, 0, nullptr);
1979 }
1980 update();
1981}
1982
1983
1984void
1986#ifdef WIN32
1987 long t = SysUtils::getCurrentMillis();
1988 // only skip if the simulation is running
1989 if (t - myLastStepEventMillis < MIN_DRAW_DELAY && myRunThread->simulationIsStopable()) {
1990 // do not try to redraw with more than 50FPS (#6371)
1991 return;
1992 }
1994#endif
1996 const int running = myRunThread->getNet().getVehicleControl().getRunningVehicleNo();
1997 const int backlog = myRunThread->getNet().getInsertionControl().getWaitingVehicleNo();
1998 if (backlog > running) {
1999 if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::GREENVEHICLE)) {
2001 }
2002 } else {
2003 if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::YELLOWVEHICLE)) {
2005 }
2006 }
2007 myStatButtons.front()->setText(toString(running).c_str());
2008 if (myRunThread->getNet().hasPersons()) {
2009 if (!myStatButtons[1]->shown()) {
2010 myStatButtons[1]->show();
2011 }
2013 }
2014 if (myRunThread->getNet().hasContainers()) {
2015 if (!myStatButtons[2]->shown()) {
2016 myStatButtons[2]->show();
2017 }
2019 }
2020 if (myAmGaming) {
2021 if (myTLSGame) {
2023 } else {
2025 }
2026 }
2028 getApp()->forceRefresh(); // restores keyboard focus
2029 }
2030 // try to load dynamic selection
2031 if (myDynamicSelection != nullptr) {
2032 std::stringstream tmp;
2034 if (tmp.str().empty()) {
2035 delete myDynamicSelection;
2036 myDynamicSelection = nullptr;
2037 } else {
2038 myDynamicSelection->str(tmp.str());
2039 myDynamicSelection->clear(); // first clear error state before seek works
2040 myDynamicSelection->seekg(0);
2041 }
2042 }
2044 update();
2045}
2046
2047
2048void
2050 GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
2052 setStatusBarText(ec->getMsg());
2053 } else {
2055 }
2056}
2057
2058
2059void
2062 onCmdStop(nullptr, 0, nullptr);
2063 if (ec->getReason() == MSNet::SIMSTATE_LOADING) {
2064 onCmdReload(nullptr, 0, nullptr);
2065 } else if (GUIGlobals::gQuitOnEnd) {
2067 getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
2068 } else if (GUIGlobals::gDemoAutoReload) {
2069 onCmdReload(nullptr, 1, nullptr);
2070 } else if (!myHaveNotifiedAboutSimEnd) {
2071 // GUIRunThread::deleteSim() triggers the final message to the log file
2072 // (this will never reach the GUI but we cannot use WRITE_MESSAGE here
2073 // to avoid a duplicate log entry)
2075 TLF("Simulation ended at time: %. (%)",
2077 // build the text
2078 const std::string text = TLF("Simulation ended at time: %.", time2string(ec->getTimeStep())) + "\n" +
2079 TL("Reason:") + MSNet::getStateMessage(ec->getReason()) + "\n" +
2080 TL("Do you want to close all open files and views?");
2081 FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, TL("Simulation ended"), "%s", text.c_str());
2082 if (answer == 1) { //1:yes, 2:no, 4:esc
2084 } else {
2087 update();
2088 }
2090 }
2091}
2092
2093
2094void
2099#ifdef HAVE_DANGEROUS_SOUNDS // disable user-configurable command execution for public build
2100 if (myJamSounds.getOverallProb() > 0) {
2101 // play honking sound if some vehicle is waiting too long
2102 for (; it != end; ++it) {
2103 // XXX use impatience instead of waiting time ?
2104 if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
2105 const std::string cmd = myJamSounds.get(&myGamingRNG);
2106 if (cmd != "") {
2107 // yay! fun with dangerous commands... Never use this over the internet
2109 // one sound per simulation step is enough
2110 break;
2111 }
2112 }
2113 }
2114 }
2117 if (myPreviousCollisionNumber != collisions) {
2118 const std::string cmd = myCollisionSounds.get(&myGamingRNG);
2119 if (cmd != "") {
2120 // yay! fun with dangerous commands... Never use this over the internet
2122 }
2123 myPreviousCollisionNumber = collisions;
2124 }
2125 }
2126#endif
2127 // update performance indicators
2128 for (it = vc.loadedVehBegin(); it != end; ++it) {
2129 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2130 assert(veh != 0);
2131 if (veh->isOnRoad() && !veh->isStopped()) {
2132 const double vmax = veh->getLane()->getVehicleMaxSpeed(veh);
2133 if (veh->getSpeed() < SUMO_const_haltingSpeed) {
2135 if (veh->getVClass() == SVC_EMERGENCY) {
2137 }
2138 }
2139 myTimeLoss += TIME2STEPS(TS * (vmax - veh->getSpeed()) / vmax); // may be negative with speedFactor > 1
2140 }
2141
2142 }
2146}
2147
2148
2149void
2151 // update performance indicators
2155
2158 for (auto it = vc.loadedVehBegin(); it != end; ++it) {
2159 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2160 assert(veh != 0);
2161 if (veh->isOnRoad() && !veh->isStopped()) {
2163 }
2164 }
2166}
2167
2168
2169void
2171 if (!myAmLoading) {
2173 getApp()->beginWaitCursor();
2174 myAmLoading = true;
2175 myIsReload = false;
2177 gSchemeStorage.saveViewport(0, 0, -1, 0); // recenter view
2179 setStatusBarText(TLF("Loading '%'.", file));
2180 update();
2181 }
2182}
2183
2184
2187 if (!myRunThread->networkAvailable()) {
2188 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
2189 return nullptr;
2190 }
2191 GUISUMOAbstractView* oldView = nullptr;
2192 if (myMDIClient->numChildren() > 0) {
2193 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2194 if (w != nullptr) {
2195 oldView = w->getView();
2196 }
2197 }
2198 if (caption == "") {
2199 caption = "View #" + toString(myViewNumber++);
2200 }
2201 FXuint opts = MDI_TRACKING;
2202 GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
2203 this, GUIIconSubSys::getIcon(GUIIcon::SUMO_MINI), opts, 10, 10, 200, 100);
2205 if (oldView != nullptr) {
2206 // copy viewport
2207 oldView->copyViewportTo(v);
2208 }
2209 w->create();
2210 if (myMDIClient->numChildren() == 1) {
2211 w->maximize();
2212 } else {
2213 myMDIClient->vertical(true);
2214 }
2215 myMDIClient->setActiveChild(w);
2216
2217 return v;
2218}
2219
2220
2221FXGLCanvas*
2223 if (myMDIClient->numChildren() == 0) {
2224 return nullptr;
2225 }
2226 GUISUMOViewParent* share_tmp1 =
2227 static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
2228 return share_tmp1->getBuildGLCanvas();
2229}
2230
2231
2232void
2234 myTrackerLock.lock();
2235 myLCDLabel->setText("----------------");
2236 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2237 (*it)->setText("-");
2238 if (it != myStatButtons.begin()) {
2239 (*it)->hide();
2240 }
2241 }
2242 // delete the simulation
2244 // reset the caption
2245 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
2246 // remove trackers and other external windows (must be delayed until deleteSim)
2247 while (!myGLWindows.empty()) {
2248 delete myGLWindows.front();
2249 }
2250 // make a copy because deleting modifyes the vector;
2251 std::vector<FXMainWindow*> trackerWindows = myTrackerWindows;
2252 for (FXMainWindow* const window : trackerWindows) {
2253 delete window;
2254 }
2255 myTrackerWindows.clear();
2256 // clear selected items
2257 gSelected.clear();
2258 // add a separator to the log
2260 myTrackerLock.unlock();
2261 // remove coordinate information
2262 myGeoCoordinate->setText(TL("N/A"));
2263 myCartesianCoordinate->setText(TL("N/A"));
2264 if (myTestCoordinate) {
2265 myTestCoordinate->setText(TL("N/A"));
2266 }
2267 //
2270 update();
2271}
2272
2273
2274FXCursor*
2276 return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
2277}
2278
2279
2284
2285
2286double
2290
2291
2292void
2294 loadConfigOrNet("");
2295 if (wait) {
2296 while (myAmLoading) {
2297 myRunThread->sleep(50);
2298 }
2299 }
2300}
2301
2302
2303void
2305 myStatusbar->getStatusLine()->setText(text.c_str());
2306 myStatusbar->getStatusLine()->setNormalText(text.c_str());
2307}
2308
2309
2310void
2312 myRecentNetworks.appendFile(f);
2313}
2314
2315
2316void
2318 myRecentConfigs.appendFile(f);
2319}
2320
2321
2322void
2324 if (myShowTimeAsHMS) {
2325 myLCDLabel->setToolTipText("HH:MM:SS");
2326 if (myAmGaming) {
2328 myTimeLossLabel->setToolTipText("HH:MM:SS");
2330 }
2331 } else {
2332 myLCDLabel->setToolTipText(TL("seconds"));
2333 if (myAmGaming) {
2335 myTimeLossLabel->setToolTipText(TL("seconds"));
2337 }
2338 }
2339}
2340
2341
2342void
2344 time -= DELTA_T; // synchronize displayed time with netstate output
2345 if (time < 0) {
2346 myLCDLabel->setText("----------------");
2347 return;
2348 }
2349 if (myAmGaming) {
2350 // show time counting backwards
2351 time = myRunThread->getSimEndTime() - time;
2352 }
2353 std::ostringstream str;
2354 str << std::setfill('0');
2355 const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0;
2356 if (myShowTimeAsHMS) {
2357 SUMOTime day = time / 86400000;
2358 if (day > 0) {
2359 str << day << '-';
2360 time %= 86400000;
2361 }
2362 str << std::setw(2);
2363 str << time / 3600000 << '-';
2364 time %= 3600000;
2365 str << std::setw(2) << time / 60000 << '-';
2366 time %= 60000;
2367 }
2368 str << std::setw(2) << time / 1000;
2369 if (!hideFraction) {
2370 str << '.' << std::setw(3) << time % 1000;
2371 }
2372 myLCDLabel->setText(str.str().c_str());
2373}
2374
2375
2376void
2378 if (press != nullptr) {
2379 myHotkeyPress[key] = press;
2380 }
2381 if (release != nullptr) {
2382 myHotkeyRelease[key] = release;
2383 }
2384}
2385
2386
2387long
2388GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* ptr) {
2389 FXEvent* e = (FXEvent*) ptr;
2390 // PgUp and PgDown switch between widgets by default and binding them via menu shortcuts does not work reliably
2391 // so we must intercept them before FXMainWindow can handle it
2392 if (e->code == FX::KEY_Page_Up) {
2393 onCmdDelayInc(nullptr, 0, nullptr);
2394 } else if (e->code == FX::KEY_Page_Down) {
2395 onCmdDelayDec(nullptr, 0, nullptr);
2396 } else {
2397 // disable hotkeys without modifiers for the game
2398 const bool ignoreSimple = myAmGaming && (e->state & (CONTROLMASK | SHIFTMASK | ALTMASK)) == 0;
2399 const long handled = ignoreSimple ? 0 : FXMainWindow::onKeyPress(o, sel, ptr);
2400 if (handled == 0 && myMDIClient->numChildren() > 0) {
2401 auto it = myHotkeyPress.find(e->code);
2402 if (it != myHotkeyPress.end()) {
2403 it->second->execute(SIMSTEP);
2404 }
2405 if (!ignoreSimple) {
2406 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2407 if (w != nullptr) {
2408 w->onKeyPress(nullptr, sel, ptr);
2409 }
2410 }
2411 }
2412 }
2413 return 0;
2414}
2415
2416
2417long
2418GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* ptr) {
2419 const long handled = FXMainWindow::onKeyRelease(o, sel, ptr);
2420 if (handled == 0 && myMDIClient->numChildren() > 0) {
2421 FXEvent* e = (FXEvent*) ptr;
2422 auto it = myHotkeyRelease.find(e->code);
2423 if (it != myHotkeyRelease.end()) {
2424 it->second->execute(SIMSTEP);
2425 }
2426 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2427 if (w != nullptr) {
2428 w->onKeyRelease(nullptr, sel, ptr);
2429 }
2430 }
2431 return 0;
2432}
2433
2434
2435double
2437 return mySimDelay;
2438}
2439
2440
2441void
2443 mySimDelay = delay;
2444}
2445
2446
2447void
2449 myEventMutex.lock();
2450 myEvents.push_back(event);
2452 //myEventCondition.wait(myEventMutex);
2453 myEventMutex.unlock();
2454}
2455
2456
2457void
2458GUIApplicationWindow::setBreakpoints(const std::vector<SUMOTime>& breakpoints) {
2459 if (myRunThread != nullptr) {
2461 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
2462 myRunThread->getBreakpointLock().unlock();
2464 }
2465}
2466
2467
2468void
2470 const SUMOTime begin = string2time(OptionsCont::getOptions().getString("begin"));
2471 if (time >= begin) {
2472 // ensure breakpoint is valid
2473 time -= (time - begin) % DELTA_T;
2474 std::vector<SUMOTime> breakpoints = retrieveBreakpoints();
2475 if (std::find(breakpoints.begin(), breakpoints.end(), time) == breakpoints.end()) {
2476 breakpoints.push_back(time);
2477 std::sort(breakpoints.begin(), breakpoints.end());
2478 setBreakpoints(breakpoints);
2479 setStatusBarText(TLF("Set breakpoint at %", time2string(time)));
2480 }
2481 }
2482}
2483
2484
2485const std::vector<SUMOTime>
2488 std::vector<SUMOTime> result = myRunThread->getBreakpoints();
2489 myRunThread->getBreakpointLock().unlock();
2490 return result;
2491}
2492
2493
2494void
2498
2499/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ MID_HOTKEY_CTRL_Q_CLOSE
Main window closes.
Definition GUIAppEnum.h:115
@ ID_RUNTHREAD_EVENT
The Simulation execution 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_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_HOTKEY_CTRL_A_STARTSIMULATION_OPENADDITIONALS
Start the simulation in SUMO and open Additionals Elements in netedit.
Definition GUIAppEnum.h:83
@ 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_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:298
#define WRITE_ERRORF(...)
Definition MsgHandler.h:305
#define TL(string)
Definition MsgHandler.h:315
#define TLF(string,...)
Definition MsgHandler.h:317
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:69
#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.
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.
GUIApplicationWindow(FXApp *a, const std::string &configPattern)
Constructor.
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.
std::string myConfigPattern
Input file pattern.
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:786
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.
ComboBox with icon.
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:112
static FXString getTitleText(const FXString &appname, FXString filename="")
Returns the title text in dependence to an optional file name.
Definition MFXUtils.cpp:60
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:39
static FXString assureExtension(const FXString &filename, const FXString &defaultExtension)
Corrects missing extension.
Definition MFXUtils.cpp:69
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:1677
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:935
void quickReload()
reset state to the beginning without reloading the network
Definition MSNet.cpp:1656
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:320
bool hasContainers() const
Returns whether containers are simulated.
Definition MSNet.h:411
bool hasPersons() const
Returns whether persons are simulated.
Definition MSNet.h:395
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition MSNet.h:431
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition MSNet.h:501
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:378
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:85
double x() const
Returns the x-position.
Definition Position.h:55
double y() const
Returns the y-position.
Definition Position.h:60
static const RGBColor GREEN
Definition RGBColor.h:186
static const RGBColor RED
named colors
Definition RGBColor.h:185
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.
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