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-2019 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>
34 
35 
36 // ===========================================================================
37 // class declarations
38 // ===========================================================================
39 class GUIEvent;
40 class GUIGlChildWindow;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
47 class GUIMainWindow : public FXMainWindow {
48 public:
49  GUIMainWindow(FXApp* a);
50  virtual ~GUIMainWindow();
52  void addGLChild(GUIGlChildWindow* child);
53  void addChild(FXMainWindow* child);
54 
56  void removeGLChild(GUIGlChildWindow* child);
57  void removeChild(FXMainWindow* child);
58 
59  std::vector<std::string> getViewIDs() const;
60  GUIGlChildWindow* getViewByID(const std::string& id) const;
61  const std::vector<GUIGlChildWindow*>& getViews() const {
62  return myGLWindows;
63  }
64 
65  void updateChildren();
66 
67  FXFont* getBoldFont();
68 
69  FXGLVisual* getGLVisual() const;
70 
71  virtual FXGLCanvas* getBuildGLCanvas() const = 0;
72 
73  virtual SUMOTime getCurrentSimTime() const = 0;
74 
75  virtual double getTrackerInterval() const = 0;
76 
77  virtual void setStatusBarText(const std::string&) { }
78 
79  FXLabel& getCartesianLabel();
80  FXLabel& getGeoLabel();
81 
83  bool isGaming() const {
84  return myAmGaming;
85  }
86 
88  bool listInternal() const {
89  return myListInternal;
90  }
91 
93  bool listParking() const {
94  return myListParking;
95  }
96 
98  bool listTeleporting() const {
99  return myListTeleporting;
100  }
101 
102  static GUIMainWindow* getInstance();
103 
107  virtual double getDelay() const {
108  return 0.;
109  }
110 
113  virtual void setDelay(double) {}
114 
117  virtual void setBreakpoints(const std::vector<SUMOTime>&) {}
118 
122  virtual void sendBlockingEvent(GUIEvent* event) {
123  UNUSED_PARAMETER(event);
124  }
125 
128 
130  virtual long onCmdFullScreen(FXObject*, FXSelector, void*) {
131  return 1;
132  }
133 
134  bool isFullScreen() {
135  return myAmFullScreen;
136  }
137 
139  virtual const std::vector<SUMOTime> retrieveBreakpoints() const {
140  return std::vector<SUMOTime>();
141  }
142 
143 protected:
146 
147  std::vector<GUIGlChildWindow*> myGLWindows;
148  std::vector<FXMainWindow*> myTrackerWindows;
150  FXMutex myTrackerLock;
151 
153  FXFont* myBoldFont;
154 
156  FXMDIClient* myMDIClient;
157 
159  FXStatusBar* myStatusbar;
160 
163  FXHorizontalFrame* myCartesianFrame, *myGeoFrame;
164 
166  FXGLVisual* myGLVisual;
167 
169 
172 
175 
178 
181 
184 
185 protected:
187 
189  void setWindowSizeAndPos();
190 
192  void storeWindowSizeAndPos();
193 
194 };
195 
196 
197 #endif
198 
199 /****************************************************************************/
200 
std::vector< FXMainWindow * > myTrackerWindows
FXLabel * myGeoCoordinate
virtual SUMOTime getCurrentSimTime() const =0
FXGLVisual * getGLVisual() const
long long int SUMOTime
Definition: SUMOTime.h:35
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:98
virtual void setDelay(double)
Sets the delay of the parent application.
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
bool myListTeleporting
information whether the locator should list teleporting vehicles
std::vector< std::string > getViewIDs() const
virtual void setBreakpoints(const std::vector< SUMOTime > &)
Sets the breakpoints of the parent application.
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:77
static GUIMainWindow * getInstance()
FXDockSite * myLeftDock
virtual FXGLCanvas * getBuildGLCanvas() const =0
bool isGaming() const
return whether the gui is in gaming mode
Definition: GUIMainWindow.h:83
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:88
FXStatusBar * myStatusbar
The status bar.
bool listParking() const
return whether to list parking vehicles
Definition: GUIMainWindow.h:93
void removeChild(FXMainWindow *child)
FXDockSite * myBottomDock
FXLabel * myCartesianCoordinate
Labels for the current cartesian and geo-coordinate.
const std::vector< GUIGlChildWindow * > & getViews() const
Definition: GUIMainWindow.h:61
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