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-2018 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 //
18 /****************************************************************************/
19 #ifndef GUIMainWindow_h
20 #define GUIMainWindow_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
28 #include <fx.h>
29 #include <vector>
30 #include <string>
31 #include <map>
32 #include <utils/common/StdDefs.h>
33 #include <utils/common/SUMOTime.h>
35 
36 
37 // ===========================================================================
38 // class declarations
39 // ===========================================================================
40 class GUIEvent;
41 class GUIGlChildWindow;
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
48 class GUIMainWindow : public FXMainWindow {
49 public:
50  GUIMainWindow(FXApp* a);
51  virtual ~GUIMainWindow();
53  void addGLChild(GUIGlChildWindow* child);
54  void addChild(FXMainWindow* child);
55 
57  void removeGLChild(GUIGlChildWindow* child);
58  void removeChild(FXMainWindow* child);
59 
60  std::vector<std::string> getViewIDs() const;
61  GUIGlChildWindow* getViewByID(const std::string& id) const;
62  const std::vector<GUIGlChildWindow*>& getViews() const {
63  return myGLWindows;
64  }
65 
66  void updateChildren();
67 
68  FXFont* getBoldFont();
69 
70  FXGLVisual* getGLVisual() const;
71 
72  virtual FXGLCanvas* getBuildGLCanvas() const = 0;
73 
74  virtual SUMOTime getCurrentSimTime() const = 0;
75 
76  virtual double getTrackerInterval() const = 0;
77 
78  virtual void setStatusBarText(const std::string&) { }
79 
80  FXLabel& getCartesianLabel();
81  FXLabel& getGeoLabel();
82 
84  bool isGaming() const {
85  return myAmGaming;
86  }
87 
89  bool listInternal() const {
90  return myListInternal;
91  }
92 
94  bool listParking() const {
95  return myListParking;
96  }
97 
99  bool listTeleporting() const {
100  return myListTeleporting;
101  }
102 
103  static GUIMainWindow* getInstance();
104 
108  virtual double getDelay() const {
109  return 0.;
110  }
111 
114  virtual void setDelay(double) {}
115 
119  virtual void sendBlockingEvent(GUIEvent* event) {
120  UNUSED_PARAMETER(event);
121  }
122 
125 
127  virtual long onCmdFullScreen(FXObject*, FXSelector, void*) {
128  return 1;
129  }
130 
131  bool isFullScreen() {
132  return myAmFullScreen;
133  }
134 
136  virtual const std::vector<SUMOTime> retrieveBreakpoints() const {
137  return std::vector<SUMOTime>();
138  }
139 
140 protected:
143 
144  std::vector<GUIGlChildWindow*> myGLWindows;
145  std::vector<FXMainWindow*> myTrackerWindows;
148 
150  FXFont* myBoldFont;
151 
153  FXMDIClient* myMDIClient;
154 
156  FXStatusBar* myStatusbar;
157 
160  FXHorizontalFrame* myCartesianFrame, *myGeoFrame;
161 
163  FXGLVisual* myGLVisual;
164 
166 
169 
172 
175 
178 
181 
182 protected:
184 
186  void setWindowSizeAndPos();
187 
189  void storeWindowSizeAndPos();
190 
191 };
192 
193 
194 #endif
195 
196 /****************************************************************************/
197 
std::vector< FXMainWindow * > myTrackerWindows
FXLabel * myGeoCoordinate
virtual SUMOTime getCurrentSimTime() const =0
FXGLVisual * getGLVisual() const
long long int SUMOTime
Definition: SUMOTime.h:36
bool myListParking
information whether the locator should list parking vehicles
virtual long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
virtual const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints if provided by the application
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call ...
FXFont * myBoldFont
Font used for popup-menu titles.
FXDockSite * myRightDock
FXGLVisual * myGLVisual
The gl-visual used.
bool listTeleporting() const
return whether to list teleporting vehicles
Definition: GUIMainWindow.h:99
virtual void setDelay(double)
Sets the delay of the parent application.
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:33
bool myListTeleporting
information whether the locator should list teleporting vehicles
std::vector< std::string > getViewIDs() const
FXHorizontalFrame * myCartesianFrame
FXLabel & getCartesianLabel()
bool myAmGaming
information whether the gui is currently in gaming mode
GUISUMOAbstractView * getActiveView() const
get the active view or 0
virtual void sendBlockingEvent(GUIEvent *event)
Sends an event from the application thread to the GUI and waits until it is handled.
virtual void setStatusBarText(const std::string &)
Definition: GUIMainWindow.h:78
static GUIMainWindow * getInstance()
FXDockSite * myLeftDock
virtual FXGLCanvas * getBuildGLCanvas() const =0
bool isGaming() const
return whether the gui is in gaming mode
Definition: GUIMainWindow.h:84
static GUIMainWindow * myInstance
the singleton window instance
FXFont * getBoldFont()
void addGLChild(GUIGlChildWindow *child)
Adds a further child window to the list.
FXLabel & getGeoLabel()
bool isFullScreen()
bool myListInternal
information whether the locator should list internal structures
std::vector< GUIGlChildWindow * > myGLWindows
bool listInternal() const
return whether to list internal structures
Definition: GUIMainWindow.h:89
FXStatusBar * myStatusbar
The status bar.
bool listParking() const
return whether to list parking vehicles
Definition: GUIMainWindow.h:94
void removeChild(FXMainWindow *child)
FXDockSite * myBottomDock
FXLabel * myCartesianCoordinate
Labels for the current cartesian and geo-coordinate.
MFXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
const std::vector< GUIGlChildWindow * > & getViews() const
Definition: GUIMainWindow.h:62
FXHorizontalFrame * myGeoFrame
FXDockSite * myTopDock
virtual ~GUIMainWindow()
virtual double getDelay() const
Returns the delay (should be overwritten by subclasses if applicable)
FXMDIClient * myMDIClient
The multi view panel.
bool myAmFullScreen
whether to show the window in full screen mode
GUIGlChildWindow * getViewByID(const std::string &id) const
void addChild(FXMainWindow *child)
void storeWindowSizeAndPos()
record window position and size in registry
virtual double getTrackerInterval() const =0
void removeGLChild(GUIGlChildWindow *child)
removes the given child window from the list