![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 2009 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: DtVrfBatchScenarioManager.h,v $ $Revision: 1.12 $ $State: Exp $ 00007 ******************************************************************************/ 00008 00011 00013 00014 #pragma once 00015 00016 #include <vrfGuiCoreQt/vrfGuiCoreQt.h> 00017 00018 #include <vrvUtil/DtVirtualBaseClass.h> 00019 #include <vrvUtil/signalslib.h> 00020 #include <vrvCore/DtDe.h> 00021 00022 #include <vlutil/vlFilename.h> 00023 00024 #include <boost/signal.hpp> 00025 00026 #include <QtCore/QString> 00027 00028 class QWidget; 00029 class QString; 00030 class DtScenarioBatchIterator; 00031 class QFileDialog; 00032 class DtScenario; 00033 00034 namespace makVrv 00035 { 00036 class DtDe; 00037 } 00038 00039 namespace makVrf 00040 { 00041 class DtVrfScenarioRemapFunction; 00042 00044 class DT_DLL_VRFGUICOREQT DtVrfBatchScenarioManager : public makVrv::DtVirtualBaseClass 00045 { 00046 public: 00048 enum State 00049 { 00050 StateIdle, 00051 StateRunStart, 00052 StateLoading, 00053 StateRunning, 00054 StateRunComplete, 00055 StateRunBatchComplete, 00056 StateErrorLoading, 00057 StateClosing, 00058 }; 00059 00060 public: 00061 DtVrfBatchScenarioManager(makVrv::DtDe&); 00062 virtual ~DtVrfBatchScenarioManager(); 00063 00065 static DtVrfBatchScenarioManager& instance(makVrv::DtDe& de); 00066 00067 public: 00068 00070 virtual void loadBatchScenario(QWidget*); 00071 virtual QFileDialog* createLoadBatchScenarioDialog(QWidget*); 00072 virtual bool loadBatchScenario(const QString& batch); 00073 00075 virtual bool runBatch(); 00076 00077 bool isBatchRunning() const 00078 { 00079 return myRunning; 00080 } 00081 00082 DtScenarioBatchIterator* batchIterator() const 00083 { 00084 return myBatchIterator; 00085 } 00086 00087 bool runningBatchScenario() const 00088 { 00089 return (batchIterator() != 0); 00090 } 00091 00094 virtual void nextScenarioRun(); 00095 00098 virtual void nextScenario(); 00099 00101 virtual bool close(); 00102 00103 public: 00104 boost::signal<void ()> signal_stateRunStart; 00105 00107 boost::signal<void ()> signal_nextRunAboutToStart; 00108 00110 boost::signal<void ()> signal_batchRunComplete; 00111 00112 boost::signal<void ()> signal_errorLoadingScenario; 00113 00115 boost::signal<void ()> signal_scenarioRunComplete; 00116 00117 protected: 00118 virtual void tick(); 00119 00120 protected: 00122 virtual void idle(); 00123 00125 virtual void startNextBatchScenario(); 00126 00129 virtual void loading(); 00130 00133 virtual void running(); 00134 00137 virtual double currentSimulationTime() const; 00138 00139 virtual DtFilename constructLoggerFilename(const DtScenario* scenario); 00140 00142 virtual void allBackendsClosed(); 00143 00145 virtual void loadScenarioError(const std::string& error, bool showMessage = true); 00146 00147 protected: 00149 virtual void slot_scenarioLoadComplete(); 00150 00151 virtual QString batchRunTitle(const DtScenario*) const; 00152 00153 virtual void setMainWindowTitle(const QString&); 00154 00155 virtual QString mainWindowTitle() const; 00156 00157 protected: 00158 DtScenarioBatchIterator* myBatchIterator; 00159 makVrv::DtDe& myDe; 00160 QString myBatchFile; 00161 bool myRunning; 00162 DtVrfScenarioRemapFunction* myRemap; 00163 double myRunStartTime; 00164 State myState; 00165 QString myOriginalTitle; 00166 }; 00167 }