LCOV - code coverage report
Current view: top level - src/utils/gui/windows - GUIMainWindow.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 0.0 % 20 0
Test Date: 2026-10-12 15:53:19 Functions: 0.0 % 11 0

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2026 German Aerospace Center (DLR) and others.
       4              : // This program and the accompanying materials are made available under the
       5              : // terms of the Eclipse Public License 2.0 which is available at
       6              : // https://www.eclipse.org/legal/epl-2.0/
       7              : // This Source Code may also be made available under the following Secondary
       8              : // Licenses when the conditions for such availability set forth in the Eclipse
       9              : // Public License 2.0 are satisfied: GNU General Public License, version 2
      10              : // or later which is available at
      11              : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      12              : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      13              : /****************************************************************************/
      14              : /// @file    GUIMainWindow.h
      15              : /// @author  Daniel Krajzewicz
      16              : /// @author  Jakob Erdmann
      17              : /// @author  Michael Behrisch
      18              : /// @date    Fri, 29.04.2005
      19              : ///
      20              : //
      21              : /****************************************************************************/
      22              : #pragma once
      23              : #include <config.h>
      24              : 
      25              : #include <utils/foxtools/fxheader.h>
      26              : #include <vector>
      27              : #include <string>
      28              : #include <map>
      29              : #include <utils/common/StdDefs.h>
      30              : #include <utils/common/SUMOTime.h>
      31              : #include "GUIAppEnum.h"
      32              : 
      33              : 
      34              : // ===========================================================================
      35              : // class declarations
      36              : // ===========================================================================
      37              : class GUIEvent;
      38              : class GUIGlChildWindow;
      39              : class GUISUMOAbstractView;
      40              : class MFXStaticToolTip;
      41              : class MFXCheckableButton;
      42              : 
      43              : 
      44              : // ===========================================================================
      45              : // class definitions
      46              : // ===========================================================================
      47              : class GUIMainWindow : public FXMainWindow {
      48              : 
      49              : public:
      50              :     /// @brief constructor
      51              :     GUIMainWindow(FXApp* app);
      52              : 
      53              :     /// @brief destructor
      54              :     virtual ~GUIMainWindow();
      55              : 
      56              :     /// @brief Adds a further child window to the list (GUIGlChildWindow)
      57              :     void addGLChild(GUIGlChildWindow* child);
      58              : 
      59              :     /// @brief Adds a further child window to the list (FXMainWindow)
      60              :     void addChild(FXMainWindow* child);
      61              : 
      62              :     /// @brief removes the given child window from the list (GUIGlChildWindow)
      63              :     void removeGLChild(GUIGlChildWindow* child);
      64              : 
      65              :     /// @brief removes the given child window from the list (FXMainWindow)
      66              :     void removeChild(FXMainWindow* child);
      67              : 
      68              :     /// @brief get top dock
      69              :     FXDockSite* getTopDock();
      70              : 
      71              :     /// @brief get view IDs
      72              :     std::vector<std::string> getViewIDs() const;
      73              : 
      74              :     /// @brief get specific view by ID
      75              :     GUIGlChildWindow* getViewByID(const std::string& id) const;
      76              : 
      77              :     void removeViewByID(const std::string& id);
      78              : 
      79              :     /// @brief get views
      80              :     const std::vector<GUIGlChildWindow*>& getViews() const;
      81              : 
      82              :     /// @brief update childrens
      83              :     void updateChildren(int msg = MID_SIMSTEP);
      84              : 
      85              :     /// @brief get bold front
      86              :     FXFont* getBoldFont();
      87              : 
      88              :     /// @brief get fallback front
      89              :     FXFont* getFallbackFont();
      90              : 
      91              :     /// @brief get GL Visual
      92              :     FXGLVisual* getGLVisual() const;
      93              : 
      94              :     /// @brief get static toolTip for menus
      95              :     MFXStaticToolTip* getStaticTooltipMenu() const;
      96              : 
      97              :     /// @brief get static toolTip for view
      98              :     MFXStaticToolTip* getStaticTooltipView() const;
      99              : 
     100              :     /// @brief get build GL Canvas (must be implemented in all children)
     101              :     virtual FXGLCanvas* getBuildGLCanvas() const = 0;
     102              : 
     103              :     /// @brief get current sim time (must be implemented in all children)
     104              :     virtual SUMOTime getCurrentSimTime() const = 0;
     105              : 
     106              :     /// @brief get tracker interval (must be implemented in all children)
     107              :     virtual double getTrackerInterval() const = 0;
     108              : 
     109              :     /// @brief get status bar text (can be implemented in children)
     110            0 :     virtual void setStatusBarText(const std::string&) { }
     111              : 
     112              :     /// @brief get cartesian coordinate field
     113              :     FXTextField* getCartesianLabel();
     114              : 
     115              :     /// @brief get geo coordinate field
     116              :     FXTextField* getGeoLabel();
     117              : 
     118              :     /// @brief parse geo coordinate string ("lat, lon" or "lat:... lon:...")
     119              :     static bool parseGeoCoordinate(const std::string& text, double& lat, double& lon);
     120              : 
     121              :     /// @brief parse cartesian coordinate string ("x, y" or "x:... y:...")
     122              :     static bool parseCartesianCoordinate(const std::string& text, double& x, double& y);
     123              : 
     124              :     /// @brief called when user enters a geo coordinate in the status bar
     125              :     long onCmdSetGeoCoordinate(FXObject*, FXSelector, void*);
     126              : 
     127              :     /// @brief called when user enters a cartesian coordinate in the status bar
     128              :     long onCmdSetCartesianCoordinate(FXObject*, FXSelector, void*);
     129              : 
     130              :     /// @brief called when user focuses a coordinate field in the status bar
     131              :     long onCmdFocusCoordinate(FXObject*, FXSelector, void*);
     132              : 
     133              :     /// @brief called when a coordinate field in the status bar loses focus
     134              :     long onCmdUnfocusCoordinate(FXObject*, FXSelector, void*);
     135              : 
     136              :     /// @brief get test label
     137              :     FXLabel* getTestLabel();
     138              : 
     139              :     /// @brief get test frame
     140              :     FXHorizontalFrame* getTestFrame();
     141              : 
     142              :     /// @brief return whether the gui is in gaming mode
     143              :     bool isGaming() const;
     144              : 
     145              :     /// @brief return whether to list internal structures
     146              :     bool listInternal() const;
     147              : 
     148              :     /// @brief return whether to list parking vehicles
     149              :     bool listParking() const;
     150              : 
     151              :     /// @brief return whether to list teleporting vehicles
     152              :     bool listTeleporting() const;
     153              : 
     154              :     /// @brief get instance
     155              :     static GUIMainWindow* getInstance();
     156              : 
     157              :     /** @brief Returns the delay (should be overwritten by subclasses if applicable)
     158              :      * @return parsed delay in milliseconds
     159              :      */
     160            0 :     virtual double getDelay() const {
     161            0 :         return 0.;
     162              :     }
     163              : 
     164              :     /// @brief Sets the delay of the parent application
     165            0 :     virtual void setDelay(double) {}
     166              : 
     167              :     /// @brief Sets the breakpoints of the parent application
     168            0 :     virtual void setBreakpoints(const std::vector<SUMOTime>&) {}
     169              : 
     170              :     /// @brief get checkable button for menu tooltips (if any)
     171            0 :     virtual MFXCheckableButton* getShowToolTipsMenu() const {
     172            0 :         return nullptr;
     173              :     }
     174              : 
     175              :     /// @brief get checkable button for view tooltips (if any)
     176            0 :     virtual MFXCheckableButton* getShowToolTipsView() const {
     177            0 :         return nullptr;
     178              :     }
     179              : 
     180              :     /** @brief Sends an event from the application thread to the GUI and waits until it is handled
     181              :      * @param event the event to send
     182              :      */
     183            0 :     virtual void sendBlockingEvent(GUIEvent* event) {
     184              :         UNUSED_PARAMETER(event);
     185            0 :     }
     186              : 
     187              :     /// @brief get the active view or 0
     188              :     GUISUMOAbstractView* getActiveView() const;
     189              : 
     190              :     /// @brief Toggle full screen mode
     191            0 :     virtual long onCmdFullScreen(FXObject*, FXSelector, void*) {
     192            0 :         return 1;
     193              :     }
     194              : 
     195              :     bool isFullScreen() {
     196            0 :         return myAmFullScreen;
     197              :     }
     198              : 
     199              :     const std::map<std::string, std::string>& getOnlineMaps() const {
     200              :         return myOnlineMaps;
     201              :     }
     202              : 
     203              :     void addOnlineMap(const std::string& name, const std::string& url) {
     204            0 :         myOnlineMaps[name] = url;
     205            0 :     }
     206              : 
     207              :     /// @brief add breakpoint to the application
     208            0 :     virtual void addBreakpoint(SUMOTime /* time */) {}
     209              : 
     210              :     /// @brief retrieve breakpoints if provided by the application
     211            0 :     virtual const std::vector<SUMOTime> retrieveBreakpoints() const {
     212            0 :         return std::vector<SUMOTime>();
     213              :     }
     214              : 
     215              :     // @brief called when changes language
     216              :     long onCmdChangeLanguage(FXObject*, FXSelector, void*);
     217              : 
     218              :     // @brief called when language is updated
     219              :     long onUpdChangeLanguage(FXObject*, FXSelector, void*);
     220              : 
     221              : protected:
     222              :     /// @brief FOX need this
     223            0 :     FOX_CONSTRUCTOR(GUIMainWindow)
     224              : 
     225              :     /// @brief whether to show the window in full screen mode
     226              :     bool myAmFullScreen;
     227              : 
     228              :     /// @brief list of GLWindows
     229              :     std::vector<GUIGlChildWindow*> myGLWindows;
     230              : 
     231              :     /// @brief list of tracker windows
     232              :     std::vector<FXMainWindow*> myTrackerWindows;
     233              : 
     234              :     /// @brief A lock to make the removal and addition of trackers secure
     235              :     FXMutex myTrackerLock;
     236              : 
     237              :     /// @brief default Font (after scaling)
     238              :     FXFont* myNormalFont = nullptr;
     239              : 
     240              :     /// @brief Font used for popup-menu titles
     241              :     FXFont* myBoldFont = nullptr;
     242              : 
     243              :     /// @brief Fallback font for extended characters support
     244              :     FXFont* myFallbackFont = nullptr;
     245              : 
     246              :     /// @brief The multi view panel
     247              :     FXMDIClient* myMDIClient = nullptr;
     248              : 
     249              :     /// @brief The status bar
     250              :     FXStatusBar* myStatusbar = nullptr;
     251              : 
     252              :     /// @brief Coordinate fields for the current cartesian, geo-coordinate and test coordinates
     253              :     FXTextField* myCartesianCoordinate = nullptr;
     254              :     FXTextField* myGeoCoordinate = nullptr;
     255              :     FXLabel* myTestCoordinate = nullptr;
     256              : 
     257              :     /// @brief frames for coordinates
     258              :     FXHorizontalFrame* myTraCiFrame = nullptr;
     259              :     FXHorizontalFrame* myCartesianFrame = nullptr;
     260              :     FXHorizontalFrame* myGeoFrame = nullptr;
     261              :     FXHorizontalFrame* myTestFrame = nullptr;
     262              : 
     263              :     /// @brief The gl-visual used
     264              :     FXGLVisual* myGLVisual = nullptr;
     265              : 
     266              :     /// @brief dock sites
     267              :     FXDockSite* myTopDock = nullptr;
     268              :     FXDockSite* myBottomDock = nullptr;
     269              :     FXDockSite* myLeftDock = nullptr;
     270              :     FXDockSite* myRightDock = nullptr;
     271              : 
     272              :     /// @brief Language menu common to all applications
     273              :     FXMenuPane* myLanguageMenu = nullptr;
     274              : 
     275              :     /// @brief static toolTip used in menus
     276              :     MFXStaticToolTip* myStaticTooltipMenu = nullptr;
     277              : 
     278              :     /// @brief static toolTip used in view
     279              :     MFXStaticToolTip* myStaticTooltipView = nullptr;
     280              : 
     281              :     /// @brief information whether the gui is currently in gaming mode
     282              :     bool myAmGaming;
     283              : 
     284              :     /// @brief information whether the locator should list internal structures
     285              :     bool myListInternal;
     286              : 
     287              :     /// @brief information whether the locator should list parking vehicles
     288              :     bool myListParking;
     289              : 
     290              :     /// @brief information whether the locator should list teleporting vehicles
     291              :     bool myListTeleporting;
     292              : 
     293              :     /// @brief online mapping services for the context menu
     294              :     std::map<std::string, std::string> myOnlineMaps;
     295              : 
     296              :     /// @brief the singleton window instance
     297              :     static GUIMainWindow* myInstance;
     298              : 
     299              :     /// @brief perform initial window positioning and sizing according to user options / previous call
     300              :     void setWindowSizeAndPos();
     301              : 
     302              :     /// @brief record window position and size in registry
     303              :     void storeWindowSizeAndPos();
     304              : 
     305              :     void buildLanguageMenu(FXMenuBar* menuBar);
     306              : 
     307              : };
        

Generated by: LCOV version 2.0-1