Eclipse SUMO - Simulation of Urban MObility
GUIMainWindow.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3 // Copyright (C) 2001-2024 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
20 //
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
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;
40 class MFXStaticToolTip;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
46 class GUIMainWindow : public FXMainWindow {
47 
48 public:
50  GUIMainWindow(FXApp* app);
51 
53  virtual ~GUIMainWindow();
54 
56  void addGLChild(GUIGlChildWindow* child);
57 
59  void addChild(FXMainWindow* child);
60 
62  void removeGLChild(GUIGlChildWindow* child);
63 
65  void removeChild(FXMainWindow* child);
66 
68  FXDockSite* getTopDock();
69 
71  std::vector<std::string> getViewIDs() const;
72 
74  GUIGlChildWindow* getViewByID(const std::string& id) const;
75 
76  void removeViewByID(const std::string& id);
77 
79  const std::vector<GUIGlChildWindow*>& getViews() const;
80 
82  void updateChildren(int msg = MID_SIMSTEP);
83 
85  FXFont* getBoldFont();
86 
88  FXFont* getFallbackFont();
89 
91  FXGLVisual* getGLVisual() const;
92 
95 
98 
100  virtual FXGLCanvas* getBuildGLCanvas() const = 0;
101 
103  virtual SUMOTime getCurrentSimTime() const = 0;
104 
106  virtual double getTrackerInterval() const = 0;
107 
109  virtual void setStatusBarText(const std::string&) { }
110 
112  FXLabel* getCartesianLabel();
113 
115  FXLabel* getGeoLabel();
116 
118  FXLabel* getTestLabel();
119 
121  FXHorizontalFrame* getTestFrame();
122 
124  bool isGaming() const;
125 
127  bool listInternal() const;
128 
130  bool listParking() const;
131 
133  bool listTeleporting() const;
134 
136  static GUIMainWindow* getInstance();
137 
141  virtual double getDelay() const {
142  return 0.;
143  }
144 
146  virtual void setDelay(double) {}
147 
149  virtual void setBreakpoints(const std::vector<SUMOTime>&) {}
150 
154  virtual void sendBlockingEvent(GUIEvent* event) {
155  UNUSED_PARAMETER(event);
156  }
157 
160 
162  virtual long onCmdFullScreen(FXObject*, FXSelector, void*) {
163  return 1;
164  }
165 
166  bool isFullScreen() {
167  return myAmFullScreen;
168  }
169 
170  const std::map<std::string, std::string>& getOnlineMaps() const {
171  return myOnlineMaps;
172  }
173 
174  void addOnlineMap(const std::string& name, const std::string& url) {
175  myOnlineMaps[name] = url;
176  }
177 
179  virtual const std::vector<SUMOTime> retrieveBreakpoints() const {
180  return std::vector<SUMOTime>();
181  }
182 
183  // @brief called when changes language
184  long onCmdChangeLanguage(FXObject*, FXSelector, void*);
185 
186  // @brief called when language is updated
187  long onUpdChangeLanguage(FXObject*, FXSelector, void*);
188 
189 protected:
191  FOX_CONSTRUCTOR(GUIMainWindow)
192 
193 
195 
198 
200  std::vector<FXMainWindow*> myTrackerWindows;
201 
203  FXMutex myTrackerLock;
204 
206  FXFont* myBoldFont = nullptr;
207 
209  FXFont* myFallbackFont = nullptr;
210 
212  FXMDIClient* myMDIClient = nullptr;
213 
215  FXStatusBar* myStatusbar = nullptr;
216 
218  FXLabel* myCartesianCoordinate = nullptr;
219  FXLabel* myGeoCoordinate = nullptr;
220  FXLabel* myTestCoordinate = nullptr;
221 
223  FXHorizontalFrame* myTraCiFrame = nullptr;
224  FXHorizontalFrame* myCartesianFrame = nullptr;
225  FXHorizontalFrame* myGeoFrame = nullptr;
226  FXHorizontalFrame* myTestFrame = nullptr;
227 
229  FXGLVisual* myGLVisual = nullptr;
230 
232  FXDockSite* myTopDock = nullptr;
233  FXDockSite* myBottomDock = nullptr;
234  FXDockSite* myLeftDock = nullptr;
235  FXDockSite* myRightDock = nullptr;
236 
238  FXMenuPane* myLanguageMenu = nullptr;
239 
242 
245 
248 
251 
254 
257 
259  std::map<std::string, std::string> myOnlineMaps;
260 
263 
265  void setWindowSizeAndPos();
266 
268  void storeWindowSizeAndPos();
269 
270  void buildLanguageMenu(FXMenuBar* menuBar);
271 
272 };
long long int SUMOTime
Definition: GUI.h:35
@ MID_SIMSTEP
A Simulation step was performed.
Definition: GUIAppEnum.h:537
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:30
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call
const std::vector< GUIGlChildWindow * > & getViews() const
get views
bool myListParking
information whether the locator should list parking vehicles
static GUIMainWindow * myInstance
the singleton window instance
virtual ~GUIMainWindow()
destructor
FXDockSite * myRightDock
void removeViewByID(const std::string &id)
GUIGlChildWindow * getViewByID(const std::string &id) const
get specific view by ID
bool isFullScreen()
std::vector< FXMainWindow * > myTrackerWindows
list of tracker windows
MFXStaticToolTip * getStaticTooltipView() const
get static toolTip for view
FXFont * myFallbackFont
Fallback font for extended characters support.
virtual double getDelay() const
Returns the delay (should be overwritten by subclasses if applicable)
std::vector< std::string > getViewIDs() const
get view IDs
FXMenuPane * myLanguageMenu
Language menu common to all applications.
GUISUMOAbstractView * getActiveView() const
get the active view or 0
virtual long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
FXLabel * getGeoLabel()
get geo label
bool isGaming() const
return whether the gui is in gaming mode
bool myListTeleporting
information whether the locator should list teleporting vehicles
FXLabel * myCartesianCoordinate
Labels for the current cartesian, geo-coordinate and test coordinates.
virtual double getTrackerInterval() const =0
get tracker interval (must be implemented in all children)
std::map< std::string, std::string > myOnlineMaps
online mapping services for the context menu
const std::map< std::string, std::string > & getOnlineMaps() const
MFXStaticToolTip * myStaticTooltipMenu
static toolTip used in menus
FXMDIClient * myMDIClient
The multi view panel.
FXHorizontalFrame * myTraCiFrame
frames for coordinates
FXFont * getBoldFont()
get bold front
FXDockSite * myLeftDock
void buildLanguageMenu(FXMenuBar *menuBar)
virtual const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints if provided by the application
virtual FXGLCanvas * getBuildGLCanvas() const =0
get build GL Canvas (must be implemented in all children)
long onCmdChangeLanguage(FXObject *, FXSelector, void *)
virtual void setBreakpoints(const std::vector< SUMOTime > &)
Sets the breakpoints of the parent application.
bool listTeleporting() const
return whether to list teleporting vehicles
FXLabel * getTestLabel()
get test label
MFXStaticToolTip * myStaticTooltipView
static toolTip used in view
MFXStaticToolTip * getStaticTooltipMenu() const
get static toolTip for menus
FXFont * myBoldFont
Font used for popup-menu titles.
virtual void setStatusBarText(const std::string &)
get status bar text (can be implemented in children)
static GUIMainWindow * getInstance()
get instance
bool listParking() const
return whether to list parking vehicles
FXHorizontalFrame * myGeoFrame
FXDockSite * myBottomDock
bool listInternal() const
return whether to list internal structures
FXHorizontalFrame * myTestFrame
void addGLChild(GUIGlChildWindow *child)
Adds a further child window to the list (GUIGlChildWindow)
FXHorizontalFrame * myCartesianFrame
FXLabel * myTestCoordinate
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
virtual void setDelay(double)
Sets the delay of the parent application.
FXDockSite * myTopDock
dock sites
bool myListInternal
information whether the locator should list internal structures
void storeWindowSizeAndPos()
record window position and size in registry
virtual SUMOTime getCurrentSimTime() const =0
get current sim time (must be implemented in all children)
FXLabel * getCartesianLabel()
get cartesian label
FXGLVisual * getGLVisual() const
get GL Visual
void addOnlineMap(const std::string &name, const std::string &url)
bool myAmFullScreen
FOX need this.
virtual void sendBlockingEvent(GUIEvent *event)
Sends an event from the application thread to the GUI and waits until it is handled.
void removeGLChild(GUIGlChildWindow *child)
removes the given child window from the list (GUIGlChildWindow)
FXDockSite * getTopDock()
get top dock
FXHorizontalFrame * getTestFrame()
get test frame
FXLabel * myGeoCoordinate
FXStatusBar * myStatusbar
The status bar.
FXFont * getFallbackFont()
get fallback front
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
void removeChild(FXMainWindow *child)
removes the given child window from the list (FXMainWindow)
GUIMainWindow(FXApp *app)
constructor
std::vector< GUIGlChildWindow * > myGLWindows
list of GLWindows
long onUpdChangeLanguage(FXObject *, FXSelector, void *)
void addChild(FXMainWindow *child)
Adds a further child window to the list (FXMainWindow)
MFXStaticToolTip (based on FXToolTip)
Definition: json.hpp:4471