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;
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
47 class GUIMainWindow : public FXMainWindow {
48 public:
49  GUIMainWindow(FXApp* a);
50  virtual ~GUIMainWindow();
52  void addChild(FXMDIChild* child, bool updateOnSimStep = true);
53  void addChild(FXMainWindow* child, bool updateOnSimStep = true);
54 
56  void removeChild(FXMDIChild* child);
57  void removeChild(FXMainWindow* child);
58 
59  std::vector<std::string> getViewIDs() const;
60  FXMDIChild* getViewByID(const std::string& id) const;
61 
62  void updateChildren();
63 
64  FXFont* getBoldFont();
65 
66  FXGLVisual* getGLVisual() const;
67 
68  virtual FXGLCanvas* getBuildGLCanvas() const = 0;
69 
70  virtual SUMOTime getCurrentSimTime() const = 0;
71 
72  virtual double getTrackerInterval() const = 0;
73 
74  virtual void setStatusBarText(const std::string&) { }
75 
76  FXLabel& getCartesianLabel();
77  FXLabel& getGeoLabel();
78 
80  bool isGaming() const {
81  return myAmGaming;
82  }
83 
85  bool listInternal() const {
86  return myListInternal;
87  }
88 
90  bool listParking() const {
91  return myListParking;
92  }
93 
95  bool listTeleporting() const {
96  return myListTeleporting;
97  }
98 
99  static GUIMainWindow* getInstance();
100 
104  virtual double getDelay() const {
105  return 0.;
106  }
107 
110  virtual void setDelay(double) {}
111 
115  virtual void sendBlockingEvent(GUIEvent* event) {
116  UNUSED_PARAMETER(event);
117  }
118 
121 
123  virtual long onCmdFullScreen(FXObject*, FXSelector, void*) {
124  return 1;
125  }
126 
127  bool isFullScreen() {
128  return myAmFullScreen;
129  }
130 
132  virtual const std::vector<SUMOTime> retrieveBreakpoints() const {
133  return std::vector<SUMOTime>();
134  }
135 
136 protected:
139 
140  std::vector<FXMDIChild*> mySubWindows;
141  std::vector<FXMainWindow*> myTrackerWindows;
144 
146  FXFont* myBoldFont;
147 
149  FXMDIClient* myMDIClient;
150 
152  FXStatusBar* myStatusbar;
153 
156  FXHorizontalFrame* myCartesianFrame, *myGeoFrame;
157 
159  FXGLVisual* myGLVisual;
160 
162 
165 
168 
171 
174 
177 
178 protected:
180 
182  void setWindowSizeAndPos();
183 
185  void storeWindowSizeAndPos();
186 
187 };
188 
189 
190 #endif
191 
192 /****************************************************************************/
193 
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:95
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
std::vector< FXMDIChild * > mySubWindows
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.
void addChild(FXMDIChild *child, bool updateOnSimStep=true)
Adds a further child window to the list.
virtual void setStatusBarText(const std::string &)
Definition: GUIMainWindow.h:74
static GUIMainWindow * getInstance()
FXDockSite * myLeftDock
virtual FXGLCanvas * getBuildGLCanvas() const =0
bool isGaming() const
return whether the gui is in gaming mode
Definition: GUIMainWindow.h:80
static GUIMainWindow * myInstance
the singleton window instance
FXFont * getBoldFont()
FXLabel & getGeoLabel()
void removeChild(FXMDIChild *child)
removes the given child window from the list
bool isFullScreen()
bool myListInternal
information whether the locator should list internal structures
bool listInternal() const
return whether to list internal structures
Definition: GUIMainWindow.h:85
FXStatusBar * myStatusbar
The status bar.
bool listParking() const
return whether to list parking vehicles
Definition: GUIMainWindow.h:90
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.
FXMDIChild * getViewByID(const std::string &id) const
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
void storeWindowSizeAndPos()
record window position and size in registry
virtual double getTrackerInterval() const =0