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-2020 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials are made available under the
5 // terms of the Eclipse Public License 2.0 which is available at
6 // https://www.eclipse.org/legal/epl-2.0/
7 // This Source Code may also be made available under the following Secondary
8 // Licenses when the conditions for such availability set forth in the Eclipse
9 // Public License 2.0 are satisfied: GNU General Public License, version 2
10 // or later which is available at
11 // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12 // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13 /****************************************************************************/
20 //
21 /****************************************************************************/
22 #pragma once
23 #include <config.h>
24 
25 #include <fx.h>
26 #include <vector>
27 #include <string>
28 #include <map>
29 #include <utils/common/StdDefs.h>
30 #include <utils/common/SUMOTime.h>
31 
32 
33 // ===========================================================================
34 // class declarations
35 // ===========================================================================
36 class GUIEvent;
37 class GUIGlChildWindow;
39 
40 
41 // ===========================================================================
42 // class definitions
43 // ===========================================================================
44 class GUIMainWindow : public FXMainWindow {
45 
46 public:
48  GUIMainWindow(FXApp* a);
49 
51  virtual ~GUIMainWindow();
52 
54  void addGLChild(GUIGlChildWindow* child);
55 
57  void addChild(FXMainWindow* child);
58 
60  void removeGLChild(GUIGlChildWindow* child);
61 
63  void removeChild(FXMainWindow* child);
64 
66  FXDockSite* getTopDock();
67 
69  std::vector<std::string> getViewIDs() const;
70 
72  GUIGlChildWindow* getViewByID(const std::string& id) const;
73 
75  const std::vector<GUIGlChildWindow*>& getViews() const;
76 
78  void updateChildren();
79 
81  FXFont* getBoldFont();
82 
84  FXGLVisual* getGLVisual() const;
85 
87  virtual FXGLCanvas* getBuildGLCanvas() const = 0;
88 
90  virtual SUMOTime getCurrentSimTime() const = 0;
91 
93  virtual double getTrackerInterval() const = 0;
94 
96  virtual void setStatusBarText(const std::string&) { }
97 
99  FXLabel& getCartesianLabel();
100 
102  FXLabel& getGeoLabel();
103 
105  bool isGaming() const;
106 
108  bool listInternal() const;
109 
111  bool listParking() const;
112 
114  bool listTeleporting() const;
115 
117  static GUIMainWindow* getInstance();
118 
122  virtual double getDelay() const {
123  return 0.;
124  }
125 
127  virtual void setDelay(double) {}
128 
130  virtual void setBreakpoints(const std::vector<SUMOTime>&) {}
131 
135  virtual void sendBlockingEvent(GUIEvent* event) {
136  UNUSED_PARAMETER(event);
137  }
138 
141 
143  virtual long onCmdFullScreen(FXObject*, FXSelector, void*) {
144  return 1;
145  }
146 
147  bool isFullScreen() {
148  return myAmFullScreen;
149  }
150 
152  virtual const std::vector<SUMOTime> retrieveBreakpoints() const {
153  return std::vector<SUMOTime>();
154  }
155 
156 protected:
158  FOX_CONSTRUCTOR(GUIMainWindow)
159 
160 
162 
164 
165  std::vector<FXMainWindow*> myTrackerWindows;
166 
168  FXMutex myTrackerLock;
169 
171  FXFont* myBoldFont;
172 
174  FXMDIClient* myMDIClient;
175 
177  FXStatusBar* myStatusbar;
178 
181 
182  FXHorizontalFrame* myCartesianFrame, *myGeoFrame;
183 
185  FXGLVisual* myGLVisual;
186 
188 
191 
194 
197 
200 
203 
205  void setWindowSizeAndPos();
206 
208  void storeWindowSizeAndPos();
209 };
long long int SUMOTime
Definition: SUMOTime.h:31
#define UNUSED_PARAMETER(x)
Definition: StdDefs.h:29
void setWindowSizeAndPos()
perform initial window positioning and sizing according to user options / previous call
const std::vector< GUIGlChildWindow * > & getViews() const
get views
bool myListParking
information whether the locator should list parking vehicles
static GUIMainWindow * myInstance
the singleton window instance
virtual ~GUIMainWindow()
destructor
GUIGlChildWindow * getViewByID(const std::string &id) const
get specific view by ID
bool isFullScreen()
std::vector< FXMainWindow * > myTrackerWindows
FXLabel & getCartesianLabel()
get cartesian label
virtual double getDelay() const
Returns the delay (should be overwritten by subclasses if applicable)
std::vector< std::string > getViewIDs() const
get view IDs
GUISUMOAbstractView * getActiveView() const
get the active view or 0
virtual long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
bool isGaming() const
return whether the gui is in gaming mode
bool myListTeleporting
information whether the locator should list teleporting vehicles
FXLabel * myCartesianCoordinate
Labels for the current cartesian and geo-coordinate.
virtual double getTrackerInterval() const =0
get tracker interval (must be implemented in all children)
FXMDIClient * myMDIClient
The multi view panel.
FXFont * getBoldFont()
get bold front
virtual const std::vector< SUMOTime > retrieveBreakpoints() const
retrieve breakpoints if provided by the application
virtual FXGLCanvas * getBuildGLCanvas() const =0
get build GL Canvas (must be implemented in all children)
virtual void setBreakpoints(const std::vector< SUMOTime > &)
Sets the breakpoints of the parent application.
bool listTeleporting() const
return whether to list teleporting vehicles
FXHorizontalFrame * myGeoFrame
FXFont * myBoldFont
Font used for popup-menu titles.
virtual void setStatusBarText(const std::string &)
get status bar text (can be implemented in children)
Definition: GUIMainWindow.h:96
static GUIMainWindow * getInstance()
get instance
FXLabel * myGeoCoordinate
bool listParking() const
return whether to list parking vehicles
FXDockSite * myRightDock
FXDockSite * myBottomDock
void updateChildren()
update childrens
bool listInternal() const
return whether to list internal structures
void addGLChild(GUIGlChildWindow *child)
Adds a further child window to the list (GUIGlChildWindow)
FXHorizontalFrame * myCartesianFrame
FXMutex myTrackerLock
A lock to make the removal and addition of trackers secure.
virtual void setDelay(double)
Sets the delay of the parent application.
FXDockSite * myTopDock
bool myListInternal
information whether the locator should list internal structures
void storeWindowSizeAndPos()
record window position and size in registry
virtual SUMOTime getCurrentSimTime() const =0
get current sim time (must be implemented in all children)
GUIMainWindow(FXApp *a)
constructor
FXGLVisual * getGLVisual() const
get GL Visual
FXLabel & getGeoLabel()
get geo label
FXDockSite * myLeftDock
bool myAmFullScreen
fox need this
virtual void sendBlockingEvent(GUIEvent *event)
Sends an event from the application thread to the GUI and waits until it is handled.
void removeGLChild(GUIGlChildWindow *child)
removes the given child window from the list (GUIGlChildWindow)
FXDockSite * getTopDock()
get top dock
FXStatusBar * myStatusbar
The status bar.
FXGLVisual * myGLVisual
The gl-visual used.
bool myAmGaming
information whether the gui is currently in gaming mode
void removeChild(FXMainWindow *child)
removes the given child window from the list (FXMainWindow)
std::vector< GUIGlChildWindow * > myGLWindows
void addChild(FXMainWindow *child)
Adds a further child window to the list (FXMainWindow)