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-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>
31#include "GUIAppEnum.h"
32
33
34// ===========================================================================
35// class declarations
36// ===========================================================================
37class GUIEvent;
41
42
43// ===========================================================================
44// class definitions
45// ===========================================================================
46class GUIMainWindow : public FXMainWindow {
47
48public:
50 GUIMainWindow(FXApp* app);
51
53 virtual ~GUIMainWindow();
54
56 void addGLChild(GUIGlChildWindow* child);
57
59 void addChild(FXMainWindow* child);
60
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
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 void addBreakpoint(SUMOTime /* time */) {}
180
182 virtual const std::vector<SUMOTime> retrieveBreakpoints() const {
183 return std::vector<SUMOTime>();
184 }
185
186 // @brief called when changes language
187 long onCmdChangeLanguage(FXObject*, FXSelector, void*);
188
189 // @brief called when language is updated
190 long onUpdChangeLanguage(FXObject*, FXSelector, void*);
191
192protected:
194 FOX_CONSTRUCTOR(GUIMainWindow)
195
196
198
201
203 std::vector<FXMainWindow*> myTrackerWindows;
204
207
209 FXFont* myBoldFont = nullptr;
210
212 FXFont* myFallbackFont = nullptr;
213
215 FXMDIClient* myMDIClient = nullptr;
216
218 FXStatusBar* myStatusbar = nullptr;
219
221 FXLabel* myCartesianCoordinate = nullptr;
222 FXLabel* myGeoCoordinate = nullptr;
223 FXLabel* myTestCoordinate = nullptr;
224
226 FXHorizontalFrame* myTraCiFrame = nullptr;
227 FXHorizontalFrame* myCartesianFrame = nullptr;
228 FXHorizontalFrame* myGeoFrame = nullptr;
229 FXHorizontalFrame* myTestFrame = nullptr;
230
232 FXGLVisual* myGLVisual = nullptr;
233
235 FXDockSite* myTopDock = nullptr;
236 FXDockSite* myBottomDock = nullptr;
237 FXDockSite* myLeftDock = nullptr;
238 FXDockSite* myRightDock = nullptr;
239
241 FXMenuPane* myLanguageMenu = nullptr;
242
245
248
251
254
257
260
262 std::map<std::string, std::string> myOnlineMaps;
263
266
268 void setWindowSizeAndPos();
269
272
273 void buildLanguageMenu(FXMenuBar* menuBar);
274
275};
long long int SUMOTime
Definition GUI.h:36
@ MID_SIMSTEP
A Simulation step was performed.
Definition GUIAppEnum.h:541
#define UNUSED_PARAMETER(x)
Definition StdDefs.h:30
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
virtual ~GUIMainWindow()
destructor
FXDockSite * myRightDock
void removeViewByID(const std::string &id)
GUIGlChildWindow * getViewByID(const std::string &id) const
get specific view by ID
std::vector< FXMainWindow * > myTrackerWindows
list of tracker windows
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.
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
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
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
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)
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