#include // #include "Workflow.h" #include "WellLogWorkflowRunner.h" #include "Module.h" #include "ModuleInformation.h" #include "ModuleCheckResult.h" #include "PELibraryModule.h" #include "ObjWelllog.h" // #include "VecWindow.h" // #include "PaiJob.h" #include "WorkflowFile.h" // #include "QtWellSceneManager.h" #include "ObjWellLogINP.h" #include "LogModuleConsole.h" // #include "VecDisplayObjectCommand.h" // #include "VecWindow.h" // #include "ObjWellRulerTrack.h" // #include "VecSceneManager.h" // #include "ConsoleOutputWidget.h" #include "ObjWelllogRound.h" #include // #include "ObjProject.h" // #include "VecWindowCommand.h" // #include "VecWindowDocument.h" // #include "DataImport.h" #include "LogModuleParamers.h" // #include "WellSectionWindowDocument.h" // void OSGFRAMEWORK_EXPORT AppendConsole(pai::log::Priority priority,const QString &output); CWellLogWorkflowRunner::CWellLogWorkflowRunner(void) { m_RunTimeContext = new CRunTimeContext; } CWellLogWorkflowRunner::~CWellLogWorkflowRunner(void) { if(m_RunTimeContext){ delete m_RunTimeContext; m_RunTimeContext=NULL; } } void CWellLogWorkflowRunner::ValidateWorkflow( pai::objectmodel::PaiWorkflowDataModel * pWorkflowDataMode ) { } void CWellLogWorkflowRunner::RunWorkFlow(pai::objectmodel::PaiWorkflowDataModel * pWorkflowDataModel ) { // CWellLogWorkflowDataModel * pwellWorkflowDataModel =dynamic_cast(pWorkflowDataModel); // if(!pwellWorkflowDataModel) return; // std::map logCurveContainer = m_RunTimeContext->GetLogCurveContainer(); // if(!m_RunTimeContext->GetLogCurveContainer().empty()) // { // m_RunTimeContext->GetLogCurveContainer().clear(); // } // CModuleConsole *pConsole=GetWorkflowConsole(); // if(!pConsole) return; // int nSize = pWorkflowDataModel->GetModuleCount(); // if(nSize) { // pConsole->bmoduleinfos=*pwellWorkflowDataModel->GetWorkflowFile()->GetModuleInfos(); // } // else { // std::vector *moduleinfos=pwellWorkflowDataModel->GetWorkflowFile()->GetModuleInfos(); // for(int i=0;ibmoduleinfos.size();i++) { // moduleinfos->push_back((CModuleInformation*)GetWorkflowConsole()->bmoduleinfos.at(i)); // } // } // nSize = pWorkflowDataModel->GetModuleCount(); // if(!nSize) { // AfxMessageBox("您还没有选择处理方法,请先选择处理方法再进行此项操作!"); // return; // } // CWellSectionWindowDocument *pDoc = dynamic_cast(pwellWorkflowDataModel->GetMWVecWindowDocument()); // if(!pDoc) return; // CVecWindow *pWindow=pDoc->GetVecWindow(); // if(!pWindow) return; // QString Zone; // if(pDoc) Zone=pDoc->GetCurrentZone(); // CQtWellSceneManager*m_pWellSceneManager = dynamic_cast(pWindow->GetSceneManager()); // if(!m_pWellSceneManager) return; // QVector vWellTracks =m_pWellSceneManager->GetWellSectionGeomtry().GetAllWellTrack(false); // if(vWellTracks.size()<1) { // AfxMessageBox("请加载井图形及井数据!"); // return; // } // for (int i= 0; iGetModule(i); // pai::module::CModule* pModule = pModuleInfo->GetModule(); // PELibraryModule * pWelllogModule = dynamic_cast(pModule); // std::string strName = pModuleInfo->GetName(); // foreach(CObjWellTrack*pWellTrack,vWellTracks) // { // QString ss=pWellTrack->GetWelllogRound()->GetSlfFileName(); // pWelllogModule->SetSlfFileName(ss); // QString path,wellname; // GetWellNameAndPath(ss,wellname,path); // path=wellname+QString::fromStdString(" "+pModule->GetMetaData()->GetName())+"开始执行...."; // AppendConsole(pai::log::PAI_INFO,path); // double dep1=-99999,dep2=-99999; // if(!Zone.isEmpty()) // { // pWellTrack->GetZoneDepth(Zone,dep1,dep2); // } // pWellTrack->SaveToSLF(); // char *Zone1=NULL; // if(!Zone.isEmpty()) Zone1=(char*)Zone.toStdString().c_str(); // int i=(int)pWelllogModule->Run(dep1,dep2,Zone1); // pWellTrack->LoadFromSLF(); // CDataImport::ChangetoSlf(ss); // if(i<0) { // path=wellname+QString::fromStdString(" "+pModule->GetMetaData()->GetName())+"发生错误,处理被终止!"; // AppendConsole(pai::log::PAI_ERROR,path); // } // else{ // path=wellname+QString::fromStdString(" "+pModule->GetMetaData()->GetName())+"执行完成"; // AppendConsole(pai::log::PAI_INFO,path); // } // } // QApplication::processEvents(); // if(pConsole->g_mModuleParamers==(CModuleParamers*)0xfeeefeeefeeefeee) return; // QTextDocument *pdoc=pConsole->g_mModuleParamers->GetEdtParamCard()->document(); // if(pdoc&&pdoc->isModified()) // { // pdoc->setModified(false); // } // } // std::vector vObjectID; // pWindow->GetSceneManager()->Refurbish(); // pWindow->GetSceneManager()->SetDirtyUIElement(true,true); // QApplication::processEvents(); } void CWellLogWorkflowRunner::RunWorkFlow(pai::objectmodel::PaiWorkflowDataModel * pWorkflowDataModel,float sdep,float edep) { // CWellLogWorkflowDataModel * pwellWorkflowDataModel =dynamic_cast(pWorkflowDataModel); // if(!pwellWorkflowDataModel) return; // std::map logCurveContainer = m_RunTimeContext->GetLogCurveContainer(); // if(!m_RunTimeContext->GetLogCurveContainer().empty()) // { // m_RunTimeContext->GetLogCurveContainer().clear(); // } // CModuleConsole *pConsole=GetWorkflowConsole(); // if(!pConsole) return; // int nSize = pWorkflowDataModel->GetModuleCount(); // if(nSize) { // pConsole->bmoduleinfos=*pwellWorkflowDataModel->GetWorkflowFile()->GetModuleInfos(); // } // else { // std::vector *moduleinfos=pwellWorkflowDataModel->GetWorkflowFile()->GetModuleInfos(); // for(int i=0;ibmoduleinfos.size();i++) { // moduleinfos->push_back((CModuleInformation*)GetWorkflowConsole()->bmoduleinfos.at(i)); // } // } // nSize = pWorkflowDataModel->GetModuleCount(); // if(!nSize) { // AfxMessageBox("您还没有选择处理方法,请先选择处理方法再进行此项操作!"); // return; // } // CWellSectionWindowDocument *pDoc = dynamic_cast(pwellWorkflowDataModel->GetMWVecWindowDocument()); // if(!pDoc) return; // CVecWindow *pWindow=pDoc->GetVecWindow(); // if(!pWindow) return; // CQtWellSceneManager*m_pWellSceneManager = dynamic_cast(pWindow->GetSceneManager()); // if(!m_pWellSceneManager) return; // QVector vWellTracks =m_pWellSceneManager->GetWellSectionGeomtry().GetAllWellTrack(false); // if(vWellTracks.size()<1) { // AfxMessageBox("请加载井图形及井数据!"); // return; // } // for (int i= 0; iGetModule(i); // pai::module::CModule* pModule = pModuleInfo->GetModule(); // PELibraryModule * pWelllogModule = dynamic_cast(pModule); // std::string strName = pModuleInfo->GetName(); // foreach(CObjWellTrack*pWellTrack,vWellTracks) // { // QString ss=pWellTrack->GetWelllogRound()->GetSlfFileName(); // pWelllogModule->SetSlfFileName(ss); // QString path,wellname; // GetWellNameAndPath(ss,wellname,path); // path=wellname+QString::fromStdString(" "+pModule->GetMetaData()->GetName())+"开始执行...."; // AppendConsole(pai::log::PAI_INFO,path); // pWellTrack->SaveToSLF(); // int i=(int)pWelllogModule->Run(sdep,edep); // pWellTrack->LoadFromSLF(); // CDataImport::ChangetoSlf(ss); // if(i<0) path=wellname+QString::fromStdString(" "+pModule->GetMetaData()->GetName())+"发生错误,处理被终止!"; // else path=wellname+QString::fromStdString(" "+pModule->GetMetaData()->GetName())+"执行完成"; // AppendConsole(pai::log::PAI_INFO,path); // } // QApplication::processEvents(); // QTextDocument *pdoc=pConsole->g_mModuleParamers->GetEdtParamCard()->document(); // if(pdoc&&pdoc->isModified()) // { // pdoc->setModified(false); // } // } // pWindow->GetSceneManager()->SetDirtyUIElement(true,true); // QApplication::processEvents(); }