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;
42
43
44// ===========================================================================
45// class definitions
46// ===========================================================================
47class GUIMainWindow : public FXMainWindow {
48
49public:
51 GUIMainWindow(FXApp* app);
52
54 virtual ~GUIMainWindow();
55
57 void addGLChild(GUIGlChildWindow* child);
58
60 void addChild(FXMainWindow* child);
61
64
66 void removeChild(FXMainWindow* child);
67
69 FXDockSite* getTopDock();
70
72 std::vector<std::string> getViewIDs() const;
73
75 GUIGlChildWindow* getViewByID(const std::string& id) const;
76
77 void removeViewByID(const std::string& id);
78
80 const std::vector<GUIGlChildWindow*>& getViews() const;
81
83 void updateChildren(int msg = MID_SIMSTEP);
84
86 FXFont* getBoldFont();
87
89 FXFont* getFallbackFont();
90
92 FXGLVisual* getGLVisual() const;
93
96
99
101 virtual FXGLCanvas* getBuildGLCanvas() const = 0;
102
104 virtual SUMOTime getCurrentSimTime() const = 0;
105
107 virtual double getTrackerInterval() const = 0;
108
110 virtual void setStatusBarText(const std::string&) { }
111
113 FXTextField* getCartesianLabel();
114
116 FXTextField* getGeoLabel();
117
119 static bool parseGeoCoordinate(const std::string& text, double& lat, double& lon);
120
122 static bool parseCartesianCoordinate(const std::string& text, double& x, double& y);
123
125 long onCmdSetGeoCoordinate(FXObject*, FXSelector, void*);
126
128 long onCmdSetCartesianCoordinate(FXObject*, FXSelector, void*);
129
131 long onCmdFocusCoordinate(FXObject*, FXSelector, void*);
132
134 long onCmdUnfocusCoordinate(FXObject*, FXSelector, void*);
135
137 FXLabel* getTestLabel();
138
140 FXHorizontalFrame* getTestFrame();
141
143 bool isGaming() const;
144
146 bool listInternal() const;
147
149 bool listParking() const;
150
152 bool listTeleporting() const;
153
155 static GUIMainWindow* getInstance();
156
160 virtual double getDelay() const {
161 return 0.;
162 }
163
165 virtual void setDelay(double) {}
166
168 virtual void setBreakpoints(const std::vector<SUMOTime>&) {}
169
172 return nullptr;
173 }
174
177 return nullptr;
178 }
179
183 virtual void sendBlockingEvent(GUIEvent* event) {
184 UNUSED_PARAMETER(event);
185 }
186
189
191 virtual long onCmdFullScreen(FXObject*, FXSelector, void*) {
192 return 1;
193 }
194
196 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 myOnlineMaps[name] = url;
205 }
206
208 virtual void addBreakpoint(SUMOTime /* time */) {}
209
211 virtual const std::vector<SUMOTime> retrieveBreakpoints() const {
212 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
221protected:
223 FOX_CONSTRUCTOR(GUIMainWindow)
224
225
227
230
232 std::vector<FXMainWindow*> myTrackerWindows;
233
236
238 FXFont* myNormalFont = nullptr;
239
241 FXFont* myBoldFont = nullptr;
242
244 FXFont* myFallbackFont = nullptr;
245
247 FXMDIClient* myMDIClient = nullptr;
248
250 FXStatusBar* myStatusbar = nullptr;
251
253 FXTextField* myCartesianCoordinate = nullptr;
254 FXTextField* myGeoCoordinate = nullptr;
255 FXLabel* myTestCoordinate = nullptr;
256
258 FXHorizontalFrame* myTraCiFrame = nullptr;
259 FXHorizontalFrame* myCartesianFrame = nullptr;
260 FXHorizontalFrame* myGeoFrame = nullptr;
261 FXHorizontalFrame* myTestFrame = nullptr;
262
264 FXGLVisual* myGLVisual = nullptr;
265
267 FXDockSite* myTopDock = nullptr;
268 FXDockSite* myBottomDock = nullptr;
269 FXDockSite* myLeftDock = nullptr;
270 FXDockSite* myRightDock = nullptr;
271
273 FXMenuPane* myLanguageMenu = nullptr;
274
277
280
283
286
289
292
294 std::map<std::string, std::string> myOnlineMaps;
295
298
300 void setWindowSizeAndPos();
301
304
305 void buildLanguageMenu(FXMenuBar* menuBar);
306
307};
long long int SUMOTime
Definition GUI.h:36
@ MID_SIMSTEP
A Simulation step was performed.
Definition GUIAppEnum.h:551
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call
virtual void addBreakpoint(SUMOTime)
add breakpoint to the application
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
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
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.
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
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
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.
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)
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
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
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)
MFXStaticToolTip (based on FXToolTip)
#define UNUSED_PARAMETER(x)
Definition json.hpp:4471