Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
GUIApplicationWindow.cpp
Go to the documentation of this file.
1/****************************************************************************/
2// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3// Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
22// The main window of the SUMO-gui.
23/****************************************************************************/
24#include <config.h>
25
26#ifdef HAVE_VERSION_H
27#include <version.h>
28#endif
29
30#include <fxkeys.h>
31
32#include <guisim/GUILane.h>
33#include <guisim/GUINet.h>
36#include <microsim/MSGlobals.h>
42#include <netload/NLHandler.h>
71#include <utils/xml/XMLSubSys.h>
72
76#include "GUIGlobals.h"
77#include "GUILoadThread.h"
78#include "GUIRunThread.h"
84
85
86#define MIN_DRAW_DELAY 20
87//#define HAVE_DANGEROUS_SOUNDS
88
89#define STAT_VEHS 0
90#define STAT_DELAYED 1
91#define STAT_TELEPORTS 2
92#define STAT_PERSONS 3
93#define STAT_CONTAINERS 4
94
95// ===========================================================================
96// FOX-declarations
97// ===========================================================================
98FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[] = {
99 // close
103 FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GUIApplicationWindow::onCmdQuit),
104 // toolbar
121 // gaming
132 // OSG
133#ifdef HAVE_OSG
134 FXMAPFUNC(SEL_COMMAND, MID_NEW_OSGVIEW, GUIApplicationWindow::onCmdNewOSG),
136
137#endif
140 // Time
147 FXMAPFUNC(SEL_COMMAND, MID_DELAY_INC, GUIApplicationWindow::onCmdDelayInc),
148 FXMAPFUNC(SEL_COMMAND, MID_DELAY_DEC, GUIApplicationWindow::onCmdDelayDec),
149 FXMAPFUNC(SEL_COMMAND, MID_SIMSAVE, GUIApplicationWindow::onCmdSaveState),
150 FXMAPFUNC(SEL_COMMAND, MID_SIMLOAD, GUIApplicationWindow::onCmdLoadState),
158 // Stats
162 // these functions do not assign shortcut keys to commands, but rather affect the button enable status upon other events (e.g. simulation loaded)
163 // since those events are invoked through pseudo key events (?), the same key shortcuts as in cmd must be supplied as well
193 FXMAPFUNC(SEL_COMMAND, MID_HOTKEYS, GUIApplicationWindow::onCmdHotkeys),
194 FXMAPFUNC(SEL_COMMAND, MID_TUTORIAL, GUIApplicationWindow::onCmdTutorial),
196 FXMAPFUNC(SEL_COMMAND, MID_FEEDBACK, GUIApplicationWindow::onCmdFeedback),
197 FXMAPFUNC(SEL_COMMAND, MID_NEWS, GUIMainWindow::onCmdNews),
199 // forward requests to the active view
218 // languages
239 // coordinate inputs
246 // keys
247 FXMAPFUNC(SEL_KEYPRESS, 0, GUIApplicationWindow::onKeyPress),
248 FXMAPFUNC(SEL_KEYRELEASE, 0, GUIApplicationWindow::onKeyRelease),
249 // clipboard
250 FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GUIApplicationWindow::onClipboardRequest),
251 // events
256};
257
258// Object implementation
259FXIMPLEMENT(GUIApplicationWindow, FXMainWindow, GUIApplicationWindowMap, ARRAYNUMBER(GUIApplicationWindowMap))
260
261// ===========================================================================
262// static members
263// ===========================================================================
265
266
267// ===========================================================================
268// member method definitions
269// ===========================================================================
270#ifdef _MSC_VER
271#pragma warning(push)
272#pragma warning(disable: 4355) // mask warning about "this" in initializers
273#endif
275 GUIMainWindow(a),
276 myFileMenuRecentNetworks(new FXMenuPane(this)),
277 myFileMenuRecentConfigs(new FXMenuPane(this)),
278 myRecentNetworks(a, "networks"),
279 myRecentConfigs(a, "configs"),
280 myLastStepEventMillis(SysUtils::getCurrentMillis() - MIN_DRAW_DELAY) {
281 // init icons
283 // init Textures
285 // init cursors
287 // disable tooltips
288 a->setTooltipTime(1000000000);
289 a->setTooltipPause(1000000000);
290}
291#ifdef _MSC_VER
292#pragma warning(pop)
293#endif
294
295
300
301
302void
304 // don't do this twice
305 if (hadDependentBuild) {
306 return;
307 }
308 hadDependentBuild = true;
309 setTarget(this);
310 setSelector(MID_WINDOW);
311 // build menu bar
312 myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBar);
314 new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
316 // build the thread - io
321 // build the status bar
322 myStatusbar = new FXStatusBar(this, GUIDesignStatusBar);
323 {
324 // build TraCi info
326 auto button = GUIDesigns::buildFXButton(myTraCiFrame, "TraCI", "", "", nullptr, this, MID_TRACI_STATUS, GUIDesignButtonStatusBarFixed);
327 button->setBackColor(FXRGBA(253, 255, 206, 255));
328 if (TraCIServer::getInstance() == nullptr) {
329 myTraCiFrame->hide();
330 }
331 // build geo coordiantes
333 myGeoCoordinate = new FXTextField(myGeoFrame, 26, this, MID_GEO_COORDINATE, FRAME_NONE | LAYOUT_CENTER_Y | TEXTFIELD_ENTER_ONLY, 0, 0, 0, GUIDesignHeight, 2, 2, 1, 1);
334 myGeoCoordinate->setHelpText(TL("Original coordinate (before coordinate transformation in netconvert). Enter 'lat, lon' or 'lat:... lon:...' to center view"));
335 myGeoCoordinate->setTipText(TL("Enter 'lat, lon' to center view"));
336 myGeoCoordinate->setBackColor(myGeoFrame->getBackColor());
337 myGeoCoordinate->setText(TL("N/A"));
338 myGeoCoordinate->disable();
339 myGeoCoordinate->setEditable(false);
340 // build cartesian coordinates
342 myCartesianCoordinate = new FXTextField(myCartesianFrame, 22, this, MID_CARTESIAN_COORDINATE, FRAME_NONE | LAYOUT_CENTER_Y | TEXTFIELD_ENTER_ONLY, 0, 0, 0, GUIDesignHeight, 2, 2, 1, 1);
343 myCartesianCoordinate->setHelpText(TL("Network coordinate. Enter 'x, y' to center view"));
344 myCartesianCoordinate->setTipText(TL("Enter 'x, y' to center view"));
345 myCartesianCoordinate->setBackColor(myCartesianFrame->getBackColor());
346 myCartesianCoordinate->setText(TL("N/A"));
347 myCartesianCoordinate->disable();
348 myCartesianCoordinate->setEditable(false);
349 // build buttons
350 std::vector<std::string> help({
351 TL("number of running vehicles"),
352 TL("number of insertion backlogged vehicles"),
353 TL("percentage of teleports per departed vehicles"),
354 TL("number of active persons"),
355 TL("number of active containers")});
356
357 const GUIIcon greenVehIcon = (OptionsCont::getOptions().isSet("mesosim") && OptionsCont::getOptions().getBool("mesosim")) ?
361 myStatButtons.back()->hide();
363 myStatButtons.back()->hide();
364 GUIIcon greenPersonIcon = GUIIcon::GREENPERSON;
365 if (OptionsCont::getOptions().isSet("pedestrian.model")) {
366 const std::string pedModel = OptionsCont::getOptions().getString("pedestrian.model");
367 if (StringUtils::to_lower_case(pedModel) == "noninteracting") {
369 } else if (StringUtils::to_lower_case(pedModel) == "jupedsim") {
370 greenPersonIcon = GUIIcon::GREEN_PERSON_JUPEDSIM;
371 }
372 }
374 myStatButtons.back()->hide();
376 myStatButtons.back()->hide();
377 }
378 // make the window a mdi-window
379 myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
381 myMDIMenu = new FXMDIMenu(this, myMDIClient);
382 new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
383 new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
384 new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
385 new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
386 // build the message window
388 // fill menu and tool bar
389 fillMenuBar();
390 myToolBar6->hide();
391 myToolBar7->hide();
392 myToolBar9->hide();
393 myToolBar10->hide();
394 // build additional threads
395 myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent, isLibsumo);
397 // set the status bar
398 setStatusBarText(TL("Ready."));
399 // set the caption
400 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
401 // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
402 myRunThread->start();
405}
406
407
408void
411 gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
412 FXMainWindow::create();
413 myMenuBarDrag->create();
414 myToolBarDrag1->create();
415 myToolBarDrag2->create();
416 myToolBarDrag3->create();
417 myToolBarDrag4->create();
418 myToolBarDrag5->create();
419 myToolBarDrag6->create();
420 myToolBarDrag7->create();
421 myFileMenu->create();
422 mySelectByPermissions->create();
423 myEditMenu->create();
424 mySettingsMenu->create();
425 myLocatorMenu->create();
426 myControlMenu->create();
427 myWindowMenu->create();
428 myLanguageMenu->create();
429 myHelpMenu->create();
430 FXint textWidth = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
431 myCartesianFrame->setWidth(textWidth);
432 myGeoFrame->setWidth(textWidth);
433 if (myTestFrame) {
434 myTestFrame->setWidth(textWidth);
435 }
436
437 show(PLACEMENT_DEFAULT);
438 if (!OptionsCont::getOptions().isSet("window-size")) {
439 if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
440 maximize();
441 }
442 }
443 myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
444 myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
445 const std::string& onlineMaps = getApp()->reg().readStringEntry("gui", "onlineMaps", "");
446 for (const std::string& entry : StringTokenizer(onlineMaps, "\n").getVector()) {
447 const std::vector<std::string> split = StringTokenizer(entry, "\t").getVector();
448 if (split.size() == 2) {
449 myOnlineMaps[split[0]] = split[1];
450 }
451 }
452 if (myOnlineMaps.empty()) {
453 myOnlineMaps["GeoHack"] = "https://geohack.toolforge.org/geohack.php?params=%lat;%lon_scale:1000";
454 myOnlineMaps["Google Maps"] = "https://www.google.com/maps/search/?api=1&query=%lat,%lon&zoom=19";
455 myOnlineMaps["OSM"] = "https://www.openstreetmap.org/?mlat=%lat&mlon=%lon&zoom=18&layers=M";
456 }
458 checkNews();
459}
460
461
464 myRunThread->join();
466 // close icons
469 // delete visual
470 delete myGLVisual;
471 // delete some non-parented windows
472 delete myToolBarDrag1;
473 delete mySimDelayTarget;
474 // delete rest of elements
477 delete myRunThread;
478 delete myFileMenu;
479 delete myEditMenu;
481 delete mySettingsMenu;
482 delete myLocatorMenu;
483 delete myControlMenu;
484 delete myLanguageMenu;
485 delete myWindowMenu;
486 delete myHelpMenu;
487 delete myLoadThread;
488
489 while (!myEvents.empty()) {
490 // get the next event
491 GUIEvent* e = myEvents.top();
492 myEvents.pop();
493 delete e;
494 }
495 for (auto item : myHotkeyPress) {
496 delete item.second;
497 }
498 for (auto item : myHotkeyRelease) {
499 delete item.second;
500 }
501}
502
503
504void
506 FXMainWindow::detach();
507 myMenuBarDrag->detach();
508 myToolBarDrag1->detach();
509}
510
511
512void
513GUIApplicationWindow::addToWindowsMenu(FXMenuPane* /*menuPane*/) {
514 // unused, implement in children
515}
516
517
518void
520 // build file menu
521 myFileMenu = new FXMenuPane(this);
524 TL("New Window"), "Ctrl+Shift+N", TL("Open a new sumo-gui window."),
525 nullptr, this, MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW);
526 new FXMenuSeparator(myFileMenu);
528 TL("&Open Simulation..."), "Ctrl+O", TL("Open a simulation (Configuration file)."),
531 TL("Open &Network..."), "Ctrl+N", TL("Open a network."),
534 TL("Open Shapes "), "Ctrl+P", TL("Load POIs and Polygons for visualization."),
537 TL("Open EdgeData "), "Ctrl+U", TL("Load edge related data for visualization."),
540 TL("&Reload"), "Ctrl+R", TL("Reloads the simulation / the network."),
543 TL("Quick-Reload"), "Ctrl+0", TL("Reloads the simulation (but not network)."),
545 new FXMenuSeparator(myFileMenu);
547 TL("Save Configuration"), "Ctrl+Shift+S", TL("Save current options as a configuration file."),
550 TL("Close"), "Ctrl+W", TL("Close the simulation."),
552 new FXMenuSeparator(myFileMenu);
553 // build recent files
556 new FXMenuSeparator(myFileMenu);
558 TL("&Quit"), "Ctrl+Q", TL("Quit the Application."),
559 nullptr, this, MID_HOTKEY_CTRL_Q_CLOSE);
560 // build edit menu
561 mySelectByPermissions = new FXMenuPane(this);
562 std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
563 for (const auto& vehicleClass : vehicleClasses) {
565 }
566 myEditMenu = new FXMenuPane(this);
569 TL("Edit Selected..."), "Ctrl+E", TL("Opens a dialog for editing the list of selected items."),
571 mySelectLanesMenuCascade = new FXMenuCascade(myEditMenu, TL("Select lanes which allow..."), GUIIconSubSys::getIcon(GUIIcon::FLAG), mySelectByPermissions);
572 mySelectLanesMenuCascade->setHelpText(TL("Opens a menu for selecting a vehicle class by which to selected lanes."));
573 new FXMenuSeparator(myEditMenu);
575 TL("Set Breakpoint"), "B", TL("Sets a breakpoint at the current simulation step"),
578 TL("Set Breakpoint with offset"), "Alt+B", TL("Sets a breakpoint at the current simulation step + offset configured in application settings"),
581 TL("Edit Breakpoints"), "Ctrl+B", TL("Opens a dialog for editing breakpoints."),
584 TL("Edit Visualization"), "F9", TL("Opens a dialog for editing visualization settings."),
587 TL("Edit Viewport"), "Ctrl+I", TL("Opens a dialog for editing viewing area, zoom and rotation."),
589 new FXMenuSeparator(myEditMenu);
590 // add open in sumo options
591 myLoadAdditionalsInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load additionals in netedit"), TL("Load additionals in netedit."), this, MID_TOOLBAREDIT_LOADADDITIONALS);
592 myLoadAdditionalsInNetedit->setCheck(TRUE);
593 myLoadDemandInNetedit = GUIDesigns::buildFXMenuCheckbox(myEditMenu, TL("Load demand in netedit"), TL("Load demand in netedit."), this, MID_TOOLBAREDIT_LOADDEMAND);
594 myLoadDemandInNetedit->setCheck(FALSE);
596 TL("Open in netedit"), "Ctrl+T", TL("Opens current simulation in NETEDIT."),
599 TL("Open network in netedit"), "Ctrl+Shift+T", TL("Opens current network in NETEDIT."),
601 // build settings menu
602 mySettingsMenu = new FXMenuPane(this);
605 TL("Application Settings"), "Ctrl+H", TL("Open a Dialog for Application Settings editing."),
608 TL("Gaming Mode"), "Ctrl+G", TL("Toggle gaming mode on/off."),
611 TL("Full Screen Mode"), "Ctrl+F or F11", TL("Toggle full screen mode on/off."),
613 // build Locate menu
614 myLocatorMenu = new FXMenuPane(this);
617 TL("&Junctions"), "Shift+J", TL("Open a dialog for locating a Junction."),
620 TL("&Edges"), "Shift+E", TL("Open a dialog for locating an Edge."),
623 TL("&Vehicles"), "Shift+V", TL("Open a dialog for locating a Vehicle."),
626 TL("&Persons"), "Shift+P", TL("Open a dialog for locating a Person."),
629 TL("&Container"), "Shift+C", TL("Open a dialog for locating a Container."),
632 TL("&TLS"), "Shift+T", TL("Open a dialog for locating a Traffic Light."),
635 TL("&Additional"), "Shift+A", TL("Open a dialog for locating an Additional Structure."),
638 TL("P&oI"), "Shift+O", TL("Open a dialog for locating a Point of Interest."),
641 TL("Po&lygon"), "Shift+L", TL("Open a dialog for locating a Polygon."),
643 new FXMenuSeparator(myLocatorMenu);
644 GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Internal Structures"), TL("Show internal junctions and streets in locator dialog."), this, MID_LISTINTERNAL);
645 FXMenuCheck* listParking = GUIDesigns::buildFXMenuCheckbox(myLocatorMenu, TL("Show Parking Vehicles"), TL("Show parking vehicles in locator dialog."), this, MID_LISTPARKING);
646 listParking->setCheck(myListParking);
647 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);
648 // build control menu
649 // the shortcut designator is not only at text in the submenu but also defines the real shortcut key assigned with it!
650 // secondary shortcuts (ctrl+A, ctrl+S, ctrl+D) are defined in GUIShortcutsSubSys::buildSUMOAccelerators
651 myControlMenu = new FXMenuPane(this);
652 GUIDesigns::buildFXMenuTitle(myMenuBar, TL("Simulation"), nullptr, myControlMenu);
654 TL("Run"), "A or Spacebar", TL("Start/ Resume the simulation."),
657 TLC("Simulation", "Stop"), "S or Spacebar", TL("Halt the simulation."),
660 TL("Step"), "D", TL("Perform one simulation step."),
663 TL("Delay+"), "PgUp", TL("Increase simulation step delay."), nullptr, this, MID_DELAY_INC);
665 TL("Delay-"), "PgDn", TL("Decrease simulation step delay."), nullptr, this, MID_DELAY_DEC);
667 TL("Save"), "", TL("Save the current simulation state to a file."),
670 TL("Load"), "", TL("Load simulation state for the current network from file."),
672 // build windows menu
673 myWindowMenu = new FXMenuPane(this);
675 GUIDesigns::buildFXMenuCommandShortcut(myWindowMenu, TL("Open new view"), "", TL("Open a new microscopic view."), GUIIconSubSys::getIcon(GUIIcon::MICROVIEW), this, MID_NEW_MICROVIEW);
676#ifdef HAVE_OSG
678#endif
680 TL("Tile &Horizontally"), "", TL("Tile the views horizontally."),
681 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_HORI), myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
683 TL("Tile &Vertically"), "", TL("Tile the views vertically."),
684 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_VERT), myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
686 TL("Cascade"), "", TL("Cascade the views."),
688 myMDIClient, FXMDIClient::ID_MDI_CASCADE);
690 TL("&Close"), "", TL("Close the selected view."),
691 nullptr, myMDIClient, FXMDIClient::ID_MDI_CLOSE);
692 FXMenuSeparator* sep2 = new FXMenuSeparator(myWindowMenu);
693 sep2->setTarget(myMDIClient);
694 sep2->setSelector(FXMDIClient::ID_MDI_ANY);
695 // for whatever reason, sonar complains in the next line that sep2 may leak, but fox does the cleanup
696 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_1); // NOSONAR
697 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_2);
698 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_3);
699 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_4);
700 GUIDesigns::buildFXMenuCommand(myWindowMenu, TL("&Others..."), nullptr, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
701
702 new FXMenuSeparator(myWindowMenu);
703 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Status Line"), TL("Toggle the Status Bar on/off."), myStatusbar, FXWindow::ID_TOGGLESHOWN);
704 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Message Window"), TL("Toggle the Message Window on/off."), myMessageWindow, FXWindow::ID_TOGGLESHOWN);
705 GUIDesigns::buildFXMenuCommandShortcut(myWindowMenu, TL("Toggle Message Window and Status Line"), "Ctrl+Shift+W", TL("Show or hide both the Message Window and the Status Line."),
707 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Time"), TL("Toggle the Simulation Time on/off."), myToolBar3, FXWindow::ID_TOGGLESHOWN);
708 GUIDesigns::buildFXMenuCheckbox(myWindowMenu, TL("Show Simulation Delay"), TL("Toggle the Simulation Delay Entry on/off."), myToolBar4, FXWindow::ID_TOGGLESHOWN);
710
711 new FXMenuSeparator(myWindowMenu);
713 TL("Clear Message Window"), "", TL("Clear the message window."),
715 // build windows menu
717 // build help menu
718 myHelpMenu = new FXMenuPane(this);
720 TL("&Help"),
721 nullptr, myHelpMenu);
722 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Online Documentation"), "F1", TL("Open Online documentation."),
723 nullptr, this, MID_HOTKEY_F1_ONLINEDOCUMENTATION);
724 new FXMenuSeparator(myHelpMenu);
725 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Changelog"), "", TL("Open Changelog."),
726 nullptr, this, MID_CHANGELOG);
727 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Hotkeys"), "", TL("Open Hotkeys."),
728 nullptr, this, MID_HOTKEYS);
729 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Tutorial"), "", TL("Open Tutorial."),
730 nullptr, this, MID_TUTORIAL);
731 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Feedback"), "", TL("Open feedback dialog."),
732 nullptr, this, MID_FEEDBACK);
733 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&News"), "", TL("Show the latest SUMO news."),
734 nullptr, this, MID_NEWS);
735 new FXMenuSeparator(myHelpMenu);
736 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&About"), "F12", TL("About sumo-gui."),
738 // build SUMO Accelerators (hotkeys)
739 GUIShortcutsSubSys::buildAccelerators(getAccelTable(), this, true);
740}
741
742
743void
745 // file and simulation tool bar
746 {
747 myToolBarDrag1 = new FXToolBarShell(this, GUIDesignToolBar);
749 new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
750 // build file tools
751 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen simulation\tOpen a simulation (Configuration file)."),
753 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen network\tOpen a network."),
755 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tReload\tReloads the simulation / the network."),
757 }
758 // simulation toolbar
759 {
760 myToolBarDrag2 = new FXToolBarShell(this, GUIDesignToolBar);
762 new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
763 // build simulation tools
764 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tRun\tStart/Resume the loaded simulation."),
766 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStop\tHalt the running simulation."),
768 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStep\tPerform a single simulation step."),
770 }
771 // Simulation Step Display
772 {
773 myToolBarDrag3 = new FXToolBarShell(this, GUIDesignToolBar);
775 new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
776 new MFXButtonTooltip(myToolBar3, myStaticTooltipMenu, TL("Time:\tToggle between time formats\tToggle between seconds and hour:minute:seconds display."), nullptr, this, MID_TIME_TOGGLE, GUIDesignButtonToolbarText);
777
778 myLCDLabel = new MFXLCDLabel(myToolBar3, myStaticTooltipMenu, 16, nullptr, 0, JUSTIFY_RIGHT);
783 myLCDLabel->setText("----------------");
784 }
785 // Simulation Delay
786 {
787 myToolBarDrag4 = new FXToolBarShell(this, GUIDesignToolBar);
789 new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
790 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);
791 // create spinner for delay
792 mySimDelay = 0;
793 mySimDelayTarget = new FXDataTarget(mySimDelay);
795 // create slider
796 mySimDelaySlider = new FXSlider(myToolBar4, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSlider);
797 mySimDelaySlider->setRange(0, 1000);
798 mySimDelaySlider->setHeadSize(10);
799 mySimDelaySlider->setIncrement(50);
800 mySimDelaySlider->setTickDelta(100);
801 mySimDelaySlider->setValue((int)mySimDelay);
802 //mySimDelayTarget->setNumberFormat(0);
803 //mySimDelayTarget->setIncrements(1, 10, 10);
804 mySimDelaySpinner->setIncrement(10);
805 mySimDelaySpinner->setRange(0, 10000);
806 mySimDelaySpinner->setValue(mySimDelay);
807 }
808 // Scale traffic (flows and incrementally loaded vehicles)
809 {
810 myToolBarDrag8 = new FXToolBarShell(this, GUIDesignToolBar);
812 new FXToolBarGrip(myToolBar8, myToolBar8, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
813 myScaleTrafficTooltip = new MFXLabelTooltip(myToolBar8, myStaticTooltipMenu, TL("Scale Traffic:"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
814 myScaleTrafficTooltip->setHelpText(TL("Scale traffic volume from running flows and from vehicles that are loaded incrementally from route files."));
816 myDemandScaleSpinner->setIncrement(0.5);
817 myDemandScaleSpinner->setRange(0, 1000);
818 myDemandScaleSpinner->setValue(1);
819 }
820 // Views
821 {
822 myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBar);
824 new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
825 // build view tools
826 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new view") + std::string("\t") + TL("Open a new microscopic view.")).c_str(),
828#ifdef HAVE_OSG
829 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new 3D view") + std::string("\t") + TL("Open a new 3D view.")).c_str(),
831#endif
832 // add toggle button for tooltips in view on/off (by default unchecked)
834 myStaticTooltipMenu, (std::string("\t") + TL("Toggle View Tooltips") + std::string("\t") + TL("Toggles whether tooltips in the view shall be shown.")).c_str(),
836 myShowToolTipsView->setChecked(getApp()->reg().readIntEntry("gui", "viewToolTips", 0) == 1);
838 // add toggle button for tooltips in menu on/off (by default checked)
840 myStaticTooltipMenu, (std::string("\t") + TL("Toggle Menu Tooltips") + std::string("\t") + TL("Toggles whether tooltips in the menu shall be shown.")).c_str(),
842 myShowToolTipsMenu->setChecked(getApp()->reg().readIntEntry("gui", "menuToolTips", 0) != 1);
844 }
846 {
847 // total waitingTime
848 myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBar);
850 new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
851 GUIDesigns::buildFXLabel(myToolBar6, TL("Waiting Time:"), "", TL("Time spent waiting accumulated for all vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
852 myWaitingTimeLabel = new MFXLCDLabel(myToolBar6, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
857 myWaitingTimeLabel->setText("-------------");
858 // idealistic time loss
859 myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBar);
861 new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
862 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);
863 myTimeLossLabel = new MFXLCDLabel(myToolBar7, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
868 myTimeLossLabel->setText("-------------");
869 // total driving distance
870 myToolBarDrag9 = new FXToolBarShell(this, GUIDesignToolBar);
872 new FXToolBarGrip(myToolBar9, myToolBar9, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
873 GUIDesigns::buildFXLabel(myToolBar9, TL("Distance (km):"), "", TL("Total distance driven by DRT vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
874 myTotalDistanceLabel = new MFXLCDLabel(myToolBar9, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
879 myTotalDistanceLabel->setText("-------------");
880 // emergency vehicle counts
881 myToolBarDrag10 = new FXToolBarShell(this, GUIDesignToolBar);
883 new FXToolBarGrip(myToolBar10, myToolBar10, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
884 GUIDesigns::buildFXLabel(myToolBar10, TL("Emergency Vehicle waiting time:"), "", TL("Time spent waiting accumulated for emergency vehicles"), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
885 myEmergencyVehicleLabel = new MFXLCDLabel(myToolBar10, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
890 myEmergencyVehicleLabel->setText("-------------");
891 }
892}
893
894
895void
896GUIApplicationWindow::buildRecentNetworks(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentNetworks) {
897 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
898 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_1);
899 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_2);
900 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_3);
901 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_4);
902 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_5);
903 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_6);
904 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_7);
905 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_8);
906 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_9);
907 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_10);
908 new FXMenuSeparator(fileMenuRecentNetworks); // NOSONAR, Fox does the cleanup
909 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("Cl&ear Recent Networks"), nullptr, &myRecentNetworks, FXRecentFiles::ID_CLEAR);
910 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("No Recent Networks"), nullptr, &myRecentNetworks, MFXRecentNetworks::ID_NOFILES);
911 // set target
912 myRecentNetworks.setTarget(this);
913 myRecentNetworks.setSelector(MID_RECENTFILE);
914 new FXMenuCascade(fileMenu, TL("Recent Networks"), nullptr, fileMenuRecentNetworks);
915}
916
917
918void
919GUIApplicationWindow::buildRecentConfigs(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentConfigs) {
920 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
921 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_1);
922 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_2);
923 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_3);
924 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_4);
925 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_5);
926 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_6);
927 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_7);
928 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_8);
929 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_9);
930 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_10);
931 new FXMenuSeparator(fileMenuRecentConfigs); // NOSONAR, Fox does the cleanup
932 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("Cl&ear Recent Configs"), nullptr, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
933 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("No Recent Configs"), nullptr, &myRecentConfigs, MFXRecentNetworks::ID_NOFILES);
934 // set target
935 myRecentConfigs.setTarget(this);
936 myRecentConfigs.setSelector(MID_RECENTFILE);
937 new FXMenuCascade(fileMenu, TL("Recent Configs"), nullptr, fileMenuRecentConfigs);
938}
939
940
941long
942GUIApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
944 getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
945 getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
946 getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
947 getApp()->reg().writeIntEntry("gui", "alternateSimDelay", (int)myAlternateSimDelay);
949 getApp()->exit(0);
950 return 1;
951}
952
953
954long
955GUIApplicationWindow::onCmdEditChosen(FXObject* menu, FXSelector, void*) {
956 FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
957 if (mc->getText() == StringUtils::replace(TL("Edit Selected..."), "&", "").c_str()) {
959 chooser->create();
960 chooser->show();
961 } else {
963 const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
964 for (MSEdgeVector::const_iterator i = MSEdge::getAllEdges().begin(); i != MSEdge::getAllEdges().end(); ++i) {
965 const std::vector<MSLane*>& lanes = (*i)->getLanes();
966 for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
967 GUILane* lane = dynamic_cast<GUILane*>(*it);
968 assert(lane != 0);
969 if ((lane->getPermissions() & svc) != 0) {
970 gSelected.select(lane->getGlID());
971 }
972 }
973 }
974 if (myMDIClient->numChildren() > 0) {
975 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
976 if (w != nullptr) {
977 // color by selection
979 }
980 }
981 }
983 }
984 return 1;
985}
986
987
988long
989GUIApplicationWindow::onCmdEditBreakpoints(FXObject*, FXSelector, void*) {
990 if (myBreakpointDialog == nullptr) {
992 } else {
993 myBreakpointDialog->restore();
994 myBreakpointDialog->setFocus();
995 myBreakpointDialog->raise();
996 }
997 return 1;
998}
999
1000
1001long
1002GUIApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
1003 if (!myGLWindows.empty()) {
1004 myGLWindows[0]->getView()->showViewportEditor();
1005 }
1006 return 1;
1007}
1008
1009
1010long
1011GUIApplicationWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
1012 if (!myGLWindows.empty()) {
1013 myGLWindows[0]->getView()->showViewschemeEditor();
1014 }
1015 return 1;
1016}
1017
1018
1019long
1020GUIApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
1021 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html");
1022 return 1;
1023}
1024
1025
1026long
1027GUIApplicationWindow::onCmdChangelog(FXObject*, FXSelector, void*) {
1028 // update in every version
1029 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/ChangeLog.html");
1030 return 1;
1031}
1032
1033
1034long
1035GUIApplicationWindow::onCmdHotkeys(FXObject*, FXSelector, void*) {
1036 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html#keyboard_shortcuts");
1037 return 1;
1038}
1039
1040
1041long
1042GUIApplicationWindow::onCmdTutorial(FXObject*, FXSelector, void*) {
1043 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/Tutorials/index.html");
1044 return 1;
1045}
1046
1047
1048long
1049GUIApplicationWindow::onCmdOpenInNetedit(FXObject* sender, FXSelector, void* ptr) {
1050 if (myGLWindows.empty()) {
1051 return 1;
1052 }
1053 bool onlyNet;
1054 if (sender == myOpenNetInNetedit) {
1055 onlyNet = true;
1056 } else if (sender == myOpenInNetedit) {
1057 onlyNet = false;
1058 } else {
1059 // we have to check (menu-item) sender first because ptr is only valid when
1060 // triggered via hotkey
1061 FXEvent* e = (FXEvent*) ptr;
1062 onlyNet = (e->state & SHIFTMASK) != 0;
1063 }
1064 FXRegistry reg("SUMO netedit", "netedit");
1065 reg.read();
1066 const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
1067 reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
1068 reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
1069 reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
1070 reg.write();
1071 std::string netedit = "netedit";
1072 const char* sumoPath = getenv("SUMO_HOME");
1073 if (sumoPath != nullptr) {
1074 std::string newPath = std::string(sumoPath) + "/bin/netedit";
1075 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1076 netedit = "\"" + newPath + "\"";
1077 }
1078 }
1079 // declare command for calling netedit using the viewport saved in registry
1080 std::string cmd = netedit + " --registry-viewport";
1081 // continue depending if we're loading only a network or the entire sumo config
1082 if (myLoadAdditionalsInNetedit->shown() && !onlyNet) {
1083 cmd += " --sumocfg-file \"" + OptionsCont::getOptions().getString("configuration-file") + "\"";
1084 // check if ignore additional or demand elements
1085 if (myLoadAdditionalsInNetedit->getCheck() == FALSE) {
1086 cmd += " --ignore.additionalelements";
1087 }
1088 if (myLoadDemandInNetedit->getCheck() == FALSE) {
1089 cmd += " --ignore.routeelements";
1090 }
1091 } else {
1092 cmd += " -s \"" + OptionsCont::getOptions().getString("net-file") + "\"";
1093 }
1094 // start in background
1095#ifndef WIN32
1096 cmd = cmd + " &";
1097#else
1098 // see "help start" for the parameters
1099 cmd = "start /B \"\" " + cmd;
1100#endif
1101 WRITE_MESSAGEF(TL("Running %."), cmd);
1102 // yay! fun with dangerous commands... Never use this over the internet
1104 return 1;
1105}
1106
1107
1108long
1109GUIApplicationWindow::onCmdNewWindow(FXObject*, FXSelector, void*) {
1110 FXRegistry reg("SUMO sumo-gui", "sumo-gui");
1111 std::string sumo_gui = "sumo-gui";
1112 const char* sumoPath = getenv("SUMO_HOME");
1113 if (sumoPath != nullptr) {
1114 std::string newPath = std::string(sumoPath) + "/bin/sumo_gui";
1115 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1116 sumo_gui = "\"" + newPath + "\"";
1117 }
1118 }
1119 std::string cmd = sumo_gui;
1120 // start in background
1121#ifndef WIN32
1122 cmd = cmd + " &";
1123#else
1124 // see "help start" for the parameters
1125 cmd = "start /B \"\" " + cmd;
1126#endif
1127 WRITE_MESSAGEF(TL("Running %."), cmd);
1128 // yay! fun with dangerous commands... Never use this over the internet
1130 return 1;
1131}
1132
1133
1134long
1136 // get the new file name
1137 FXFileDialog opendialog(this, TL("Open Simulation Configuration"));
1139 opendialog.setSelectMode(SELECTFILE_EXISTING);
1140 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1141 if (gCurrentFolder.length() != 0) {
1142 opendialog.setDirectory(gCurrentFolder);
1143 }
1144 if (opendialog.execute()) {
1145 gCurrentFolder = opendialog.getDirectory();
1146 std::string file = opendialog.getFilename().text();
1147 loadConfigOrNet(file);
1148 myRecentConfigs.appendFile(file.c_str());
1149 }
1150 return 1;
1151}
1152
1153
1154long
1155GUIApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
1156 // get the new file name
1157 FXFileDialog opendialog(this, TL("Open Network"));
1158 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1159 opendialog.setSelectMode(SELECTFILE_EXISTING);
1160 opendialog.setPatternList(SUMOXMLDefinitions::NetFileExtensions.getMultilineString().c_str());
1161 if (gCurrentFolder.length() != 0) {
1162 opendialog.setDirectory(gCurrentFolder);
1163 }
1164 if (opendialog.execute()) {
1165 gCurrentFolder = opendialog.getDirectory();
1166 std::string file = opendialog.getFilename().text();
1167 loadConfigOrNet(file);
1168 myRecentNetworks.appendFile(file.c_str());
1169 }
1170 return 1;
1171}
1172
1173
1174long
1175GUIApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
1176 // get the shape file name
1177 FXFileDialog opendialog(this, TL("Open Shapes"));
1178 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_SHAPES));
1179 opendialog.setSelectMode(SELECTFILE_EXISTING);
1180 opendialog.setPatternList(SUMOXMLDefinitions::ShapesFileExtensions.getMultilineString().c_str());
1181 if (gCurrentFolder.length() != 0) {
1182 opendialog.setDirectory(gCurrentFolder);
1183 }
1184 if (opendialog.execute()) {
1185 gCurrentFolder = opendialog.getDirectory();
1186 std::string file = opendialog.getFilename().text();
1187
1188 dynamic_cast<GUIShapeContainer&>(myRunThread->getNet().getShapeContainer()).allowReplacement();
1190 if (!XMLSubSys::runParser(handler, file, false)) {
1191 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1192 }
1193 update();
1194 if (myMDIClient->numChildren() > 0) {
1195 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1196 if (w != nullptr) {
1197 w->getView()->update();
1198 }
1199 }
1200 }
1201 return 1;
1202}
1203
1204
1205long
1206GUIApplicationWindow::onCmdOpenEdgeData(FXObject*, FXSelector, void*) {
1207 // get the shape file name
1208 FXFileDialog opendialog(this, TL("Open EdgeData"));
1209 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1210 opendialog.setSelectMode(SELECTFILE_EXISTING);
1211 opendialog.setPatternList(SUMOXMLDefinitions::EdgeDataFileExtensions.getMultilineString().c_str());
1212 if (gCurrentFolder.length() != 0) {
1213 opendialog.setDirectory(gCurrentFolder);
1214 }
1215 if (opendialog.execute()) {
1216 gCurrentFolder = opendialog.getDirectory();
1217 std::string file = opendialog.getFilename().text();
1218 if (!GUINet::getGUIInstance()->loadEdgeData(file)) {
1219 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1220 }
1221 update();
1222 if (myMDIClient->numChildren() > 0) {
1223 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1224 if (w != nullptr) {
1225 w->getView()->update();
1226 }
1227 }
1228 }
1229 return 1;
1230}
1231
1232
1233long
1234GUIApplicationWindow::onCmdReload(FXObject* sender, FXSelector sel, void*) {
1235 if (!myAmLoading && (sender == nullptr || (myLoadThread->getFileName() != "" && TraCIServer::getInstance() == nullptr))) {
1237 getApp()->beginWaitCursor();
1238 myAmLoading = true;
1239 // without a loaded simulation (failed load or closed simulation) this behaves like a fresh load
1240 myIsReload = (sender != nullptr && myRunThread->networkAvailable()) || sel == 1;
1242 myLoadThread->start();
1243 if (sender == nullptr) {
1244 setStatusBarText(sel == 1 ? TL("Auto-Reloading.") : TL("TraCI-Loading."));
1245 } else {
1246 setStatusBarText(TL("Reloading."));
1247 }
1248 update();
1249 }
1250 return 1;
1251}
1252
1253
1254long
1255GUIApplicationWindow::onCmdQuickReload(FXObject*, FXSelector, void*) {
1257 setStatusBarText(TL("Quick-Reloading."));
1259 }
1260 return 1;
1261}
1262
1263
1264long
1265GUIApplicationWindow::onCmdOpenRecent(FXObject* /* sender */, FXSelector, void* ptr) {
1266 if (myAmLoading) {
1267 myStatusbar->getStatusLine()->setText(TL("Already loading!"));
1268 return 1;
1269 }
1270 std::string file((const char*)ptr);
1271 loadConfigOrNet(file);
1272 return 1;
1273}
1274
1275
1276long
1277GUIApplicationWindow::onCmdSaveConfig(FXObject*, FXSelector, void*) {
1278 // get the new file name
1279 FXFileDialog opendialog(this, TL("Save SUMO Configuration"));
1280 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1281 opendialog.setSelectMode(SELECTFILE_ANY);
1282 opendialog.setPatternList(SUMOXMLDefinitions::SumoConfigFileExtensions.getMultilineString().c_str());
1283 if (gCurrentFolder.length() != 0) {
1284 opendialog.setDirectory(gCurrentFolder);
1285 }
1286 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1287 return 1;
1288 }
1289 const std::string file = MFXUtils::assureExtension(opendialog).text();
1290 std::ofstream out(StringUtils::transcodeLocal(file, true));
1291 if (out.good()) {
1292 OptionsCont::getOptions().writeConfiguration(out, true, false, false, file, true);
1293 setStatusBarText(TLF("Configuration saved to %.", file));
1294 } else {
1295 setStatusBarText(TLF("Could not save configuration to %.", file));
1296 }
1297 out.close();
1298 return 1;
1299}
1300
1301
1302long
1303GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
1305 return 1;
1306}
1307
1308
1309long
1310GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
1311 sender->handle(this,
1312 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1313 ptr);
1314 return 1;
1315}
1316
1317
1318long
1319GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
1320 sender->handle(this,
1322 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1323 ptr);
1324 return 1;
1325}
1326
1327
1328long
1329GUIApplicationWindow::onUpdQuickReload(FXObject* sender, FXSelector, void* ptr) {
1330 sender->handle(this,
1332 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1333 ptr);
1334 return 1;
1335}
1336
1337
1338long
1339GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
1340 sender->handle(this,
1341 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1342 ptr);
1343 return 1;
1344}
1345
1346
1347long
1348GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
1349 sender->handle(this,
1351 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1352 ptr);
1353 return 1;
1354}
1355
1356
1357long
1358GUIApplicationWindow::onCmdStart(FXObject*, FXSelector, void*) {
1359 // check whether a net was loaded successfully
1360 if (!myRunThread->networkAvailable()) {
1361 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1362 return 1;
1363 }
1364 // check whether it was started before and paused;
1365 if (!myWasStarted) {
1366 myRunThread->begin();
1367 myWasStarted = true;
1368 }
1370 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1371 return 1;
1372}
1373
1374
1375long
1376GUIApplicationWindow::onCmdStop(FXObject*, FXSelector, void*) {
1377 myRunThread->stop();
1378 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1379 return 1;
1380}
1381
1382
1383long
1384GUIApplicationWindow::onCmdStep(FXObject*, FXSelector, void*) {
1385 // check whether a net was loaded successfully
1386 if (!myRunThread->networkAvailable()) {
1387 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1388 return 1;
1389 }
1390 // check whether it was started before and paused;
1391 if (!myWasStarted) {
1392 myRunThread->begin();
1393 myWasStarted = true;
1394 }
1396 return 1;
1397}
1398
1399
1400long
1401GUIApplicationWindow::onCmdSaveState(FXObject*, FXSelector, void*) {
1402 // get the new file name
1403 FXFileDialog opendialog(this, TL("Save Simulation State"));
1404 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1405 opendialog.setSelectMode(SELECTFILE_ANY);
1406 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1407 if (gCurrentFolder.length() != 0) {
1408 opendialog.setDirectory(gCurrentFolder);
1409 }
1410 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1411 return 1;
1412 }
1413 const std::string file = MFXUtils::assureExtension(opendialog).text();
1414 MSStateHandler::saveState(file, MSNet::getInstance()->getCurrentTimeStep(), false);
1415 setStatusBarText(TLF("Simulation state saved to '%'.", file));
1416 return 1;
1417}
1418
1419
1420long
1421GUIApplicationWindow::onCmdLoadState(FXObject*, FXSelector, void*) {
1422 // get the new file name
1423 FXFileDialog opendialog(this, TL("Load Simulation State"));
1424 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN));
1425 opendialog.setSelectMode(SELECTFILE_ANY);
1426 opendialog.setPatternList(SUMOXMLDefinitions::StateFileExtensions.getMultilineString().c_str());
1427 if (gCurrentFolder.length() != 0) {
1428 opendialog.setDirectory(gCurrentFolder);
1429 }
1430 if (opendialog.execute() && FXStat::exists(opendialog.getFilename())) {
1431 gCurrentFolder = opendialog.getDirectory();
1432 const std::string file = opendialog.getFilename().text();
1433 try {
1434 MSNet::getInstance()->loadState(file, true);
1435 setStatusBarText(TLF("State loaded from '%'.", file));
1436 } catch (ProcessError& e) {
1437 setStatusBarText(TLF("Failed to load state from '%' (%).", file, e.what()));
1438 }
1439 }
1440 return 1;
1441}
1442
1443
1444long
1445GUIApplicationWindow::onCmdTimeToggle(FXObject*, FXSelector, void*) {
1446 // toggle show time as HMS
1451 }
1452 return 1;
1453}
1454
1455
1456long
1457GUIApplicationWindow::onCmdDelayInc(FXObject*, FXSelector, void*) {
1458 if (mySimDelay < 10) {
1459 mySimDelay = 10;
1460 } else if (mySimDelay >= 20 && mySimDelay < 50) {
1461 mySimDelay = 50;
1462 } else if (mySimDelay >= 200 && mySimDelay < 500) {
1463 mySimDelay = 500;
1464 } else {
1465 mySimDelay *= 2;
1466 }
1467 if (mySimDelay > 1000) {
1468 // setting high delay by pressing the key too often is hard to recover from
1469 mySimDelay = 1000;
1470 }
1471 mySimDelaySlider->setValue((int)mySimDelay);
1472 mySimDelaySpinner->setValue(mySimDelay);
1473 return 1;
1474}
1475
1476
1477long
1478GUIApplicationWindow::onCmdDelayDec(FXObject*, FXSelector, void*) {
1479 if (mySimDelay <= 10) {
1480 mySimDelay = 0;
1481 } else if (mySimDelay > 20 && mySimDelay <= 50) {
1482 mySimDelay = 20;
1483 } else if (mySimDelay > 200 && mySimDelay <= 500) {
1484 mySimDelay = 200;
1485 } else {
1486 mySimDelay /= 2;
1487 }
1488 mySimDelaySlider->setValue((int)mySimDelay);
1489 mySimDelaySpinner->setValue(mySimDelay);
1490 return 1;
1491}
1492
1493
1494long
1495GUIApplicationWindow::onCmdDelayToggle(FXObject*, FXSelector, void*) {
1496 const double tmp = myAlternateSimDelay;
1498 mySimDelay = tmp;
1499 return 1;
1500}
1501
1502
1503long
1504GUIApplicationWindow::onCmdDemandScale(FXObject*, FXSelector, void*) {
1507 }
1508 return 1;
1509}
1510
1511
1512long
1513GUIApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
1515 return 1;
1516}
1517
1518
1519long
1524
1525
1526long
1527GUIApplicationWindow::onCmdBreakpoint(FXObject*, FXSelector, void*) {
1528 // see updateTimeLCD for the DELTA_T
1531 }
1532 return 1;
1533}
1534
1535
1536long
1537GUIApplicationWindow::onCmdBreakpointEarly(FXObject*, FXSelector, void*) {
1538 // see updateTimeLCD for the DELTA_T
1541 }
1542 return 1;
1543}
1544
1545
1546long
1547GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
1548 sender->handle(this,
1550 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1551 ptr);
1553 // bind start simulation with space key
1555 }
1556 return 1;
1557}
1558
1559
1560long
1561GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
1562 sender->handle(this,
1564 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1565 ptr);
1567 // bind stop simulation with space key
1569 }
1570 return 1;
1571}
1572
1573
1574long
1575GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
1576 sender->handle(this,
1578 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1579 ptr);
1580 return 1;
1581}
1582
1583
1584long
1585GUIApplicationWindow::onUpdNeedsNetwork(FXObject* sender, FXSelector, void* ptr) {
1586 // check if there is a loaded network and gui isn't loading
1588 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1589 // enable certain elements manually
1590 mySelectLanesMenuCascade->enable();
1591 myScaleTrafficTooltip->setTipText(TL("Scale number of vehicles in simulation"));
1592 } else {
1593 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1594 // disable certain elements manually
1595 mySelectLanesMenuCascade->disable();
1596 myScaleTrafficTooltip->setTipText("");
1597 }
1598 return 1;
1599}
1600
1601
1602long
1603GUIApplicationWindow::onUpdNeedsSumoConfig(FXObject* sender, FXSelector, void* ptr) {
1604 // check if there is a loaded network and gui isn't loading
1605 if (myRunThread->networkAvailable() && !myAmLoading && OptionsCont::getOptions().isSet("configuration-file")) {
1606 sender->handle(this, FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1607 sender->handle(this, FXSEL(SEL_COMMAND, ID_SHOW), ptr);
1608 myOpenInNetedit->setText(TL("Open sumo config in netedit"));
1609 } else {
1610 sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1611 sender->handle(this, FXSEL(SEL_COMMAND, ID_HIDE), ptr);
1612 myOpenInNetedit->setText(TL("Open network in netedit"));
1613 }
1614 return 1;
1615}
1616
1617
1618long
1619GUIApplicationWindow::onUpdTraCIStatus(FXObject* /*sender*/, FXSelector, void* /*ptr*/) {
1621 myTraCiFrame->show();
1622 } else {
1623 myTraCiFrame->hide();
1624 }
1625 return 1;
1626}
1627
1628
1629long
1630GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
1631 if (myMDIClient->numChildren() > 0) {
1632 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1633 if (w != nullptr) {
1634 w->onCmdLocate(nullptr, sel, nullptr);
1635 }
1636 }
1637 return 1;
1638}
1639
1640
1641long
1642GUIApplicationWindow::onCmdShowStats(FXObject*, FXSelector, void*) {
1643 if (myMDIClient->numChildren() > 0) {
1644 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1646 }
1647 return 1;
1648}
1649
1650
1651long
1652GUIApplicationWindow::onCmdAppSettings(FXObject*, FXSelector, void*) {
1654 d->create();
1655 d->show(PLACEMENT_OWNER);
1656 return 1;
1657}
1658
1659
1660long
1661GUIApplicationWindow::onCmdGaming(FXObject*, FXSelector, void*) {
1662 // without a view, the gaming mode can only be left
1663 if (myGLWindows.empty() && !myAmGaming) {
1664 return 1;
1665 }
1667 if (!myGLWindows.empty()) {
1668 myGLWindows[0]->getView()->editVisualisationSettings()->gaming = myAmGaming;
1669 }
1670 if (myAmGaming) {
1671 myMenuBar->hide();
1672 myStatusbar->hide();
1673 myToolBar1->hide();
1674 myToolBar2->hide();
1675 myToolBar4->hide();
1676 myToolBar5->hide();
1677 myToolBar6->show();
1678 myToolBar8->hide();
1679 myToolBar10->show();
1680 if (myTLSGame) {
1681 myToolBar7->show();
1682 } else {
1683 myToolBar9->show();
1684 }
1685 myMessageWindow->hide();
1691 } else {
1692 myMenuBar->show();
1693 myStatusbar->show();
1694 myToolBar1->show();
1695 myToolBar2->show();
1696 myToolBar4->show();
1697 myToolBar5->show();
1698 myToolBar6->hide();
1699 myToolBar7->hide();
1700 myToolBar8->show();
1701 myToolBar9->hide();
1702 myToolBar10->hide();
1703 myMessageWindow->show();
1705 }
1706 if (myMDIClient->numChildren() > 0) {
1707 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1708 if (w != nullptr) {
1710 }
1711 }
1712 update();
1713 return 1;
1714}
1715
1716
1717long
1719 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1720 if (w != nullptr) {
1721 // show or hide grid depending of myNetworkViewOptions.menuCheckToggleGrid
1724 } else {
1726 }
1727 w->getView()->update();
1728 }
1729 return 1;
1730}
1731
1732
1733long
1735 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1736 if (w != nullptr) {
1737 // toggle secondary shape visualization
1739 w->getView()->update();
1740 }
1741 return 1;
1742}
1743
1744
1745long
1746GUIApplicationWindow::onCmdFullScreen(FXObject*, FXSelector, void*) {
1747 if (myGLWindows.empty() && !myAmFullScreen) {
1748 return 1;
1749 }
1751 if (myAmFullScreen) {
1752 myWasMaximizedBeforeFullScreen = isMaximized() == TRUE;
1753 getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1754 getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1755 getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1756 getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1757 maximize();
1758 setDecorations(DECOR_NONE);
1759 place(PLACEMENT_MAXIMIZED);
1760 myMenuBar->hide();
1761 myStatusbar->hide();
1762 myToolBar1->hide();
1763 myToolBar2->hide();
1764 myToolBar3->hide();
1765 myToolBar4->hide();
1766 myToolBar5->hide();
1767 myToolBar6->hide();
1768 myToolBar7->hide();
1769 myToolBar8->hide();
1770 myMessageWindow->hide();
1771 if (myMDIClient->numChildren() > 0) {
1772 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1773 if (w != nullptr) {
1774 w->setToolBarVisibility(false);
1775 }
1776 }
1777 update();
1778 } else {
1779 setDecorations(DECOR_ALL);
1780 myToolBar3->show();
1781 // re-apply the gaming mode (it is left if no view remains)
1782 myAmGaming = myGLWindows.empty() || !myAmGaming;
1783 onCmdGaming(nullptr, 0, nullptr);
1785 restore();
1786 position(getApp()->reg().readIntEntry("SETTINGS", "x", 150),
1787 getApp()->reg().readIntEntry("SETTINGS", "y", 150),
1788 getApp()->reg().readIntEntry("SETTINGS", "width", 600),
1789 getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1790 }
1791 }
1792 // show or hide the full screen hint
1793 for (GUIGlChildWindow* const window : myGLWindows) {
1794 window->getView()->update();
1795 }
1796 return 1;
1797}
1798
1799
1800long
1802 // a (re)load opens a new view, so the full screen mode is kept
1803 if (myAmFullScreen && myGLWindows.empty() && !myAmLoading) {
1804 onCmdFullScreen(nullptr, 0, nullptr);
1805 }
1806 return 1;
1807}
1808
1809
1810long
1811GUIApplicationWindow::onCmdListInternal(FXObject*, FXSelector, void*) {
1813 return 1;
1814}
1815
1816
1817long
1818GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) {
1820 return 1;
1821}
1822
1823long
1824GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) {
1826 return 1;
1827}
1828
1829
1830long
1831GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) {
1833 return 1;
1834}
1835
1836
1837#ifdef HAVE_OSG
1838long
1839GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1841 return 1;
1842}
1843#endif
1844
1845
1846long
1847GUIApplicationWindow::onCmdShowToolTipsView(FXObject*, FXSelector, void*) {
1848 // invert check
1850 // update parent
1852 // save in registry
1853 getApp()->reg().writeIntEntry("gui", "viewToolTips", myShowToolTipsView->amChecked() ? 1 : 0);
1854 return 1;
1855}
1856
1857
1858long
1859GUIApplicationWindow::onCmdShowToolTipsMenu(FXObject*, FXSelector, void*) {
1860 // invert check
1862 // update parent
1864 // save in registry
1865 getApp()->reg().writeIntEntry("gui", "menuToolTips", myShowToolTipsMenu->amChecked() ? 0 : 1);
1866 return 1;
1867}
1868
1869
1870long
1871GUIApplicationWindow::onCmdFeedback(FXObject*, FXSelector, void*) {
1872 // create and open feedback dialog
1873 GUIDialog_Feedback* feedback = new GUIDialog_Feedback(this);
1874 feedback->create();
1875 feedback->show(PLACEMENT_OWNER);
1876 return 1;
1877}
1878
1879
1880long
1881GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
1882 GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this);
1883 about->create();
1884 about->show(PLACEMENT_OWNER);
1885 return 1;
1886}
1887
1888
1889long
1890GUIApplicationWindow::onCmdHallOfFame(FXObject*, FXSelector, void*) {
1892 hall->create();
1893 hall->show(PLACEMENT_OWNER);
1894 return 1;
1895}
1896
1897
1898long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1899 FXEvent* event = (FXEvent*)ptr;
1900 FXString string = GUIUserIO::clipped.c_str();
1901 setDNDData(FROM_CLIPBOARD, event->target, string);
1902 return 1;
1903}
1904
1905
1906long
1907GUIApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
1908 eventOccurred();
1909 return 1;
1910}
1911
1912
1913long
1914GUIApplicationWindow::onRunThreadEvent(FXObject*, FXSelector, void*) {
1915 eventOccurred();
1916 return 1;
1917}
1918
1919
1920void
1922 while (!myEvents.empty()) {
1923 // get the next event
1924 GUIEvent* e = myEvents.top();
1925 myEvents.pop();
1926 // process
1927 switch (e->getOwnType()) {
1930 setFocus();
1931 break;
1933 if (myRunThread->networkAvailable()) { // avoid race-condition related crash if reload was pressed
1935 }
1936 break;
1944 break;
1946 GUIEvent_AddView* ave = dynamic_cast<GUIEvent_AddView*>(e);
1948 if (ave->getSchemeName() != "") {
1949 MFXComboBoxIcon* sCombo = v->getColoringSchemesCombo();
1950 int index = sCombo->findItem(ave->getSchemeName().c_str());
1951 if (index >= 0) {
1952 sCombo->setCurrentItem(index);
1953 }
1954 v->setColorScheme(ave->getSchemeName());
1955 }
1956 break;
1957 }
1959 GUIEvent_CloseView* ave = dynamic_cast<GUIEvent_CloseView*>(e);
1960 removeViewByID(ave->getCaption());
1961 break;
1962 }
1965 break;
1966 default:
1967 break;
1968 }
1969 delete e;
1970 }
1971 myToolBar2->forceRefresh();
1972 myToolBar3->forceRefresh();
1973}
1974
1975
1976void
1978 myAmLoading = false;
1980 // check whether the loading was successful
1981 if (ec->myNet == nullptr) {
1982 // report failure
1983 setStatusBarText(TLF("Loading of '%' failed!", ec->myFile));
1986 getApp()->exit(1);
1987 }
1988 } else {
1989 // initialise simulation thread
1990 if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1993 getApp()->exit(1);
1994 }
1995 } else {
1996 // report success
1997 setStatusBarText(TLF("'%' loaded.", ec->myFile));
1999 myWasStarted = false;
2001 // initialise views
2002 myViewNumber = 0;
2004 // check/record settings file modification time
2005 long long mTime = myGuiSettingsFileMTime;
2006 if (ec->mySettingsFiles.size() > 0) {
2007 for (std::string fname : ec->mySettingsFiles) {
2008 mTime = MAX2(mTime, SysUtils::getModifiedTime(fname));
2009 }
2010 }
2011 // always reload if settings were modified or to restore multiple views
2012 if (!myIsReload) {
2014 }
2015 if (ec->mySettingsFiles.size() > 0 && (!myIsReload || myGuiSettingsFileMTime < mTime || ec->mySettingsFiles.size() > 1)) {
2016 // open a view for each file and apply settings
2017 for (std::string fname : ec->mySettingsFiles) {
2018 GUISettingsHandler settings(getApp(), fname);
2019 GUISUMOViewParent::ViewType vt = defaultType;
2020 if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
2022 }
2023 if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
2025 }
2026 GUISUMOAbstractView* view = openNewView(vt);
2027 if (view == nullptr) {
2028 break;
2029 }
2030 if (settings.getSettingName() != "") {
2031 view->setColorScheme(settings.getSettingName());
2032 MFXComboBoxIcon* sCombo = view->getColoringSchemesCombo();
2033 int index = sCombo->findItem(settings.getSettingName().c_str());
2034 if (index >= 0) {
2035 sCombo->setCurrentItem(index);
2036 }
2037 }
2038 view->addDecals(settings.getDecals());
2039 settings.applyViewport(view);
2040 settings.setSnapshots(view);
2041 if (settings.getDelay() > 0.) {
2042 mySimDelay = settings.getDelay();
2043 }
2044 if (settings.getBreakpoints().size() > 0) {
2046 myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
2047 myRunThread->getBreakpointLock().unlock();
2048 }
2049 myJamSounds = settings.getEventDistribution("jam");
2050 myCollisionSounds = settings.getEventDistribution("collision");
2051 if (settings.getJamSoundTime() > 0) {
2052 myJamSoundTime = settings.getJamSoundTime();
2053 }
2054 for (const std::string& tlsID : settings.getTrackers()) {
2055 if (MSNet::getInstance()->getTLSControl().knows(tlsID)) {
2058 if (tllW) {
2059 tllW->begin2TrackPhases(this);
2060 }
2061 } else {
2062 WRITE_WARNINGF("Tracker for unknown tlLogic '%' in settings file '%'", tlsID, fname);
2063 }
2064 }
2065 }
2066 } else {
2067 openNewView(defaultType);
2068 }
2069 myGuiSettingsFileMTime = mTime;
2070 if (!OptionsCont::getOptions().isDefault("delay")) {
2071 setDelay(OptionsCont::getOptions().getFloat("delay"));
2072 mySimDelaySlider->setValue((int)mySimDelay);
2073 mySimDelaySpinner->setValue(mySimDelay);
2074 }
2075 if (!OptionsCont::getOptions().isDefault("breakpoints") && !myIsReload) {
2076 std::vector<SUMOTime> breakpoints;
2077 for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
2078 SUMOTime t = string2time(val);
2079 // round down to nearest reachable time step
2080 t -= t % DELTA_T;
2081 breakpoints.push_back(t);
2082 }
2083 std::sort(breakpoints.begin(), breakpoints.end());
2085 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
2086 myRunThread->getBreakpointLock().unlock();
2087 }
2088 if (!OptionsCont::getOptions().isDefault("selection-file")) {
2089 delete myDynamicSelection;
2090 myDynamicSelection = new std::stringstream();
2091 std::string msg = gSelected.load(OptionsCont::getOptions().getString("selection-file"), GLO_MAX, myDynamicSelection);
2092 if (msg != "") {
2093 WRITE_ERRORF("Errors while loading selection: %", msg.c_str());
2094 }
2095 if (!myDynamicSelection->str().empty()) {
2096 std::string dummy;
2097 int numNotFound = 0;
2098 while (myDynamicSelection->good()) {
2099 (*myDynamicSelection) >> dummy;
2100 numNotFound++;
2101 }
2102 myDynamicSelection->clear(); // first clear error state before seek works
2103 myDynamicSelection->seekg(0);
2104 // @note for some reason the last line is read twice
2105 WRITE_MESSAGEF("% dynamic objects not present while loading selection", numNotFound - 1);
2106 }
2107 }
2108 myTLSGame = OptionsCont::getOptions().getString("game.mode") == "tls";
2109 if (OptionsCont::getOptions().getBool("game")) {
2110 if (myTLSGame) {
2111 setTitle(TL("SUMO Interactive Traffic Light"));
2112 } else {
2113 setTitle(TL("SUMO Interactive Demand-Responsive-Transport"));
2114 }
2115 onCmdGaming(nullptr, 0, nullptr);
2116 } else {
2117 // set simulation name on the caption
2118 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str()));
2119 }
2120 if (ec->myViewportFromRegistry) {
2121 Position off;
2122 off.set(getApp()->reg().readRealEntry("viewport", "x"),
2123 getApp()->reg().readRealEntry("viewport", "y"),
2124 getApp()->reg().readRealEntry("viewport", "z"));
2125 Position p(off.x(), off.y(), 0);
2126 GUISUMOAbstractView* view = myGLWindows[0]->getView();
2127 view->setViewportFromToRot(off, p, 0);
2128 }
2129 // set simulation step begin information
2130 myLCDLabel->setText("----------------");
2132 myStatButtons[STAT_VEHS]->setIcon(GUIIconSubSys::getIcon(greenVehIcon));
2133
2134 const std::string pedModel = OptionsCont::getOptions().getString("pedestrian.model");
2135 if (StringUtils::to_lower_case(pedModel) == "noninteracting") {
2137 } else if (StringUtils::to_lower_case(pedModel) == "jupedsim") {
2139 } else {
2141 }
2142
2143 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2144 (*it)->setText("-");
2145 }
2146 // initialize scale from options unless already set in the UI
2147 if (myDemandScaleSpinner->getValue() == 1 || !OptionsCont::getOptions().isDefault("scale")) {
2149 }
2151 }
2152 }
2153 getApp()->endWaitCursor();
2154 // start if wished
2156 onCmdStart(nullptr, 0, nullptr);
2157 }
2158 update();
2159}
2160
2161
2162void
2164#ifdef WIN32
2165 long t = SysUtils::getCurrentMillis();
2166 // only skip if the simulation is running
2167 if (t - myLastStepEventMillis < MIN_DRAW_DELAY && myRunThread->simulationIsStopable()) {
2168 // do not try to redraw with more than 50FPS (#6371)
2169 return;
2170 }
2172#endif
2174 FXButton* vehStats = myStatButtons[STAT_VEHS];
2175 FXButton* delayStats = myStatButtons[STAT_DELAYED];
2176 FXButton* teleStats = myStatButtons[STAT_TELEPORTS];
2177 FXButton* personStats = myStatButtons[STAT_PERSONS];
2178 FXButton* containerStats = myStatButtons[STAT_CONTAINERS];
2179
2180 const int running = myRunThread->getNet().getVehicleControl().getRunningVehicleNo();
2181 const int backlog = myRunThread->getNet().getInsertionControl().getWaitingVehicleNo();
2182 const int teleports = myRunThread->getNet().getVehicleControl().getTeleportCount();
2183 const int departed = myRunThread->getNet().getVehicleControl().getDepartedVehicleNo();
2185 if (backlog > running) {
2186 if (vehStats->getIcon() == GUIIconSubSys::getIcon(greenVehIcon)) {
2188 }
2189 } else {
2190 if (vehStats->getIcon() == GUIIconSubSys::getIcon(GUIIcon::YELLOWVEHICLE)) {
2191 vehStats->setIcon(GUIIconSubSys::getIcon(greenVehIcon));
2192 }
2193 }
2194 vehStats->setText(toString(running).c_str());
2195 if (backlog > 0) {
2196 if (!delayStats->shown()) {
2197 delayStats->show();
2198 }
2199 delayStats->setText(toString(backlog).c_str());
2200 } else {
2201 if (delayStats->shown()) {
2202 delayStats->hide();
2203 }
2204 }
2205 if (teleports > 0) {
2206 if (!teleStats->shown()) {
2207 teleStats->show();
2208 }
2209 teleStats->setText((toString(100.00 * teleports / departed) + "%").c_str());
2210 }
2211 if (myRunThread->getNet().hasPersons()) {
2212 if (!personStats->shown()) {
2213 personStats->show();
2214 }
2215 personStats->setText(toString(myRunThread->getNet().getPersonControl().getRunningNumber()).c_str());
2216 }
2217 if (myRunThread->getNet().hasContainers()) {
2218 if (!containerStats->shown()) {
2219 containerStats->show();
2220 }
2221 containerStats->setText(toString(myRunThread->getNet().getContainerControl().getRunningNumber()).c_str());
2222 }
2223 if (myAmGaming) {
2224 if (myTLSGame) {
2226 } else {
2228 }
2229 }
2231 getApp()->forceRefresh(); // restores keyboard focus
2232 }
2233 // try to load dynamic selection
2234 if (myDynamicSelection != nullptr) {
2235 std::stringstream tmp;
2237 if (tmp.str().empty()) {
2238 delete myDynamicSelection;
2239 myDynamicSelection = nullptr;
2240 } else {
2241 myDynamicSelection->str(tmp.str());
2242 myDynamicSelection->clear(); // first clear error state before seek works
2243 myDynamicSelection->seekg(0);
2244 }
2245 }
2247 update();
2248}
2249
2250
2251void
2253 GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
2255 setStatusBarText(ec->getMsg());
2256 } else {
2258 }
2259}
2260
2261
2262void
2265 onCmdStop(nullptr, 0, nullptr);
2266 if (ec->getReason() == MSNet::SIMSTATE_LOADING) {
2267 onCmdReload(nullptr, 0, nullptr);
2268 } else if (GUIGlobals::gQuitOnEnd) {
2270 getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
2271 } else if (GUIGlobals::gDemoAutoReload) {
2272 onCmdReload(nullptr, 1, nullptr);
2273 } else if (!myHaveNotifiedAboutSimEnd) {
2274 // GUIRunThread::deleteSim() triggers the final message to the log file
2275 // (this will never reach the GUI but we cannot use WRITE_MESSAGE here
2276 // to avoid a duplicate log entry)
2278 TLF("Simulation ended at time: %. (%)",
2280 // build the text
2281 const std::string text = TLF("Simulation ended at time: %.", time2string(ec->getTimeStep())) + "\n" +
2282 TL("Reason:") + MSNet::getStateMessage(ec->getReason()) + "\n" +
2283 TL("Do you want to close all open files and views?");
2284 FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, TL("Simulation ended"), "%s", text.c_str());
2285 if (answer == 1) { //1:yes, 2:no, 4:esc
2287 } else {
2290 update();
2291 }
2293 }
2294}
2295
2296
2297void
2302#ifdef HAVE_DANGEROUS_SOUNDS // disable user-configurable command execution for public build
2303 if (myJamSounds.getOverallProb() > 0) {
2304 // play honking sound if some vehicle is waiting too long
2305 for (; it != end; ++it) {
2306 // XXX use impatience instead of waiting time ?
2307 if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
2308 const std::string cmd = myJamSounds.get(&myGamingRNG);
2309 if (cmd != "") {
2310 // yay! fun with dangerous commands... Never use this over the internet
2312 // one sound per simulation step is enough
2313 break;
2314 }
2315 }
2316 }
2317 }
2320 if (myPreviousCollisionNumber != collisions) {
2321 const std::string cmd = myCollisionSounds.get(&myGamingRNG);
2322 if (cmd != "") {
2323 // yay! fun with dangerous commands... Never use this over the internet
2325 }
2326 myPreviousCollisionNumber = collisions;
2327 }
2328 }
2329#endif
2330 // update performance indicators
2331 for (it = vc.loadedVehBegin(); it != end; ++it) {
2332 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2333 assert(veh != 0);
2334 if (veh->isOnRoad() && !veh->isStopped()) {
2335 const double vmax = veh->getLane()->getVehicleMaxSpeed(veh);
2336 if (veh->getSpeed() < SUMO_const_haltingSpeed) {
2338 if (veh->getVClass() == SVC_EMERGENCY) {
2340 }
2341 }
2342 myTimeLoss += TIME2STEPS(TS * (vmax - veh->getSpeed()) / vmax); // may be negative with speedFactor > 1
2343 }
2344
2345 }
2349}
2350
2351
2352void
2354 // update performance indicators
2358
2361 for (auto it = vc.loadedVehBegin(); it != end; ++it) {
2362 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2363 assert(veh != 0);
2364 if (veh->isOnRoad() && !veh->isStopped()) {
2366 }
2367 }
2369}
2370
2371
2372void
2374 if (!myAmLoading) {
2376 getApp()->beginWaitCursor();
2377 myAmLoading = true;
2378 myIsReload = false;
2380 gSchemeStorage.saveViewport(0, 0, -1, 0); // recenter view
2382 setStatusBarText(TLF("Loading '%'.", file));
2383 update();
2384 }
2385}
2386
2387
2390 if (!myRunThread->networkAvailable()) {
2391 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
2392 return nullptr;
2393 }
2394 GUISUMOAbstractView* oldView = nullptr;
2395 if (myMDIClient->numChildren() > 0) {
2396 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2397 if (w != nullptr) {
2398 oldView = w->getView();
2399 }
2400 }
2401 if (caption == "") {
2402 caption = "View #" + toString(myViewNumber++);
2403 }
2404 FXuint opts = MDI_TRACKING;
2405 GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
2406 this, GUIIconSubSys::getIcon(GUIIcon::SUMO_MINI), opts, 10, 10, 200, 100);
2408 if (oldView != nullptr) {
2409 // copy viewport
2410 oldView->copyViewportTo(v);
2411 }
2412 w->create();
2413 if (myMDIClient->numChildren() == 1) {
2414 w->maximize();
2415 } else {
2416 myMDIClient->vertical(true);
2417 }
2418 myMDIClient->setActiveChild(w);
2419
2420 return v;
2421}
2422
2423
2424FXGLCanvas*
2426 if (myMDIClient->numChildren() == 0) {
2427 return nullptr;
2428 }
2429 GUISUMOViewParent* share_tmp1 =
2430 static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
2431 return share_tmp1->getBuildGLCanvas();
2432}
2433
2434
2435void
2437 myTrackerLock.lock();
2438 myLCDLabel->setText("----------------");
2441 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2442 (*it)->setText("-");
2443 if (it != myStatButtons.begin()) {
2444 (*it)->hide();
2445 }
2446 }
2447 // save decals and viewport
2448 for (GUIGlChildWindow* window : myGLWindows) {
2449 GUISUMOAbstractView* view = window->getView();
2452 view->getChanger().getZPos(), view->getChanger().getRotation());
2453 }
2454 // delete the simulation
2456 // reset the caption
2457 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
2458 // clear decals and release GPU textures
2459 for (GUIGlChildWindow* window : myGLWindows) {
2460 GUISUMOAbstractView* view = window->getView();
2461 if (view->makeCurrent()) {
2462 view->clearDecals();
2466 view->makeNonCurrent();
2467 }
2468 }
2469 // remove trackers and other external windows (must be delayed until deleteSim)
2470 while (!myGLWindows.empty()) {
2471 delete myGLWindows.front();
2472 }
2473 // make a copy because deleting modifyes the vector;
2474 std::vector<FXMainWindow*> trackerWindows = myTrackerWindows;
2475 for (FXMainWindow* const window : trackerWindows) {
2476 delete window;
2477 }
2478 myTrackerWindows.clear();
2479 // clear selected items
2480 gSelected.clear();
2481 // add a separator to the log
2483 myTrackerLock.unlock();
2484 // remove coordinate information
2485 myGeoCoordinate->setText(TL("N/A"));
2486 myGeoCoordinate->disable();
2487 myGeoCoordinate->setEditable(false);
2488 myCartesianCoordinate->setText(TL("N/A"));
2489 myCartesianCoordinate->disable();
2490 myCartesianCoordinate->setEditable(false);
2491 if (myTestCoordinate) {
2492 myTestCoordinate->setText(TL("N/A"));
2493 }
2494 update();
2495}
2496
2497
2498FXCursor*
2500 return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
2501}
2502
2503
2508
2509
2510double
2514
2515
2516void
2518 loadConfigOrNet("");
2519 if (wait) {
2520 while (myAmLoading) {
2521 myRunThread->sleep(50);
2522 }
2523 }
2524}
2525
2526
2527void
2529 myStatusbar->getStatusLine()->setText(text.c_str());
2530 myStatusbar->getStatusLine()->setNormalText(text.c_str());
2531}
2532
2533
2534void
2536 myRecentNetworks.appendFile(f);
2537}
2538
2539
2540void
2542 myRecentConfigs.appendFile(f);
2543}
2544
2545
2546void
2548 if (myShowTimeAsHMS) {
2549 myLCDLabel->setToolTipText("HH:MM:SS");
2550 if (myAmGaming) {
2552 myTimeLossLabel->setToolTipText("HH:MM:SS");
2554 }
2555 } else {
2556 myLCDLabel->setToolTipText(TL("seconds"));
2557 if (myAmGaming) {
2559 myTimeLossLabel->setToolTipText(TL("seconds"));
2561 }
2562 }
2563}
2564
2565
2566void
2568 time -= DELTA_T; // synchronize displayed time with netstate output
2569 if (time < 0) {
2570 myLCDLabel->setText("----------------");
2571 return;
2572 }
2573 if (myAmGaming) {
2574 // show time counting backwards
2575 time = myRunThread->getSimEndTime() - time;
2576 }
2577 std::ostringstream str;
2578 str << std::setfill('0');
2579 const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0;
2580 if (myShowTimeAsHMS) {
2581 SUMOTime day = time / SUMOTime_DAY;
2582 if (day > 0) {
2583 str << day << '-';
2584 time %= SUMOTime_DAY;
2585 }
2586 str << std::setw(2);
2587 str << time / SUMOTime_HOUR << '-';
2588 time %= SUMOTime_HOUR;
2589 str << std::setw(2) << time / SUMOTime_MINUTE << '-';
2590 time %= SUMOTime_MINUTE;
2591 }
2592 str << std::setw(2) << time / 1000;
2593 if (!hideFraction) {
2594 str << '.' << std::setw(3) << time % 1000;
2595 }
2596 myLCDLabel->setText(str.str().c_str());
2597}
2598
2599
2600void
2602 if (press != nullptr) {
2603 myHotkeyPress[key] = press;
2604 }
2605 if (release != nullptr) {
2606 myHotkeyRelease[key] = release;
2607 }
2608}
2609
2610
2611long
2612GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* ptr) {
2613 FXEvent* e = (FXEvent*) ptr;
2614 if (e->code == KEY_Escape) {
2615 if (myGeoCoordinate && myGeoCoordinate->hasFocus()) {
2616 myGeoCoordinate->killFocus();
2617 if (getActiveView()) {
2619 }
2620 return 1;
2621 }
2622 if (myCartesianCoordinate && myCartesianCoordinate->hasFocus()) {
2623 myCartesianCoordinate->killFocus();
2624 if (getActiveView()) {
2626 }
2627 return 1;
2628 }
2629 }
2630 // PgUp and PgDown switch between widgets by default and binding them via menu shortcuts does not work reliably
2631 // so we must intercept them before FXMainWindow can handle it
2632 if (e->code == FX::KEY_Page_Up) {
2633 onCmdDelayInc(nullptr, 0, nullptr);
2634 } else if (e->code == FX::KEY_Page_Down) {
2635 onCmdDelayDec(nullptr, 0, nullptr);
2636 } else {
2637 // disable hotkeys without modifiers for the game
2638 const bool ignoreSimple = myAmGaming && (e->state & (CONTROLMASK | SHIFTMASK | ALTMASK)) == 0;
2639 const long handled = ignoreSimple ? 0 : FXMainWindow::onKeyPress(o, sel, ptr);
2640 if (handled == 0 && myMDIClient->numChildren() > 0) {
2641 auto it = myHotkeyPress.find(e->code);
2642 if (it != myHotkeyPress.end()) {
2643 it->second->execute(SIMSTEP);
2644 }
2645 if (!ignoreSimple) {
2646 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2647 if (w != nullptr) {
2648 w->onKeyPress(nullptr, sel, ptr);
2649 }
2650 }
2651 }
2652 }
2653 return 0;
2654}
2655
2656
2657long
2658GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* ptr) {
2659 const long handled = FXMainWindow::onKeyRelease(o, sel, ptr);
2660 if (handled == 0 && myMDIClient->numChildren() > 0) {
2661 FXEvent* e = (FXEvent*) ptr;
2662 auto it = myHotkeyRelease.find(e->code);
2663 if (it != myHotkeyRelease.end()) {
2664 it->second->execute(SIMSTEP);
2665 }
2666 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2667 if (w != nullptr) {
2668 w->onKeyRelease(nullptr, sel, ptr);
2669 }
2670 }
2671 return 0;
2672}
2673
2674
2675double
2677 return mySimDelay;
2678}
2679
2680
2681void
2683 mySimDelay = delay;
2684}
2685
2686
2687void
2689 myEventMutex.lock();
2690 myEvents.push_back(event);
2692 //myEventCondition.wait(myEventMutex);
2693 myEventMutex.unlock();
2694}
2695
2696
2697void
2698GUIApplicationWindow::setBreakpoints(const std::vector<SUMOTime>& breakpoints) {
2699 if (myRunThread != nullptr) {
2701 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
2702 myRunThread->getBreakpointLock().unlock();
2704 }
2705}
2706
2707
2708void
2710 const SUMOTime begin = string2time(OptionsCont::getOptions().getString("begin"));
2711 if (time >= begin) {
2712 // ensure breakpoint is valid
2713 time -= (time - begin) % DELTA_T;
2714 std::vector<SUMOTime> breakpoints = retrieveBreakpoints();
2715 if (std::find(breakpoints.begin(), breakpoints.end(), time) == breakpoints.end()) {
2716 breakpoints.push_back(time);
2717 std::sort(breakpoints.begin(), breakpoints.end());
2718 setBreakpoints(breakpoints);
2719 setStatusBarText(TLF("Set breakpoint at %", time2string(time)));
2720 }
2721 }
2722}
2723
2724
2725const std::vector<SUMOTime>
2728 std::vector<SUMOTime> result = myRunThread->getBreakpoints();
2729 myRunThread->getBreakpointLock().unlock();
2730 return result;
2731}
2732
2733
2734void
2738
2739/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ MID_HOTKEY_CTRL_Q_CLOSE
Main window closes.
Definition GUIAppEnum.h:115
@ ID_RUNTHREAD_EVENT
The testing thread.
Definition GUIAppEnum.h:352
@ 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:362
@ MID_TOOLBAREDIT_LOADADDITIONALS
load additionals in sumo-gui/netedit after press ctrl+T
Definition GUIAppEnum.h:700
@ MID_NEW_MICROVIEW
Open a new microscopic view.
Definition GUIAppEnum.h:340
@ 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:250
@ 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_NEWS
show latest news
Definition GUIAppEnum.h:680
@ MID_TRACI_STATUS
update traci status
Definition GUIAppEnum.h:379
@ MID_LANGUAGE_TR
change language to turkish
@ MID_CHANGELOG
changelog button
Definition GUIAppEnum.h:671
@ 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:702
@ MID_HOTKEY_F1_ONLINEDOCUMENTATION
open online documentation
Definition GUIAppEnum.h:234
@ MID_HOTKEY_CTRL_U_OPENEDGEDATA
Load edge data for visualization.
Definition GUIAppEnum.h:125
@ MID_HOTKEY_CTRL_R_RELOAD
Reload the previously loaded simulation.
Definition GUIAppEnum.h:119
@ MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK
Stop the simulation in SUMO and save network in netedit.
Definition GUIAppEnum.h:117
@ MID_HOTKEY_D_MODE_SINGLESIMULATIONSTEP_DELETE
hotkey for perform a single simulation step in SUMO and set delete mode in netedit
Definition GUIAppEnum.h:49
@ MID_HOTKEY_CTRL_A_STARTSIMULATION_OPENADDITIONALELEMENTS
Start the simulation in SUMO and open Additionals Elements in netedit.
Definition GUIAppEnum.h:83
@ MID_HOTKEY_SHIFT_O_LOCATEPOI
Locate poi - button.
Definition GUIAppEnum.h:182
@ MID_LANGUAGE_ZHT
change language to chinese (traditional)
@ MID_LANGUAGE_ES
change language to spanish
@ MID_HOTKEY_SHIFT_A_LOCATEADDITIONAL
Locate additional structure - button.
Definition GUIAppEnum.h:172
@ MID_HOTKEY_CTRL_SHIFT_W_TOGGLEMESSAGEWINDOW
toggle the message window and the status line (based on the status of the message window)
Definition GUIAppEnum.h:226
@ MID_SIMLOAD
(quick)-load state from file
Definition GUIAppEnum.h:332
@ MID_DEMAND_SCALE
scale traffic
Definition GUIAppEnum.h:409
@ MID_HOTKEY_CTRL_I_EDITVIEWPORT
Open viewport editor.
Definition GUIAppEnum.h:99
@ MID_SHOWTOOLTIPS_MENU
Show tool tips in menus - button.
Definition GUIAppEnum.h:395
@ MID_RECENTFILE
Loads a file previously loaded.
Definition GUIAppEnum.h:322
@ 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:256
@ 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:371
@ MID_HOTKEY_CTRL_F_FULSCREENMODE
Fullscreen mode - menu entry.
Definition GUIAppEnum.h:93
@ MID_SIMSAVE
Save state to file.
Definition GUIAppEnum.h:330
@ MID_TUTORIAL
tutorial button
Definition GUIAppEnum.h:675
@ MID_LISTTELEPORTING
Definition GUIAppEnum.h:364
@ 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:373
@ ID_LOADTHREAD_EVENT
The loading thread.
Definition GUIAppEnum.h:350
@ MID_SHOWTOOLTIPS_VIEW
Show tool tips in view - button.
Definition GUIAppEnum.h:393
@ MID_GEO_COORDINATE
enter geo coordinate to center view
Definition GUIAppEnum.h:381
@ 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:377
@ MID_DELAY_TOGGLE
toggle delay between alternative value
Definition GUIAppEnum.h:407
@ MID_HOTKEYS
hotkeys button
Definition GUIAppEnum.h:673
@ MID_TIMELINK_BREAKPOINT
Set breakpionts from messages - Option.
Definition GUIAppEnum.h:583
@ 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:401
@ MID_DELAY_DEC
decrease sim delay
Definition GUIAppEnum.h:405
@ MID_LISTPARKING
Definition GUIAppEnum.h:363
@ MID_NEW_OSGVIEW
Open a new microscopic 3D view.
Definition GUIAppEnum.h:342
@ MID_CARTESIAN_COORDINATE
enter cartesian coordinate to center view
Definition GUIAppEnum.h:383
@ MID_LANGUAGE_JA
change language to japanese
@ MID_FEEDBACK
feedback button
Definition GUIAppEnum.h:677
@ 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:258
@ 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:403
@ 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:375
@ MID_LANGUAGE_FR
change language to french
@ MID_HOTKEY_CTRL_SHIFT_T_OPEN_NET
load only the network in sumo-gui/netedit
Definition GUIAppEnum.h:224
@ MID_WINDOW
Main window-ID.
Definition GUIAppEnum.h:302
@ MID_LANGUAGE_KO
change language to korean
#define STAT_CONTAINERS
FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[]
#define STAT_DELAYED
#define MIN_DRAW_DELAY
#define STAT_PERSONS
#define STAT_TELEPORTS
#define STAT_VEHS
GUICompleteSchemeStorage gSchemeStorage
#define GUIDesignSlider
Definition GUIDesigns.h:536
#define GUIDesignSpinDial
Definition GUIDesigns.h:516
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
Definition GUIDesigns.h:480
#define GUIDesignButtonStatusBarFixed
button rectangular with thick and raise frame with a width of 100
Definition GUIDesigns.h:124
#define GUIDesignMDIButtonLeft
Definition GUIDesigns.h:220
#define GUIDesignToolBarRaisedSameTop
design for first toolbar shell positioned in the same position of dock
Definition GUIDesigns.h:486
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition GUIDesigns.h:144
#define GUIDesignHorizontalFrameStatusBar
Horizontal frame used in status bar.
Definition GUIDesigns.h:359
#define GUIDesignToolBar
design for default toolbar
Definition GUIDesigns.h:465
#define GUIDesignSplitter
Definition GUIDesigns.h:505
#define GUIDesignSplitterMDI
MDI Splitter.
Definition GUIDesigns.h:508
#define GUIDesignMFXCheckableButtonSquare
Definition GUIDesigns.h:158
#define GUIDesignToolbarMenuBar
Definition GUIDesigns.h:459
#define GUIDesignToolBarRaisedNextTop
design for first toolbar shell positioned in the next-top position of dock
Definition GUIDesigns.h:483
#define GUIDesignButtonToolbarText
Definition GUIDesigns.h:141
#define GUIDesignMDIButtonRight
MDIButton oriented to right.
Definition GUIDesigns.h:223
#define GUIDesignStatusBar
design used in status bar
Definition GUIDesigns.h:477
@ SIMULATION_ENDED
Send when the simulation is over;.
@ MESSAGE_OCCURRED
send when a message occurred
@ GLDEBUG_OCCURRED
send when a gldebug occurred
@ ERROR_OCCURRED
send when a error occurred
@ SIMULATION_STEP
send when a simulation step has been performed
@ ADD_VIEW
Send when a new should be opened (via TraCI)
@ CLOSE_VIEW
Send when a view should be closed (via TraCI)
@ SIMULATION_LOADED
send when a simulation has been loaded
@ STATUS_OCCURRED
send when a status change occurred
@ DEBUG_OCCURRED
send when a debug occurred
@ WARNING_OCCURRED
send when a warning occurred
@ GLO_MAX
empty max
GUISelectedStorage gSelected
A global holder of selected objects.
FXString gCurrentFolder
The folder used as last.
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
@ INSERTION_DELAY
@ EDITVIEWPORT
@ CLEARMESSAGEWINDOW
@ NETEDIT_MINI
@ GREENVEHICLE
@ LOCATEVEHICLE
@ LOCATEPERSON
@ SHOWTOOLTIPS_MENU
@ WINDOWS_TILE_VERT
@ GREENCONTAINER
@ WINDOWS_CASCADE
@ GREEN_PERSON_NON_INTERACTING
@ GREEN_VEHICLE_MESO
@ SHOWTOOLTIPS_VIEW
@ OPEN
open icons
@ LOCATECONTAINER
@ LOCATEJUNCTION
@ APP_BREAKPOINTS
@ SAVE_SUMOCONFIG
@ WINDOWS_TILE_HORI
@ YELLOWVEHICLE
@ OPEN_SUMOCONFIG
@ SAVE
save icons
@ GREEN_PERSON_JUPEDSIM
@ KEY_SPACE
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
#define WRITE_WARNINGF(...)
Definition MsgHandler.h:299
#define WRITE_MESSAGEF(...)
Definition MsgHandler.h:301
#define WRITE_ERRORF(...)
Definition MsgHandler.h:308
#define TL(string)
Definition MsgHandler.h:316
#define TLF(string,...)
Definition MsgHandler.h:318
SUMOTime DELTA_T
Definition SUMOTime.cpp:39
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:47
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:107
#define SPEED2DIST(x)
Definition SUMOTime.h:48
#define SUMOTime_MINUTE
Definition SUMOTime.h:39
#define SIMSTEP
Definition SUMOTime.h:69
constexpr SUMOTime TIME2STEPS(double x)
Definition SUMOTime.h:60
#define SUMOTime_DAY
Definition SUMOTime.h:37
#define SUMOTime_HOUR
Definition SUMOTime.h:38
#define TS
Definition SUMOTime.h:45
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
int GUIDesignHeight
the default height for GUI elements
Definition StdDefs.cpp:41
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition StdDefs.h:62
T MAX2(T a, T b)
Definition StdDefs.h:86
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:57
#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" occurred
GUILoadThread * myLoadThread
the thread that loads simulations
MFXLabelTooltip * myScaleTrafficTooltip
the demand scale label
void handleEvent_SimulationEnded(GUIEvent *e)
called when event "simulation ended" occurred
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" occurred
long onCmdBreakpoint(FXObject *, FXSelector, void *)
Called to set a breakpoint via hotkey.
FXToolBarShell * myToolBarDrag9
long onCmdToggleMessageWindow(FXObject *, FXSelector, void *)
Called to show or hide the message window and the status line.
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" occurred
bool myHaveNotifiedAboutSimEnd
whether the simulation end was already announced
void setStatusBarText(const std::string &text)
set status bar text
FXToolBarShell * myToolBarDrag10
MFXCheckableButton * myShowToolTipsView
checkable button for show tool tips in view
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
long onCmdShowToolTipsMenu(FXObject *, FXSelector, void *)
Called on "show tool tips in menu".
virtual void setDelay(double delay)
Sets the delay of the parent application in milliseconds.
MFXLCDLabel * myEmergencyVehicleLabel
emergency vehicle label
long onChoreLeaveFullScreen(FXObject *, FXSelector, void *)
Leave full screen mode after the last view was closed.
std::stringstream * myDynamicSelection
FXToolBarShell * myToolBarDrag7
bool myWasMaximizedBeforeFullScreen
whether the window was maximized before entering the full screen mode
double mySimDelay
the simulation delay in milliseconds
void addRecentConfig(const FX::FXString &f)
add recent config to recent file list
SUMOTime getCurrentSimTime() const
get current simulation time
long onUpdAddView(FXObject *, FXSelector, void *)
Determines whether adding a view is enabled.
FXToolBarShell * myToolBarDrag1
for some menu detaching fun
long onCmdEditViewScheme(FXObject *, FXSelector, void *)
Called on menu Edit->Visualization.
long onRunThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the simulation thread.
MFXLCDLabel * myTotalDistanceLabel
total distance label
bool hadDependentBuild
flag to mark if GUIApplicationWIndow has depend build
SUMOTime myEmergencyVehicleCount
emergency vehicle count
FXMenuPane * myFileMenuRecentNetworks
FXMenu pane for recent networks.
FXCursor * getDefaultCursor()
get default cursor
SUMOTime myTimeLoss
time loss
void checkGamingEventsDRT()
handles additional game-related events (DRT)
FXMDIMenu * myMDIMenu
The menu used for the MDI-windows.
GUIApplicationWindow(FXApp *a)
Constructor.
void updateTimeLCDTooltip()
update LCD timer tooltip
long onCmdListTeleporting(FXObject *, FXSelector, void *)
Toggle listing of teleporting vehicles.
long onCmdNewWindow(FXObject *, FXSelector, void *)
Called on menu File->New Window.
long onCmdStep(FXObject *, FXSelector, void *)
Called on "step".
FXMutex myEventMutex
the mutex for the waiting semaphore
double getTrackerInterval() const
get tracker interval
long onCmdClose(FXObject *, FXSelector, void *)
Called on menu File->Close.
virtual void buildToolBars()
Builds the tool bar.
long onCmdDelayToggle(FXObject *, FXSelector, void *)
Called on "delay toggle".
FXMenuCheck * myLoadAdditionalsInNetedit
menuCheck for enable/disable load additionals in netedit
void buildRecentNetworks(FXMenuPane *fileMenu, FXMenuPane *fileMenuRecentNetworks)
build recent networks
FXMenuPane * myFileMenu
the submenus
long onCmdToggleSecondaryShape(FXObject *, FXSelector, void *)
Toggle draw junction shape.
virtual double getDelay() const
Returns the simulation delay in miliseconds.
long onCmdStart(FXObject *, FXSelector, void *)
Called on "play".
GUIMessageWindow * myMessageWindow
A window to display messages, warnings and error in.
GUIRunThread * getRunner()
get run thread
void loadConfigOrNet(const std::string &file)
starts to load a simulation
FXToolBar * myToolBar1
The application tool bar.
bool myWasStarted
the information whether the simulation was started before
MFXCheckableButton * myShowToolTipsMenu
checkable button for show tool tips in menu
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 dependent
long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
long onCmdEditBreakpoints(FXObject *, FXSelector, void *)
Called on menu Edit->Edit Breakpoints.
long onCmdOpenShapes(FXObject *, FXSelector, void *)
Called on menu File->Load Shapes.
FXToolBarShell * myMenuBarDrag
const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve list of breakpoints
long onCmdQuit(FXObject *, FXSelector, void *)
Called by FOX if the application shall be closed (Called either by FileMenu->Quit,...
FXToolBarShell * myToolBarDrag8
long onUpdStart(FXObject *sender, FXSelector, void *ptr)
Determines whether "play" is enabled.
GUISUMOAbstractView * openNewView(GUISUMOViewParent::ViewType vt=GUISUMOViewParent::VIEW_2D_OPENGL, std::string caption="")
opens a new simulation display
FXGLCanvas * getBuildGLCanvas() const
get build GLCanvas
RandomDistributor< std::string > myJamSounds
random list of jam sounds
long onCmdNewView(FXObject *, FXSelector, void *)
Called if a new view shall be opened (2D view)
FXMenuCommand * myOpenNetInNetedit
menuCommand for opening only the network in netedit
GUIRunThread * myRunThread
the thread that runs simulations
long onCmdClearMsgWindow(FXObject *, FXSelector, void *)
Called if the message window shall be cleared.
long onCmdToggleDrawJunctionShape(FXObject *, FXSelector, void *)
Toggle draw junction shape.
virtual void create()
Creates the main window (required by FOX)
std::map< int, Command * > myHotkeyPress
custom hotkeys pressed
FXToolBarShell * myToolBarDrag5
MFXLCDLabel * myWaitingTimeLabel
waiting time label
long onCmdDemandScale(FXObject *, FXSelector, void *)
Called on "demand scale".
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
called when a key is released
RandomDistributor< std::string > myCollisionSounds
random list of collision sounds
FXMenuCascade * mySelectLanesMenuCascade
the menu cascades
long onCmdOpenNetwork(FXObject *, FXSelector, void *)
Called on menu File->Open Network.
virtual void setBreakpoints(const std::vector< SUMOTime > &breakpoints)
Sets the breakpoints of the parent application.
long onUpdNeedsNetwork(FXObject *, FXSelector, void *)
Determines whether some buttons which require an active network may be shown.
long onCmdLoadState(FXObject *, FXSelector, void *)
Called on "save state".
void eraseBreakpointDialog()
erase current breakpoint dialog
int myPreviousCollisionNumber
previous collision number
long onCmdEditChosen(FXObject *, FXSelector, void *)
Called on menu Edit->Edit Chosen.
virtual void detach()
Detaches the tool/menu bar.
long onCmdDelayDec(FXObject *, FXSelector, void *)
Called on "delay dec".
long onCmdOpenRecent(FXObject *, FXSelector, void *)
Called on opening a recent file.
MFXRecentNetworks myRecentConfigs
List of recent configs.
long onUpdOpenRecent(FXObject *, FXSelector, void *)
Determines whether opening a recent file is enabled.
MFXSynchQue< GUIEvent * > myEvents
List of got requests.
bool myShowTimeAsHMS
whether to show time as hour:minute:second
double myAlternateSimDelay
The alternate simulation delay in milliseconds for toggling.
long onUpdStop(FXObject *, FXSelector, void *)
Determines whether "stop" is enabled.
FXDataTarget * mySimDelayTarget
Simulation delay target.
long onCmdSaveConfig(FXObject *, FXSelector, void *)
Called on menu File->Close.
void closeAllWindows()
this method closes all windows and deletes the current simulation
void updateTimeLCD(SUMOTime time)
updates the simulation time display
long onCmdSaveState(FXObject *, FXSelector, void *)
Called on "save state".
std::map< int, Command * > myHotkeyRelease
custom hotkeys released
long onCmdShowToolTipsView(FXObject *, FXSelector, void *)
Called on "show tool tips in view".
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
long onUpdQuickReload(FXObject *, FXSelector, void *)
Determines whether quick reload can be executed.
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 occurred
void checkGamingEvents()
handles additional game-related events
long onCmdQuickReload(FXObject *, FXSelector, void *)
Called on quick-reload.
FXMenuCommand * myOpenInNetedit
menuCommand for opening simulation/network in netedit
long onCmdGaming(FXObject *, FXSelector, void *)
Toggle gaming mode.
void clearDecals()
Clear the default decals.
void saveViewport(const double x, const double y, const double z, const double rot)
Makes the given viewport the default.
void saveDecals(const std::vector< GUISUMOAbstractView::Decal > &decals)
Makes the given decals the default.
static void close()
close GUICursorSubSys
static void initCursors(FXApp *a)
Initiate GUICursorSubSys.
static FXLabel * buildFXLabel(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXuint opts, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
Construct label with given text and icon.
static FXButton * buildFXButton(FXComposite *p, const std::string &text, const std::string &tip, const std::string &help, FXIcon *ic, FXObject *tgt, FXSelector sel, FXuint opts=BUTTON_NORMAL, FXint x=0, FXint y=0, FXint w=0, FXint h=0, FXint pl=DEFAULT_PAD, FXint pr=DEFAULT_PAD, FXint pt=DEFAULT_PAD, FXint pb=DEFAULT_PAD)
build button
static FXMenuTitle * buildFXMenuTitle(FXComposite *p, const std::string &text, FXIcon *icon, FXMenuPane *menuPane)
build menu title
static FXMenuCommand * buildFXMenuCommandRecentFile(FXComposite *p, const std::string &text, FXObject *tgt, FXSelector sel)
build menu command (for recent files)
static FXMenuCheck * buildFXMenuCheckbox(FXComposite *p, const std::string &text, const std::string &info, FXObject *tgt, FXSelector sel)
build menu checkbox
static FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel, const bool disable=false)
build menu command
static FXMenuCommand * buildFXMenuCommandShortcut(FXComposite *p, const std::string &text, const std::string &shortcut, const std::string &info, FXIcon *icon, FXObject *tgt, FXSelector sel)
build menu command
The application's "About" - dialog.
void create()
Creates the widget.
The dialog to change the application (gui) settings.
Editor for simulation breakpoints.
The application's "Feedback" dialog.
void create()
Creates the widget.
Editor for the list of chosen objects.
The SUMO User Conference "Hall of Fame" - dialog / easter egg.
void create()
Creates the widget.
const std::string & getCaption() const
const std::string & getSchemeName() const
const std::string & getCaption() const
const std::string & getMsg() const
Returns the message.
Event sent when the simulation is over.
MSNet::SimulationState getReason() const
Returns the reason the simulation has ended due.
SUMOTime getTimeStep() const
Returns the time step the simulation has ended at.
const SUMOTime myBegin
the time the simulation shall start with
const std::vector< std::string > mySettingsFiles
the name of the settings file to load
const bool myOsgView
whether to load the OpenSceneGraph view
const SUMOTime myEnd
the time the simulation shall end with
const bool myViewportFromRegistry
whether loading viewport from registry
const std::string myFile
the name of the loaded file
GUIEventType getOwnType() const
returns the event type
Definition GUIEvent.h:89
virtual void create()
create GUIGlChildWindow
GUISUMOAbstractView * getView() const
return GUISUMOAbstractView
virtual FXGLCanvas * getBuildGLCanvas() const
get build GL Canvas
GUIGlID getGlID() const
Returns the numerical id of the object.
static double gTrackerInterval
the aggregation period for tracker windows in seconds
Definition GUIGlobals.h:46
static bool gRunAfterLoad
the simulation shall start direct after loading
Definition GUIGlobals.h:37
static bool gQuitOnEnd
the window shall be closed when the simulation has ended
Definition GUIGlobals.h:40
static bool gDemoAutoReload
the simulation shall reload when it has ended (demo)
Definition GUIGlobals.h:43
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static void initIcons(FXApp *a)
Initiate GUIIconSubSys.
static void close()
close GUIIconSubSys
Representation of a lane in the micro simulation (gui-version)
Definition GUILane.h:60
void loadConfigOrNet(const std::string &file)
begins the loading of the given file
const std::string & getFileName() const
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call
bool myListParking
information whether the locator should list parking vehicles
void removeViewByID(const std::string &id)
long onCmdUnfocusCoordinate(FXObject *, FXSelector, void *)
called when a coordinate field in the status bar loses focus
std::vector< FXMainWindow * > myTrackerWindows
list of tracker windows
FXMenuPane * myLanguageMenu
Language menu common to all applications.
void checkNews()
fetch the release news feed in the background if it was not accessed recently
GUISUMOAbstractView * getActiveView() const
get the active view or 0
long onCmdSetGeoCoordinate(FXObject *, FXSelector, void *)
called when user enters a geo coordinate in the status bar
bool myListTeleporting
information whether the locator should list teleporting vehicles
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.
long onCmdSetCartesianCoordinate(FXObject *, FXSelector, void *)
called when user enters a cartesian coordinate in the status bar
FXHorizontalFrame * myTraCiFrame
frames for coordinates
long onCmdNews(FXObject *, FXSelector, void *)
show the latest release news (fetching them if necessary)
void buildLanguageMenu(FXMenuBar *menuBar)
long onCmdChangeLanguage(FXObject *, FXSelector, void *)
MFXStaticToolTip * myStaticTooltipView
static toolTip used in view
bool listParking() const
return whether to list parking vehicles
FXHorizontalFrame * myGeoFrame
FXTextField * myCartesianCoordinate
Coordinate fields for the current cartesian, geo-coordinate and test coordinates.
FXHorizontalFrame * myTestFrame
FXHorizontalFrame * myCartesianFrame
FXLabel * myTestCoordinate
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
void toggleMessageWindowAndStatusBar(FXWindow *messageWindow)
FOX need this.
FXDockSite * myTopDock
dock sites
bool myListInternal
information whether the locator should list internal structures
void storeWindowSizeAndPos()
record window position and size in registry
long onCmdFocusCoordinate(FXObject *, FXSelector, void *)
called when user focuses a coordinate field in the status bar
bool myAmFullScreen
whether to show the window in full screen mode
FXStatusBar * myStatusbar
The status bar.
void updateChildren(int msg=MID_SIMSTEP)
update childrens
FXTextField * myGeoCoordinate
FXGLVisual * myGLVisual
The gl-visual used.
bool myAmGaming
information whether the gui is currently in gaming mode
std::vector< GUIGlChildWindow * > myGLWindows
list of GLWindows
long onUpdChangeLanguage(FXObject *, FXSelector, void *)
A logging window for the gui.
void addSeparator()
Adds a a separator to this log window.
void clear()
Clears the window.
void appendMsg(GUIEventType eType, const std::string &msg)
Adds new text to the window.
static SUMOTime getBreakPointOffset()
ask whether locate links is enabled
MSTransportableControl & getPersonControl() override
Returns the person control.
Definition GUINet.cpp:130
void flushOutputsAtEnd()
flush outputs once the simulation has reached its end
Definition GUINet.cpp:814
GUITrafficLightLogicWrapper * getTLLWrapper(MSTrafficLightLogic *tll)
Definition GUINet.cpp:226
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition GUINet.cpp:486
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition GUINet.cpp:581
MSTransportableControl & getContainerControl() override
Returns the container control.
Definition GUINet.cpp:139
virtual double getRotation() const =0
Returns the rotation of the canvas stored in this changer.
virtual double getXPos() const =0
Returns the x-offset of the field to show stored in this changer.
virtual double getYPos() const =0
Returns the y-offset of the field to show stored in this changer.
virtual double getZPos() const =0
Returns the camera height corresponding to the current zoom factor.
void singleStep()
called when the user presses the "single step"-button
GUINet & getNet() const
returns the loaded network
virtual void begin()
starts the simulation (execution of one step after another)
SUMOTime getSimBegin()
get simulation begin time
void resume()
called when the user presses the "resume"-button
virtual bool simulationIsStartable() const
check if simulation is startable
bool networkAvailable() const
returns the information whether a network has been loaded
virtual bool simulationIsStepable() const
check if simulation is stepable
std::vector< SUMOTime > & getBreakpoints()
get list of breakpoints
virtual bool init(GUINet *net, SUMOTime start, SUMOTime end)
initialises the thread with the new simulation
FXMutex & getBreakpointLock()
get breakpoint lock
SUMOTime getSimEndTime() const
get simulation end time
virtual bool simulationIsStopable() const
check if simulation is stopableo
virtual void deleteSim()
deletes the existing simulation
void stop()
halts the simulation execution
void prepareDestruction()
halts the thread before it shall be deleted
MFXComboBoxIcon * getColoringSchemesCombo()
get coloring schemes combo
void addDecals(const std::vector< Decal > &decals)
add decals
void processPendingTextureDeletes()
process pending texture deletions
FXbool makeCurrent()
A reimplementation due to some internal reasons.
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
GUIPerspectiveChanger & getChanger() const
get changer
std::vector< Decal > & getDecals()
The list of decals to show.
void clearDecals()
clear all decals
virtual void updatePositionInformationLabel() const
update position information labels
virtual void setViewportFromToRot(const Position &lookFrom, const Position &lookAt, double rotation)
applies the given viewport settings
GUIVisualizationSettings * editVisualisationSettings() const
edit visualization settings (allow modify VisualizationSetings, use carefully)
virtual void copyViewportTo(GUISUMOAbstractView *view)
copy the viewport to the given view
virtual bool setColorScheme(const std::string &)
set color scheme
A single child window which contains a view of the simulation area.
ViewType
Available view types.
@ VIEW_3D_OSG
plain 3D OSG view (
@ VIEW_2D_OPENGL
plain 2D openGL view (
virtual GUISUMOAbstractView * init(FXGLCanvas *share, GUINet &net, ViewType type)
"Initialises" this window by building the contents
long onCmdLocate(FXObject *, FXSelector, void *)
locator-callback
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
void setToolBarVisibility(const bool value)
about toggled gaming status
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
void clear()
Clears the list of selected objects.
void select(GUIGlID id, bool update=true)
Adds the object with the given id.
std::string load(const std::string &filename, GUIGlObjectType type=GLO_MAX, std::ostream *dynamicNotFound=nullptr)
Loads a selection list (optionally with restricted type)
An XML-handler for visualisation schemes.
double getDelay() const
Returns the parsed delay.
const std::string & getSettingName() const
std::vector< std::string > getTrackers()
RandomDistributor< std::string > getEventDistribution(const std::string &id)
const std::string & getViewType() const
Returns the parsed view type.
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
const std::vector< SUMOTime > & getBreakpoints() const
Returns the parsed breakpoints.
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
Storage for geometrical objects extended by mutexes.
static void buildAccelerators(FXAccelTable *accelTable, FXObject *target, const bool sumogui)
build accelerators
static void changeAccelerator(FXAccelTable *accelTable, FXObject *target, GUIShortcut keysym, long msg)
change accelerator (used for toggle dynamically binding space key with start/end simulation)
static void resetTextures()
Reset textures.
static void initTextures(FXApp *a)
Initiate GUITextureSubSys for textures.
void begin2TrackPhases(GUIMainWindow *app=nullptr)
Builds a GUITLLogicPhasesTrackerWindow which will receive new phases.
static std::string clipped
Definition GUIUserIO.h:58
bool drawJunctionShape
whether the shape of the junction should be drawn
bool secondaryShape
whether secondary lane shape shall be drawn
GUIColorer laneColorer
The lane colorer.
bool amChecked() const
check if this MFXCheckableButton is checked
void setChecked(bool val, const bool inform=false)
check or uncheck this MFXCheckableButton
long setCurrentItem(const FXint index, FXbool notify=FALSE)
Set the current item (index is zero-based)
FXint findItem(const FXString &text) const
find item
void setVertical(const FXint len)
set segment vertical length - must be more than twice the segment width
void setGroove(const FXint w)
set groove width - must be less than segment width
void setThickness(const FXint w)
set segment width - must be less than half the segment length
void setToolTipText(const FXString &text)
set tooltip text
void setText(FXString lbl)
manipulate text in LCD label
void setHorizontal(const FXint len)
set segment horizontal length - must be more than twice the segment width
void setFgColor(FXColor clr)
set forground color
static void sleep(long ms)
void enableStaticToolTip(const bool value)
enable/disable static tooltip
void push_back(T what)
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:146
static FXString getTitleText(const FXString &appname, FXString filename="")
Returns the title text in dependence to an optional file name.
Definition MFXUtils.cpp:62
static FXbool userPermitsOverwritingWhenFileExists(FXWindow *const parent, const FXString &file)
Returns true if either the file given by its name does not exist or the user allows overwriting it.
Definition MFXUtils.cpp:41
static FXString assureExtension(const FXFileDialog &openDialog)
Corrects missing extension.
Definition MFXUtils.cpp:71
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
bool isStopped() const
Returns whether the vehicle is at a stop.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition MSEdge.cpp:1157
static bool gUseMesoSim
Definition MSGlobals.h:106
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition MSLane.h:640
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition MSLane.h:575
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
Definition MSNet.cpp:1886
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:201
MSTLLogicControl & getTLSControl()
Returns the tls logics control.
Definition MSNet.h:476
@ SIMSTATE_LOADING
The simulation is loading.
Definition MSNet.h:97
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
Definition MSNet.h:107
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition MSNet.cpp:1038
void quickReload()
reset state to the beginning without reloading the network
Definition MSNet.cpp:1863
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:335
bool hasContainers() const
Returns whether containers are simulated.
Definition MSNet.h:436
bool hasPersons() const
Returns whether persons are simulated.
Definition MSNet.h:420
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition MSNet.h:456
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition MSNet.h:526
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:403
static void saveState(const std::string &file, SUMOTime step, bool usePrefix=true)
Saves the current state.
MSTrafficLightLogic * getActive() const
bool knows(const std::string &id) const
Returns the information whether the named tls is stored.
TLSLogicVariants & get(const std::string &id) const
Returns the variants of a named tls.
The parent class for traffic light logics.
int getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
int getWaitingForVehicleNumber() const
Returns the number of transportables waiting for a ride.
The class responsible for building and deletion of vehicles.
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
void setScale(double scale)
sets the demand scaling factor
int getCollisionCount() const
return the number of collisions
int getDepartedVehicleNo() const
Returns the number of inserted vehicles.
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
int getTeleportCount() const
return the number of teleports (including collisions)
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition MSVehicle.h:605
const MSLane * getLane() const
Returns the lane the vehicle is on.
Definition MSVehicle.h:581
double getSpeed() const
Returns the vehicle's current speed.
Definition MSVehicle.h:490
The XML-Handler for shapes loading network loading.
Definition NLHandler.h:55
void writeConfiguration(std::ostream &os, const bool filled, const bool complete, const bool addComments, const std::string &relativeTo="", const bool forceRelative=false, const bool inComment=false, const std::string &indent="") const
Writes the configuration.
bool isSet(const std::string &name, bool failOnNonExistant=true) const
Returns the information whether the named option is set.
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
bool getBool(const std::string &name) const
Returns the boolean-value of the named option (only for Option_Bool)
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
void set(double x, double y)
set positions x and y
Definition Position.h:82
double x() const
Returns the x-position.
Definition Position.h:52
double y() const
Returns the y-position.
Definition Position.h:57
static const RGBColor GREEN
Definition RGBColor.h:205
static const RGBColor RED
named colors
Definition RGBColor.h:204
double getOverallProb() const
Return the sum of the probabilites assigned to the members.
T get(SumoRNG *which=nullptr) const
Draw a sample of the distribution.
static StringBijection< StateFileExtension > StateFileExtensions
state file extensions
static StringBijection< SumoConfigFileExtension > SumoConfigFileExtensions
sumo config file extensions
static StringBijection< EdgeDataFileExtension > EdgeDataFileExtensions
edgedata file extensions
static StringBijection< ShapesFileExtension > ShapesFileExtensions
additional file extensions
static StringBijection< NetFileExtension > NetFileExtensions
net file extensions
std::vector< std::string > getVector()
return vector of strings
static std::string transcodeLocal(const std::string &str, bool toLocal)
convert a string between UTF-8 and the local codepage (identity on non-Windows systems)
static std::string to_lower_case(const std::string &str)
Transfers the content to lower case.
static std::string replace(std::string str, const std::string &what, const std::string &by)
Replaces all occurrences of the second string by the third string within the first string.
A few system-specific functions.
Definition SysUtils.h:30
static unsigned long runHiddenCommand(const std::string &cmd)
run a shell command without popping up any windows (particuarly on win32)
Definition SysUtils.cpp:67
static long long getModifiedTime(const std::string &fname)
@brie get modified time
Definition SysUtils.cpp:107
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition SysUtils.cpp:42
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:171
@ SEL_THREAD
Definition fxexdefs.h:153