GUITLLogicPhasesTrackerWindow.h

Go to the documentation of this file.
00001 /****************************************************************************/
00007 // A window displaying the phase diagram of a tl-logic
00008 /****************************************************************************/
00009 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00010 // Copyright 2001-2010 DLR (http://www.dlr.de/) and contributors
00011 /****************************************************************************/
00012 //
00013 //   This program is free software; you can redistribute it and/or modify
00014 //   it under the terms of the GNU General Public License as published by
00015 //   the Free Software Foundation; either version 2 of the License, or
00016 //   (at your option) any later version.
00017 //
00018 /****************************************************************************/
00019 #ifndef GUITLLogicPhasesTrackerWindow_h
00020 #define GUITLLogicPhasesTrackerWindow_h
00021 
00022 
00023 // ===========================================================================
00024 // included modules
00025 // ===========================================================================
00026 #ifdef _MSC_VER
00027 #include <windows_config.h>
00028 #else
00029 #include <config.h>
00030 #endif
00031 
00032 #include <vector>
00033 #include <string>
00034 #include <bitset>
00035 #include <utility>
00036 #include <fx.h>
00037 #include <fx3d.h>
00038 #include <microsim/traffic_lights/MSSimpleTrafficLightLogic.h>
00039 #include <microsim/traffic_lights/MSTLLogicControl.h>
00040 #include <utils/common/ValueRetriever.h>
00041 #include <guisim/GLObjectValuePassConnector.h>
00042 #include <microsim/logging/FunctionBinding.h>
00043 #include <utils/common/SUMOTime.h>
00044 #include <utils/foxtools/FXRealSpinDial.h>
00045 #include <utils/foxtools/MFXMutex.h>
00046 
00047 #ifdef _WIN32
00048 #include <windows.h>
00049 #include <GL/gl.h>
00050 #endif
00051 
00052 
00053 // ===========================================================================
00054 // class declarations
00055 // ===========================================================================
00056 class GUIMainWindow;
00057 class MSTrafficLightLogic;
00058 class GUITrafficLightLogicWrapper;
00059 
00060 
00061 // ===========================================================================
00062 // class definitions
00063 // ===========================================================================
00068 class GUITLLogicPhasesTrackerWindow
00069         : public FXMainWindow,
00070             public ValueRetriever<std::pair<SUMOTime, MSPhaseDefinition> > {
00071     FXDECLARE(GUITLLogicPhasesTrackerWindow)
00072 public:
00079     GUITLLogicPhasesTrackerWindow(GUIMainWindow &app,
00080                                   MSTrafficLightLogic &logic, GUITrafficLightLogicWrapper &wrapper,
00081                                   ValueSource<std::pair<SUMOTime, MSPhaseDefinition> > *src) throw();
00082 
00083 
00090     GUITLLogicPhasesTrackerWindow(
00091         GUIMainWindow &app,
00092         MSTrafficLightLogic &logic, GUITrafficLightLogicWrapper &wrapper,
00093         const MSSimpleTrafficLightLogic::Phases &phases) throw();
00094 
00095 
00097     ~GUITLLogicPhasesTrackerWindow() throw();
00098 
00099 
00101     void create();
00102 
00103 
00107     void addValue(std::pair<SUMOTime, MSPhaseDefinition> def) throw();
00108 
00109 
00113     void setBeginTime(SUMOTime time) throw();
00114 
00115 
00118 
00120     long onConfigure(FXObject *sender, FXSelector sel, void *data);
00121 
00123     long onPaint(FXObject *sender, FXSelector sel, void *data);
00124 
00126     long onSimStep(FXObject *sender, FXSelector sel, void *data);
00128 
00129 
00130 public:
00132     typedef std::vector<MSPhaseDefinition> PhasesVector;
00133 
00135     typedef std::vector<size_t> DurationsVector;
00136 
00137 
00144     class GUITLLogicPhasesTrackerPanel : public FXGLCanvas {
00145         FXDECLARE(GUITLLogicPhasesTrackerPanel)
00146     public:
00152         GUITLLogicPhasesTrackerPanel(FXComposite *c,
00153                                      GUIMainWindow &app, GUITLLogicPhasesTrackerWindow &parent) throw();
00154 
00156         ~GUITLLogicPhasesTrackerPanel() throw();
00157 
00159         friend class GUITLLogicPhasesTrackerWindow;
00160 
00161 
00164 
00166         long onConfigure(FXObject*,FXSelector,void*);
00167 
00169         long onPaint(FXObject*,FXSelector,void*);
00171 
00172 
00173     private:
00175         GUITLLogicPhasesTrackerWindow *myParent;
00176 
00178         GUIMainWindow *myApplication;
00179 
00180     protected:
00182         GUITLLogicPhasesTrackerPanel() { }
00183 
00184     };
00185 
00186 
00190     void drawValues(GUITLLogicPhasesTrackerPanel &caller) throw();
00191 
00192 
00193 private:
00195     GUIMainWindow *myApplication;
00196 
00198     MSTrafficLightLogic *myTLLogic;
00199 
00201     PhasesVector myPhases;
00202 
00204     DurationsVector myDurations;
00205 
00207     GUITLLogicPhasesTrackerPanel *myPanel;
00208 
00210     MFXMutex myLock;
00211 
00215     std::vector<std::string> myLinkNames;
00216 
00218     size_t myFirstPhase2Show;
00219 
00221     size_t myFirstPhaseOffset;
00222 
00224     SUMOTime myFirstTime2Show;
00225 
00227     SUMOTime myBeginTime;
00228 
00230     SUMOTime myLastTime;
00231 
00233     GLObjectValuePassConnector<std::pair<SUMOTime, MSPhaseDefinition> > *myConnector;
00234 
00236     bool myAmInTrackingMode;
00237 
00239     FXToolBarShell *myToolBarDrag;
00240 
00242     FXToolBar *myToolBar;
00243 
00245     FXRealSpinDial *myBeginOffset;
00246 
00247 
00248 protected:
00250     GUITLLogicPhasesTrackerWindow() { }
00251 
00252 
00253 };
00254 
00255 
00256 #endif
00257 
00258 /****************************************************************************/
00259 

Generated on Wed May 5 00:06:30 2010 for Sumo - Simulation of Urban MObility by  doxygen 1.5.6