SUMO - Simulation of Urban MObility
GUITLLogicPhasesTrackerWindow.h
Go to the documentation of this file.
00001 /****************************************************************************/
00009 // A window displaying the phase diagram of a tl-logic
00010 /****************************************************************************/
00011 // SUMO, Simulation of Urban MObility; see http://sumo.sourceforge.net/
00012 // Copyright (C) 2001-2012 DLR (http://www.dlr.de/) and contributors
00013 /****************************************************************************/
00014 //
00015 //   This file is part of SUMO.
00016 //   SUMO is free software: you can redistribute it and/or modify
00017 //   it under the terms of the GNU General Public License as published by
00018 //   the Free Software Foundation, either version 3 of the License, or
00019 //   (at your option) any later version.
00020 //
00021 /****************************************************************************/
00022 #ifndef GUITLLogicPhasesTrackerWindow_h
00023 #define GUITLLogicPhasesTrackerWindow_h
00024 
00025 
00026 // ===========================================================================
00027 // included modules
00028 // ===========================================================================
00029 #ifdef _MSC_VER
00030 #include <windows_config.h>
00031 #else
00032 #include <config.h>
00033 #endif
00034 
00035 #include <vector>
00036 #include <string>
00037 #include <bitset>
00038 #include <utility>
00039 #include <fx.h>
00040 #include <fx3d.h>
00041 #include <microsim/traffic_lights/MSSimpleTrafficLightLogic.h>
00042 #include <microsim/traffic_lights/MSTLLogicControl.h>
00043 #include <utils/common/ValueRetriever.h>
00044 #include <utils/gui/div/GLObjectValuePassConnector.h>
00045 #include <microsim/logging/FunctionBinding.h>
00046 #include <utils/common/SUMOTime.h>
00047 #include <utils/foxtools/FXRealSpinDial.h>
00048 
00049 
00050 // ===========================================================================
00051 // class declarations
00052 // ===========================================================================
00053 class GUIMainWindow;
00054 class MSTrafficLightLogic;
00055 class GUITrafficLightLogicWrapper;
00056 class MFXMutex;
00057 
00058 
00059 // ===========================================================================
00060 // class definitions
00061 // ===========================================================================
00066 class GUITLLogicPhasesTrackerWindow
00067     : public FXMainWindow,
00068       public ValueRetriever<std::pair<SUMOTime, MSPhaseDefinition> > {
00069     FXDECLARE(GUITLLogicPhasesTrackerWindow)
00070 public:
00077     GUITLLogicPhasesTrackerWindow(GUIMainWindow& app,
00078                                   MSTrafficLightLogic& logic, GUITrafficLightLogicWrapper& wrapper,
00079                                   ValueSource<std::pair<SUMOTime, MSPhaseDefinition> > *src) ;
00080 
00081 
00088     GUITLLogicPhasesTrackerWindow(
00089         GUIMainWindow& app,
00090         MSTrafficLightLogic& logic, GUITrafficLightLogicWrapper& wrapper,
00091         const MSSimpleTrafficLightLogic::Phases& phases) ;
00092 
00093 
00095     ~GUITLLogicPhasesTrackerWindow() ;
00096 
00097 
00099     void create();
00100 
00101 
00105     void addValue(std::pair<SUMOTime, MSPhaseDefinition> def) ;
00106 
00107 
00111     void setBeginTime(SUMOTime time) ;
00112 
00113 
00116 
00118     long onConfigure(FXObject* sender, FXSelector sel, void* data);
00119 
00121     long onPaint(FXObject* sender, FXSelector sel, void* data);
00122 
00124     long onSimStep(FXObject* sender, FXSelector sel, void* data);
00126 
00127 
00128 public:
00130     typedef std::vector<MSPhaseDefinition> PhasesVector;
00131 
00133     typedef std::vector<SUMOTime> DurationsVector;
00134 
00135 
00142     class GUITLLogicPhasesTrackerPanel : public FXGLCanvas {
00143         FXDECLARE(GUITLLogicPhasesTrackerPanel)
00144     public:
00150         GUITLLogicPhasesTrackerPanel(FXComposite* c,
00151                                      GUIMainWindow& app, GUITLLogicPhasesTrackerWindow& parent) ;
00152 
00154         ~GUITLLogicPhasesTrackerPanel() ;
00155 
00157         friend class GUITLLogicPhasesTrackerWindow;
00158 
00159 
00162 
00164         long onConfigure(FXObject*, FXSelector, void*);
00165 
00167         long onPaint(FXObject*, FXSelector, void*);
00169 
00170 
00171     private:
00173         GUITLLogicPhasesTrackerWindow* myParent;
00174 
00176         GUIMainWindow* myApplication;
00177 
00178     protected:
00180         GUITLLogicPhasesTrackerPanel() { }
00181 
00182     };
00183 
00184 
00188     void drawValues(GUITLLogicPhasesTrackerPanel& caller) ;
00189 
00190 
00191 private:
00193     GUIMainWindow* myApplication;
00194 
00196     MSTrafficLightLogic* myTLLogic;
00197 
00199     PhasesVector myPhases;
00200 
00202     DurationsVector myDurations;
00203 
00205     GUITLLogicPhasesTrackerPanel* myPanel;
00206 
00208     MFXMutex myLock;
00209 
00213     std::vector<std::string> myLinkNames;
00214 
00216     size_t myFirstPhase2Show;
00217 
00219     size_t myFirstPhaseOffset;
00220 
00222     SUMOTime myFirstTime2Show;
00223 
00225     SUMOTime myBeginTime;
00226 
00228     SUMOTime myLastTime;
00229 
00231     GLObjectValuePassConnector<std::pair<SUMOTime, MSPhaseDefinition> > *myConnector;
00232 
00234     bool myAmInTrackingMode;
00235 
00237     FXToolBarShell* myToolBarDrag;
00238 
00240     FXToolBar* myToolBar;
00241 
00243     FXRealSpinDial* myBeginOffset;
00244 
00245 
00246 protected:
00248     GUITLLogicPhasesTrackerWindow() { }
00249 
00250 
00251 };
00252 
00253 
00254 #endif
00255 
00256 /****************************************************************************/
00257 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines