SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GUIApplicationWindow.h
Go to the documentation of this file.
1 /****************************************************************************/
10 // The main window of the SUMO-gui.
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2001-2015 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 #ifndef GUIApplicationWindow_h
24 #define GUIApplicationWindow_h
25 
26 
27 // ===========================================================================
28 // included modules
29 // ===========================================================================
30 #ifdef _MSC_VER
31 #include <windows_config.h>
32 #else
33 #include <config.h>
34 #endif
35 
36 #include <string>
37 #include <vector>
38 #include <iostream>
39 #include <fx.h>
49 #include "GUISUMOViewParent.h"
50 
51 
52 // ===========================================================================
53 // class declarations
54 // ===========================================================================
55 class GUILoadThread;
56 class GUIRunThread;
57 class GUIMessageWindow;
58 class GUIEvent;
61 
62 
63 // ===========================================================================
64 // class definition
65 // ===========================================================================
76  // FOX-declarations
77  FXDECLARE(GUIApplicationWindow)
78 public:
79 
84  GUIApplicationWindow(FXApp* a, const std::string& configPattern);
85 
86 
88  virtual ~GUIApplicationWindow();
89 
90 
93 
95  virtual void create();
96 
98  virtual void detach();
100 
101  void loadOnStartup();
102 
103 
104  void dependentBuild(bool game);
105 
106  void setStatusBarText(const std::string&);
107 
108  FXGLCanvas* getBuildGLCanvas() const;
109  SUMOTime getCurrentSimTime() const;
110 
111  FXCursor* getDefaultCursor();
112 
113 
114 
115 
118 
119  virtual void eventOccured();
122  void handleEvent_Message(GUIEvent* e);
125 
126 
127 
130 
132  long onCmdOpenConfiguration(FXObject*, FXSelector, void*);
133 
135  long onCmdOpenNetwork(FXObject*, FXSelector, void*);
136 
138  long onCmdOpenShapes(FXObject*, FXSelector, void*);
139 
141  long onCmdReload(FXObject*, FXSelector, void*);
142 
144  long onCmdOpenRecent(FXObject*, FXSelector, void*);
145 
147  long onCmdClose(FXObject*, FXSelector, void*);
148 
152  long onCmdQuit(FXObject*, FXSelector, void*);
153 
155  long onCmdEditChosen(FXObject*, FXSelector, void*);
156 
158  long onCmdEditBreakpoints(FXObject*, FXSelector, void*);
159 
161  long onCmdAppSettings(FXObject*, FXSelector, void*);
162 
164  long onCmdGaming(FXObject*, FXSelector, void*);
165 
167  long onCmdFullScreen(FXObject*, FXSelector, void*);
168 
170  long onCmdListInternal(FXObject*, FXSelector, void*);
171 
173  long onCmdAbout(FXObject*, FXSelector, void*);
174 
176  long onCmdStart(FXObject*, FXSelector, void*);
177 
179  long onCmdStop(FXObject*, FXSelector, void*);
180 
182  long onCmdStep(FXObject*, FXSelector, void*);
183 
185  long onCmdTimeToggle(FXObject*, FXSelector, void*);
186 
188  long onCmdDelayToggle(FXObject*, FXSelector, void*);
189 
191  long onCmdNewView(FXObject*, FXSelector, void*);
192 
193 #ifdef HAVE_OSG
194  long onCmdNewOSG(FXObject*, FXSelector, void*);
196 #endif
197 
199  long onUpdOpen(FXObject*, FXSelector, void*);
200 
202  long onUpdReload(FXObject*, FXSelector, void*);
203 
205  long onUpdOpenRecent(FXObject*, FXSelector, void*);
206 
208  long onUpdAddView(FXObject*, FXSelector, void*);
209 
211  long onUpdStart(FXObject* sender, FXSelector, void* ptr);
212 
214  long onUpdStop(FXObject*, FXSelector, void*);
215 
217  long onUpdStep(FXObject*, FXSelector, void*);
218 
220  long onUpdNeedsSimulation(FXObject*, FXSelector, void*);
221 
223  long onCmdClearMsgWindow(FXObject*, FXSelector, void*);
224 
226  long onCmdLocate(FXObject*, FXSelector, void*);
227 
229  long onLoadThreadEvent(FXObject*, FXSelector, void*);
230 
232  long onRunThreadEvent(FXObject*, FXSelector, void*);
233 
235  long onClipboardRequest(FXObject* sender, FXSelector sel, void* ptr);
237 
238 
242  virtual SUMOReal getDelay() const {
243  return mySimDelayTarget->getValue();
244  }
245 
246 protected:
247  virtual void addToWindowsMenu(FXMenuPane*) { }
248 
249 private:
251  void loadConfigOrNet(const std::string& file, bool isNet, bool isReload = false);
252 
254  void closeAllWindows();
255 
257  void updateTimeLCD(SUMOTime time);
258 
261 
263  void checkGamingEvents();
264 
265 protected:
268 
269 protected:
271  virtual void fillMenuBar();
272 
274  virtual void buildToolBars();
275 
276 protected:
278  std::string myName;
279 
282 
285 
288 
290  size_t myViewNumber;
291 
294 
299 
302 
304  FXSplitter* myMainSplitter;
305 
309 
312 
315 
318 
320  FXMDIMenu* myMDIMenu;
321 
323  FXMenuBar* myMenuBar;
324 
327 
330 
333 
336 
338  FXRecentFiles myRecentConfigs;
339 
341  FXRecentFiles myRecentNets;
342 
344  std::string myConfigPattern;
345 
347 
350 
353 
356 
364 
370  FXToolBar* myToolBar6, *myToolBar7;
371  FXToolBarShell* myToolBarDrag6, *myToolBarDrag7;
373 
374 };
375 
376 
377 #endif
378 
379 /****************************************************************************/
380 
RandomDistributor< std::string > myJamSounds
virtual ~GUIApplicationWindow()
Destructor.
GUILoadThread * myLoadThread
long onCmdStep(FXObject *, FXSelector, void *)
Called on "step".
void handleEvent_SimulationLoaded(GUIEvent *e)
long onCmdReload(FXObject *, FXSelector, void *)
Called on reload.
SUMOTime myAlternateSimDelay
The alternate simulation delay for toggling.
FXSplitter * myMainSplitter
The splitter that divides the main window into vies and the log window.
long onUpdOpenRecent(FXObject *, FXSelector, void *)
Determines whether opening a recent file is enabled.
long onCmdEditChosen(FXObject *, FXSelector, void *)
Called on menu Edit->Edit Chosen.
static MTRand myGamingRNG
A random number generator used to choose a gaming sound.
FXToolBarShell * myToolBarDrag4
long onUpdStop(FXObject *, FXSelector, void *)
Determines whether "stop" is enabled.
long onClipboardRequest(FXObject *sender, FXSelector sel, void *ptr)
Somebody wants our clipped text.
virtual void detach()
Detaches the tool/menu bar.
GUISUMOAbstractView * openNewView(GUISUMOViewParent::ViewType vt=GUISUMOViewParent::VIEW_2D_OPENGL)
long onCmdStop(FXObject *, FXSelector, void *)
Called on "stop".
long onCmdNewView(FXObject *, FXSelector, void *)
Called if a new view shall be opened (2D view)
long onUpdOpen(FXObject *, FXSelector, void *)
Determines whether opening is enabled.
FXToolBarShell * myToolBarDrag2
void checkGamingEvents()
handles additional game-related events
FXMenuPane * myFileMenu
the submenus
virtual void create()
Creates the main window (required by FOX)
FXRecentFiles myRecentNets
List of recent nets.
A window which displays the time line of one (or more) value(s)
bool myShowTimeAsHMS
whether to show time as hour:minute:second
void handleEvent_Message(GUIEvent *e)
long onCmdOpenRecent(FXObject *, FXSelector, void *)
Called on opening a recent file.
void updateTimeLCD(SUMOTime time)
updates the simulation time display
void handleEvent_SimulationEnded(GUIEvent *e)
FXdouble getValue() const
Return current value.
bool myHaveNotifiedAboutSimEnd
whether the simulation end was already announced
std::string myConfigPattern
Input file pattern.
long onCmdEditBreakpoints(FXObject *, FXSelector, void *)
Called on menu Edit->Edit Breakpoints.
SUMOReal myJamSoundTime
waiting time after which vehicles trigger jam sounds
long onCmdStart(FXObject *, FXSelector, void *)
Called on "play".
long onCmdAppSettings(FXObject *, FXSelector, void *)
Opens the application settings menu (Settings->Application Settings...)
virtual void buildToolBars()
Builds the tool bar.
size_t myViewNumber
The current view number.
FXMDIMenu * myMDIMenu
The menu used for the MDI-windows.
FXToolBarShell * myMenuBarDrag
SUMOTime getCurrentSimTime() const
ViewType
Available view types.
long onCmdListInternal(FXObject *, FXSelector, void *)
Toggle listing of internal structures.
long onUpdReload(FXObject *, FXSelector, void *)
Determines whether reloading is enabled.
long onCmdDelayToggle(FXObject *, FXSelector, void *)
Called on "delay toggle".
FXToolBarShell * myToolBarDrag3
void setStatusBarText(const std::string &)
bool myAmFullScreen
whether to show the window in full screen mode
long onCmdAbout(FXObject *, FXSelector, void *)
Shows the about dialog.
long onCmdClose(FXObject *, FXSelector, void *)
Called on menu File->Close.
long onCmdOpenShapes(FXObject *, FXSelector, void *)
Called on menu File->Load Shapes.
long onCmdClearMsgWindow(FXObject *, FXSelector, void *)
Called if the message window shall be cleared.
FXMenuPane * mySelectByPermissions
virtual void fillMenuBar()
Builds the menu bar.
GUIApplicationWindow()
FOX needs this for static members.
FXEX::FXLCDLabel * myWaitingTimeLabel
performance indicators
long onCmdGaming(FXObject *, FXSelector, void *)
Toggle gaming mode.
FXMenuBar * myMenuBar
The application menu bar.
FXToolBarShell * myToolBarDrag5
FXGLCanvas * getBuildGLCanvas() const
FXToolBarShell * myToolBarDrag7
long onCmdFullScreen(FXObject *, FXSelector, void *)
Toggle full screen mode.
FXToolBarShell * myToolBarDrag6
long onCmdOpenConfiguration(FXObject *, FXSelector, void *)
Called on menu File->Open Configuration.
long onRunThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the simulation thread.
MFXEventQue< GUIEvent * > myEvents
List of got requests.
void loadConfigOrNet(const std::string &file, bool isNet, bool isReload=false)
long onUpdAddView(FXObject *, FXSelector, void *)
Determines whether adding a view is enabled.
long onCmdLocate(FXObject *, FXSelector, void *)
Called on menu commands from the Locator menu.
FXEX::FXLCDLabel * myTimeLossLabel
FXRealSpinDial * mySimDelayTarget
FXRecentFiles myRecentConfigs
List of recent config files.
FXToolBarShell * myToolBarDrag1
for some menu detaching fun
int SUMOTime
Definition: SUMOTime.h:43
FXEX::FXThreadEvent myLoadThreadEvent
io-event with the load-thread
FXEX::FXThreadEvent myRunThreadEvent
io-event with the run-thread
FXToolBar * myToolBar1
The application tool bar.
long onCmdOpenNetwork(FXObject *, FXSelector, void *)
Called on menu File->Open Network.
long onUpdNeedsSimulation(FXObject *, FXSelector, void *)
Determines whether some buttons which require an active simulation may be shown.
#define SUMOReal
Definition: config.h:218
virtual SUMOReal getDelay() const
Returns the simulation delay.
long onLoadThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the loading thread.
GUIMessageWindow * myMessageWindow
A window to display messages, warnings and error in.
bool myAmLoading
information whether the gui is currently loading and the load-options shall be greyed out ...
long onCmdTimeToggle(FXObject *, FXSelector, void *)
Called on "time toggle".
void handleEvent_SimulationStep(GUIEvent *e)
Spinner control.
FXEX::FXLCDLabel * myLCDLabel
the simulation step display
A logging window for the gui.
A window containing a gl-object's parameter.
long onUpdStep(FXObject *, FXSelector, void *)
Determines whether "step" is enabled.
long onCmdQuit(FXObject *, FXSelector, void *)
Called by FOX if the application shall be closed.
virtual void addToWindowsMenu(FXMenuPane *)
long onUpdStart(FXObject *sender, FXSelector, void *ptr)
Determines whether "play" is enabled.
The main window of the SUMO-gui.