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-2016 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& text);
107 
108  void addRecentFile(const FX::FXString& f, const bool isNet);
109 
110  FXGLCanvas* getBuildGLCanvas() const;
111  SUMOTime getCurrentSimTime() const;
112 
113  FXCursor* getDefaultCursor();
114 
115 
116 
117 
120 
121  virtual void eventOccured();
124  void handleEvent_Message(GUIEvent* e);
128 
129 
130 
133 
135  long onCmdOpenConfiguration(FXObject*, FXSelector, void*);
136 
138  long onCmdOpenNetwork(FXObject*, FXSelector, void*);
139 
141  long onCmdOpenShapes(FXObject*, FXSelector, void*);
142 
144  long onCmdReload(FXObject*, FXSelector, void*);
145 
147  long onCmdOpenRecent(FXObject*, FXSelector, void*);
148 
150  long onCmdClose(FXObject*, FXSelector, void*);
151 
155  long onCmdQuit(FXObject*, FXSelector, void*);
156 
158  long onCmdEditChosen(FXObject*, FXSelector, void*);
159 
161  long onCmdEditBreakpoints(FXObject*, FXSelector, void*);
162 
164  long onCmdHelp(FXObject* sender, FXSelector sel, void* ptr);
165 
167  long onCmdNetedit(FXObject*, FXSelector, void*);
168 
170  long onCmdAppSettings(FXObject*, FXSelector, void*);
171 
173  long onCmdGaming(FXObject*, FXSelector, void*);
174 
176  long onCmdFullScreen(FXObject*, FXSelector, void*);
177 
179  long onCmdListInternal(FXObject*, FXSelector, void*);
180 
182  long onCmdAbout(FXObject*, FXSelector, void*);
183 
185  long onCmdStart(FXObject*, FXSelector, void*);
186 
188  long onCmdStop(FXObject*, FXSelector, void*);
189 
191  long onCmdStep(FXObject*, FXSelector, void*);
192 
194  long onCmdTimeToggle(FXObject*, FXSelector, void*);
195 
197  long onCmdDelayToggle(FXObject*, FXSelector, void*);
198 
200  long onCmdNewView(FXObject*, FXSelector, void*);
201 
202 #ifdef HAVE_OSG
203  long onCmdNewOSG(FXObject*, FXSelector, void*);
205 #endif
206 
208  long onUpdOpen(FXObject*, FXSelector, void*);
209 
211  long onUpdReload(FXObject*, FXSelector, void*);
212 
214  long onUpdOpenRecent(FXObject*, FXSelector, void*);
215 
217  long onUpdAddView(FXObject*, FXSelector, void*);
218 
220  long onUpdStart(FXObject* sender, FXSelector, void* ptr);
221 
223  long onUpdStop(FXObject*, FXSelector, void*);
224 
226  long onUpdStep(FXObject*, FXSelector, void*);
227 
229  long onUpdNeedsSimulation(FXObject*, FXSelector, void*);
230 
232  long onCmdClearMsgWindow(FXObject*, FXSelector, void*);
233 
235  long onCmdLocate(FXObject*, FXSelector, void*);
236 
238  long onCmdShowStats(FXObject*, FXSelector, void*);
239 
241  long onLoadThreadEvent(FXObject*, FXSelector, void*);
242 
244  long onRunThreadEvent(FXObject*, FXSelector, void*);
245 
247  long onClipboardRequest(FXObject* sender, FXSelector sel, void* ptr);
248 
250  long onKeyPress(FXObject* o, FXSelector sel, void* data);
251  long onKeyRelease(FXObject* o, FXSelector sel, void* data);
253 
254 
258  virtual SUMOReal getDelay() const {
259  return mySimDelayTarget->getValue();
260  }
261 
264  virtual void setDelay(SUMOReal delay) {
265  mySimDelayTarget->setValue(delay);
266  }
267 
271  virtual void sendBlockingEvent(GUIEvent* event);
272 
273 protected:
274  virtual void addToWindowsMenu(FXMenuPane*) { }
275 
276 private:
278  void loadConfigOrNet(const std::string& file, bool isNet);
279 
281  void closeAllWindows();
282 
284  void updateTimeLCD(SUMOTime time);
285 
288 
290  void checkGamingEvents();
291 
292 protected:
295 
296 protected:
298  virtual void fillMenuBar();
299 
301  virtual void buildToolBars();
302 
303 protected:
305  std::string myName;
306 
309 
312 
315 
318 
321 
326 
328  std::vector<FXButton*> myStatButtons;
329 
332 
334  FXSplitter* myMainSplitter;
335 
339 
342 
345 
348 
350  FXMDIMenu* myMDIMenu;
351 
353  FXMenuBar* myMenuBar;
354 
357 
360 
363 
366 
368  FXRecentFiles myRecentConfigs;
369 
371  FXRecentFiles myRecentNets;
372 
374  std::string myConfigPattern;
375 
377 
380 
383 
386 
388  FXMutex myEventMutex;
389 
391  FXCondition myEventCondition;
392 
402 
408  FXToolBar* myToolBar6, *myToolBar7;
409  FXToolBarShell* myToolBarDrag6, *myToolBarDrag7;
411 
412 };
413 
414 
415 #endif
416 
417 /****************************************************************************/
418 
virtual void setDelay(SUMOReal delay)
Sets the delay of the parent application.
RandomDistributor< std::string > myJamSounds
long onCmdShowStats(FXObject *, FXSelector, void *)
Called on commands from the statistic buttons.
virtual ~GUIApplicationWindow()
Destructor.
GUILoadThread * myLoadThread
long onCmdStep(FXObject *, FXSelector, void *)
Called on "step".
void handleEvent_SimulationLoaded(GUIEvent *e)
long long int SUMOTime
Definition: SUMOTime.h:43
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.
void addRecentFile(const FX::FXString &f, const bool isNet)
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 setValue(FXdouble value)
Change current value.
int myViewNumber
The current view number.
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".
FXMutex myEventMutex
the mutex for the waiting semaphore
long onCmdNetedit(FXObject *, FXSelector, void *)
Called on menu Edit->Netedit.
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.
long onCmdHelp(FXObject *sender, FXSelector sel, void *ptr)
called if the user selects help->Documentation
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->Edit Breakpoints.
SUMOReal myJamSoundTime
waiting time after which vehicles trigger jam sounds
std::vector< FXButton * > myStatButtons
Buttons showing and running values and triggering statistic windows.
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.
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
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 onKeyRelease(FXObject *o, FXSelector sel, void *data)
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
RandomDistributor< std::string > myCollisionSounds
long onCmdOpenConfiguration(FXObject *, FXSelector, void *)
Called on menu File->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
void setStatusBarText(const std::string &text)
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->Open Network.
long onUpdNeedsSimulation(FXObject *, FXSelector, void *)
Determines whether some buttons which require an active simulation may be shown.
#define SUMOReal
Definition: config.h:214
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".
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'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.