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 /****************************************************************************/
16 //
17 /****************************************************************************/
18 #ifndef GUIMainWindow_h
19 #define GUIMainWindow_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
27 #include <fx.h>
28 #include <vector>
29 #include <string>
30 #include <map>
31 #include <utils/common/StdDefs.h>
32 #include <utils/common/SUMOTime.h>
33 
34 
35 // ===========================================================================
36 // class declarations
37 // ===========================================================================
38 class GUIEvent;
39 class GUIGlChildWindow;
41 
42 
43 // ===========================================================================
44 // class definitions
45 // ===========================================================================
46 class GUIMainWindow : public FXMainWindow {
47 public:
48  GUIMainWindow(FXApp* a);
49  virtual ~GUIMainWindow();
51  void addGLChild(GUIGlChildWindow* child);
52  void addChild(FXMainWindow* child);
53 
55  void removeGLChild(GUIGlChildWindow* child);
56  void removeChild(FXMainWindow* child);
57 
58  std::vector<std::string> getViewIDs() const;
59  GUIGlChildWindow* getViewByID(const std::string& id) const;
60  const std::vector<GUIGlChildWindow*>& getViews() const {
61  return myGLWindows;
62  }
63 
64  void updateChildren();
65 
66  FXFont* getBoldFont();
67 
68  FXGLVisual* getGLVisual() const;
69 
70  virtual FXGLCanvas* getBuildGLCanvas() const = 0;
71 
72  virtual SUMOTime getCurrentSimTime() const = 0;
73 
74  virtual double getTrackerInterval() const = 0;
75 
76  virtual void setStatusBarText(const std::string&) { }
77 
78  FXLabel& getCartesianLabel();
79  FXLabel& getGeoLabel();
80 
82  bool isGaming() const {
83  return myAmGaming;
84  }
85 
87  bool listInternal() const {
88  return myListInternal;
89  }
90 
92  bool listParking() const {
93  return myListParking;
94  }
95 
97  bool listTeleporting() const {
98  return myListTeleporting;
99  }
100 
101  static GUIMainWindow* getInstance();
102 
106  virtual double getDelay() const {
107  return 0.;
108  }
109 
112  virtual void setDelay(double) {}
113 
116  virtual void setBreakpoints(const std::vector<SUMOTime>&) {}
117 
121  virtual void sendBlockingEvent(GUIEvent* event) {
122  UNUSED_PARAMETER(event);
123  }
124 
127 
129  virtual long onCmdFullScreen(FXObject*, FXSelector, void*) {
130  return 1;
131  }
132 
133  bool isFullScreen() {
134  return myAmFullScreen;
135  }
136 
138  virtual const std::vector<SUMOTime> retrieveBreakpoints() const {
139  return std::vector<SUMOTime>();
140  }
141 
142 protected:
145 
146  std::vector<GUIGlChildWindow*> myGLWindows;
147  std::vector<FXMainWindow*> myTrackerWindows;
149  FXMutex myTrackerLock;
150 
152  FXFont* myBoldFont;
153 
155  FXMDIClient* myMDIClient;
156 
158  FXStatusBar* myStatusbar;
159 
162  FXHorizontalFrame* myCartesianFrame, *myGeoFrame;
163 
165  FXGLVisual* myGLVisual;
166 
168 
171 
174 
177 
180 
183 
184 protected:
186 
187 
188  void setWindowSizeAndPos();
189 
191  void storeWindowSizeAndPos();
192 
193 };
194 
195 
196 #endif
197 
198 /****************************************************************************/
199 
GUIMainWindow::~GUIMainWindow
virtual ~GUIMainWindow()
Definition: GUIMainWindow.cpp:81
UNUSED_PARAMETER
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:31
GUIMainWindow::getDelay
virtual double getDelay() const
Returns the delay (should be overwritten by subclasses if applicable)
Definition: GUIMainWindow.h:106
GUIMainWindow::listParking
bool listParking() const
return whether to list parking vehicles
Definition: GUIMainWindow.h:92
GUIMainWindow::listTeleporting
bool listTeleporting() const
return whether to list teleporting vehicles
Definition: GUIMainWindow.h:97
GUIMainWindow::myAmFullScreen
bool myAmFullScreen
whether to show the window in full screen mode
Definition: GUIMainWindow.h:144
GUIMainWindow::myCartesianFrame
FXHorizontalFrame * myCartesianFrame
Definition: GUIMainWindow.h:162
GUIMainWindow::myGeoFrame
FXHorizontalFrame * myGeoFrame
Definition: GUIMainWindow.h:162
GUIMainWindow::storeWindowSizeAndPos
void storeWindowSizeAndPos()
record window position and size in registry
Definition: GUIMainWindow.cpp:241
SUMOTime.h
GUISUMOAbstractView
Definition: GUISUMOAbstractView.h:72
GUIMainWindow::myMDIClient
FXMDIClient * myMDIClient
The multi view panel.
Definition: GUIMainWindow.h:155
GUIMainWindow::myTopDock
FXDockSite * myTopDock
Definition: GUIMainWindow.h:167
GUIMainWindow::myStatusbar
FXStatusBar * myStatusbar
The status bar.
Definition: GUIMainWindow.h:158
GUIMainWindow::getTrackerInterval
virtual double getTrackerInterval() const =0
GUIMainWindow::setStatusBarText
virtual void setStatusBarText(const std::string &)
Definition: GUIMainWindow.h:76
GUIMainWindow::myBoldFont
FXFont * myBoldFont
Font used for popup-menu titles.
Definition: GUIMainWindow.h:152
GUIMainWindow::GUIMainWindow
GUIMainWindow(FXApp *a)
Definition: GUIMainWindow.cpp:54
GUIMainWindow::setDelay
virtual void setDelay(double)
Sets the delay of the parent application.
Definition: GUIMainWindow.h:112
GUIMainWindow::myGLWindows
std::vector< GUIGlChildWindow * > myGLWindows
Definition: GUIMainWindow.h:146
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
GUIMainWindow::myListTeleporting
bool myListTeleporting
information whether the locator should list teleporting vehicles
Definition: GUIMainWindow.h:179
GUIMainWindow::getViewIDs
std::vector< std::string > getViewIDs() const
Definition: GUIMainWindow.cpp:124
GUIMainWindow::isFullScreen
bool isFullScreen()
Definition: GUIMainWindow.h:133
GUIMainWindow::retrieveBreakpoints
virtual const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints if provided by the application
Definition: GUIMainWindow.h:138
GUIMainWindow::myTrackerLock
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
Definition: GUIMainWindow.h:149
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:121
GUIMainWindow::getActiveView
GUISUMOAbstractView * getActiveView() const
get the active view or 0
Definition: GUIMainWindow.cpp:191
GUIMainWindow::myCartesianCoordinate
FXLabel * myCartesianCoordinate
Labels for the current cartesian and geo-coordinate.
Definition: GUIMainWindow.h:161
GUIMainWindow::getInstance
static GUIMainWindow * getInstance()
Definition: GUIMainWindow.cpp:182
GUIMainWindow::isGaming
bool isGaming() const
return whether the gui is in gaming mode
Definition: GUIMainWindow.h:82
GUIMainWindow::setWindowSizeAndPos
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call
Definition: GUIMainWindow.cpp:201
GUIMainWindow::getCartesianLabel
FXLabel & getCartesianLabel()
Definition: GUIMainWindow.cpp:170
GUIMainWindow::myTrackerWindows
std::vector< FXMainWindow * > myTrackerWindows
Definition: GUIMainWindow.h:147
GUIMainWindow::getCurrentSimTime
virtual SUMOTime getCurrentSimTime() const =0
GUIMainWindow::myListParking
bool myListParking
information whether the locator should list parking vehicles
Definition: GUIMainWindow.h:176
GUIMainWindow::setBreakpoints
virtual void setBreakpoints(const std::vector< SUMOTime > &)
Sets the breakpoints of the parent application.
Definition: GUIMainWindow.h:116
GUIMainWindow::getViewByID
GUIGlChildWindow * getViewByID(const std::string &id) const
Definition: GUIMainWindow.cpp:134
GUIMainWindow::removeChild
void removeChild(FXMainWindow *child)
Definition: GUIMainWindow.cpp:115
GUIMainWindow::myBottomDock
FXDockSite * myBottomDock
Definition: GUIMainWindow.h:167
FOX_CONSTRUCTOR
#define FOX_CONSTRUCTOR(classname)
Definition: config.h:13
GUIMainWindow::myLeftDock
FXDockSite * myLeftDock
Definition: GUIMainWindow.h:167
GUIMainWindow::myRightDock
FXDockSite * myRightDock
Definition: GUIMainWindow.h:167
GUIMainWindow::updateChildren
void updateChildren()
Definition: GUIMainWindow.cpp:151
GUIMainWindow::myAmGaming
bool myAmGaming
information whether the gui is currently in gaming mode
Definition: GUIMainWindow.h:170
GUIMainWindow::getGeoLabel
FXLabel & getGeoLabel()
Definition: GUIMainWindow.cpp:176
GUIMainWindow::getGLVisual
FXGLVisual * getGLVisual() const
Definition: GUIMainWindow.cpp:164
GUIMainWindow::getViews
const std::vector< GUIGlChildWindow * > & getViews() const
Definition: GUIMainWindow.h:60
GUIMainWindow::addGLChild
void addGLChild(GUIGlChildWindow *child)
Adds a further child window to the list.
Definition: GUIMainWindow.cpp:92
GUIMainWindow::myGLVisual
FXGLVisual * myGLVisual
The gl-visual used.
Definition: GUIMainWindow.h:165
GUIMainWindow::myGeoCoordinate
FXLabel * myGeoCoordinate
Definition: GUIMainWindow.h:161
GUIMainWindow
Definition: GUIMainWindow.h:46
GUIMainWindow::getBoldFont
FXFont * getBoldFont()
Definition: GUIMainWindow.cpp:145
GUIEvent
Definition: GUIEvent.h:76
GUIMainWindow::onCmdFullScreen
virtual long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
Definition: GUIMainWindow.h:129
GUIMainWindow::myListInternal
bool myListInternal
information whether the locator should list internal structures
Definition: GUIMainWindow.h:173
GUIMainWindow::removeGLChild
void removeGLChild(GUIGlChildWindow *child)
removes the given child window from the list
Definition: GUIMainWindow.cpp:98
GUIMainWindow::getBuildGLCanvas
virtual FXGLCanvas * getBuildGLCanvas() const =0
config.h
StdDefs.h
GUIGlChildWindow
Definition: GUIGlChildWindow.h:40
GUIMainWindow::addChild
void addChild(FXMainWindow *child)
Definition: GUIMainWindow.cpp:107
GUIMainWindow::listInternal
bool listInternal() const
return whether to list internal structures
Definition: GUIMainWindow.h:87
GUIMainWindow::myInstance
static GUIMainWindow * myInstance
the singleton window instance
Definition: GUIMainWindow.h:182