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-2023 German Aerospace Center (DLR) and others.
4// This program and the accompanying materials are made available under the
5// terms of the Eclipse Public License 2.0 which is available at
6// https://www.eclipse.org/legal/epl-2.0/
7// This Source Code may also be made available under the following Secondary
8// Licenses when the conditions for such availability set forth in the Eclipse
9// Public License 2.0 are satisfied: GNU General Public License, version 2
10// or later which is available at
11// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13/****************************************************************************/
22// The main window of the SUMO-gui.
23/****************************************************************************/
24#include <config.h>
25
26#ifdef HAVE_VERSION_H
27#include <version.h>
28#endif
29
30#include <fxkeys.h>
31
32#include <guisim/GUILane.h>
33#include <guisim/GUINet.h>
38#include <netload/NLHandler.h>
61#include <utils/xml/XMLSubSys.h>
62
66#include "GUIGlobals.h"
67#include "GUILoadThread.h"
68#include "GUIRunThread.h"
74
75
76#define MIN_DRAW_DELAY 20
77//#define HAVE_DANGEROUS_SOUNDS
78
79// ===========================================================================
80// FOX-declarations
81// ===========================================================================
82FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[] = {
83 // close
87 FXMAPFUNC(SEL_CLOSE, MID_WINDOW, GUIApplicationWindow::onCmdQuit),
88 // toolbar
104 //FXMAPFUNC(SEL_COMMAND, MID_NETEDIT_SUMOCFG, GUIApplicationWindow::onCmdNeteditSUMOConfig),
105 // gaming
115 // OSG
116#ifdef HAVE_OSG
117 FXMAPFUNC(SEL_COMMAND, MID_NEW_OSGVIEW, GUIApplicationWindow::onCmdNewOSG),
119
120#endif
121 // Time
128 FXMAPFUNC(SEL_COMMAND, MID_DELAY_INC, GUIApplicationWindow::onCmdDelayInc),
129 FXMAPFUNC(SEL_COMMAND, MID_DELAY_DEC, GUIApplicationWindow::onCmdDelayDec),
130 FXMAPFUNC(SEL_COMMAND, MID_SIMSAVE, GUIApplicationWindow::onCmdSaveState),
131 FXMAPFUNC(SEL_COMMAND, MID_SIMLOAD, GUIApplicationWindow::onCmdLoadState),
136 // Stats
140 // these functions do not assign shortcut keys to commands, but rather affect the button enable status upon other events (e.g. simulation loaded)
141 // since those events are invoked through pseudo key events (?), the same key shortcuts as in cmd must be supplied as well
163 //FXMAPFUNC(SEL_UPDATE, MID_NETEDIT_SUMOCFG, GUIApplicationWindow::onUpdNeteditSUMOConfig),
167 FXMAPFUNC(SEL_COMMAND, MID_HOTKEYS, GUIApplicationWindow::onCmdHotkeys),
168 FXMAPFUNC(SEL_COMMAND, MID_TUTORIAL, GUIApplicationWindow::onCmdTutorial),
170 FXMAPFUNC(SEL_COMMAND, MID_FEEDBACK, GUIApplicationWindow::onCmdFeedback),
172 // forward requests to the active view
191 // languages
208 // keys
209 FXMAPFUNC(SEL_KEYPRESS, 0, GUIApplicationWindow::onKeyPress),
210 FXMAPFUNC(SEL_KEYRELEASE, 0, GUIApplicationWindow::onKeyRelease),
211 // clipboard
212 FXMAPFUNC(SEL_CLIPBOARD_REQUEST, 0, GUIApplicationWindow::onClipboardRequest),
213 // events
218};
219
220// Object implementation
221FXIMPLEMENT(GUIApplicationWindow, FXMainWindow, GUIApplicationWindowMap, ARRAYNUMBER(GUIApplicationWindowMap))
222
223// ===========================================================================
224// static members
225// ===========================================================================
226
228
229// ===========================================================================
230// member method definitions
231// ===========================================================================
232GUIApplicationWindow::GUIApplicationWindow(FXApp* a, const std::string& configPattern) :
233 GUIMainWindow(a),
234 myFileMenuRecentNetworks(new FXMenuPane(this)),
235 myFileMenuRecentConfigs(new FXMenuPane(this)),
236 myRecentNetworks(a, "networks"),
237 myRecentConfigs(a, "configs"),
238 myConfigPattern(configPattern),
239 myLastStepEventMillis(SysUtils::getCurrentMillis() - MIN_DRAW_DELAY) {
240 // init icons
242 // init cursors
244 // disable tooltips
245 a->setTooltipTime(1000000000);
246 a->setTooltipPause(1000000000);
247}
248
249
254
255
256void
258 // don't do this twice
259 if (hadDependentBuild) {
260 return;
261 }
262 hadDependentBuild = true;
263 // set language
264 if (gLanguage == "C") {
265 gLanguage = getApp()->reg().readStringEntry("gui", "language", "C");
267 }
268 setTarget(this);
269 setSelector(MID_WINDOW);
270 // build menu bar
271 myMenuBarDrag = new FXToolBarShell(this, GUIDesignToolBar);
273 new FXToolBarGrip(myMenuBar, myMenuBar, FXMenuBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
275 // build the thread - io
280 // build the status bar
281 myStatusbar = new FXStatusBar(this, GUIDesignStatusBar);
282 {
283 // build TraCi info
285 auto button = new FXButton(myTraCiFrame, "TraCI", nullptr, this, MID_TRACI_STATUS, GUIDesignButtonStatusBarFixed);
286 button->setBackColor(FXRGBA(253, 255, 206, 255));
287 if (TraCIServer::getInstance() == nullptr) {
288 myTraCiFrame->hide();
289 }
290 // build geo coordiantes
292 myGeoCoordinate = new FXLabel(myGeoFrame, (TL("N/A") + std::string("\t\t") + TL("Original coordinate (before coordinate transformation in netconvert)")).c_str(), nullptr, LAYOUT_CENTER_Y);
293 // build cartesian coordinates
295 myCartesianCoordinate = new FXLabel(myCartesianFrame, (TL("N/A") + std::string("\t\t") + TL("Network coordinate")).c_str(), nullptr, LAYOUT_CENTER_Y);
296 // build buttons
299 myStatButtons.back()->hide();
301 myStatButtons.back()->hide();
302 }
303 // make the window a mdi-window
304 myMainSplitter = new FXSplitter(this, GUIDesignSplitter | SPLITTER_VERTICAL | SPLITTER_REVERSED);
306 myMDIMenu = new FXMDIMenu(this, myMDIClient);
307 new FXMDIWindowButton(myMenuBar, myMDIMenu, myMDIClient, FXMDIClient::ID_MDI_MENUWINDOW, GUIDesignMDIButtonLeft);
308 new FXMDIDeleteButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUCLOSE, GUIDesignMDIButtonRight);
309 new FXMDIRestoreButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENURESTORE, GUIDesignMDIButtonRight);
310 new FXMDIMinimizeButton(myMenuBar, myMDIClient, FXMDIClient::ID_MDI_MENUMINIMIZE, GUIDesignMDIButtonRight);
311 // build the message window
313 // fill menu and tool bar
314 fillMenuBar();
315 myToolBar6->hide();
316 myToolBar7->hide();
317 myToolBar9->hide();
318 myToolBar10->hide();
319 // build additional threads
320 myLoadThread = new GUILoadThread(getApp(), this, myEvents, myLoadThreadEvent, isLibsumo);
322 // set the status bar
323 setStatusBarText(TL("Ready."));
324 // set the caption
325 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
326 // start the simulation-thread (it will loop until the application ends deciding by itself whether to perform a step or not)
327 myRunThread->start();
330}
331
332
333void
336 gCurrentFolder = getApp()->reg().readStringEntry("SETTINGS", "basedir", "");
337 FXMainWindow::create();
338 myMenuBarDrag->create();
339 myToolBarDrag1->create();
340 myToolBarDrag2->create();
341 myToolBarDrag3->create();
342 myToolBarDrag4->create();
343 myToolBarDrag5->create();
344 myToolBarDrag6->create();
345 myToolBarDrag7->create();
346 myFileMenu->create();
347 mySelectByPermissions->create();
348 myEditMenu->create();
349 mySettingsMenu->create();
350 myLocatorMenu->create();
351 myControlMenu->create();
352 myWindowMenu->create();
353 myLanguageMenu->create();
354 myHelpMenu->create();
355 FXint textWidth = getApp()->getNormalFont()->getTextWidth("8", 1) * 24;
356 myCartesianFrame->setWidth(textWidth);
357 myGeoFrame->setWidth(textWidth);
358 if (myTestFrame) {
359 myTestFrame->setWidth(textWidth);
360 }
361
362 show(PLACEMENT_DEFAULT);
363 if (!OptionsCont::getOptions().isSet("window-size")) {
364 if (getApp()->reg().readIntEntry("SETTINGS", "maximized", 0) == 1) {
365 maximize();
366 }
367 }
368 myShowTimeAsHMS = (getApp()->reg().readIntEntry("gui", "timeasHMS", 0) == 1);
369 myAlternateSimDelay = getApp()->reg().readIntEntry("gui", "alternateSimDelay", 100);
370 const std::string& onlineMaps = getApp()->reg().readStringEntry("gui", "onlineMaps", "");
371 for (const std::string& entry : StringTokenizer(onlineMaps, "\n").getVector()) {
372 const std::vector<std::string> split = StringTokenizer(entry, "\t").getVector();
373 myOnlineMaps[split[0]] = split[1];
374 }
375 if (myOnlineMaps.empty()) {
376 myOnlineMaps["GeoHack"] = "https://geohack.toolforge.org/geohack.php?params=%lat;%lon_scale:1000";
377 myOnlineMaps["GoogleSat"] = "https://www.google.com/maps?ll=%lat,%lon&t=h&z=18";
378 myOnlineMaps["OSM"] = "https://www.openstreetmap.org/?mlat=%lat&mlon=%lon&zoom=18&layers=M";
379 }
381}
382
383
386 myRunThread->join();
388 // close icons
391 // delete visual
392 delete myGLVisual;
393 // delete some non-parented windows
394 delete myToolBarDrag1;
395 delete mySimDelayTarget;
396 // delete rest of elements
399 delete myRunThread;
400 delete myFileMenu;
401 delete myEditMenu;
403 delete mySettingsMenu;
404 delete myLocatorMenu;
405 delete myControlMenu;
406 delete myLanguageMenu;
407 delete myWindowMenu;
408 delete myHelpMenu;
409 delete myLoadThread;
410
411 while (!myEvents.empty()) {
412 // get the next event
413 GUIEvent* e = myEvents.top();
414 myEvents.pop();
415 delete e;
416 }
417 for (auto item : myHotkeyPress) {
418 delete item.second;
419 }
420 for (auto item : myHotkeyRelease) {
421 delete item.second;
422 }
423}
424
425
426void
428 FXMainWindow::detach();
429 myMenuBarDrag->detach();
430 myToolBarDrag1->detach();
431}
432
433
434void
435GUIApplicationWindow::addToWindowsMenu(FXMenuPane* /*menuPane*/) {
436 // unused, implement in children
437}
438
439
440void
442 // build file menu
443 myFileMenu = new FXMenuPane(this);
446 TL("New Window"), "Ctrl+Shift+N", TL("Open a new sumo-gui window."),
447 nullptr, this, MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW);
448 new FXMenuSeparator(myFileMenu);
450 TL("&Open Simulation..."), "Ctrl+O", TL("Open a simulation (Configuration file)."),
453 TL("Open &Network..."), "Ctrl+N", TL("Open a network."),
456 TL("Open Shapes "), "Ctrl+P", TL("Load POIs and Polygons for visualization."),
459 TL("Open EdgeData "), "Ctrl+U", TL("Load edge related data for visualization."),
462 TL("&Reload"), "Ctrl+R", TL("Reloads the simulation / the network."),
465 TL("Quick-Reload"), "Ctrl+0", TL("Reloads the simulation (but not network)."),
467 new FXMenuSeparator(myFileMenu);
469 TL("Save Configuration"), "Ctrl+Shift+S", TL("Save current options as a configuration file."),
472 TL("Close"), "Ctrl+W", TL("Close the simulation."),
474 new FXMenuSeparator(myFileMenu);
475 // build recent files
478 new FXMenuSeparator(myFileMenu);
480 TL("&Quit"), "Ctrl+Q", TL("Quit the Application."),
481 nullptr, this, MID_HOTKEY_CTRL_Q_CLOSE);
482 // build edit menu
483 mySelectByPermissions = new FXMenuPane(this);
484 std::vector<std::string> vehicleClasses = SumoVehicleClassStrings.getStrings();
485 for (const auto& vehicleClass : vehicleClasses) {
487 }
488 myEditMenu = new FXMenuPane(this);
491 TL("Edit Selected..."), "Ctrl+E", TL("Opens a dialog for editing the list of selected items."),
493 mySelectLanesMenuCascade = new FXMenuCascade(myEditMenu,
494 (TL("Select lanes which allow...") + std::string("\t\t") + TL("Opens a menu for selecting a vehicle class by which to selected lanes.")).c_str(),
496 new FXMenuSeparator(myEditMenu);
498 TL("Edit Breakpoints"), "Ctrl+B", TL("Opens a dialog for editing breakpoints."),
501 TL("Edit Visualisation"), "F9", TL("Opens a dialog for editing visualization settings."),
504 TL("Edit Viewport"), "Ctrl+I", TL("Opens a dialog for editing viewing area, zoom and rotation."),
506 new FXMenuSeparator(myEditMenu);
508 TL("Open network in netedit"), "Ctrl+T", TL("Opens current network in NETEDIT."),
510 //GUIDesigns::buildFXMenuCommandShortcut(myEditMenu,
511 // TL("Open config in netedit"), "", TL("Opens current sumo config in NETEDIT."),
512 // GUIIconSubSys::getIcon(GUIIcon::NETEDIT_MINI), this, MID_NETEDIT_SUMOCFG);
513 // build settings menu
514 mySettingsMenu = new FXMenuPane(this);
517 TL("Application Settings"), "Ctrl+H", TL("Open a Dialog for Application Settings editing."),
519 myGamingModeCheckbox = new FXMenuCheck(mySettingsMenu,
520 TL("Gaming Mode\tCtrl+G\tToggle gaming mode on/off."),
523 TL("Full Screen Mode"), "Ctrl+F", TL("Toggle full screen mode on/off."),
525 // build Locate menu
526 myLocatorMenu = new FXMenuPane(this);
529 TL("&Junctions"), "Shift+J", TL("Open a Dialog for Locating a Junction."),
532 TL("&Edges"), "Shift+E", TL("Open a Dialog for Locating an Edge."),
535 TL("&Vehicles"), "Shift+V", TL("Open a Dialog for Locating a Vehicle."),
538 TL("&Persons"), "Shift+P", TL("Open a Dialog for Locating a Person."),
541 TL("&Container"), "Shift+C", TL("Open a Dialog for Locating a Container."),
544 TL("&TLS"), "Shift+T", TL("Open a Dialog for Locating a Traffic Light."),
547 TL("&Additional"), "Shift+A", TL("Open a Dialog for Locating an Additional Structure."),
550 TL("P&oI"), "Shift+O", TL("Open a Dialog for Locating a Point of Interest."),
553 TL("Po&lygon"), "Shift+L", TL("Open a Dialog for Locating a Polygon."),
555 new FXMenuSeparator(myLocatorMenu);
556 new FXMenuCheck(myLocatorMenu,
557 (TL("Show Internal Structures") + std::string("\t\t") + TL("Show internal junctions and streets in locator dialog.")).c_str(),
558 this, MID_LISTINTERNAL);
559 FXMenuCheck* listParking = new FXMenuCheck(myLocatorMenu,
560 (TL("Show Parking Vehicles") + std::string("\t\t") + TL("Show parking vehicles in locator dialog.")).c_str(),
561 this, MID_LISTPARKING);
562 listParking->setCheck(myListParking);
563 new FXMenuCheck(myLocatorMenu,
564 (TL("Show vehicles outside the road network") + std::string("\t\t") + TL("Show vehicles that are teleporting or driving remote-controlled outside the road network in locator dialog.")).c_str(),
565 this, MID_LISTTELEPORTING);
566 // build control menu
567 // the shortcut designator is not only at text in the submenu but also defines the real shortcut key assigned with it!
568 // secondary shortcuts (ctrl+A, ctrl+S, ctrl+D) are defined in GUIShortcutsSubSys::buildSUMOAccelerators
569 myControlMenu = new FXMenuPane(this);
570 GUIDesigns::buildFXMenuTitle(myMenuBar, TL("Simulation"), nullptr, myControlMenu);
572 TL("Run"), "A,space", TL("Start/ Resume the simulation."),
575 TLC("Simulation", "Stop"), "S,space", TL("Halt the simulation."),
578 TL("Step"), "D", TL("Perform one simulation step."),
581 TL("Delay+"), "PgUp", TL("Increase simulation step delay."), nullptr, this, MID_DELAY_INC);
583 TL("Delay-"), "PgDn", TL("Decrease simulation step delay."), nullptr, this, MID_DELAY_DEC);
585 TL("Save"), "", TL("Save the current simulation state to a file."),
588 TL("Load"), "", TL("Load simulation state for the current network from file."),
590 // build windows menu
591 myWindowMenu = new FXMenuPane(this);
594#ifdef HAVE_OSG
596#endif
598 TL("Tile &Horizontally"), "", "",
599 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_HORI), myMDIClient, FXMDIClient::ID_MDI_TILEHORIZONTAL);
601 TL("Tile &Vertically"), "", "",
602 GUIIconSubSys::getIcon(GUIIcon::WINDOWS_TILE_VERT), myMDIClient, FXMDIClient::ID_MDI_TILEVERTICAL);
604 TL("Cascade"), "", "",
606 myMDIClient, FXMDIClient::ID_MDI_CASCADE);
608 TL("&Close"), "", "",
609 nullptr, myMDIClient, FXMDIClient::ID_MDI_CLOSE);
610 FXMenuSeparator* sep2 = new FXMenuSeparator(myWindowMenu);
611 sep2->setTarget(myMDIClient);
612 sep2->setSelector(FXMDIClient::ID_MDI_ANY);
613 // for whatever reason, sonar complains in the next line that sep2 may leak, but fox does the cleanup
614 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_1); // NOSONAR
615 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_2);
616 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_3);
617 GUIDesigns::buildFXMenuCommand(myWindowMenu, "", nullptr, myMDIClient, FXMDIClient::ID_MDI_4);
618 GUIDesigns::buildFXMenuCommand(myWindowMenu, TL("&Others..."), nullptr, myMDIClient, FXMDIClient::ID_MDI_OVER_5);
619
620 new FXMenuSeparator(myWindowMenu);
621 new FXMenuCheck(myWindowMenu,
622 (TL("Show Status Line") + std::string("\t\t") + TL("Toggle the Status Bar on/off.")).c_str(),
623 myStatusbar, FXWindow::ID_TOGGLESHOWN);
624 new FXMenuCheck(myWindowMenu,
625 (TL("Show Message Window") + std::string("\t\t") + TL("Toggle the Message Window on/off.")).c_str(),
626 myMessageWindow, FXWindow::ID_TOGGLESHOWN);
627 new FXMenuCheck(myWindowMenu,
628 (TL("Show Simulation Time") + std::string("\t\t") + TL("Toggle the Simulation Time on/off.")).c_str(),
629 myToolBar3, FXWindow::ID_TOGGLESHOWN);
630 new FXMenuCheck(myWindowMenu,
631 (TL("Show Simulation Delay") + std::string("\t\t") + TL("Toggle the Simulation Delay Entry on/off.")).c_str(),
632 myToolBar4, FXWindow::ID_TOGGLESHOWN);
634
635 new FXMenuSeparator(myWindowMenu);
637 TL("Clear Message Window"), "", TL("Clear the message window."),
639 // build windows menu
641 // build help menu
642 myHelpMenu = new FXMenuPane(this);
644 TL("&Help"),
645 nullptr, myHelpMenu);
646 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Online Documentation"), "F1", TL("Open Online documentation."),
647 nullptr, this, MID_HOTKEY_F1_ONLINEDOCUMENTATION);
648 new FXMenuSeparator(myHelpMenu);
649 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Changelog"), "", TL("Open Changelog."),
650 nullptr, this, MID_CHANGELOG);
651 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Hotkeys"), "", TL("Open Hotkeys."),
652 nullptr, this, MID_HOTKEYS);
653 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Tutorial"), "", TL("Open Tutorial."),
654 nullptr, this, MID_TUTORIAL);
655 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&Feedback"), "", TL("Open feedback dialog."),
656 nullptr, this, MID_FEEDBACK);
657 new FXMenuSeparator(myHelpMenu);
658 GUIDesigns::buildFXMenuCommandShortcut(myHelpMenu, TL("&About"), "F12", TL("About sumo-gui."),
660 // build SUMO Accelerators (hotkeys)
661 GUIShortcutsSubSys::buildAccelerators(getAccelTable(), this, true);
662}
663
664
665void
667 // file and simulation tool bar
668 {
669 myToolBarDrag1 = new FXToolBarShell(this, GUIDesignToolBar);
671 new FXToolBarGrip(myToolBar1, myToolBar1, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
672 // build file tools
673 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen simulation\tOpen a simulation (Configuration file)."),
675 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tOpen network\tOpen a network."),
677 new MFXButtonTooltip(myToolBar1, myStaticTooltipMenu, TL("\tReload\tReloads the simulation / the network."),
679 }
680 // simulation toolbar
681 {
682 myToolBarDrag2 = new FXToolBarShell(this, GUIDesignToolBar);
684 new FXToolBarGrip(myToolBar2, myToolBar2, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
685 // build simulation tools
686 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tRun\tStart/Resume the loaded simulation."),
688 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStop\tHalt the running simulation."),
690 new MFXButtonTooltip(myToolBar2, myStaticTooltipMenu, TL("\tStep\tPerform a single simulation step."),
692 }
693 // Simulation Step Display
694 {
695 myToolBarDrag3 = new FXToolBarShell(this, GUIDesignToolBar);
697 new FXToolBarGrip(myToolBar3, myToolBar3, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
698 new MFXButtonTooltip(myToolBar3, myStaticTooltipMenu, TL("Time:\tToggle between time formats\tToggle between seconds and hour:minute:seconds display."), nullptr, this, MID_TIME_TOGGLE, GUIDesignButtonToolbarText);
699
700 myLCDLabel = new MFXLCDLabel(myToolBar3, myStaticTooltipMenu, 16, nullptr, 0, JUSTIFY_RIGHT);
705 myLCDLabel->setText("----------------");
706 }
707 // Simulation Delay
708 {
709 myToolBarDrag4 = new FXToolBarShell(this, GUIDesignToolBar);
711 new FXToolBarGrip(myToolBar4, myToolBar4, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
712 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);
713 // create spinner for delay
714 mySimDelay = 0;
715 mySimDelayTarget = new FXDataTarget(mySimDelay);
717 // create slider
718 mySimDelaySlider = new FXSlider(myToolBar4, mySimDelayTarget, FXDataTarget::ID_VALUE, GUIDesignSlider);
719 mySimDelaySlider->setRange(0, 1000);
720 mySimDelaySlider->setHeadSize(10);
721 mySimDelaySlider->setIncrement(50);
722 mySimDelaySlider->setTickDelta(100);
723 mySimDelaySlider->setValue((int)mySimDelay);
724 //mySimDelayTarget->setNumberFormat(0);
725 //mySimDelayTarget->setIncrements(1, 10, 10);
726 mySimDelaySpinner->setIncrement(10);
727 mySimDelaySpinner->setRange(0, 10000);
728 mySimDelaySpinner->setValue(mySimDelay);
729 }
730 // Scale traffic (flows and incrementally loaded vehicles)
731 {
732 myToolBarDrag8 = new FXToolBarShell(this, GUIDesignToolBar);
734 new FXToolBarGrip(myToolBar8, myToolBar8, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
735 new FXLabel(myToolBar8, (TL("Scale Traffic:") + std::string("\t\t") + TL("Scale traffic from flows and vehicles that are loaded incrementally from route files.")).c_str(), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
737 myDemandScaleSpinner->setIncrement(0.5);
738 myDemandScaleSpinner->setRange(0, 1000);
739 myDemandScaleSpinner->setValue(1);
740 }
741 // Views
742 {
743 myToolBarDrag5 = new FXToolBarShell(this, GUIDesignToolBar);
745 new FXToolBarGrip(myToolBar5, myToolBar5, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
746 // build view tools
747 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new view") + std::string("\t") + TL("Open a new microscopic view.")).c_str(),
749#ifdef HAVE_OSG
750 new MFXButtonTooltip(myToolBar5, myStaticTooltipMenu, (std::string("\t") + TL("Open new 3D view") + std::string("\t") + TL("Open a new 3D view.")).c_str(),
752#endif
753 }
755 {
756 // total waitingTime
757 myToolBarDrag6 = new FXToolBarShell(this, GUIDesignToolBar);
759 new FXToolBarGrip(myToolBar6, myToolBar6, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
760 new FXLabel(myToolBar6, (TL("Waiting Time:") + std::string("\t\t") + TL("Time spent waiting accumulated for all vehicles")).c_str(), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
761 myWaitingTimeLabel = new MFXLCDLabel(myToolBar6, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
766 myWaitingTimeLabel->setText("-------------");
767 // idealistic time loss
768 myToolBarDrag7 = new FXToolBarShell(this, GUIDesignToolBar);
770 new FXToolBarGrip(myToolBar7, myToolBar7, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
771 new FXLabel(myToolBar7, (TL("Time Loss:") + std::string("\t\t") + TL("Time lost due to being unable to drive with maximum speed for all vehicles")).c_str(), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
772 myTimeLossLabel = new MFXLCDLabel(myToolBar7, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
777 myTimeLossLabel->setText("-------------");
778 // total driving distance
779 myToolBarDrag9 = new FXToolBarShell(this, GUIDesignToolBar);
781 new FXToolBarGrip(myToolBar9, myToolBar9, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
782 new FXLabel(myToolBar9, (TL("Distance (km):") + std::string("\t\t") + TL("Total distance driven by DRT vehicles")).c_str(), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
783 myTotalDistanceLabel = new MFXLCDLabel(myToolBar9, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
788 myTotalDistanceLabel->setText("-------------");
789 // emergency vehicle counts
790 myToolBarDrag10 = new FXToolBarShell(this, GUIDesignToolBar);
792 new FXToolBarGrip(myToolBar10, myToolBar10, FXToolBar::ID_TOOLBARGRIP, GUIDesignToolBarGrip);
793 new FXLabel(myToolBar10, (TL("Emergency Vehicle waiting time:") + std::string("\t\t") + TL("Time spent waiting accumulated for emergency vehicles")).c_str(), nullptr, LAYOUT_TOP | LAYOUT_LEFT);
794 myEmergencyVehicleLabel = new MFXLCDLabel(myToolBar10, myStaticTooltipMenu, 13, nullptr, 0, JUSTIFY_RIGHT);
799 myEmergencyVehicleLabel->setText("-------------");
800 }
801}
802
803
804void
805GUIApplicationWindow::buildRecentNetworks(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentNetworks) {
806 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
807 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_1);
808 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_2);
809 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_3);
810 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_4);
811 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_5);
812 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_6);
813 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_7);
814 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_8);
815 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_9);
816 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentNetworks, "", &myRecentNetworks, FXRecentFiles::ID_FILE_10);
817 new FXMenuSeparator(fileMenuRecentNetworks); // NOSONAR, Fox does the cleanup
818 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("Cl&ear Recent Networks"), nullptr, &myRecentNetworks, FXRecentFiles::ID_CLEAR);
819 GUIDesigns::buildFXMenuCommand(fileMenuRecentNetworks, TL("No Recent Networks"), nullptr, &myRecentNetworks, MFXRecentNetworks::ID_NOFILES);
820 // set target
821 myRecentNetworks.setTarget(this);
822 myRecentNetworks.setSelector(MID_RECENTFILE);
823 new FXMenuCascade(fileMenu, TL("Recent Networks"), nullptr, fileMenuRecentNetworks);
824}
825
826
827void
828GUIApplicationWindow::buildRecentConfigs(FXMenuPane* fileMenu, FXMenuPane* fileMenuRecentConfigs) {
829 // for whatever reason, sonar complains in the next line that sep1 may leak, but fox does the cleanup
830 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_1);
831 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_2);
832 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_3);
833 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_4);
834 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_5);
835 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_6);
836 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_7);
837 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_8);
838 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_9);
839 GUIDesigns::buildFXMenuCommandRecentFile(fileMenuRecentConfigs, "", &myRecentConfigs, FXRecentFiles::ID_FILE_10);
840 new FXMenuSeparator(fileMenuRecentConfigs); // NOSONAR, Fox does the cleanup
841 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("Cl&ear Recent Configs"), nullptr, &myRecentConfigs, FXRecentFiles::ID_CLEAR);
842 GUIDesigns::buildFXMenuCommand(fileMenuRecentConfigs, TL("No Recent Configs"), nullptr, &myRecentConfigs, MFXRecentNetworks::ID_NOFILES);
843 // set target
844 myRecentConfigs.setTarget(this);
845 myRecentConfigs.setSelector(MID_RECENTFILE);
846 new FXMenuCascade(fileMenu, TL("Recent Configs"), nullptr, fileMenuRecentConfigs);
847}
848
849
850long
851GUIApplicationWindow::onCmdQuit(FXObject*, FXSelector, void*) {
853 getApp()->reg().writeStringEntry("SETTINGS", "basedir", gCurrentFolder.text());
854 getApp()->reg().writeIntEntry("SETTINGS", "maximized", isMaximized() ? 1 : 0);
855 getApp()->reg().writeIntEntry("gui", "timeasHMS", myShowTimeAsHMS ? 1 : 0);
856 getApp()->reg().writeIntEntry("gui", "alternateSimDelay", (int)myAlternateSimDelay);
858 getApp()->exit(0);
859 return 1;
860}
861
862
863long
864GUIApplicationWindow::onCmdEditChosen(FXObject* menu, FXSelector, void*) {
865 FXMenuCommand* mc = dynamic_cast<FXMenuCommand*>(menu);
866 if (mc->getText() == "Edit Selected...") {
867 GUIDialog_GLChosenEditor* chooser =
869 chooser->create();
870 chooser->show();
871 } else {
873 const SUMOVehicleClass svc = SumoVehicleClassStrings.get(mc->getText().text());
874 for (MSEdgeVector::const_iterator i = MSEdge::getAllEdges().begin(); i != MSEdge::getAllEdges().end(); ++i) {
875 const std::vector<MSLane*>& lanes = (*i)->getLanes();
876 for (std::vector<MSLane*>::const_iterator it = lanes.begin(); it != lanes.end(); ++it) {
877 GUILane* lane = dynamic_cast<GUILane*>(*it);
878 assert(lane != 0);
879 if ((lane->getPermissions() & svc) != 0) {
880 gSelected.select(lane->getGlID());
881 }
882 }
883 }
884 if (myMDIClient->numChildren() > 0) {
885 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
886 if (w != nullptr) {
887 // color by selection
889 }
890 }
891 }
893 }
894 return 1;
895}
896
897
898long
899GUIApplicationWindow::onCmdEditBreakpoints(FXObject*, FXSelector, void*) {
900 if (myBreakpointDialog == nullptr) {
902 } else {
903 myBreakpointDialog->restore();
904 myBreakpointDialog->setFocus();
905 myBreakpointDialog->raise();
906 }
907 return 1;
908}
909
910
911long
912GUIApplicationWindow::onCmdEditViewport(FXObject*, FXSelector, void*) {
913 if (!myGLWindows.empty()) {
914 myGLWindows[0]->getView()->showViewportEditor();
915 }
916 return 1;
917}
918
919
920long
921GUIApplicationWindow::onCmdEditViewScheme(FXObject*, FXSelector, void*) {
922 if (!myGLWindows.empty()) {
923 myGLWindows[0]->getView()->showViewschemeEditor();
924 }
925 return 1;
926}
927
928
929long
930GUIApplicationWindow::onCmdHelp(FXObject*, FXSelector, void*) {
931 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html");
932 return 1;
933}
934
935
936long
937GUIApplicationWindow::onCmdChangelog(FXObject*, FXSelector, void*) {
938 // update in every version
939 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/ChangeLog.html");
940 return 1;
941}
942
943
944long
945GUIApplicationWindow::onCmdHotkeys(FXObject*, FXSelector, void*) {
946 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/sumo-gui.html#keyboard_shortcuts");
947 return 1;
948}
949
950
951long
952GUIApplicationWindow::onCmdTutorial(FXObject*, FXSelector, void*) {
953 MFXLinkLabel::fxexecute("https://sumo.dlr.de/docs/Tutorials/index.html");
954 return 1;
955}
956
957
958long
959GUIApplicationWindow::onCmdNeteditNetwork(FXObject*, FXSelector, void*) {
960 if (myGLWindows.empty()) {
961 return 1;
962 }
963 FXRegistry reg("SUMO netedit", "netedit");
964 reg.read();
965 const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
966 reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
967 reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
968 reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
969 reg.write();
970 std::string netedit = "netedit";
971 const char* sumoPath = getenv("SUMO_HOME");
972 if (sumoPath != nullptr) {
973 std::string newPath = std::string(sumoPath) + "/bin/netedit";
974 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
975 netedit = "\"" + newPath + "\"";
976 }
977 }
978 std::string cmd = netedit + " --registry-viewport -s " + "\"" + OptionsCont::getOptions().getString("net-file") + "\"";
979 // start in background
980#ifndef WIN32
981 cmd = cmd + " &";
982#else
983 // see "help start" for the parameters
984 cmd = "start /B \"\" " + cmd;
985#endif
986 WRITE_MESSAGEF(TL("Running %."), cmd);
987 // yay! fun with dangerous commands... Never use this over the internet
989 return 1;
990}
991
992
993long
994GUIApplicationWindow::onCmdNeteditSUMOConfig(FXObject*, FXSelector, void*) {
995 if (myGLWindows.empty()) {
996 return 1;
997 }
998 FXRegistry reg("SUMO netedit", "netedit");
999 reg.read();
1000 const GUISUMOAbstractView* const v = myGLWindows[0]->getView();
1001 reg.writeRealEntry("viewport", "x", v->getChanger().getXPos());
1002 reg.writeRealEntry("viewport", "y", v->getChanger().getYPos());
1003 reg.writeRealEntry("viewport", "z", v->getChanger().getZPos());
1004 reg.write();
1005 std::string netedit = "netedit";
1006 const char* sumoPath = getenv("SUMO_HOME");
1007 if (sumoPath != nullptr) {
1008 std::string newPath = std::string(sumoPath) + "/bin/netedit";
1009 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1010 netedit = "\"" + newPath + "\"";
1011 }
1012 }
1013 std::string cmd = netedit + " --registry-viewport --sumocfg " + "\"" + OptionsCont::getOptions().getString("configuration-file") + "\"";
1014 // start in background
1015#ifndef WIN32
1016 cmd = cmd + " &";
1017#else
1018 // see "help start" for the parameters
1019 cmd = "start /B \"\" " + cmd;
1020#endif
1021 WRITE_MESSAGEF(TL("Running %."), cmd);
1022 // yay! fun with dangerous commands... Never use this over the internet
1024 return 1;
1025}
1026
1027
1028
1029long
1030GUIApplicationWindow::onUpdNeteditSUMOConfig(FXObject* sender, FXSelector, void* ptr) {
1032 return sender->handle(this, FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1033 } else {
1034 return sender->handle(this, OptionsCont::getOptions().isSet("configuration-file") ? FXSEL(SEL_COMMAND, ID_ENABLE) : FXSEL(SEL_COMMAND, ID_DISABLE), ptr);
1035 }
1036}
1037
1038
1039long
1040GUIApplicationWindow::onCmdNewWindow(FXObject*, FXSelector, void*) {
1041 FXRegistry reg("SUMO sumo-gui", "sumo-gui");
1042 std::string sumo_gui = "sumo-gui";
1043 const char* sumoPath = getenv("SUMO_HOME");
1044 if (sumoPath != nullptr) {
1045 std::string newPath = std::string(sumoPath) + "/bin/sumo_gui";
1046 if (FileHelpers::isReadable(newPath) || FileHelpers::isReadable(newPath + ".exe")) {
1047 sumo_gui = "\"" + newPath + "\"";
1048 }
1049 }
1050 std::string cmd = sumo_gui;
1051 // start in background
1052#ifndef WIN32
1053 cmd = cmd + " &";
1054#else
1055 // see "help start" for the parameters
1056 cmd = "start /B \"\" " + cmd;
1057#endif
1058 WRITE_MESSAGEF(TL("Running %."), cmd);
1059 // yay! fun with dangerous commands... Never use this over the internet
1061 return 1;
1062}
1063
1064
1065long
1067 // get the new file name
1068 FXFileDialog opendialog(this, TL("Open Simulation Configuration"));
1070 opendialog.setSelectMode(SELECTFILE_EXISTING);
1071 opendialog.setPatternList(myConfigPattern.c_str());
1072 if (gCurrentFolder.length() != 0) {
1073 opendialog.setDirectory(gCurrentFolder);
1074 }
1075 if (opendialog.execute()) {
1076 gCurrentFolder = opendialog.getDirectory();
1077 std::string file = opendialog.getFilename().text();
1078 loadConfigOrNet(file);
1079 myRecentConfigs.appendFile(file.c_str());
1080 }
1081 return 1;
1082}
1083
1084
1085long
1086GUIApplicationWindow::onCmdOpenNetwork(FXObject*, FXSelector, void*) {
1087 // get the new file name
1088 FXFileDialog opendialog(this, TL("Open Network"));
1089 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1090 opendialog.setSelectMode(SELECTFILE_EXISTING);
1091 opendialog.setPatternList("SUMO nets (*.net.xml,*.net.xml.gz)\nAll files (*)");
1092 if (gCurrentFolder.length() != 0) {
1093 opendialog.setDirectory(gCurrentFolder);
1094 }
1095 if (opendialog.execute()) {
1096 gCurrentFolder = opendialog.getDirectory();
1097 std::string file = opendialog.getFilename().text();
1098 loadConfigOrNet(file);
1099 myRecentNetworks.appendFile(file.c_str());
1100 }
1101 return 1;
1102}
1103
1104
1105long
1106GUIApplicationWindow::onCmdOpenShapes(FXObject*, FXSelector, void*) {
1107 // get the shape file name
1108 FXFileDialog opendialog(this, TL("Open Shapes"));
1109 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_SHAPES));
1110 opendialog.setSelectMode(SELECTFILE_EXISTING);
1111 opendialog.setPatternList("Additional files (*.xml,*.xml.gz)\nAll files (*)");
1112 if (gCurrentFolder.length() != 0) {
1113 opendialog.setDirectory(gCurrentFolder);
1114 }
1115 if (opendialog.execute()) {
1116 gCurrentFolder = opendialog.getDirectory();
1117 std::string file = opendialog.getFilename().text();
1118
1119 dynamic_cast<GUIShapeContainer&>(myRunThread->getNet().getShapeContainer()).allowReplacement();
1121 if (!XMLSubSys::runParser(handler, file, false)) {
1122 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1123 }
1124 update();
1125 if (myMDIClient->numChildren() > 0) {
1126 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1127 if (w != nullptr) {
1128 w->getView()->update();
1129 }
1130 }
1131 }
1132 return 1;
1133}
1134
1135
1136long
1137GUIApplicationWindow::onCmdOpenEdgeData(FXObject*, FXSelector, void*) {
1138 // get the shape file name
1139 FXFileDialog opendialog(this, TL("Open EdgeData"));
1140 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN_NET));
1141 opendialog.setSelectMode(SELECTFILE_EXISTING);
1142 opendialog.setPatternList("EdgeData files (*.xml,*.xml.gz)\nAll files (*)");
1143 if (gCurrentFolder.length() != 0) {
1144 opendialog.setDirectory(gCurrentFolder);
1145 }
1146 if (opendialog.execute()) {
1147 gCurrentFolder = opendialog.getDirectory();
1148 std::string file = opendialog.getFilename().text();
1149 if (!GUINet::getGUIInstance()->loadEdgeData(file)) {
1150 WRITE_MESSAGEF(TL("Loading of % failed."), file);
1151 }
1152 update();
1153 if (myMDIClient->numChildren() > 0) {
1154 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1155 if (w != nullptr) {
1156 w->getView()->update();
1157 }
1158 }
1159 }
1160 return 1;
1161}
1162
1163
1164long
1165GUIApplicationWindow::onCmdReload(FXObject* sender, FXSelector sel, void*) {
1166 if (!myAmLoading && (sender == nullptr || TraCIServer::getInstance() == nullptr)) {
1168 getApp()->beginWaitCursor();
1169 myAmLoading = true;
1170 myIsReload = sender != nullptr || sel == 1;
1172 myLoadThread->start();
1173 if (sender == nullptr) {
1174 setStatusBarText(sel == 1 ? TL("Auto-Reloading.") : TL("TraCI-Loading."));
1175 } else {
1176 setStatusBarText(TL("Reloading."));
1177 }
1178 update();
1179 }
1180 return 1;
1181}
1182
1183
1184long
1185GUIApplicationWindow::onCmdQuickReload(FXObject*, FXSelector, void*) {
1186 if (!myAmLoading) {
1187 setStatusBarText(TL("Quick-Reloading."));
1189 }
1190 return 1;
1191}
1192
1193
1194long
1195GUIApplicationWindow::onCmdOpenRecent(FXObject* /* sender */, FXSelector, void* ptr) {
1196 if (myAmLoading) {
1197 myStatusbar->getStatusLine()->setText(TL("Already loading!"));
1198 return 1;
1199 }
1200 std::string file((const char*)ptr);
1201 loadConfigOrNet(file);
1202 return 1;
1203}
1204
1205
1206long
1207GUIApplicationWindow::onCmdSaveConfig(FXObject*, FXSelector, void*) {
1208 // get the new file name
1209 FXFileDialog opendialog(this, TL("Save SUMO Configuration"));
1210 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1211 opendialog.setSelectMode(SELECTFILE_ANY);
1212 opendialog.setPatternList("Config (*.sumocfg)");
1213 if (gCurrentFolder.length() != 0) {
1214 opendialog.setDirectory(gCurrentFolder);
1215 }
1216 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1217 return 1;
1218 }
1219 std::string file = MFXUtils::assureExtension(opendialog.getFilename(),
1220 opendialog.getPatternText(opendialog.getCurrentPattern()).after('.').before(')')).text();
1221 std::ofstream out(StringUtils::transcodeToLocal(file));
1222 if (out.good()) {
1223 OptionsCont::getOptions().writeConfiguration(out, true, false, false, file, true);
1224 setStatusBarText(TLF("Configuration saved to %.", file));
1225 } else {
1226 setStatusBarText(TLF("Could not save configuration to %.", file));
1227 }
1228 out.close();
1229 return 1;
1230}
1231
1232
1233long
1234GUIApplicationWindow::onCmdClose(FXObject*, FXSelector, void*) {
1236 return 1;
1237}
1238
1239
1240long
1241GUIApplicationWindow::onUpdOpen(FXObject* sender, FXSelector, void* ptr) {
1242 sender->handle(this,
1243 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1244 ptr);
1245 return 1;
1246}
1247
1248
1249long
1250GUIApplicationWindow::onUpdReload(FXObject* sender, FXSelector, void* ptr) {
1251 sender->handle(this,
1253 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1254 ptr);
1255 return 1;
1256}
1257
1258
1259long
1260GUIApplicationWindow::onUpdOpenRecent(FXObject* sender, FXSelector, void* ptr) {
1261 sender->handle(this,
1262 myAmLoading ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1263 ptr);
1264 return 1;
1265}
1266
1267
1268long
1269GUIApplicationWindow::onUpdAddView(FXObject* sender, FXSelector, void* ptr) {
1270 sender->handle(this,
1272 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1273 ptr);
1274 return 1;
1275}
1276
1277
1278long
1279GUIApplicationWindow::onCmdStart(FXObject*, FXSelector, void*) {
1280 // check whether a net was loaded successfully
1282 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1283 return 1;
1284 }
1285 // check whether it was started before and paused;
1286 if (!myWasStarted) {
1287 myRunThread->begin();
1288 myWasStarted = true;
1289 }
1291 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1292 return 1;
1293}
1294
1295
1296long
1297GUIApplicationWindow::onCmdStop(FXObject*, FXSelector, void*) {
1298 myRunThread->stop();
1299 getApp()->forceRefresh(); // only calling myToolBar2->forceRefresh somehow looses keyboard focus
1300 return 1;
1301}
1302
1303
1304long
1305GUIApplicationWindow::onCmdStep(FXObject*, FXSelector, void*) {
1306 // check whether a net was loaded successfully
1308 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
1309 return 1;
1310 }
1311 // check whether it was started before and paused;
1312 if (!myWasStarted) {
1313 myRunThread->begin();
1314 myWasStarted = true;
1315 }
1317 return 1;
1318}
1319
1320
1321long
1322GUIApplicationWindow::onCmdSaveState(FXObject*, FXSelector, void*) {
1323 // get the new file name
1324 FXFileDialog opendialog(this, TL("Save Simulation State"));
1325 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::SAVE));
1326 opendialog.setSelectMode(SELECTFILE_ANY);
1327 opendialog.setPatternList("GZipped State (*.xml.gz)\nXML State (*.xml)");
1328 if (gCurrentFolder.length() != 0) {
1329 opendialog.setDirectory(gCurrentFolder);
1330 }
1331 if (!opendialog.execute() || !MFXUtils::userPermitsOverwritingWhenFileExists(this, opendialog.getFilename())) {
1332 return 1;
1333 }
1334
1335 const std::string file = MFXUtils::assureExtension(opendialog.getFilename(),
1336 opendialog.getPatternText(opendialog.getCurrentPattern()).after('.').before(')')).text();
1337 MSStateHandler::saveState(file, MSNet::getInstance()->getCurrentTimeStep(), false);
1338 setStatusBarText(TLF("Simulation state saved to '%'.", file));
1339 return 1;
1340}
1341
1342
1343long
1344GUIApplicationWindow::onCmdLoadState(FXObject*, FXSelector, void*) {
1345 // get the new file name
1346 FXFileDialog opendialog(this, TL("Load Simulation State"));
1347 opendialog.setIcon(GUIIconSubSys::getIcon(GUIIcon::OPEN));
1348 opendialog.setSelectMode(SELECTFILE_ANY);
1349 opendialog.setPatternList("GZipped State (*.xml.gz)\nXML State (*.xml)");
1350 if (gCurrentFolder.length() != 0) {
1351 opendialog.setDirectory(gCurrentFolder);
1352 }
1353 if (opendialog.execute() && FXStat::exists(opendialog.getFilename())) {
1354 gCurrentFolder = opendialog.getDirectory();
1355 const std::string file = opendialog.getFilename().text();
1356 try {
1357 MSNet::getInstance()->loadState(file, true);
1358 setStatusBarText(TLF("State loaded from '%'.", file));
1359 } catch (ProcessError& e) {
1360 setStatusBarText(TLF("Failed to load state from '%' (%).", file, e.what()));
1361 }
1362 }
1363 return 1;
1364}
1365
1366
1367long
1368GUIApplicationWindow::onCmdTimeToggle(FXObject*, FXSelector, void*) {
1369 // toogle show time as HMS
1374 }
1375 return 1;
1376}
1377
1378
1379long
1380GUIApplicationWindow::onCmdDelayInc(FXObject*, FXSelector, void*) {
1381 if (mySimDelay < 10) {
1382 mySimDelay = 10;
1383 } else if (mySimDelay >= 20 && mySimDelay < 50) {
1384 mySimDelay = 50;
1385 } else if (mySimDelay >= 200 && mySimDelay < 500) {
1386 mySimDelay = 500;
1387 } else {
1388 mySimDelay *= 2;
1389 }
1390 if (mySimDelay > 1000) {
1391 // setting high delay by pressing the key too often is hard to recover from
1392 mySimDelay = 1000;
1393 }
1394 mySimDelaySlider->setValue((int)mySimDelay);
1395 mySimDelaySpinner->setValue(mySimDelay);
1396 return 1;
1397}
1398
1399
1400long
1401GUIApplicationWindow::onCmdDelayDec(FXObject*, FXSelector, void*) {
1402 if (mySimDelay <= 10) {
1403 mySimDelay = 0;
1404 } else if (mySimDelay > 20 && mySimDelay <= 50) {
1405 mySimDelay = 20;
1406 } else if (mySimDelay > 200 && mySimDelay <= 500) {
1407 mySimDelay = 200;
1408 } else {
1409 mySimDelay /= 2;
1410 }
1411 mySimDelaySlider->setValue((int)mySimDelay);
1412 mySimDelaySpinner->setValue(mySimDelay);
1413 return 1;
1414}
1415
1416
1417long
1418GUIApplicationWindow::onCmdDelayToggle(FXObject*, FXSelector, void*) {
1419 const double tmp = myAlternateSimDelay;
1421 mySimDelay = tmp;
1422 return 1;
1423}
1424
1425
1426long
1427GUIApplicationWindow::onCmdDemandScale(FXObject*, FXSelector, void*) {
1430 }
1431 return 1;
1432}
1433
1434
1435long
1436GUIApplicationWindow::onCmdClearMsgWindow(FXObject*, FXSelector, void*) {
1438 return 1;
1439}
1440
1441
1442long
1443GUIApplicationWindow::onUpdStart(FXObject* sender, FXSelector, void* ptr) {
1444 sender->handle(this,
1446 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1447 ptr);
1449 // bind start simulation with space key
1451 }
1452 return 1;
1453}
1454
1455
1456long
1457GUIApplicationWindow::onUpdStop(FXObject* sender, FXSelector, void* ptr) {
1458 sender->handle(this,
1460 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1461 ptr);
1463 // bind stop simulation with space key
1465 }
1466 return 1;
1467}
1468
1469
1470long
1471GUIApplicationWindow::onUpdStep(FXObject* sender, FXSelector, void* ptr) {
1472 sender->handle(this,
1474 ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE),
1475 ptr);
1476 return 1;
1477}
1478
1479
1480long
1481GUIApplicationWindow::onUpdNeedsSimulation(FXObject* sender, FXSelector, void* ptr) {
1482 bool disable = !myRunThread->simulationAvailable() || myAmLoading;
1483 sender->handle(this, disable ? FXSEL(SEL_COMMAND, ID_DISABLE) : FXSEL(SEL_COMMAND, ID_ENABLE), ptr);
1484 // mySelectLanesMenuCascade has to be disabled manually
1485 if (disable) {
1486 mySelectLanesMenuCascade->disable();
1487 } else {
1488 mySelectLanesMenuCascade->enable();
1489 }
1490 return 1;
1491}
1492
1493
1494long
1495GUIApplicationWindow::onUpdTraCIStatus(FXObject* /*sender*/, FXSelector, void* /*ptr*/) {
1497 myTraCiFrame->show();
1498 } else {
1499 myTraCiFrame->hide();
1500 }
1501 return 1;
1502}
1503
1504
1505long
1506GUIApplicationWindow::onCmdLocate(FXObject*, FXSelector sel, void*) {
1507 if (myMDIClient->numChildren() > 0) {
1508 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1509 if (w != nullptr) {
1510 w->onCmdLocate(nullptr, sel, nullptr);
1511 }
1512 }
1513 return 1;
1514}
1515
1516
1517long
1518GUIApplicationWindow::onCmdShowStats(FXObject*, FXSelector, void*) {
1519 if (myMDIClient->numChildren() > 0) {
1520 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1522 }
1523 return 1;
1524}
1525
1526
1527long
1528GUIApplicationWindow::onCmdAppSettings(FXObject*, FXSelector, void*) {
1530 d->create();
1531 d->show(PLACEMENT_OWNER);
1532 return 1;
1533}
1534
1535
1536long
1537GUIApplicationWindow::onCmdGaming(FXObject*, FXSelector, void*) {
1538 if (myGLWindows.empty()) {
1539 return 1;
1540 }
1542 myGLWindows[0]->getView()->editVisualisationSettings()->gaming = myAmGaming;
1543 if (myAmGaming) {
1544 myGamingModeCheckbox->setCheck(TRUE);
1545 myMenuBar->hide();
1546 myStatusbar->hide();
1547 myToolBar1->hide();
1548 myToolBar2->hide();
1549 myToolBar4->hide();
1550 myToolBar5->hide();
1551 myToolBar6->show();
1552 myToolBar8->hide();
1553 myToolBar10->show();
1554 if (myTLSGame) {
1555 myToolBar7->show();
1556 } else {
1557 myToolBar9->show();
1558 }
1559 myMessageWindow->hide();
1565 } else {
1566 myGamingModeCheckbox->setCheck(FALSE);
1567 myMenuBar->show();
1568 myStatusbar->show();
1569 myToolBar1->show();
1570 myToolBar2->show();
1571 myToolBar4->show();
1572 myToolBar5->show();
1573 myToolBar6->hide();
1574 myToolBar7->hide();
1575 myToolBar8->show();
1576 myToolBar9->hide();
1577 myToolBar10->hide();
1578 myMessageWindow->show();
1580 }
1581 if (myMDIClient->numChildren() > 0) {
1582 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1583 if (w != nullptr) {
1585 }
1586 }
1587 update();
1588 return 1;
1589}
1590
1591
1592long
1594 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1595 if (w != nullptr) {
1596 // show or hide grid depending of myNetworkViewOptions.menuCheckToggleGrid
1599 } else {
1601 }
1602 w->getView()->update();
1603 }
1604 return 1;
1605}
1606
1607
1608long
1610 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1611 if (w != nullptr) {
1612 // toggle secondary shape visualization
1614 w->getView()->update();
1615 }
1616 return 1;
1617}
1618
1619
1620long
1621GUIApplicationWindow::onCmdFullScreen(FXObject*, FXSelector, void*) {
1622 if (myGLWindows.empty()) {
1623 return 1;
1624 }
1626 if (myAmFullScreen) {
1627 getApp()->reg().writeIntEntry("SETTINGS", "x", getX());
1628 getApp()->reg().writeIntEntry("SETTINGS", "y", getY());
1629 getApp()->reg().writeIntEntry("SETTINGS", "width", getWidth());
1630 getApp()->reg().writeIntEntry("SETTINGS", "height", getHeight());
1631 maximize();
1632 setDecorations(DECOR_NONE);
1633 place(PLACEMENT_MAXIMIZED);
1634 myMenuBar->hide();
1635 myStatusbar->hide();
1636 myToolBar1->hide();
1637 myToolBar2->hide();
1638 myToolBar3->hide();
1639 myToolBar4->hide();
1640 myToolBar5->hide();
1641 myToolBar6->hide();
1642 myToolBar7->hide();
1643 myToolBar8->hide();
1644 myMessageWindow->hide();
1645 if (myMDIClient->numChildren() > 0) {
1646 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
1647 if (w != nullptr) {
1648 w->setToolBarVisibility(false);
1649 }
1650 }
1651 update();
1652 } else {
1653 place(PLACEMENT_VISIBLE);
1654 setDecorations(DECOR_ALL);
1655 restore();
1656 myToolBar3->show();
1658 onCmdGaming(nullptr, 0, nullptr);
1659 setWidth(getApp()->reg().readIntEntry("SETTINGS", "width", 600));
1660 setHeight(getApp()->reg().readIntEntry("SETTINGS", "height", 400));
1661 setX(getApp()->reg().readIntEntry("SETTINGS", "x", 150));
1662 setY(getApp()->reg().readIntEntry("SETTINGS", "y", 150));
1663 }
1664 return 1;
1665}
1666
1667
1668long
1669GUIApplicationWindow::onCmdListInternal(FXObject*, FXSelector, void*) {
1671 return 1;
1672}
1673
1674
1675long
1676GUIApplicationWindow::onCmdListParking(FXObject*, FXSelector, void*) {
1678 return 1;
1679}
1680
1681long
1682GUIApplicationWindow::onCmdListTeleporting(FXObject*, FXSelector, void*) {
1684 return 1;
1685}
1686
1687
1688long
1689GUIApplicationWindow::onCmdNewView(FXObject*, FXSelector, void*) {
1691 return 1;
1692}
1693
1694
1695#ifdef HAVE_OSG
1696long
1697GUIApplicationWindow::onCmdNewOSG(FXObject*, FXSelector, void*) {
1699 return 1;
1700}
1701#endif
1702
1703
1704long
1705GUIApplicationWindow::onCmdFeedback(FXObject*, FXSelector, void*) {
1706 // create and open feedback dialog
1707 GUIDialog_Feedback* feedback = new GUIDialog_Feedback(this);
1708 feedback->create();
1709 feedback->show(PLACEMENT_OWNER);
1710 return 1;
1711}
1712
1713
1714long
1715GUIApplicationWindow::onCmdAbout(FXObject*, FXSelector, void*) {
1716 GUIDialog_AboutSUMO* about = new GUIDialog_AboutSUMO(this);
1717 about->create();
1718 about->show(PLACEMENT_OWNER);
1719 return 1;
1720}
1721
1722
1723long
1724GUIApplicationWindow::onCmdHallOfFame(FXObject*, FXSelector, void*) {
1726 hall->create();
1727 hall->show(PLACEMENT_OWNER);
1728 return 1;
1729}
1730
1731
1732long GUIApplicationWindow::onClipboardRequest(FXObject* /* sender */, FXSelector /* sel */, void* ptr) {
1733 FXEvent* event = (FXEvent*)ptr;
1734 FXString string = GUIUserIO::clipped.c_str();
1735 setDNDData(FROM_CLIPBOARD, event->target, string);
1736 return 1;
1737}
1738
1739
1740long
1741GUIApplicationWindow::onLoadThreadEvent(FXObject*, FXSelector, void*) {
1742 eventOccurred();
1743 return 1;
1744}
1745
1746
1747long
1748GUIApplicationWindow::onRunThreadEvent(FXObject*, FXSelector, void*) {
1749 eventOccurred();
1750 return 1;
1751}
1752
1753
1754void
1756 while (!myEvents.empty()) {
1757 // get the next event
1758 GUIEvent* e = myEvents.top();
1759 myEvents.pop();
1760 // process
1761 switch (e->getOwnType()) {
1764 setFocus();
1765 break;
1767 if (myRunThread->simulationAvailable()) { // avoid race-condition related crash if reload was pressed
1769 }
1770 break;
1778 break;
1780 GUIEvent_AddView* ave = dynamic_cast<GUIEvent_AddView*>(e);
1782 if (ave->getSchemeName() != "") {
1783 FXComboBox* sCombo = v->getColoringSchemesCombo();
1784 int index = sCombo->findItem(ave->getSchemeName().c_str());
1785 if (index >= 0) {
1786 sCombo->setCurrentItem(index);
1787 }
1788 v->setColorScheme(ave->getSchemeName());
1789 }
1790 break;
1791 }
1793 GUIEvent_CloseView* ave = dynamic_cast<GUIEvent_CloseView*>(e);
1794 removeViewByID(ave->getCaption());
1795 break;
1796 }
1799 break;
1800 default:
1801 break;
1802 }
1803 delete e;
1804 }
1805 myToolBar2->forceRefresh();
1806 myToolBar3->forceRefresh();
1807}
1808
1809
1810void
1812 myAmLoading = false;
1814 // check whether the loading was successfull
1815 if (ec->myNet == nullptr) {
1816 // report failure
1817 setStatusBarText(TLF("Loading of '%' failed!", ec->myFile));
1820 getApp()->exit(1);
1821 }
1822 } else {
1823 // initialise simulation thread
1824 if (!myRunThread->init(ec->myNet, ec->myBegin, ec->myEnd)) {
1827 getApp()->exit(1);
1828 }
1829 } else {
1830 // report success
1831 setStatusBarText(TLF("'%' loaded.", ec->myFile));
1833 myWasStarted = false;
1835 // initialise views
1836 myViewNumber = 0;
1838 // check/record settings file modification time
1839 long long mTime = myGuiSettingsFileMTime;
1840 if (ec->mySettingsFiles.size() > 0) {
1841 for (std::string fname : ec->mySettingsFiles) {
1842 mTime = MAX2(mTime, SysUtils::getModifiedTime(fname));
1843 }
1844 }
1845 // always reload if settings were modified or to restore multiple views
1846 if (!myIsReload) {
1848 }
1849 if (ec->mySettingsFiles.size() > 0 && (!myIsReload || myGuiSettingsFileMTime < mTime || ec->mySettingsFiles.size() > 1)) {
1850 // open a view for each file and apply settings
1851 for (std::string fname : ec->mySettingsFiles) {
1852 GUISettingsHandler settings(fname);
1853 GUISUMOViewParent::ViewType vt = defaultType;
1854 if (settings.getViewType() == "osg" || settings.getViewType() == "3d") {
1856 }
1857 if (settings.getViewType() == "opengl" || settings.getViewType() == "2d") {
1859 }
1860 GUISUMOAbstractView* view = openNewView(vt);
1861 if (view == nullptr) {
1862 break;
1863 }
1864 if (settings.getSettingName() != "") {
1865 view->setColorScheme(settings.getSettingName());
1866 FXComboBox* sCombo = view->getColoringSchemesCombo();
1867 int index = sCombo->findItem(settings.getSettingName().c_str());
1868 if (index >= 0) {
1869 sCombo->setCurrentItem(index);
1870 }
1871 }
1872 view->addDecals(settings.getDecals());
1873 settings.applyViewport(view);
1874 settings.setSnapshots(view);
1875 if (settings.getDelay() > 0.) {
1876 mySimDelay = settings.getDelay();
1877 }
1878 if (settings.getBreakpoints().size() > 0) {
1880 myRunThread->getBreakpoints().assign(settings.getBreakpoints().begin(), settings.getBreakpoints().end());
1881 myRunThread->getBreakpointLock().unlock();
1882 }
1883 myJamSounds = settings.getEventDistribution("jam");
1884 myCollisionSounds = settings.getEventDistribution("collision");
1885 if (settings.getJamSoundTime() > 0) {
1886 myJamSoundTime = settings.getJamSoundTime();
1887 }
1888 }
1889 } else {
1890 openNewView(defaultType);
1891 }
1892 myGuiSettingsFileMTime = mTime;
1893 if (!OptionsCont::getOptions().isDefault("delay")) {
1894 setDelay(OptionsCont::getOptions().getFloat("delay"));
1895 mySimDelaySlider->setValue((int)mySimDelay);
1896 mySimDelaySpinner->setValue(mySimDelay);
1897 }
1898 if (!OptionsCont::getOptions().isDefault("breakpoints") && !myIsReload) {
1899 std::vector<SUMOTime> breakpoints;
1900 for (const std::string& val : OptionsCont::getOptions().getStringVector("breakpoints")) {
1901 SUMOTime t = string2time(val);
1902 // round down to nearest reachable time step
1903 t -= t % DELTA_T;
1904 breakpoints.push_back(t);
1905 }
1906 std::sort(breakpoints.begin(), breakpoints.end());
1908 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
1909 myRunThread->getBreakpointLock().unlock();
1910 }
1911 myTLSGame = OptionsCont::getOptions().getString("game.mode") == "tls";
1912 if (OptionsCont::getOptions().getBool("game")) {
1913 if (myTLSGame) {
1914 setTitle("SUMO Interactive Traffic Light");
1915 } else {
1916 setTitle("SUMO Interactive Demand-Responsive-Transport");
1917 }
1918 onCmdGaming(nullptr, 0, nullptr);
1919 } else {
1920 // set simulation name on the caption
1921 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING, ec->myFile.c_str()));
1922 }
1923 if (ec->myViewportFromRegistry) {
1924 Position off;
1925 off.set(getApp()->reg().readRealEntry("viewport", "x"),
1926 getApp()->reg().readRealEntry("viewport", "y"),
1927 getApp()->reg().readRealEntry("viewport", "z"));
1928 Position p(off.x(), off.y(), 0);
1929 GUISUMOAbstractView* view = myGLWindows[0]->getView();
1930 view->setViewportFromToRot(off, p, 0);
1931 }
1932 // set simulation step begin information
1933 myLCDLabel->setText("----------------");
1934 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
1935 (*it)->setText("-");
1936 }
1937 // initialize scale from options unless already set in the UI
1938 if (myDemandScaleSpinner->getValue() == 1 || !OptionsCont::getOptions().isDefault("scale")) {
1940 }
1942 }
1943 }
1944 getApp()->endWaitCursor();
1945 // start if wished
1947 onCmdStart(nullptr, 0, nullptr);
1948 }
1949 update();
1950}
1951
1952
1953void
1955#ifdef WIN32
1956 long t = SysUtils::getCurrentMillis();
1957 // only skip if the simulation is running
1958 if (t - myLastStepEventMillis < MIN_DRAW_DELAY && myRunThread->simulationIsStopable()) {
1959 // do not try to redraw with more than 50FPS (#6371)
1960 return;
1961 }
1963#endif
1965 const int running = myRunThread->getNet().getVehicleControl().getRunningVehicleNo();
1966 const int backlog = myRunThread->getNet().getInsertionControl().getWaitingVehicleNo();
1967 if (backlog > running) {
1968 if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::GREENVEHICLE)) {
1970 }
1971 } else {
1972 if (myStatButtons.front()->getIcon() == GUIIconSubSys::getIcon(GUIIcon::YELLOWVEHICLE)) {
1974 }
1975 }
1976 myStatButtons.front()->setText(toString(running).c_str());
1977 if (myRunThread->getNet().hasPersons()) {
1978 if (!myStatButtons[1]->shown()) {
1979 myStatButtons[1]->show();
1980 }
1982 }
1983 if (myRunThread->getNet().hasContainers()) {
1984 if (!myStatButtons[2]->shown()) {
1985 myStatButtons[2]->show();
1986 }
1988 }
1989 if (myAmGaming) {
1990 if (myTLSGame) {
1992 } else {
1994 }
1995 }
1997 getApp()->forceRefresh(); // restores keyboard focus
1998 }
2000 update();
2001}
2002
2003
2004void
2006 GUIEvent_Message* ec = static_cast<GUIEvent_Message*>(e);
2008 setStatusBarText(ec->getMsg());
2009 } else {
2011 }
2012}
2013
2014
2015void
2018 onCmdStop(nullptr, 0, nullptr);
2019 if (ec->getReason() == MSNet::SIMSTATE_LOADING) {
2020 onCmdReload(nullptr, 0, nullptr);
2021 } else if (GUIGlobals::gQuitOnEnd) {
2023 getApp()->exit(ec->getReason() == MSNet::SIMSTATE_ERROR_IN_SIM);
2024 } else if (GUIGlobals::gDemoAutoReload) {
2025 onCmdReload(nullptr, 1, nullptr);
2026 } else if (!myHaveNotifiedAboutSimEnd) {
2027 // GUIRunThread::deleteSim() triggers the final message to the log file
2028 // (this will never reach the GUI but we cannot use WRITE_MESSAGE here
2029 // to avoid a duplicate log entry)
2031 TLF("Simulation ended at time: %. (%)",
2033 // build the text
2034 const std::string text = "Simulation ended at time: " + time2string(ec->getTimeStep()) +
2035 ".\nReason: " + MSNet::getStateMessage(ec->getReason()) +
2036 "\nDo you want to close all open files and views?";
2037 FXuint answer = FXMessageBox::question(this, MBOX_YES_NO, TL("Simulation ended"), "%s", text.c_str());
2038 if (answer == 1) { //1:yes, 2:no, 4:esc
2040 } else {
2043 update();
2044 }
2046 }
2047}
2048
2049
2050void
2055#ifdef HAVE_DANGEROUS_SOUNDS // disable user-configurable command execution for public build
2056 if (myJamSounds.getOverallProb() > 0) {
2057 // play honking sound if some vehicle is waiting too long
2058 for (; it != end; ++it) {
2059 // XXX use impatience instead of waiting time ?
2060 if (it->second->getWaitingTime() > TIME2STEPS(myJamSoundTime)) {
2061 const std::string cmd = myJamSounds.get(&myGamingRNG);
2062 if (cmd != "") {
2063 // yay! fun with dangerous commands... Never use this over the internet
2065 // one sound per simulation step is enough
2066 break;
2067 }
2068 }
2069 }
2070 }
2073 if (myPreviousCollisionNumber != collisions) {
2074 const std::string cmd = myCollisionSounds.get(&myGamingRNG);
2075 if (cmd != "") {
2076 // yay! fun with dangerous commands... Never use this over the internet
2078 }
2079 myPreviousCollisionNumber = collisions;
2080 }
2081 }
2082#endif
2083 // update performance indicators
2084 for (it = vc.loadedVehBegin(); it != end; ++it) {
2085 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2086 assert(veh != 0);
2087 if (veh->isOnRoad() && !veh->isStopped()) {
2088 const double vmax = veh->getLane()->getVehicleMaxSpeed(veh);
2089 if (veh->getSpeed() < SUMO_const_haltingSpeed) {
2091 if (veh->getVClass() == SVC_EMERGENCY) {
2093 }
2094 }
2095 myTimeLoss += TIME2STEPS(TS * (vmax - veh->getSpeed()) / vmax); // may be negative with speedFactor > 1
2096 }
2097
2098 }
2102}
2103
2104
2105void
2107 // update performance indicators
2111
2114 for (auto it = vc.loadedVehBegin(); it != end; ++it) {
2115 const MSVehicle* veh = dynamic_cast<MSVehicle*>(it->second);
2116 assert(veh != 0);
2117 if (veh->isOnRoad() && !veh->isStopped()) {
2119 }
2120 }
2122}
2123
2124
2125void
2127 if (!myAmLoading) {
2129 getApp()->beginWaitCursor();
2130 myAmLoading = true;
2131 myIsReload = false;
2133 gSchemeStorage.saveViewport(0, 0, -1, 0); // recenter view
2135 setStatusBarText(TLF("Loading '%'.", file));
2136 update();
2137 }
2138}
2139
2140
2144 myStatusbar->getStatusLine()->setText(TL("No simulation loaded!"));
2145 return nullptr;
2146 }
2147 GUISUMOAbstractView* oldView = nullptr;
2148 if (myMDIClient->numChildren() > 0) {
2149 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2150 if (w != nullptr) {
2151 oldView = w->getView();
2152 }
2153 }
2154 if (caption == "") {
2155 caption = "View #" + toString(myViewNumber++);
2156 }
2157 FXuint opts = MDI_TRACKING;
2158 GUISUMOViewParent* w = new GUISUMOViewParent(myMDIClient, myMDIMenu, FXString(caption.c_str()),
2159 this, GUIIconSubSys::getIcon(GUIIcon::SUMO_MINI), opts, 10, 10, 200, 100);
2161 if (oldView != nullptr) {
2162 // copy viewport
2163 oldView->copyViewportTo(v);
2164 }
2165 w->create();
2166 if (myMDIClient->numChildren() == 1) {
2167 w->maximize();
2168 } else {
2169 myMDIClient->vertical(true);
2170 }
2171 myMDIClient->setActiveChild(w);
2172
2173 return v;
2174}
2175
2176
2177FXGLCanvas*
2179 if (myMDIClient->numChildren() == 0) {
2180 return nullptr;
2181 }
2182 GUISUMOViewParent* share_tmp1 =
2183 static_cast<GUISUMOViewParent*>(myMDIClient->childAtIndex(0));
2184 return share_tmp1->getBuildGLCanvas();
2185}
2186
2187
2188void
2190 myTrackerLock.lock();
2191 myLCDLabel->setText("----------------");
2192 for (std::vector<FXButton*>::const_iterator it = myStatButtons.begin(); it != myStatButtons.end(); ++it) {
2193 (*it)->setText("-");
2194 if (it != myStatButtons.begin()) {
2195 (*it)->hide();
2196 }
2197 }
2198 // delete the simulation
2200 // reset the caption
2201 setTitle(MFXUtils::getTitleText("SUMO " VERSION_STRING));
2202 // remove trackers and other external windows (must be delayed until deleteSim)
2203 while (!myGLWindows.empty()) {
2204 delete myGLWindows.front();
2205 }
2206 // make a copy because deleting modifyes the vector;
2207 std::vector<FXMainWindow*> trackerWindows = myTrackerWindows;
2208 for (FXMainWindow* const window : trackerWindows) {
2209 delete window;
2210 }
2211 myTrackerWindows.clear();
2212 // clear selected items
2213 gSelected.clear();
2214 // add a separator to the log
2216 myTrackerLock.unlock();
2217 // remove coordinate information
2218 myGeoCoordinate->setText(TL("N/A"));
2219 myCartesianCoordinate->setText(TL("N/A"));
2220 if (myTestCoordinate) {
2221 myTestCoordinate->setText(TL("N/A"));
2222 }
2223 //
2226 update();
2227}
2228
2229
2230FXCursor*
2232 return getApp()->getDefaultCursor(DEF_ARROW_CURSOR);
2233}
2234
2235
2240
2241
2242double
2246
2247
2248void
2250 loadConfigOrNet("");
2251 if (wait) {
2252 while (myAmLoading) {
2253 myRunThread->sleep(50);
2254 }
2255 }
2256}
2257
2258
2259void
2261 myStatusbar->getStatusLine()->setText(text.c_str());
2262 myStatusbar->getStatusLine()->setNormalText(text.c_str());
2263}
2264
2265
2266void
2268 myRecentNetworks.appendFile(f);
2269}
2270
2271
2272void
2274 myRecentConfigs.appendFile(f);
2275}
2276
2277
2278void
2280 if (myShowTimeAsHMS) {
2281 myLCDLabel->setToolTipText("HH:MM:SS");
2282 if (myAmGaming) {
2284 myTimeLossLabel->setToolTipText("HH:MM:SS");
2286 }
2287 } else {
2288 myLCDLabel->setToolTipText(TL("seconds"));
2289 if (myAmGaming) {
2291 myTimeLossLabel->setToolTipText(TL("seconds"));
2293 }
2294 }
2295}
2296
2297
2298void
2300 time -= DELTA_T; // synchronize displayed time with netstate output
2301 if (time < 0) {
2302 myLCDLabel->setText("----------------");
2303 return;
2304 }
2305 if (myAmGaming) {
2306 // show time counting backwards
2307 time = myRunThread->getSimEndTime() - time;
2308 }
2309 std::ostringstream str;
2310 str << std::setfill('0');
2311 const bool hideFraction = myAmGaming || DELTA_T % 1000 == 0;
2312 if (myShowTimeAsHMS) {
2313 SUMOTime day = time / 86400000;
2314 if (day > 0) {
2315 str << day << '-';
2316 time %= 86400000;
2317 }
2318 str << std::setw(2);
2319 str << time / 3600000 << '-';
2320 time %= 3600000;
2321 str << std::setw(2) << time / 60000 << '-';
2322 time %= 60000;
2323 }
2324 str << std::setw(2) << time / 1000;
2325 if (!hideFraction) {
2326 str << '.' << std::setw(3) << time % 1000;
2327 }
2328 myLCDLabel->setText(str.str().c_str());
2329}
2330
2331
2332void
2334 if (press != nullptr) {
2335 myHotkeyPress[key] = press;
2336 }
2337 if (release != nullptr) {
2338 myHotkeyRelease[key] = release;
2339 }
2340}
2341
2342
2343long
2344GUIApplicationWindow::onKeyPress(FXObject* o, FXSelector sel, void* ptr) {
2345 FXEvent* e = (FXEvent*) ptr;
2346 // PgUp and PgDown switch between widgets by default and binding them via menu shortcuts does not work reliably
2347 // so we must intercept them before FXMainWindow can handle it
2348 if (e->code == FX::KEY_Page_Up) {
2349 onCmdDelayInc(nullptr, 0, nullptr);
2350 } else if (e->code == FX::KEY_Page_Down) {
2351 onCmdDelayDec(nullptr, 0, nullptr);
2352 } else {
2353 // disable hotkeys without modifiers for the game
2354 const bool ignoreSimple = myAmGaming && (e->state & (CONTROLMASK | SHIFTMASK | ALTMASK)) == 0;
2355 const long handled = ignoreSimple ? 0 : FXMainWindow::onKeyPress(o, sel, ptr);
2356 if (handled == 0 && myMDIClient->numChildren() > 0) {
2357 auto it = myHotkeyPress.find(e->code);
2358 if (it != myHotkeyPress.end()) {
2359 it->second->execute(SIMSTEP);
2360 }
2361 if (!ignoreSimple) {
2362 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2363 if (w != nullptr) {
2364 w->onKeyPress(nullptr, sel, ptr);
2365 }
2366 }
2367 }
2368 }
2369 return 0;
2370}
2371
2372
2373long
2374GUIApplicationWindow::onKeyRelease(FXObject* o, FXSelector sel, void* ptr) {
2375 const long handled = FXMainWindow::onKeyRelease(o, sel, ptr);
2376 if (handled == 0 && myMDIClient->numChildren() > 0) {
2377 FXEvent* e = (FXEvent*) ptr;
2378 auto it = myHotkeyRelease.find(e->code);
2379 if (it != myHotkeyRelease.end()) {
2380 it->second->execute(SIMSTEP);
2381 }
2382 GUISUMOViewParent* w = dynamic_cast<GUISUMOViewParent*>(myMDIClient->getActiveChild());
2383 if (w != nullptr) {
2384 w->onKeyRelease(nullptr, sel, ptr);
2385 }
2386 }
2387 return 0;
2388}
2389
2390
2391double
2393 return mySimDelay;
2394}
2395
2396
2397void
2399 mySimDelay = delay;
2400}
2401
2402
2403void
2405 myEventMutex.lock();
2406 myEvents.push_back(event);
2408 //myEventCondition.wait(myEventMutex);
2409 myEventMutex.unlock();
2410}
2411
2412
2413void
2414GUIApplicationWindow::setBreakpoints(const std::vector<SUMOTime>& breakpoints) {
2415 if (myRunThread != nullptr) {
2417 myRunThread->getBreakpoints().assign(breakpoints.begin(), breakpoints.end());
2418 myRunThread->getBreakpointLock().unlock();
2420 }
2421}
2422
2423
2424const std::vector<SUMOTime>
2427 std::vector<SUMOTime> result = myRunThread->getBreakpoints();
2428 myRunThread->getBreakpointLock().unlock();
2429 return result;
2430}
2431
2432
2433void
2437
2438/****************************************************************************/
long long int SUMOTime
Definition GUI.h:36
@ MID_HOTKEY_CTRL_Q_CLOSE
Main window closes.
Definition GUIAppEnum.h:113
@ ID_RUNTHREAD_EVENT
The Simulation execution thread.
Definition GUIAppEnum.h:343
@ MID_HOTKEY_CTRL_T_OPENNETEDIT_OPENSUMO
Open current SUMO simulation/network in netedit, or current netedit simulation/network in SUMO.
Definition GUIAppEnum.h:121
@ MID_LISTINTERNAL
Locator configuration - menu entry.
Definition GUIAppEnum.h:353
@ MID_NEW_MICROVIEW
Open a new microscopic view.
Definition GUIAppEnum.h:331
@ MID_HOTKEY_CTRL_W_CLOSESIMULATION
Close simulation - ID.
Definition GUIAppEnum.h:127
@ MID_HOTKEY_CTRL_D_SINGLESIMULATIONSTEP_OPENDEMANDELEMENTS
Perform a single simulation step in SUMO and open Demand Elements in netedit.
Definition GUIAppEnum.h:87
@ MID_HOTKEY_CTRL_O_OPENSIMULATION_OPENNETWORK
Open simulation in SUMO and open network in netedit.
Definition GUIAppEnum.h:109
@ MID_HOTKEY_F9_EDIT_VIEWSCHEME
open edit scheme menu
Definition GUIAppEnum.h:243
@ MID_HOTKEY_CTRL_J_TOGGLEDRAWJUNCTIONSHAPE
toggle draw junction shape
Definition GUIAppEnum.h:99
@ MID_TRACI_STATUS
update traci status
Definition GUIAppEnum.h:370
@ MID_LANGUAGE_TR
change language to turkish
@ MID_CHANGELOG
changelog button
Definition GUIAppEnum.h:647
@ MID_HOTKEY_CTRL_B_EDITBREAKPOINT_OPENDATAELEMENTS
Edit simulation breakpoints in SUMO and open Data Elements in netedit.
Definition GUIAppEnum.h:83
@ MID_HOTKEY_F1_ONLINEDOCUMENTATION
open online documentation
Definition GUIAppEnum.h:227
@ MID_HOTKEY_CTRL_U_OPENEDGEDATA
Load edge data for visualization.
Definition GUIAppEnum.h:123
@ MID_HOTKEY_CTRL_R_RELOAD
Reload the previously loaded simulation.
Definition GUIAppEnum.h:117
@ MID_HOTKEY_CTRL_S_STOPSIMULATION_SAVENETWORK
Stop the simulation in SUMO and save network in netedit.
Definition GUIAppEnum.h:115
@ MID_HOTKEY_D_MODE_SINGLESIMULATIONSTEP_DELETE
hotkey for perform a single simulation step in SUMO and set delete mode in netedit
Definition GUIAppEnum.h:47
@ MID_HOTKEY_SHIFT_O_LOCATEPOI
Locate poi - button.
Definition GUIAppEnum.h:179
@ 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:169
@ MID_SIMLOAD
(quick)-load state from file
Definition GUIAppEnum.h:323
@ MID_DEMAND_SCALE
scale traffic
Definition GUIAppEnum.h:396
@ MID_HOTKEY_CTRL_I_EDITVIEWPORT
Open viewport editor.
Definition GUIAppEnum.h:97
@ MID_RECENTFILE
Loads a file previously loaded.
Definition GUIAppEnum.h:313
@ MID_HOTKEY_S_MODE_STOPSIMULATION_SELECT
hotkey for stop simulation in SUMO and set select mode in netedit
Definition GUIAppEnum.h:61
@ MID_HOTKEY_SHIFT_C_LOCATECONTAINER
Locate container - button.
Definition GUIAppEnum.h:171
@ MID_HOTKEY_CTRL_SHIFT_N_NEWWINDOW
open a new window (SUMO AND netedit)
Definition GUIAppEnum.h:215
@ MID_HOTKEY_SHIFT_V_LOCATEVEHICLE
Locate vehicle - button.
Definition GUIAppEnum.h:189
@ MID_HOTKEY_SHIFT_F11_HALLOFFAME
show the hall of fame dialog
Definition GUIAppEnum.h:249
@ MID_LANGUAGE_HU
change language to hungarian
@ MID_HOTKEY_SHIFT_L_LOCATEPOLY
Locate polygons - button.
Definition GUIAppEnum.h:177
@ MID_HOTKEY_A_MODE_STARTSIMULATION_ADDITIONALSTOP
hotkey for start simulation in SUMO and set editing mode additionals AND stops in netedit
Definition GUIAppEnum.h:43
@ MID_HOTKEY_CTRL_K_OPENTLSPROGRAMS
Load file with TLS Programs.
Definition GUIAppEnum.h:101
@ MID_HOTKEY_SHIFT_E_LOCATEEDGE
Locate edge - button.
Definition GUIAppEnum.h:173
@ MID_CLEARMESSAGEWINDOW
Clear simulation output.
Definition GUIAppEnum.h:362
@ MID_HOTKEY_CTRL_F_FULSCREENMODE
Fullscreen mode - menu entry.
Definition GUIAppEnum.h:91
@ MID_SIMSAVE
Save state to file.
Definition GUIAppEnum.h:321
@ MID_TUTORIAL
tutorial button
Definition GUIAppEnum.h:651
@ MID_LISTTELEPORTING
Definition GUIAppEnum.h:355
@ MID_HOTKEY_CTRL_G_GAMINGMODE_TOGGLEGRID
Toggle Gaming mode in SUMO and grid in netedit.
Definition GUIAppEnum.h:93
@ MID_SHOWNETSTATS
Show network statistics.
Definition GUIAppEnum.h:364
@ ID_LOADTHREAD_EVENT
The loading thread.
Definition GUIAppEnum.h:341
@ MID_HOTKEY_SHIFT_P_LOCATEPERSON
Locate person - button.
Definition GUIAppEnum.h:181
@ MID_HOTKEY_CTRL_P_OPENSHAPES
Load additional file with poi and polygons.
Definition GUIAppEnum.h:111
@ MID_LANGUAGE_EN
change language to english
@ MID_HOTKEY_SHIFT_J_LOCATEJUNCTION
Locate junction - button.
Definition GUIAppEnum.h:175
@ MID_SHOWPERSONSTATS
Show person statistics.
Definition GUIAppEnum.h:368
@ MID_DELAY_TOGGLE
toggle delay between alternative value
Definition GUIAppEnum.h:394
@ MID_HOTKEYS
hotkeys button
Definition GUIAppEnum.h:649
@ MID_TIMELINK_BREAKPOINT
Set breakpionts from messages - Option.
Definition GUIAppEnum.h:564
@ MID_LANGUAGE_DE
change language to german
@ MID_HOTKEY_ALT_F4_CLOSE
Main window closes.
Definition GUIAppEnum.h:161
@ MID_TIME_TOGGLE
toggle time display mode
Definition GUIAppEnum.h:388
@ MID_HOTKEY_CTRL_A_STARTSIMULATION_OPENADDITIONALS
Start the simulation in SUMO and open Additionals Elements in netedit.
Definition GUIAppEnum.h:81
@ MID_DELAY_DEC
decrease sim delay
Definition GUIAppEnum.h:392
@ MID_LISTPARKING
Definition GUIAppEnum.h:354
@ MID_NEW_OSGVIEW
Open a new microscopic 3D view.
Definition GUIAppEnum.h:333
@ MID_FEEDBACK
feedback button
Definition GUIAppEnum.h:653
@ MID_HOTKEY_CTRL_H_APPSETTINGS_OPENEDGETYPES
open app setting dialog in SUMO and open edge type files in netedit
Definition GUIAppEnum.h:95
@ MID_HOTKEY_CTRL_SHIFT_S_SAVESUMOCONFIG
save SUMOConfig (SUMO AND netedit)
Definition GUIAppEnum.h:219
@ MID_HOTKEY_F12_ABOUT
open about dialog
Definition GUIAppEnum.h:251
@ MID_HOTKEY_CTRL_E_EDITSELECTION_LOADNETEDITCONFIG
Edit selection in SUMO and load neteditConfig in netedit.
Definition GUIAppEnum.h:89
@ MID_HOTKEY_SHIFT_T_LOCATETLS
Locate TLS - button.
Definition GUIAppEnum.h:187
@ MID_DELAY_INC
increase sim delay
Definition GUIAppEnum.h:390
@ MID_HOTKEY_CTRL_N_OPENNETWORK_NEWNETWORK
open network in SUMO and create new empty network in netedit
Definition GUIAppEnum.h:107
@ MID_HOTKEY_CTRL_QUICK_RELOAD
Quick-Reload the previously loaded simulation (keep the net)
Definition GUIAppEnum.h:119
@ MID_LANGUAGE_ZH
change language to chinese (simplified)
@ MID_SHOWVEHSTATS
Show vehicle statistics.
Definition GUIAppEnum.h:366
@ MID_LANGUAGE_FR
change language to french
@ MID_WINDOW
Main window-ID.
Definition GUIAppEnum.h:293
FXDEFMAP(GUIApplicationWindow) GUIApplicationWindowMap[]
#define MIN_DRAW_DELAY
GUICompleteSchemeStorage gSchemeStorage
#define GUIDesignSlider
Definition GUIDesigns.h:494
#define GUIDesignSpinDial
Definition GUIDesigns.h:474
#define GUIDesignToolBarGrip
design for toolbar grip (used to change the position of toolbar with mouse)
Definition GUIDesigns.h:438
#define GUIDesignButtonStatusBarFixed
button rectangular with thick and raise frame with a width of 100
Definition GUIDesigns.h:101
#define GUIDesignMDIButtonLeft
Definition GUIDesigns.h:213
#define GUIDesignToolBarRaisedSameTop
design for first toolbar shell positioned in the same position of dock
Definition GUIDesigns.h:444
#define GUIDesignButtonToolbar
little button with icon placed in navigation toolbar
Definition GUIDesigns.h:118
#define GUIDesignHorizontalFrameStatusBar
Horizontal frame used in status bar.
Definition GUIDesigns.h:335
#define GUIDesignToolBar
design for default toolbar
Definition GUIDesigns.h:426
#define GUIDesignSplitter
Definition GUIDesigns.h:463
#define GUIDesignSplitterMDI
MDI Splitter.
Definition GUIDesigns.h:466
#define GUIDesignToolbarMenuBar
Definition GUIDesigns.h:420
#define GUIDesignToolBarRaisedNextTop
design for first toolbar shell positioned in the next-top position of dock
Definition GUIDesigns.h:441
#define GUIDesignButtonToolbarText
Definition GUIDesigns.h:115
#define GUIDesignMDIButtonRight
MDIButton oriented to right.
Definition GUIDesigns.h:216
#define GUIDesignStatusBar
design used in status bar
Definition GUIDesigns.h:435
@ SIMULATION_ENDED
Send when the simulation is over;.
@ MESSAGE_OCCURRED
send when a message occured
@ GLDEBUG_OCCURRED
send when a gldebug occured
@ ERROR_OCCURRED
send when a error occured
@ SIMULATION_STEP
send when a simulation step has been performed
@ ADD_VIEW
Send when a new should be opened (via TraCI)
@ CLOSE_VIEW
Send when a view should be closed (via TraCI)
@ SIMULATION_LOADED
send when a simulation has been loaded
@ STATUS_OCCURRED
send when a status change occured
@ DEBUG_OCCURRED
send when a debug occured
@ WARNING_OCCURRED
send when a warning occured
GUISelectedStorage gSelected
A global holder of selected objects.
FXString gCurrentFolder
The folder used as last.
@ EDITVIEWPORT
@ CLEARMESSAGEWINDOW
@ NETEDIT_MINI
@ GREENVEHICLE
@ LOCATEVEHICLE
@ LOCATEPERSON
@ WINDOWS_TILE_VERT
@ GREENCONTAINER
@ WINDOWS_CASCADE
@ OPEN
open icons
@ LOCATECONTAINER
@ LOCATEJUNCTION
@ APP_BREAKPOINTS
@ SAVE_SUMOCONFIG
@ WINDOWS_TILE_HORI
@ YELLOWVEHICLE
@ OPEN_SUMOCONFIG
@ SAVE
save icons
@ KEY_SPACE
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
#define WRITE_MESSAGEF(...)
Definition MsgHandler.h:273
#define TL(string)
Definition MsgHandler.h:287
#define TLF(string,...)
Definition MsgHandler.h:288
SUMOTime DELTA_T
Definition SUMOTime.cpp:38
SUMOTime string2time(const std::string &r)
convert string to SUMOTime
Definition SUMOTime.cpp:46
std::string time2string(SUMOTime t, bool humanReadable)
convert SUMOTime to string (independently of global format setting)
Definition SUMOTime.cpp:69
#define SPEED2DIST(x)
Definition SUMOTime.h:45
#define SIMSTEP
Definition SUMOTime.h:61
#define TS
Definition SUMOTime.h:42
#define TIME2STEPS(x)
Definition SUMOTime.h:57
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
@ SVC_EMERGENCY
public emergency vehicles
std::string gLanguage
the language for GUI elements and messages
Definition StdDefs.cpp:33
const double SUMO_const_haltingSpeed
the speed threshold at which vehicles are considered as halting
Definition StdDefs.h:58
T MAX2(T a, T b)
Definition StdDefs.h:82
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Definition ToString.h:46
#define TLC(context, string)
Definition Translation.h:47
Base (microsim) event class.
Definition Command.h:50
void setSelector(FXSelector sel)
set the selector
void setTarget(FXObject *tgt)
set the target
static bool isReadable(std::string path)
Checks whether the given file is readable.
static void resetFont()
to be called when the font context is invalidated
Definition GLHelper.cpp:600
The main window of the SUMO-gui.
long onCmdDelayInc(FXObject *, FXSelector, void *)
Called on "delay inc".
long onUpdReload(FXObject *, FXSelector, void *)
Determines whether reloading is enabled.
long onCmdShowStats(FXObject *, FXSelector, void *)
Called on commands from the statistic buttons.
FXToolBarShell * myToolBarDrag2
long onCmdTimeToggle(FXObject *, FXSelector, void *)
Called on "time toggle".
virtual void sendBlockingEvent(GUIEvent *event)
Sends an event from the application thread to the GUI and waits until it is handled.
GUIDialog_Breakpoints * myBreakpointDialog
breakpoint dialog
FXEX::MFXThreadEvent myLoadThreadEvent
io-event with the load-thread
void handleEvent_Message(GUIEvent *e)
called when event "message" ocurred
GUILoadThread * myLoadThread
the thread that loads simulations
void handleEvent_SimulationEnded(GUIEvent *e)
called when event "simulation ended" ocurred
FXMenuCheck * myGamingModeCheckbox
menu checkbox to activate game mode
int myViewNumber
The current view number.
FXToolBarShell * myToolBarDrag4
long onCmdAbout(FXObject *, FXSelector, void *)
Shows the about dialog.
SUMOTime myWaitingTime
waiting time
long onCmdFeedback(FXObject *, FXSelector, void *)
Shows the feedback dialog.
long onClipboardRequest(FXObject *sender, FXSelector sel, void *ptr)
Somebody wants our clipped text.
long onUpdTraCIStatus(FXObject *, FXSelector, void *)
Determines whether traci is active.
long onUpdStep(FXObject *, FXSelector, void *)
Determines whether "step" is enabled.
bool myAmLoading
information whether the gui is currently loading and the load-options shall be greyed out
long onCmdAppSettings(FXObject *, FXSelector, void *)
Opens the application settings menu (Settings->Application Settings...)
long onKeyPress(FXObject *o, FXSelector sel, void *data)
called when a key is pressed
void handleEvent_SimulationLoaded(GUIEvent *e)
called when event "simulation loaded" ocurred
FXToolBarShell * myToolBarDrag9
FXRealSpinner * mySimDelaySpinner
Simulation delay spinner.
long onCmdChangelog(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Changelog
void handleEvent_SimulationStep(GUIEvent *e)
called when event "simulation step" ocurred
bool myHaveNotifiedAboutSimEnd
whether the simulation end was already announced
void setStatusBarText(const std::string &text)
set status bar text
FXToolBarShell * myToolBarDrag10
FXMenuPane * myFileMenuRecentConfigs
FXMenu pane for recent configs.
long onCmdStop(FXObject *, FXSelector, void *)
Called on "stop".
MFXRecentNetworks myRecentNetworks
List of recent networks.
MFXLCDLabel * myTimeLossLabel
time loss label
double myJamSoundTime
waiting time after which vehicles trigger jam sounds
FXRealSpinner * myDemandScaleSpinner
the demand scale
long onCmdTutorial(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Tutorial
virtual void setDelay(double delay)
Sets the delay of the parent application in milliseconds.
MFXLCDLabel * myEmergencyVehicleLabel
emergency vehicle label
FXToolBarShell * myToolBarDrag7
double mySimDelay
the simulation delay in milliseconds
void addRecentConfig(const FX::FXString &f)
add recent config to recent file list
SUMOTime getCurrentSimTime() const
get current simulation time
long onUpdAddView(FXObject *, FXSelector, void *)
Determines whether adding a view is enabled.
FXToolBarShell * myToolBarDrag1
for some menu detaching fun
long onCmdEditViewScheme(FXObject *, FXSelector, void *)
Called on menu Edit->Visualization.
long onRunThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the simulation thread.
MFXLCDLabel * myTotalDistanceLabel
total distance label
bool hadDependentBuild
flag to mark if GUIApplicationWIndow has depend build
SUMOTime myEmergencyVehicleCount
emergency vehicle count
FXMenuPane * myFileMenuRecentNetworks
FXMenu pane for recent networks.
FXCursor * getDefaultCursor()
get default cursor
SUMOTime myTimeLoss
time loss
void checkGamingEventsDRT()
handles additional game-related events (DRT)
FXMDIMenu * myMDIMenu
The menu used for the MDI-windows.
void updateTimeLCDTooltip()
update LCD timer tooltip
long onCmdListTeleporting(FXObject *, FXSelector, void *)
Toggle listing of teleporting vehicles.
long onCmdNewWindow(FXObject *, FXSelector, void *)
Called on menu File->New Window.
long onCmdStep(FXObject *, FXSelector, void *)
Called on "step".
FXMutex myEventMutex
the mutex for the waiting semaphore
double getTrackerInterval() const
get tracker interval
long onCmdClose(FXObject *, FXSelector, void *)
Called on menu File->Close.
virtual void buildToolBars()
Builds the tool bar.
long onUpdNeteditSUMOConfig(FXObject *, FXSelector, void *)
Enable or disable open SUMOConfig in netedit.
long onCmdDelayToggle(FXObject *, FXSelector, void *)
Called on "delay toggle".
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
long onCmdNeteditSUMOConfig(FXObject *, FXSelector, void *)
Called on menu Edit->Netedit (SUMOCfg)
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.
void loadOnStartup(const bool wait=false)
config or net on startup
long onCmdListInternal(FXObject *, FXSelector, void *)
Toggle listing of internal structures.
bool myTLSGame
flag for enable TLS gameMode
FXEX::MFXThreadEvent myRunThreadEvent
io-event with the run-thread
void dependentBuild(const bool isLibsumo)
build dependt
long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
GUIApplicationWindow(FXApp *a, const std::string &configPattern)
Constructor.
long onCmdEditBreakpoints(FXObject *, FXSelector, void *)
Called on menu Edit->Edit Breakpoints.
long onCmdOpenShapes(FXObject *, FXSelector, void *)
Called on menu File->Load Shapes.
FXToolBarShell * myMenuBarDrag
const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve list of breakpoints
long onCmdQuit(FXObject *, FXSelector, void *)
Called by FOX if the application shall be closed (Called either by FileMenu->Quit,...
FXToolBarShell * myToolBarDrag8
long onUpdStart(FXObject *sender, FXSelector, void *ptr)
Determines whether "play" is enabled.
GUISUMOAbstractView * openNewView(GUISUMOViewParent::ViewType vt=GUISUMOViewParent::VIEW_2D_OPENGL, std::string caption="")
opens a new simulation display
FXGLCanvas * getBuildGLCanvas() const
get build GLCanvas
RandomDistributor< std::string > myJamSounds
random list of jam sounds
long onCmdNewView(FXObject *, FXSelector, void *)
Called if a new view shall be opened (2D view)
GUIRunThread * myRunThread
the thread that runs simulations
long onCmdClearMsgWindow(FXObject *, FXSelector, void *)
Called if the message window shall be cleared.
long onCmdToggleDrawJunctionShape(FXObject *, FXSelector, void *)
Toggle draw junction shape.
virtual void create()
Creates the main window (required by FOX)
std::map< int, Command * > myHotkeyPress
custom hotkeys pressed
FXToolBarShell * myToolBarDrag5
MFXLCDLabel * myWaitingTimeLabel
waiting time label
long onCmdDemandScale(FXObject *, FXSelector, void *)
Called on "demand scale".
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
called when a key is released
RandomDistributor< std::string > myCollisionSounds
random list of collision sounds
FXMenuCascade * mySelectLanesMenuCascade
the menu cascades
long onCmdOpenNetwork(FXObject *, FXSelector, void *)
Called on menu File->Open Network.
std::string myConfigPattern
Input file pattern.
virtual void setBreakpoints(const std::vector< SUMOTime > &breakpoints)
Sets the breakpoints of the parent application.
long 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 onCmdNeteditNetwork(FXObject *, FXSelector, void *)
Called on menu Edit->Netedit (network)
long onUpdStop(FXObject *, FXSelector, void *)
Determines whether "stop" is enabled.
FXDataTarget * mySimDelayTarget
Simulation delay target.
long onCmdSaveConfig(FXObject *, FXSelector, void *)
Called on menu File->Close.
void closeAllWindows()
this method closes all windows and deletes the current simulation
void updateTimeLCD(SUMOTime time)
updates the simulation time display
long onCmdSaveState(FXObject *, FXSelector, void *)
Called on "save state".
std::map< int, Command * > myHotkeyRelease
custom hotkeys released
FXToolBarShell * myToolBarDrag3
long onLoadThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the loading thread.
long onCmdReload(FXObject *, FXSelector, void *)
Called on reload.
void addRecentNetwork(const FX::FXString &f)
add recent network to recent file list
void buildRecentConfigs(FXMenuPane *fileMenu, FXMenuPane *fileMenuRecentConfigs)
build recent configs
long onUpdNeedsSimulation(FXObject *, FXSelector, void *)
Determines whether some buttons which require an active simulation may be shown.
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.
virtual void addToWindowsMenu(FXMenuPane *menuPane)
FOX need this.
long onCmdEditViewport(FXObject *, FXSelector, void *)
Called on menu Edit->Viewport.
MFXLCDLabel * myLCDLabel
the simulation step display
FXMenuBar * myMenuBar
The application menu bar.
static std::mt19937 myGamingRNG
A random number generator used to choose a gaming sound.
long onCmdHotkeys(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Hotkeys
long myLastStepEventMillis
last time the simulation view was redrawn due to a simStep
virtual ~GUIApplicationWindow()
Destructor.
long onCmdHelp(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Documentation
void addHotkey(int key, Command *press, Command *release)
register custom hotkey action
virtual void fillMenuBar()
Builds the menu bar.
bool myIsReload
whether we are reloading the simulation
std::vector< FXButton * > myStatButtons
Buttons showing and running values and triggering statistic windows.
virtual void eventOccurred()
a certaint event ocurred
void checkGamingEvents()
handles additional game-related events
long onCmdQuickReload(FXObject *, FXSelector, void *)
Called on quick-reload.
long onCmdGaming(FXObject *, FXSelector, void *)
Toggle gaming mode.
void clearDecals()
Clear the default decals.
void saveViewport(const double x, const double y, const double z, const double rot)
Makes the given viewport the default.
static void close()
close GUICursorSubSys
static void initCursors(FXApp *a)
Initiate GUICursorSubSys.
static 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 FXMenuCommand * buildFXMenuCommand(FXComposite *p, const std::string &text, FXIcon *icon, FXObject *tgt, FXSelector sel)
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 the simulation is over.
MSNet::SimulationState getReason() const
Returns the reason the simulation has ended due.
SUMOTime getTimeStep() const
Returns the time step the simulation has ended at.
const SUMOTime myBegin
the time the simulation shall start with
const std::vector< std::string > mySettingsFiles
the name of the settings file to load
const bool myOsgView
whether to load the OpenSceneGraph view
const SUMOTime myEnd
the time the simulation shall end with
const bool myViewportFromRegistry
whether loading viewport from registry
const std::string myFile
the name of the loaded file
GUIEventType getOwnType() const
returns the event type
Definition GUIEvent.h:89
virtual void create()
create GUIGlChildWindow
GUISUMOAbstractView * getView() const
return GUISUMOAbstractView
virtual FXGLCanvas * getBuildGLCanvas() const
get build GL Canvas
GUIGlID getGlID() const
Returns the numerical id of the object.
static double gTrackerInterval
the aggregation period for tracker windows in seconds
Definition GUIGlobals.h:46
static bool gRunAfterLoad
the simulation shall start direct after loading
Definition GUIGlobals.h:37
static bool gQuitOnEnd
the window shall be closed when the simulation has ended
Definition GUIGlobals.h:40
static bool gDemoAutoReload
the simulation shall reload when it has ended (demo)
Definition GUIGlobals.h:43
static FXIcon * getIcon(const GUIIcon which)
returns a icon previously defined in the enum GUIIcon
static void initIcons(FXApp *a)
Initiate GUIIconSubSys.
static void close()
close GUIIconSubSys
Representation of a lane in the micro simulation (gui-version)
Definition GUILane.h:60
void loadConfigOrNet(const std::string &file)
begins the loading of the given file
const std::string & getFileName() const
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call
bool myListParking
information whether the locator should list parking vehicles
void removeViewByID(const std::string &id)
std::vector< FXMainWindow * > myTrackerWindows
list of tracker windows
FXMenuPane * myLanguageMenu
Language menu common to all applications.
bool myListTeleporting
information whether the locator should list teleporting vehicles
FXLabel * myCartesianCoordinate
Labels for the current cartesian, geo-coordinate and test coordinates.
std::map< std::string, std::string > myOnlineMaps
online mapping services for the context menu
MFXStaticToolTip * myStaticTooltipMenu
static toolTip used in menus
FXMDIClient * myMDIClient
The multi view panel.
FXHorizontalFrame * myTraCiFrame
frames for coordinates
void buildLanguageMenu(FXMenuBar *menuBar)
long onCmdChangeLanguage(FXObject *, FXSelector, void *)
bool listParking() const
return whether to list parking vehicles
FXHorizontalFrame * myGeoFrame
FXHorizontalFrame * myTestFrame
FXHorizontalFrame * myCartesianFrame
FXLabel * myTestCoordinate
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
FXDockSite * myTopDock
dock sites
bool myListInternal
information whether the locator should list internal structures
void storeWindowSizeAndPos()
record window position and size in registry
bool myAmFullScreen
FOX need this.
FXLabel * myGeoCoordinate
FXStatusBar * myStatusbar
The status bar.
void updateChildren(int msg=MID_SIMSTEP)
update childrens
FXGLVisual * myGLVisual
The gl-visual used.
bool myAmGaming
information whether the gui is currently in gaming mode
std::vector< GUIGlChildWindow * > myGLWindows
list of GLWindows
long onUpdChangeLanguage(FXObject *, FXSelector, void *)
A logging window for the gui.
void addSeparator()
Adds a a separator to this log window.
void clear()
Clears the window.
void appendMsg(GUIEventType eType, const std::string &msg)
Adds new text to the window.
MSTransportableControl & getPersonControl() override
Returns the person control.
Definition GUINet.cpp:129
void flushOutputsAtEnd()
flush outputs once the simulation has reached its end
Definition GUINet.cpp:785
GUIParameterTableWindow * getParameterWindow(GUIMainWindow &app, GUISUMOAbstractView &parent) override
Returns an own parameter window.
Definition GUINet.cpp:476
static GUINet * getGUIInstance()
Returns the pointer to the unique instance of GUINet (singleton).
Definition GUINet.cpp:571
MSTransportableControl & getContainerControl() override
Returns the container control.
Definition GUINet.cpp:138
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.
GUINet & getNet() const
virtual void begin()
virtual bool simulationIsStartable() const
virtual bool simulationIsStepable() const
std::vector< SUMOTime > & getBreakpoints()
virtual bool init(GUINet *net, SUMOTime start, SUMOTime end)
initialises the thread with the new simulation
FXMutex & getBreakpointLock()
SUMOTime getSimEndTime() const
virtual bool simulationIsStopable() const
bool simulationAvailable() const
virtual void deleteSim()
void prepareDestruction()
SUMOTime & getSimBegin()
void addDecals(const std::vector< Decal > &decals)
add decals
const GUIVisualizationSettings & getVisualisationSettings() const
get visualization settings (read only)
GUIPerspectiveChanger & getChanger() const
get changer
virtual void setViewportFromToRot(const Position &lookFrom, const Position &lookAt, double rotation)
applies the given viewport settings
GUIVisualizationSettings * editVisualisationSettings() const
edit visualization settings (allow modify VisualizationSetings, use carefully)
virtual void copyViewportTo(GUISUMOAbstractView *view)
copy the viewport to the given view
FXComboBox * getColoringSchemesCombo()
get coloring schemes combo
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.
An XML-handler for visualisation schemes.
double getDelay() const
Returns the parsed delay.
const std::string & getSettingName() const
RandomDistributor< std::string > getEventDistribution(const std::string &id)
const std::string & getViewType() const
Returns the parsed view type.
void applyViewport(GUISUMOAbstractView *view) const
Sets the viewport which has been parsed.
const std::vector< SUMOTime > & getBreakpoints() const
Returns the parsed breakpoints.
void setSnapshots(GUISUMOAbstractView *view) const
Makes a snapshot if it has been parsed.
const std::vector< GUISUMOAbstractView::Decal > & getDecals() const
Returns the parsed decals.
Storage for geometrical objects extended by mutexes.
static void buildAccelerators(FXAccelTable *accelTable, FXObject *target, const bool sumogui)
build accelerators
static void changeAccelerator(FXAccelTable *accelTable, FXObject *target, GUIShortcut keysym, long msg)
change acelerator (used for toogle dynamically binding space key with start/end simulation)
static void clearTextures()
clears loaded textures
static std::string clipped
Definition GUIUserIO.h:58
bool drawJunctionShape
whether the shape of the junction should be drawn
bool secondaryShape
whether secondary lane shape shall be drawn
GUIColorer laneColorer
The lane colorer.
A widget which has the seven-segment display used as the drawing object for each letter in the label....
Definition MFXLCDLabel.h:34
void setVertical(const FXint len)
set segment vertical length - must be more than twice the segment width
void setGroove(const FXint w)
set groove width - must be less than segment width
void setThickness(const FXint w)
set segment width - must be less than half the segment length
void setToolTipText(const FXString &text)
set tooltip text
void setText(FXString lbl)
manipulate text in LCD label
void setHorizontal(const FXint len)
set segment horizontal length - must be more than twice the segment width
void setFgColor(FXColor clr)
set forground color
static void sleep(long ms)
void push_back(T what)
static FXColor getFXColor(const RGBColor &col)
converts FXColor to RGBColor
Definition MFXUtils.cpp:112
static FXString getTitleText(const FXString &appname, FXString filename="")
Returns the title text in dependence to an optional file name.
Definition MFXUtils.cpp:60
static FXbool userPermitsOverwritingWhenFileExists(FXWindow *const parent, const FXString &file)
Returns true if either the file given by its name does not exist or the user allows overwriting it.
Definition MFXUtils.cpp:39
static FXString assureExtension(const FXString &filename, const FXString &defaultExtension)
Corrects missing extension.
Definition MFXUtils.cpp:69
SUMOVehicleClass getVClass() const
Returns the vehicle's access class.
bool isStopped() const
Returns whether the vehicle is at a stop.
static const MSEdgeVector & getAllEdges()
Returns all edges with a numerical id.
Definition MSEdge.cpp:984
int getWaitingVehicleNo() const
Returns the number of waiting vehicles.
SVCPermissions getPermissions() const
Returns the vehicle class permissions for this lane.
Definition MSLane.h:601
double getVehicleMaxSpeed(const SUMOTrafficObject *const veh) const
Returns the lane's maximum speed, given a vehicle's speed limit adaptation.
Definition MSLane.h:565
SUMOTime loadState(const std::string &fileName, const bool catchExceptions)
load state from file and return new time
Definition MSNet.cpp:1653
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Definition MSNet.cpp:183
@ SIMSTATE_LOADING
The simulation is loading.
Definition MSNet.h:95
@ SIMSTATE_ERROR_IN_SIM
An error occurred during the simulation step.
Definition MSNet.h:105
static std::string getStateMessage(SimulationState state)
Returns the message to show if a certain state occurs.
Definition MSNet.cpp:924
void quickReload()
reset state to the beginning without reloading the network
Definition MSNet.cpp:1632
SUMOTime getCurrentTimeStep() const
Returns the current simulation step.
Definition MSNet.h:322
bool hasContainers() const
Returns whether containers are simulated.
Definition MSNet.h:413
bool hasPersons() const
Returns whether persons are simulated.
Definition MSNet.h:397
MSInsertionControl & getInsertionControl()
Returns the insertion control.
Definition MSNet.h:433
ShapeContainer & getShapeContainer()
Returns the shapes container.
Definition MSNet.h:503
MSVehicleControl & getVehicleControl()
Returns the vehicle control.
Definition MSNet.h:380
static void saveState(const std::string &file, SUMOTime step, bool usePrefix=true)
Saves the current state.
int getRunningNumber() const
Returns the number of build and inserted, but not yet deleted transportables.
int getWaitingForVehicleNumber() const
Returns the number of transportables waiting for a ride.
The class responsible for building and deletion of vehicles.
int getRunningVehicleNo() const
Returns the number of build and inserted, but not yet deleted vehicles.
void setScale(double scale)
sets the demand scaling factor
int getCollisionCount() const
return the number of collisions
std::map< std::string, SUMOVehicle * >::const_iterator constVehIt
Definition of the internal vehicles map iterator.
constVehIt loadedVehBegin() const
Returns the begin of the internal vehicle map.
constVehIt loadedVehEnd() const
Returns the end of the internal vehicle map.
Representation of a vehicle in the micro simulation.
Definition MSVehicle.h:77
bool isOnRoad() const
Returns the information whether the vehicle is on a road (is simulated)
Definition MSVehicle.h:608
const MSLane * getLane() const
Returns the lane the vehicle is on.
Definition MSVehicle.h:584
double getSpeed() const
Returns the vehicle's current speed.
Definition MSVehicle.h:493
static void setupI18n(const std::string &locale="")
set up gettext stuff
The XML-Handler for shapes loading network loading.
Definition NLHandler.h:55
double getFloat(const std::string &name) const
Returns the double-value of the named option (only for Option_Float)
std::string getString(const std::string &name) const
Returns the string-value of the named option (only for Option_String)
bool isDefault(const std::string &name) const
Returns the information whether the named option has still the default value.
void writeConfiguration(std::ostream &os, const bool filled, const bool complete, const bool addComments, const std::string &relativeTo="", const bool forceRelative=false, const bool inComment=false) const
Writes the configuration.
const StringVector & getStringVector(const std::string &name) const
Returns the list of string-value of the named option (only for Option_StringVector)
static OptionsCont & getOptions()
Retrieves the options.
A point in 2D or 3D with translation and scaling methods.
Definition Position.h:37
void set(double x, double y)
set positions x and y
Definition Position.h:85
double x() const
Returns the x-position.
Definition Position.h:55
double y() const
Returns the y-position.
Definition Position.h:60
static const RGBColor GREEN
Definition RGBColor.h:186
static const RGBColor RED
named colors
Definition RGBColor.h:185
double getOverallProb() const
Return the sum of the probabilites assigned to the members.
T get(SumoRNG *which=nullptr) const
Draw a sample of the distribution.
std::vector< std::string > getVector()
return vector of strings
static std::string transcodeToLocal(const std::string &utf8String)
convert a string from UTF-8 to the local codepage
A few system-specific functions.
Definition SysUtils.h:30
static unsigned long runHiddenCommand(const std::string &cmd)
run a shell command without popping up any windows (particuarly on win32)
Definition SysUtils.cpp:68
static long long getModifiedTime(const std::string &fname)
@brie get modified time
Definition SysUtils.cpp:108
static long getCurrentMillis()
Returns the current time in milliseconds.
Definition SysUtils.cpp:43
static TraCIServer * getInstance()
Definition TraCIServer.h:68
static FXIcon * getVClassIcon(const SUMOVehicleClass vc)
returns icon associated to the given vClass
static bool runParser(GenericSAXHandler &handler, const std::string &file, const bool isNet=false, const bool isRoute=false, const bool isExternal=false, const bool catchExceptions=true)
Runs the given handler on the given file; returns if everything's ok.
@ SEL_THREAD_EVENT
Definition fxexdefs.h:173
@ SEL_THREAD
Definition fxexdefs.h:155