|
SUMO - Simulation of Urban MObility
|
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 (C) 2001-2011 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 <utils/gui/div/GLObjectValuePassConnector.h> 00042 #include <microsim/logging/FunctionBinding.h> 00043 #include <utils/common/SUMOTime.h> 00044 #include <utils/foxtools/FXRealSpinDial.h> 00045 00046 00047 // =========================================================================== 00048 // class declarations 00049 // =========================================================================== 00050 class GUIMainWindow; 00051 class MSTrafficLightLogic; 00052 class GUITrafficLightLogicWrapper; 00053 class MFXMutex; 00054 00055 00056 // =========================================================================== 00057 // class definitions 00058 // =========================================================================== 00063 class GUITLLogicPhasesTrackerWindow 00064 : public FXMainWindow, 00065 public ValueRetriever<std::pair<SUMOTime, MSPhaseDefinition> > { 00066 FXDECLARE(GUITLLogicPhasesTrackerWindow) 00067 public: 00074 GUITLLogicPhasesTrackerWindow(GUIMainWindow& app, 00075 MSTrafficLightLogic& logic, GUITrafficLightLogicWrapper& wrapper, 00076 ValueSource<std::pair<SUMOTime, MSPhaseDefinition> > *src) throw(); 00077 00078 00085 GUITLLogicPhasesTrackerWindow( 00086 GUIMainWindow& app, 00087 MSTrafficLightLogic& logic, GUITrafficLightLogicWrapper& wrapper, 00088 const MSSimpleTrafficLightLogic::Phases& phases) throw(); 00089 00090 00092 ~GUITLLogicPhasesTrackerWindow() throw(); 00093 00094 00096 void create(); 00097 00098 00102 void addValue(std::pair<SUMOTime, MSPhaseDefinition> def) throw(); 00103 00104 00108 void setBeginTime(SUMOTime time) throw(); 00109 00110 00113 00115 long onConfigure(FXObject* sender, FXSelector sel, void* data); 00116 00118 long onPaint(FXObject* sender, FXSelector sel, void* data); 00119 00121 long onSimStep(FXObject* sender, FXSelector sel, void* data); 00123 00124 00125 public: 00127 typedef std::vector<MSPhaseDefinition> PhasesVector; 00128 00130 typedef std::vector<SUMOTime> DurationsVector; 00131 00132 00139 class GUITLLogicPhasesTrackerPanel : public FXGLCanvas { 00140 FXDECLARE(GUITLLogicPhasesTrackerPanel) 00141 public: 00147 GUITLLogicPhasesTrackerPanel(FXComposite* c, 00148 GUIMainWindow& app, GUITLLogicPhasesTrackerWindow& parent) throw(); 00149 00151 ~GUITLLogicPhasesTrackerPanel() throw(); 00152 00154 friend class GUITLLogicPhasesTrackerWindow; 00155 00156 00159 00161 long onConfigure(FXObject*,FXSelector,void*); 00162 00164 long onPaint(FXObject*,FXSelector,void*); 00166 00167 00168 private: 00170 GUITLLogicPhasesTrackerWindow* myParent; 00171 00173 GUIMainWindow* myApplication; 00174 00175 protected: 00177 GUITLLogicPhasesTrackerPanel() { } 00178 00179 }; 00180 00181 00185 void drawValues(GUITLLogicPhasesTrackerPanel& caller) throw(); 00186 00187 00188 private: 00190 GUIMainWindow* myApplication; 00191 00193 MSTrafficLightLogic* myTLLogic; 00194 00196 PhasesVector myPhases; 00197 00199 DurationsVector myDurations; 00200 00202 GUITLLogicPhasesTrackerPanel* myPanel; 00203 00205 MFXMutex myLock; 00206 00210 std::vector<std::string> myLinkNames; 00211 00213 size_t myFirstPhase2Show; 00214 00216 size_t myFirstPhaseOffset; 00217 00219 SUMOTime myFirstTime2Show; 00220 00222 SUMOTime myBeginTime; 00223 00225 SUMOTime myLastTime; 00226 00228 GLObjectValuePassConnector<std::pair<SUMOTime, MSPhaseDefinition> > *myConnector; 00229 00231 bool myAmInTrackingMode; 00232 00234 FXToolBarShell* myToolBarDrag; 00235 00237 FXToolBar* myToolBar; 00238 00240 FXRealSpinDial* myBeginOffset; 00241 00242 00243 protected: 00245 GUITLLogicPhasesTrackerWindow() { } 00246 00247 00248 }; 00249 00250 00251 #endif 00252 00253 /****************************************************************************/ 00254