Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
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-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/****************************************************************************/
20//
21/****************************************************************************/
22#pragma once
23#include <config.h>
24
26#include <vector>
27#include <string>
28#include <map>
31#include "GUIAppEnum.h"
32
33
34// ===========================================================================
35// class declarations
36// ===========================================================================
37class GUIEvent;
42class GUINewsFeed;
43
44
45// ===========================================================================
46// class definitions
47// ===========================================================================
48class GUIMainWindow : public FXMainWindow {
49
50public:
52 GUIMainWindow(FXApp* app);
53
55 virtual ~GUIMainWindow();
56
58 void addGLChild(GUIGlChildWindow* child);
59
61 void addChild(FXMainWindow* child);
62
65
67 void removeChild(FXMainWindow* child);
68
70 FXDockSite* getTopDock();
71
73 std::vector<std::string> getViewIDs() const;
74
76 GUIGlChildWindow* getViewByID(const std::string& id) const;
77
78 void removeViewByID(const std::string& id);
79
81 std::vector<GUIGlChildWindow*> getViews() const;
82
84 void updateChildren(int msg = MID_SIMSTEP);
85
87 FXFont* getBoldFont();
88
90 FXFont* getFallbackFont();
91
93 FXGLVisual* getGLVisual() const;
94
97
100
102 virtual FXGLCanvas* getBuildGLCanvas() const = 0;
103
105 virtual SUMOTime getCurrentSimTime() const = 0;
106
108 virtual double getTrackerInterval() const = 0;
109
111 virtual void setStatusBarText(const std::string&) { }
112
114 FXTextField* getCartesianLabel();
115
117 FXTextField* getGeoLabel();
118
120 static bool parseGeoCoordinate(const std::string& text, double& lat, double& lon);
121
123 static bool parseCartesianCoordinate(const std::string& text, double& x, double& y);
124
126 long onCmdSetGeoCoordinate(FXObject*, FXSelector, void*);
127
129 long onCmdSetCartesianCoordinate(FXObject*, FXSelector, void*);
130
132 long onCmdFocusCoordinate(FXObject*, FXSelector, void*);
133
135 long onCmdUnfocusCoordinate(FXObject*, FXSelector, void*);
136
138 FXLabel* getTestLabel();
139
141 FXHorizontalFrame* getTestFrame();
142
144 bool isGaming() const;
145
147 bool listInternal() const;
148
150 bool listParking() const;
151
153 bool listTeleporting() const;
154
156 void checkNews();
157
159 long onCmdNews(FXObject*, FXSelector, void*);
160
162 static GUIMainWindow* getInstance();
163
167 virtual double getDelay() const {
168 return 0.;
169 }
170
172 virtual void setDelay(double) {}
173
175 virtual void setBreakpoints(const std::vector<SUMOTime>&) {}
176
179 return nullptr;
180 }
181
184 return nullptr;
185 }
186
190 virtual void sendBlockingEvent(GUIEvent* event) {
191 UNUSED_PARAMETER(event);
192 }
193
196
198 virtual long onCmdFullScreen(FXObject*, FXSelector, void*) {
199 return 1;
200 }
201
203 return myAmFullScreen;
204 }
205
206 const std::map<std::string, std::string>& getOnlineMaps() const {
207 return myOnlineMaps;
208 }
209
210 void addOnlineMap(const std::string& name, const std::string& url) {
211 myOnlineMaps[name] = url;
212 }
213
215 virtual void addBreakpoint(SUMOTime /* time */) {}
216
218 virtual const std::vector<SUMOTime> retrieveBreakpoints() const {
219 return std::vector<SUMOTime>();
220 }
221
222 // @brief called when changes language
223 long onCmdChangeLanguage(FXObject*, FXSelector, void*);
224
225 // @brief called when language is updated
226 long onUpdChangeLanguage(FXObject*, FXSelector, void*);
227
228protected:
230 FOX_CONSTRUCTOR(GUIMainWindow)
231
232
233 void toggleMessageWindowAndStatusBar(FXWindow* messageWindow);
234
237
239 std::vector<GUIGlChildWindow*> myGLWindows;
240
242 mutable FXMutex myGLWindowsLock;
243
245 std::vector<FXMainWindow*> myTrackerWindows;
246
249
251 FXFont* myNormalFont = nullptr;
252
254 FXFont* myBoldFont = nullptr;
255
257 FXFont* myFallbackFont = nullptr;
258
260 FXMDIClient* myMDIClient = nullptr;
261
263 FXStatusBar* myStatusbar = nullptr;
264
266 FXTextField* myCartesianCoordinate = nullptr;
267 FXTextField* myGeoCoordinate = nullptr;
268 FXLabel* myTestCoordinate = nullptr;
269
271 FXHorizontalFrame* myTraCiFrame = nullptr;
272 FXHorizontalFrame* myCartesianFrame = nullptr;
273 FXHorizontalFrame* myGeoFrame = nullptr;
274 FXHorizontalFrame* myTestFrame = nullptr;
275
277 FXGLVisual* myGLVisual = nullptr;
278
280 FXDockSite* myTopDock = nullptr;
281 FXDockSite* myBottomDock = nullptr;
282 FXDockSite* myLeftDock = nullptr;
283 FXDockSite* myRightDock = nullptr;
284
286 FXMenuPane* myLanguageMenu = nullptr;
287
290
293
296
299
302
305
308
310 std::map<std::string, std::string> myOnlineMaps;
311
314
316 void setWindowSizeAndPos();
317
320
321 void buildLanguageMenu(FXMenuBar* menuBar);
322
323};
long long int SUMOTime
Definition GUI.h:36
@ MID_SIMSTEP
A Simulation step was performed.
Definition GUIAppEnum.h:553
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call
virtual void addBreakpoint(SUMOTime)
add breakpoint to the application
bool myListParking
information whether the locator should list parking vehicles
static GUIMainWindow * myInstance
the singleton window instance
FXTextField * getGeoLabel()
get geo coordinate field
virtual ~GUIMainWindow()
destructor
FXDockSite * myRightDock
void removeViewByID(const std::string &id)
long onCmdUnfocusCoordinate(FXObject *, FXSelector, void *)
called when a coordinate field in the status bar loses focus
GUIGlChildWindow * getViewByID(const std::string &id) const
get specific view by ID
std::vector< FXMainWindow * > myTrackerWindows
list of tracker windows
FXTextField * getCartesianLabel()
get cartesian coordinate field
virtual FXGLCanvas * getBuildGLCanvas() const =0
get build GL Canvas (must be implemented in all children)
MFXStaticToolTip * getStaticTooltipView() const
get static toolTip for view
FXFont * myFallbackFont
Fallback font for extended characters support.
virtual const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints if provided by the application
virtual double getDelay() const
Returns the delay (should be overwritten by subclasses if applicable)
std::vector< std::string > getViewIDs() const
get view IDs
std::vector< GUIGlChildWindow * > getViews() const
get (a copy of the list of) views
FXMenuPane * myLanguageMenu
Language menu common to all applications.
void checkNews()
fetch the release news feed in the background if it was not accessed recently
GUISUMOAbstractView * getActiveView() const
get the active view or 0
virtual long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
long onCmdSetGeoCoordinate(FXObject *, FXSelector, void *)
called when user enters a geo coordinate in the status bar
bool isGaming() const
return whether the gui is in gaming mode
bool myListTeleporting
information whether the locator should list teleporting vehicles
GUINewsFeed * myNewsFeed
fetcher for the release news
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
MFXStaticToolTip * myStaticTooltipMenu
static toolTip used in menus
FXMDIClient * myMDIClient
The multi view panel.
long onCmdSetCartesianCoordinate(FXObject *, FXSelector, void *)
called when user enters a cartesian coordinate in the status bar
FXHorizontalFrame * myTraCiFrame
frames for coordinates
long onCmdNews(FXObject *, FXSelector, void *)
show the latest release news (fetching them if necessary)
FXFont * getBoldFont()
get bold front
FXDockSite * myLeftDock
const std::map< std::string, std::string > & getOnlineMaps() const
void buildLanguageMenu(FXMenuBar *menuBar)
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
FXTextField * myCartesianCoordinate
Coordinate fields for the current cartesian, geo-coordinate and test coordinates.
virtual MFXCheckableButton * getShowToolTipsMenu() const
get checkable button for menu tooltips (if any)
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
FXFont * myNormalFont
default Font (after scaling)
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
void toggleMessageWindowAndStatusBar(FXWindow *messageWindow)
FOX need this.
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
FXMutex myGLWindowsLock
A lock to make the access to the GLWindows thread safe (they are also accessed by the simulation thre...
void storeWindowSizeAndPos()
record window position and size in registry
virtual SUMOTime getCurrentSimTime() const =0
get current sim time (must be implemented in all children)
long onCmdFocusCoordinate(FXObject *, FXSelector, void *)
called when user focuses a coordinate field in the status bar
FXGLVisual * getGLVisual() const
get GL Visual
void addOnlineMap(const std::string &name, const std::string &url)
bool myAmFullScreen
whether to show the window in full screen mode
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
FXStatusBar * myStatusbar
The status bar.
FXFont * getFallbackFont()
get fallback front
virtual MFXCheckableButton * getShowToolTipsView() const
get checkable button for view tooltips (if any)
static bool parseCartesianCoordinate(const std::string &text, double &x, double &y)
parse cartesian coordinate string ("x, y" or "x:... y:...")
void updateChildren(int msg=MID_SIMSTEP)
update childrens
FXTextField * myGeoCoordinate
FXGLVisual * myGLVisual
The gl-visual used.
static bool parseGeoCoordinate(const std::string &text, double &lat, double &lon)
parse geo coordinate string ("lat, lon" or "lat:... lon:...")
bool myAmGaming
information whether the gui is currently in gaming mode
void removeChild(FXMainWindow *child)
removes the given child window from the list (FXMainWindow)
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)
Periodically fetches an RSS feed with news about upcoming releases.
Definition GUINewsFeed.h:47
MFXStaticToolTip (based on FXToolTip)
#define UNUSED_PARAMETER(x)