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.org/sumo
3 // Copyright (C) 2001-2022 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 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class GUIEvent;
37 class GUIGlChildWindow;
39 
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
44 class GUIMainWindow : public FXMainWindow {
45 
46 public:
48  GUIMainWindow(FXApp* a);
49 
51  virtual ~GUIMainWindow();
52 
54  void addGLChild(GUIGlChildWindow* child);
55 
57  void addChild(FXMainWindow* child);
58 
60  void removeGLChild(GUIGlChildWindow* child);
61 
63  void removeChild(FXMainWindow* child);
64 
66  FXDockSite* getTopDock();
67 
69  std::vector<std::string> getViewIDs() const;
70 
72  GUIGlChildWindow* getViewByID(const std::string& id) const;
73 
75  const std::vector<GUIGlChildWindow*>& getViews() const;
76 
78  void updateChildren();
79 
81  FXFont* getBoldFont();
82 
84  FXFont* getFallbackFont();
85 
87  FXGLVisual* getGLVisual() const;
88 
90  virtual FXGLCanvas* getBuildGLCanvas() const = 0;
91 
93  virtual SUMOTime getCurrentSimTime() const = 0;
94 
96  virtual double getTrackerInterval() const = 0;
97 
99  virtual void setStatusBarText(const std::string&) { }
100 
102  FXLabel& getCartesianLabel();
103 
105  FXLabel& getGeoLabel();
106 
108  bool isGaming() const;
109 
111  bool listInternal() const;
112 
114  bool listParking() const;
115 
117  bool listTeleporting() const;
118 
120  static GUIMainWindow* getInstance();
121 
125  virtual double getDelay() const {
126  return 0.;
127  }
128 
130  virtual void setDelay(double) {}
131 
133  virtual void setBreakpoints(const std::vector<SUMOTime>&) {}
134 
138  virtual void sendBlockingEvent(GUIEvent* event) {
139  UNUSED_PARAMETER(event);
140  }
141 
144 
146  virtual long onCmdFullScreen(FXObject*, FXSelector, void*) {
147  return 1;
148  }
149 
150  bool isFullScreen() {
151  return myAmFullScreen;
152  }
153 
155  virtual const std::vector<SUMOTime> retrieveBreakpoints() const {
156  return std::vector<SUMOTime>();
157  }
158 
159 protected:
161  FOX_CONSTRUCTOR(GUIMainWindow)
162 
163 
165 
167 
168  std::vector<FXMainWindow*> myTrackerWindows;
169 
171  FXMutex myTrackerLock;
172 
174  FXFont* myBoldFont;
175 
177  FXFont* myFallbackFont;
178 
180  FXMDIClient* myMDIClient;
181 
183  FXStatusBar* myStatusbar;
184 
187 
188  FXHorizontalFrame* myCartesianFrame, *myGeoFrame;
189 
191  FXGLVisual* myGLVisual;
192 
194 
197 
200 
203 
206 
209 
211  void setWindowSizeAndPos();
212 
214  void storeWindowSizeAndPos();
215 };
long long int SUMOTime
Definition: SUMOTime.h:32
#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
GUIGlChildWindow * getViewByID(const std::string &id) const
get specific view by ID
bool isFullScreen()
std::vector< FXMainWindow * > myTrackerWindows
FXLabel & getCartesianLabel()
get cartesian label
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
GUISUMOAbstractView * getActiveView() const
get the active view or 0
virtual long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
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 and geo-coordinate.
virtual double getTrackerInterval() const =0
get tracker interval (must be implemented in all children)
FXMDIClient * myMDIClient
The multi view panel.
FXFont * getBoldFont()
get bold front
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)
virtual void setBreakpoints(const std::vector< SUMOTime > &)
Sets the breakpoints of the parent application.
bool listTeleporting() const
return whether to list teleporting vehicles
FXHorizontalFrame * myGeoFrame
FXFont * myBoldFont
Font used for popup-menu titles.
virtual void setStatusBarText(const std::string &)
get status bar text (can be implemented in children)
Definition: GUIMainWindow.h:99
static GUIMainWindow * getInstance()
get instance
FXLabel * myGeoCoordinate
bool listParking() const
return whether to list parking vehicles
FXDockSite * myRightDock
FXDockSite * myBottomDock
void updateChildren()
update childrens
bool listInternal() const
return whether to list internal structures
void addGLChild(GUIGlChildWindow *child)
Adds a further child window to the list (GUIGlChildWindow)
FXHorizontalFrame * myCartesianFrame
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
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)
GUIMainWindow(FXApp *a)
constructor
FXGLVisual * getGLVisual() const
get GL Visual
FXLabel & getGeoLabel()
get geo label
FXDockSite * myLeftDock
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
FXStatusBar * myStatusbar
The status bar.
FXFont * getFallbackFont()
get fallback front
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
void addChild(FXMainWindow *child)
Adds a further child window to the list (FXMainWindow)