SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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();
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);
126 
127 
128 
131 
133  long onCmdOpenConfiguration(FXObject*, FXSelector, void*);
134 
136  long onCmdOpenNetwork(FXObject*, FXSelector, void*);
137 
139  long onCmdOpenShapes(FXObject*, FXSelector, void*);
140 
142  long onCmdReload(FXObject*, FXSelector, void*);
143 
145  long onCmdOpenRecent(FXObject*, FXSelector, void*);
146 
148  long onCmdClose(FXObject*, FXSelector, void*);
149 
153  long onCmdQuit(FXObject*, FXSelector, void*);
154 
156  long onCmdEditChosen(FXObject*, FXSelector, void*);
157 
159  long onCmdEditBreakpoints(FXObject*, FXSelector, void*);
160 
162  long onCmdAppSettings(FXObject*, FXSelector, void*);
163 
165  long onCmdGaming(FXObject*, FXSelector, void*);
166 
168  long onCmdFullScreen(FXObject*, FXSelector, void*);
169 
171  long onCmdListInternal(FXObject*, FXSelector, void*);
172 
174  long onCmdAbout(FXObject*, FXSelector, void*);
175 
177  long onCmdStart(FXObject*, FXSelector, void*);
178 
180  long onCmdStop(FXObject*, FXSelector, void*);
181 
183  long onCmdStep(FXObject*, FXSelector, void*);
184 
186  long onCmdTimeToggle(FXObject*, FXSelector, void*);
187 
189  long onCmdDelayToggle(FXObject*, FXSelector, void*);
190 
192  long onCmdNewView(FXObject*, FXSelector, void*);
193 
194 #ifdef HAVE_OSG
195  long onCmdNewOSG(FXObject*, FXSelector, void*);
197 #endif
198 
200  long onUpdOpen(FXObject*, FXSelector, void*);
201 
203  long onUpdReload(FXObject*, FXSelector, void*);
204 
206  long onUpdOpenRecent(FXObject*, FXSelector, void*);
207 
209  long onUpdAddView(FXObject*, FXSelector, void*);
210 
212  long onUpdStart(FXObject* sender, FXSelector, void* ptr);
213 
215  long onUpdStop(FXObject*, FXSelector, void*);
216 
218  long onUpdStep(FXObject*, FXSelector, void*);
219 
221  long onUpdNeedsSimulation(FXObject*, FXSelector, void*);
222 
224  long onCmdClearMsgWindow(FXObject*, FXSelector, void*);
225 
227  long onCmdLocate(FXObject*, FXSelector, void*);
228 
230  long onLoadThreadEvent(FXObject*, FXSelector, void*);
231 
233  long onRunThreadEvent(FXObject*, FXSelector, void*);
234 
236  long onClipboardRequest(FXObject* sender, FXSelector sel, void* ptr);
237 
239  long onKeyPress(FXObject* o, FXSelector sel, void* data);
240  long onKeyRelease(FXObject* o, FXSelector sel, void* data);
242 
243 
247  virtual SUMOReal getDelay() const {
248  return mySimDelayTarget->getValue();
249  }
250 
254  virtual void sendBlockingEvent(GUIEvent* event);
255 
256 protected:
257  virtual void addToWindowsMenu(FXMenuPane*) { }
258 
259 private:
261  void loadConfigOrNet(const std::string& file, bool isNet);
262 
264  void closeAllWindows();
265 
267  void updateTimeLCD(SUMOTime time);
268 
271 
273  void checkGamingEvents();
274 
275 protected:
278 
279 protected:
281  virtual void fillMenuBar();
282 
284  virtual void buildToolBars();
285 
286 protected:
288  std::string myName;
289 
292 
295 
298 
300  size_t myViewNumber;
301 
304 
309 
312 
314  FXSplitter* myMainSplitter;
315 
319 
322 
325 
328 
330  FXMDIMenu* myMDIMenu;
331 
333  FXMenuBar* myMenuBar;
334 
337 
340 
343 
346 
348  FXRecentFiles myRecentConfigs;
349 
351  FXRecentFiles myRecentNets;
352 
354  std::string myConfigPattern;
355 
357 
360 
363 
366 
368  FXMutex myEventMutex;
369 
371  FXCondition myEventCondition;
372 
380 
386  FXToolBar* myToolBar6, *myToolBar7;
387  FXToolBarShell* myToolBarDrag6, *myToolBarDrag7;
389 
390 };
391 
392 
393 #endif
394 
395 /****************************************************************************/
396 
RandomDistributor< std::string > myJamSounds
virtual ~GUIApplicationWindow()
Destructor.
GUILoadThread * myLoadThread
long onCmdStep(FXObject *, FXSelector, void *)
Called on &quot;step&quot;.
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-&gt;Edit Chosen.
static MTRand myGamingRNG
A random number generator used to choose a gaming sound.
FXToolBarShell * myToolBarDrag4
long onUpdStop(FXObject *, FXSelector, void *)
Determines whether &quot;stop&quot; 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 &quot;stop&quot;.
FXMutex myEventMutex
the mutex for the waiting semaphore
void handleEvent_Screenshot(GUIEvent *e)
void loadConfigOrNet(const std::string &file, bool isNet)
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
FXCondition myEventCondition
the semaphore when waiting for event completion
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-&gt;Edit Breakpoints.
SUMOReal myJamSoundTime
waiting time after which vehicles trigger jam sounds
long onCmdStart(FXObject *, FXSelector, void *)
Called on &quot;play&quot;.
long onCmdAppSettings(FXObject *, FXSelector, void *)
Opens the application settings menu (Settings-&gt;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 &quot;delay toggle&quot;.
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-&gt;Close.
long onKeyRelease(FXObject *o, FXSelector sel, void *data)
long onCmdOpenShapes(FXObject *, FXSelector, void *)
Called on menu File-&gt;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-&gt;Open Configuration.
long onRunThreadEvent(FXObject *, FXSelector, void *)
Called on an event from the simulation thread.
virtual void sendBlockingEvent(GUIEvent *event)
Sends an event from the application thread to the GUI and waits until it is handled.
MFXEventQue< GUIEvent * > myEvents
List of got requests.
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
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-&gt;Open Network.
long onUpdNeedsSimulation(FXObject *, FXSelector, void *)
Determines whether some buttons which require an active simulation may be shown.
#define SUMOReal
Definition: config.h:215
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 &quot;time toggle&quot;.
long onKeyPress(FXObject *o, FXSelector sel, void *data)
handle keys
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&#39;s parameter.
long onUpdStep(FXObject *, FXSelector, void *)
Determines whether &quot;step&quot; 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 &quot;play&quot; is enabled.
The main window of the SUMO-gui.