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 
GUIMainWindow::~GUIMainWindow
virtual ~GUIMainWindow()
Definition: GUIMainWindow.cpp:82
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:32
GUIMainWindow::getDelay
virtual double getDelay() const
Returns the delay (should be overwritten by subclasses if applicable)
Definition: GUIMainWindow.h:107
GUIMainWindow::listParking
bool listParking() const
return whether to list parking vehicles
Definition: GUIMainWindow.h:93
GUIMainWindow::listTeleporting
bool listTeleporting() const
return whether to list teleporting vehicles
Definition: GUIMainWindow.h:98
GUIMainWindow::myAmFullScreen
bool myAmFullScreen
whether to show the window in full screen mode
Definition: GUIMainWindow.h:145
GUIMainWindow::myCartesianFrame
FXHorizontalFrame * myCartesianFrame
Definition: GUIMainWindow.h:163
GUIMainWindow::myGeoFrame
FXHorizontalFrame * myGeoFrame
Definition: GUIMainWindow.h:163
GUIMainWindow::storeWindowSizeAndPos
void storeWindowSizeAndPos()
record window position and size in registry
Definition: GUIMainWindow.cpp:242
SUMOTime.h
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:73
GUIMainWindow::myMDIClient
FXMDIClient * myMDIClient
The multi view panel.
Definition: GUIMainWindow.h:156
GUIMainWindow::myTopDock
FXDockSite * myTopDock
Definition: GUIMainWindow.h:168
GUIMainWindow::myStatusbar
FXStatusBar * myStatusbar
The status bar.
Definition: GUIMainWindow.h:159
GUIMainWindow::getTrackerInterval
virtual double getTrackerInterval() const =0
GUIMainWindow::setStatusBarText
virtual void setStatusBarText(const std::string &)
Definition: GUIMainWindow.h:77
GUIMainWindow::myBoldFont
FXFont * myBoldFont
Font used for popup-menu titles.
Definition: GUIMainWindow.h:153
GUIMainWindow::setDelay
virtual void setDelay(double)
Sets the delay of the parent application.
Definition: GUIMainWindow.h:113
GUIMainWindow::myGLWindows
std::vector< GUIGlChildWindow * > myGLWindows
Definition: GUIMainWindow.h:147
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:35
GUIMainWindow::myListTeleporting
bool myListTeleporting
information whether the locator should list teleporting vehicles
Definition: GUIMainWindow.h:180
GUIMainWindow::getViewIDs
std::vector< std::string > getViewIDs() const
Definition: GUIMainWindow.cpp:125
GUIMainWindow::isFullScreen
bool isFullScreen()
Definition: GUIMainWindow.h:134
GUIMainWindow::retrieveBreakpoints
virtual const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints if provided by the application
Definition: GUIMainWindow.h:139
GUIMainWindow::myTrackerLock
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
Definition: GUIMainWindow.h:150
GUIMainWindow::sendBlockingEvent
virtual void sendBlockingEvent(GUIEvent *event)
Sends an event from the application thread to the GUI and waits until it is handled.
Definition: GUIMainWindow.h:122
GUIMainWindow::getActiveView
GUISUMOAbstractView * getActiveView() const
get the active view or 0
Definition: GUIMainWindow.cpp:192
GUIMainWindow::myCartesianCoordinate
FXLabel * myCartesianCoordinate
Labels for the current cartesian and geo-coordinate.
Definition: GUIMainWindow.h:162
GUIMainWindow::getInstance
static GUIMainWindow * getInstance()
Definition: GUIMainWindow.cpp:183
GUIMainWindow::isGaming
bool isGaming() const
return whether the gui is in gaming mode
Definition: GUIMainWindow.h:83
GUIMainWindow::setWindowSizeAndPos
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call
Definition: GUIMainWindow.cpp:202
GUIMainWindow::getCartesianLabel
FXLabel & getCartesianLabel()
Definition: GUIMainWindow.cpp:171
GUIMainWindow::myTrackerWindows
std::vector< FXMainWindow * > myTrackerWindows
Definition: GUIMainWindow.h:148
GUIMainWindow::getCurrentSimTime
virtual SUMOTime getCurrentSimTime() const =0
GUIMainWindow::myListParking
bool myListParking
information whether the locator should list parking vehicles
Definition: GUIMainWindow.h:177
GUIMainWindow::setBreakpoints
virtual void setBreakpoints(const std::vector< SUMOTime > &)
Sets the breakpoints of the parent application.
Definition: GUIMainWindow.h:117
GUIMainWindow::getViewByID
GUIGlChildWindow * getViewByID(const std::string &id) const
Definition: GUIMainWindow.cpp:135
GUIMainWindow::removeChild
void removeChild(FXMainWindow *child)
Definition: GUIMainWindow.cpp:116
GUIMainWindow::myBottomDock
FXDockSite * myBottomDock
Definition: GUIMainWindow.h:168
GUIMainWindow::myLeftDock
FXDockSite * myLeftDock
Definition: GUIMainWindow.h:168
GUIMainWindow::myRightDock
FXDockSite * myRightDock
Definition: GUIMainWindow.h:168
GUIMainWindow::updateChildren
void updateChildren()
Definition: GUIMainWindow.cpp:152
GUIMainWindow::myAmGaming
bool myAmGaming
information whether the gui is currently in gaming mode
Definition: GUIMainWindow.h:171
GUIMainWindow::getGeoLabel
FXLabel & getGeoLabel()
Definition: GUIMainWindow.cpp:177
GUIMainWindow::getGLVisual
FXGLVisual * getGLVisual() const
Definition: GUIMainWindow.cpp:165
GUIMainWindow::getViews
const std::vector< GUIGlChildWindow * > & getViews() const
Definition: GUIMainWindow.h:61
GUIMainWindow::addGLChild
void addGLChild(GUIGlChildWindow *child)
Adds a further child window to the list.
Definition: GUIMainWindow.cpp:93
GUIMainWindow::myGLVisual
FXGLVisual * myGLVisual
The gl-visual used.
Definition: GUIMainWindow.h:166
GUIMainWindow::GUIMainWindow
GUIMainWindow()
Definition: GUIMainWindow.h:186
GUIMainWindow::myGeoCoordinate
FXLabel * myGeoCoordinate
Definition: GUIMainWindow.h:162
GUIMainWindow
Definition: GUIMainWindow.h:47
GUIMainWindow::getBoldFont
FXFont * getBoldFont()
Definition: GUIMainWindow.cpp:146
GUIEvent
Definition: GUIEvent.h:77
GUIMainWindow::onCmdFullScreen
virtual long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
Definition: GUIMainWindow.h:130
GUIMainWindow::myListInternal
bool myListInternal
information whether the locator should list internal structures
Definition: GUIMainWindow.h:174
GUIMainWindow::removeGLChild
void removeGLChild(GUIGlChildWindow *child)
removes the given child window from the list
Definition: GUIMainWindow.cpp:99
GUIMainWindow::getBuildGLCanvas
virtual FXGLCanvas * getBuildGLCanvas() const =0
config.h
StdDefs.h
GUIGlChildWindow
Definition: GUIGlChildWindow.h:41
GUIMainWindow::addChild
void addChild(FXMainWindow *child)
Definition: GUIMainWindow.cpp:108
GUIMainWindow::listInternal
bool listInternal() const
return whether to list internal structures
Definition: GUIMainWindow.h:88
GUIMainWindow::myInstance
static GUIMainWindow * myInstance
the singleton window instance
Definition: GUIMainWindow.h:183