From 4e36898f546b1652c27c8ad92ce94da1a114c262 Mon Sep 17 00:00:00 2001 From: zhaolei <353719554@qq.com> Date: Wed, 15 Apr 2026 10:16:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E3=80=90=E6=8C=89=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E5=AF=BC=E5=85=A5=E6=B5=8B=E4=BA=95=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E3=80=91=E3=80=81=E3=80=90=E7=BC=96=E8=BE=91=E4=BA=95=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E4=BF=A1=E6=81=AF=E3=80=91=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ConvertorManager/include/IConvertor.h | 10 +- ConvertorManager/include/InterIConvertor.h | 4 +- ConvertorManager/src/IConvertor.cpp | 12 +- ConvertorManager/src/InterIConvertor.cpp | 60 +- OSGDataModel/include/ObjWell.h | 12 +- OSGDataModel/src/ObjWell.cpp | 111 +- WellLogUI/include/WellLogDialog.h | 5 +- WellLogUI/src/WellDialog.cpp | 607 +++-- WellLogUI/src/WellLogDialog.cpp | 4 +- logPlus/DataImport.cpp | 2098 +++++++++++++++++ logPlus/DataImport.h | 73 + logPlus/logPlus.pro | 7 +- logPlus/qtprojectwidgets.cpp | 46 +- logPlus/qtprojectwidgets.h | 1 + logPlus/tishidialog.cpp | 55 + logPlus/tishidialog.h | 28 + logPlus/tishidialog.ui | 180 ++ tran/LISConvertor/src/LisConvertor.cpp | 9 +- tran/LISConvertor/src/LisConvertor.pro | 11 + .../src/SLFAsciiConvertor.pro | 11 + 20 files changed, 2980 insertions(+), 364 deletions(-) create mode 100644 logPlus/DataImport.cpp create mode 100644 logPlus/DataImport.h create mode 100644 logPlus/tishidialog.cpp create mode 100644 logPlus/tishidialog.h create mode 100644 logPlus/tishidialog.ui diff --git a/ConvertorManager/include/IConvertor.h b/ConvertorManager/include/IConvertor.h index 3182aaf..9c20abc 100644 --- a/ConvertorManager/include/IConvertor.h +++ b/ConvertorManager/include/IConvertor.h @@ -15,8 +15,8 @@ #include "ConvertorExport.h" #include "ObjectGenralFactory.h" -//#include "ObjWell.h" -//#include "ObjWelllog.h" +#include "ObjWell.h" +#include "ObjWelllog.h" #include "MyWelllogRound.h" #include "DepthProgress.h" @@ -60,7 +60,7 @@ public: virtual bool OnlyForTest(){return false;}; virtual bool Init() { -// m_WellInfo->Init(); + m_WellInfo->Init(); m_WellLogRoundInfo->Init(); // memset(&m_WellInfo,0,sizeof(m_WellInfo)); // memset(&m_WellLogRoundInfo,0,sizeof(m_WellLogRoundInfo)); @@ -116,7 +116,7 @@ public: * @return well */ - //pai::ios::welllog::Well *GetWellInfo(); + pai::ios::welllog::Well *GetWellInfo(); /** * @brief 获取井次 @@ -133,7 +133,7 @@ public: protected: -// pai::ios::welllog::Well* m_WellInfo; + pai::ios::welllog::Well* m_WellInfo; DiDepthProgress *m_pDepthProgress; QStringList m_FileHead; MyWelllogRound* m_WellLogRoundInfo; diff --git a/ConvertorManager/include/InterIConvertor.h b/ConvertorManager/include/InterIConvertor.h index 11b2ea7..824f2c0 100644 --- a/ConvertorManager/include/InterIConvertor.h +++ b/ConvertorManager/include/InterIConvertor.h @@ -61,7 +61,7 @@ public: * @return QVector file contains all welllog curve */ -// virtual QList GetWellLogList(const QString &filename); + virtual QList GetWellLogList(const QString &filename); /** * @brief 指定文件的解编出来的文件头内容 @@ -173,7 +173,7 @@ protected: int m_DepthLength; -// QListm_vWellLogCurve; + QListm_vWellLogCurve; //多维曲线 QListm_DimCurvesList; diff --git a/ConvertorManager/src/IConvertor.cpp b/ConvertorManager/src/IConvertor.cpp index 43ebee8..59461b6 100644 --- a/ConvertorManager/src/IConvertor.cpp +++ b/ConvertorManager/src/IConvertor.cpp @@ -26,7 +26,7 @@ bool sConvertorKey::operator< ( const sConvertorKey& s ) const IConvertor::IConvertor():m_ConvertorTypeName("") { m_WellLogRoundInfo=new MyWelllogRound(); -// m_WellInfo=new Well(); + m_WellInfo=new Well(); m_pDepthProgress=NULL; m_ColumnCount=0; } @@ -35,7 +35,7 @@ IConvertor::IConvertor():m_ConvertorTypeName("") IConvertor::~IConvertor() { delete m_WellLogRoundInfo; -// delete m_WellInfo; + delete m_WellInfo; } void IConvertor::InitFormatSuffixName() { @@ -47,11 +47,11 @@ MyWelllogRound * IConvertor::GetWellLogRoundInfo() } -// pai::ios::welllog::Well *IConvertor::GetWellInfo() -// { -// return m_WellInfo; +pai::ios::welllog::Well *IConvertor::GetWellInfo() +{ + return m_WellInfo; -// } +} pai::datamodel::CObjectGenralFactory& IConvertor::GetFatory() { diff --git a/ConvertorManager/src/InterIConvertor.cpp b/ConvertorManager/src/InterIConvertor.cpp index b8c5a1b..17d5699 100644 --- a/ConvertorManager/src/InterIConvertor.cpp +++ b/ConvertorManager/src/InterIConvertor.cpp @@ -149,36 +149,36 @@ bool InterIConvertor::IsSupport( const QString &filename ) return Value; } -// QList pai::graphics::InterIConvertor::GetWellLogList( const QString &filename ) -// { -// m_vWellLogCurve.clear(); -// if(m_CurveData.Curve_Num<=0) return m_vWellLogCurve; -// // GetWellLogMetas( m_vWellLogCurve, filename ); -// InitWelllogRoundInfo(filename); -// if(WellStaticInfo.XCoor)FILE_MESSAGE.Xcoor=WellStaticInfo.XCoor; -// if(WellStaticInfo.YCoor)FILE_MESSAGE.Ycoor=WellStaticInfo.YCoor; -// memmove(FILE_MESSAGE.Item,WellStaticInfo.MethodCWell,sizeof(FILE_MESSAGE.Item)); -// if(*WellStaticInfo.WellName&&*WellStaticInfo.WellName!=' ')memmove(FILE_MESSAGE.WellName,WellStaticInfo.WellName,sizeof(FILE_MESSAGE.WellName)); -// if(*WellStaticInfo.AreaName&&*WellStaticInfo.AreaName!=' ')memmove(FILE_MESSAGE.AreaName,WellStaticInfo.AreaName,sizeof(FILE_MESSAGE.AreaName)); -// if(*WellStaticInfo.OilCompanyName&&*WellStaticInfo.OilCompanyName!=' ')memmove(FILE_MESSAGE.OilCompanyName,WellStaticInfo.OilCompanyName,sizeof(FILE_MESSAGE.OilCompanyName)); -// if(WellStaticInfo.As1)FILE_MESSAGE.Altitude=WellStaticInfo.As1; -// if(WellStaticInfo.Bs1)FILE_MESSAGE.Kelly=WellStaticInfo.Bs1; -// if(strlen(WellStaticInfo.EndDrillDate))FILE_MESSAGE.EndDrillDate=StringToTime(WellStaticInfo.EndDrillDate); -// if(strlen(WellStaticInfo.StartDrillDate))FILE_MESSAGE.StartDrillDate=StringToTime(WellStaticInfo.StartDrillDate); -// if(WellStaticInfo.Sc1Edep)FILE_MESSAGE.StartDepth=WellStaticInfo.Sc1Edep; -// if(WellStaticInfo.Sc2sdep)FILE_MESSAGE.EndDepth=WellStaticInfo.Sc2sdep; -// if(*(float*)&WellStaticInfo.Remark[0])memmove(&FILE_MESSAGE.X0,&WellStaticInfo.Remark[0],4); -// if(*(float*)&WellStaticInfo.Remark[4])memmove(&FILE_MESSAGE.Y0,&WellStaticInfo.Remark[4],4); -// if(*(float*)&WellStaticInfo.Remark[8])memmove(&FILE_MESSAGE.TVD,&WellStaticInfo.Remark[8],4);//whp 2019.7.30 该语句会把解编模块扫描得到的TVD数据清空 -// //已在ASCII模块中做了相应的处理,不知道别的模块中还有没有 -// if(strlen(WellDynamicInfo.LogCompanyName))memmove(FILE_MESSAGE.LogCompanyName,WellDynamicInfo.LogCompanyName,sizeof(FILE_MESSAGE.LogCompanyName)); -// if(strlen(WellDynamicInfo.Operator))memmove(FILE_MESSAGE.Operator,WellDynamicInfo.Operator,sizeof(FILE_MESSAGE.Operator)); -// if(strlen(WellDynamicInfo.Item))memmove(FILE_MESSAGE.LoggingTeam,WellDynamicInfo.Item,sizeof(FILE_MESSAGE.LoggingTeam)); -// if(strlen(WellDynamicInfo.Date))FILE_MESSAGE.LoggingDate=StringToTime(WellDynamicInfo.Date); -// //add end -// InitWellInfo(filename); -// return m_vWellLogCurve; -// } +QList pai::graphics::InterIConvertor::GetWellLogList( const QString &filename ) +{ + m_vWellLogCurve.clear(); + if(m_CurveData.Curve_Num<=0) return m_vWellLogCurve; +// GetWellLogMetas( m_vWellLogCurve, filename ); + InitWelllogRoundInfo(filename); + if(WellStaticInfo.XCoor)FILE_MESSAGE.Xcoor=WellStaticInfo.XCoor; + if(WellStaticInfo.YCoor)FILE_MESSAGE.Ycoor=WellStaticInfo.YCoor; + memmove(FILE_MESSAGE.Item,WellStaticInfo.MethodCWell,sizeof(FILE_MESSAGE.Item)); + if(*WellStaticInfo.WellName&&*WellStaticInfo.WellName!=' ')memmove(FILE_MESSAGE.WellName,WellStaticInfo.WellName,sizeof(FILE_MESSAGE.WellName)); + if(*WellStaticInfo.AreaName&&*WellStaticInfo.AreaName!=' ')memmove(FILE_MESSAGE.AreaName,WellStaticInfo.AreaName,sizeof(FILE_MESSAGE.AreaName)); + if(*WellStaticInfo.OilCompanyName&&*WellStaticInfo.OilCompanyName!=' ')memmove(FILE_MESSAGE.OilCompanyName,WellStaticInfo.OilCompanyName,sizeof(FILE_MESSAGE.OilCompanyName)); + if(WellStaticInfo.As1)FILE_MESSAGE.Altitude=WellStaticInfo.As1; + if(WellStaticInfo.Bs1)FILE_MESSAGE.Kelly=WellStaticInfo.Bs1; + if(strlen(WellStaticInfo.EndDrillDate))FILE_MESSAGE.EndDrillDate=StringToTime(WellStaticInfo.EndDrillDate); + if(strlen(WellStaticInfo.StartDrillDate))FILE_MESSAGE.StartDrillDate=StringToTime(WellStaticInfo.StartDrillDate); + if(WellStaticInfo.Sc1Edep)FILE_MESSAGE.StartDepth=WellStaticInfo.Sc1Edep; + if(WellStaticInfo.Sc2sdep)FILE_MESSAGE.EndDepth=WellStaticInfo.Sc2sdep; + if(*(float*)&WellStaticInfo.Remark[0])memmove(&FILE_MESSAGE.X0,&WellStaticInfo.Remark[0],4); + if(*(float*)&WellStaticInfo.Remark[4])memmove(&FILE_MESSAGE.Y0,&WellStaticInfo.Remark[4],4); + if(*(float*)&WellStaticInfo.Remark[8])memmove(&FILE_MESSAGE.TVD,&WellStaticInfo.Remark[8],4);//whp 2019.7.30 该语句会把解编模块扫描得到的TVD数据清空 + //已在ASCII模块中做了相应的处理,不知道别的模块中还有没有 + if(strlen(WellDynamicInfo.LogCompanyName))memmove(FILE_MESSAGE.LogCompanyName,WellDynamicInfo.LogCompanyName,sizeof(FILE_MESSAGE.LogCompanyName)); + if(strlen(WellDynamicInfo.Operator))memmove(FILE_MESSAGE.Operator,WellDynamicInfo.Operator,sizeof(FILE_MESSAGE.Operator)); + if(strlen(WellDynamicInfo.Item))memmove(FILE_MESSAGE.LoggingTeam,WellDynamicInfo.Item,sizeof(FILE_MESSAGE.LoggingTeam)); + if(strlen(WellDynamicInfo.Date))FILE_MESSAGE.LoggingDate=StringToTime(WellDynamicInfo.Date); + //add end + InitWellInfo(filename); + return m_vWellLogCurve; +} QString InterIConvertor::GetfilePath(const char *FileName) diff --git a/OSGDataModel/include/ObjWell.h b/OSGDataModel/include/ObjWell.h index f66a3ad..2eeba22 100644 --- a/OSGDataModel/include/ObjWell.h +++ b/OSGDataModel/include/ObjWell.h @@ -28,7 +28,7 @@ class CObjWellLog; OSGDATAMODEL_EXPORT CObjWell *GetCurrentObjWell(); OSGDATAMODEL_EXPORT void SetCurrentObjWell( CObjWell *pObjWell ); -class OSGDATAMODEL_EXPORT CObjWell/* : public CObjBaseObject*/ +class OSGDATAMODEL_EXPORT CObjWell : public pai::objectmodel::PaiObject { // Q_OBJECT; public: @@ -163,6 +163,15 @@ public: /************************************************************************/ // pai::datamodel::CObjWellLog* GetWellLogByTemplate(QString wellroundPath,const QVariant& templateKey); static int ComputeTrajectory(CObjWell *pWell,QString Slffilename); + QString GetPrjname() + { + return m_strPrjname; + } + void SetPrjname(QString strPrjname) + { + m_strPrjname = strPrjname; + } + private: /** @@ -189,6 +198,7 @@ private: CObjWelllogRound*m_pCurrentWelllogRound; bool isFLAG; double m_XYZStartDep,m_XYZEndDep,m_XYZRlev; + QString m_strPrjname; public slots: // void slotWellMessage(QString slffile); }; diff --git a/OSGDataModel/src/ObjWell.cpp b/OSGDataModel/src/ObjWell.cpp index 46cd005..26637e5 100644 --- a/OSGDataModel/src/ObjWell.cpp +++ b/OSGDataModel/src/ObjWell.cpp @@ -728,58 +728,67 @@ void CObjWell::ClearXYZ() // } void CObjWell::SetDepth(CObjWell *pWell) { - // if(pWell) - // { - // int roc=pWell->GetWellRoundCount(); - // if(roc) - // { - // QListchilds; - // pWell->GetAllWellRound(childs); - // double stardep=99999,enddep=-99999; - // float rlev=100; - // for(int i=0;i(childs[i]); - // if(!pWelllogRound) continue; - // CLogIO * logio=new CLogIO(); + if(pWell) + { + // int roc=pWell->GetWellRoundCount(); + QString path=GetLogdataPath(); + path+=pWell->GetPrjname(); + path+="/#"; + path+=pWell->GetName(); - // if(!logio->Open(pWelllogRound->GetSlfFileName().toStdString().c_str(),CSlfIO::modeReadWrite)) - // { - // delete logio; - // break; - // } - // int curveCount=logio->GetObjectCount(); - // for(int k1=0;k1GetObjectName(k1,buf); - // int a=logio->OpenCurve(buf); - // if(a>-1) - // { - // Slf_CURVE acurveinfo; - // logio->GetCurveInfo(a,&acurveinfo); - // if(acurveinfo.StartDepthenddep) enddep=acurveinfo.EndDepth; - // if(rlev>acurveinfo.DepLevel) rlev=acurveinfo.DepLevel; - // } - // else { - // int a=logio->OpenWave(buf); - // if(a>-1) - // { - // Slf_WAVE acurveinfo; - // logio->GetWaveInfo(a,&acurveinfo); - // if(acurveinfo.StartDepthenddep) enddep=acurveinfo.EndDepth; - // if(rlev>acurveinfo.DepLevel) rlev=acurveinfo.DepLevel; - // } - // } - // } - // if(rlev<=0) rlev=0.125; - // delete logio; - // } - // pWell->SetDepth(stardep,enddep,rlev); - // } - // } + QStringList slffiles; + chakan(path, slffiles, "*.slf"); + + int roc=slffiles.size(); + if(roc) + { + // QListchilds; + // pWell->GetAllWellRound(childs); + double stardep=99999,enddep=-99999; + float rlev=100; + for(int i=0;i(childs[i]); + // if(!pWelllogRound) continue; + CLogIO * logio=new CLogIO(); + + if(!logio->Open(/*pWelllogRound->GetSlfFileName()*/slffiles.at(i).toStdString().c_str(),CSlfIO::modeReadWrite)) + { + delete logio; + break; + } + int curveCount=logio->GetObjectCount(); + for(int k1=0;k1GetObjectName(k1,buf); + int a=logio->OpenCurve(buf); + if(a>-1) + { + Slf_CURVE acurveinfo; + logio->GetCurveInfo(a,&acurveinfo); + if(acurveinfo.StartDepthenddep) enddep=acurveinfo.EndDepth; + if(rlev>acurveinfo.DepLevel) rlev=acurveinfo.DepLevel; + } + else { + int a=logio->OpenWave(buf); + if(a>-1) + { + Slf_WAVE acurveinfo; + logio->GetWaveInfo(a,&acurveinfo); + if(acurveinfo.StartDepthenddep) enddep=acurveinfo.EndDepth; + if(rlev>acurveinfo.DepLevel) rlev=acurveinfo.DepLevel; + } + } + } + if(rlev<=0) rlev=0.125; + delete logio; + } + pWell->SetDepth(stardep,enddep,rlev); + } + } } int CObjWell::ComputeTrajectory(CObjWell *pWell,QString slffilename) { diff --git a/WellLogUI/include/WellLogDialog.h b/WellLogUI/include/WellLogDialog.h index b6f3904..e09562d 100644 --- a/WellLogUI/include/WellLogDialog.h +++ b/WellLogUI/include/WellLogDialog.h @@ -11,6 +11,7 @@ #pragma warning( push ,0) #include "WellLogUI.h" #include "MyWelllogRound.h" +#include "ObjWell.h" #pragma warning( pop ) /** @@ -30,12 +31,12 @@ public: virtual void ViewToData(); virtual int Validate(); virtual void GetOKAndCancel(QPushButton* &okBtn,QPushButton* &cancelBtn); - void Init(); + void Init(CObjWell* pObject); private slots: virtual void slotSave(); virtual void slotCancel(); protected: - + CObjWell* m_pObject; public: MyWelllogRound wellLR; int m_DialogType; diff --git a/WellLogUI/src/WellDialog.cpp b/WellLogUI/src/WellDialog.cpp index 778e974..d517a55 100644 --- a/WellLogUI/src/WellDialog.cpp +++ b/WellLogUI/src/WellDialog.cpp @@ -57,92 +57,15 @@ void CWellDialog::GetOKAndCancel(QPushButton* &okBtn,QPushButton* &cancelBtn) void CWellDialog::DataToView() { // pai::datamodel::CObjWell* pWell = dynamic_cast(pObject); -// if(pWell != NULL) -// { -// wellLR.LoadMeesge(pWell->GetWellMessageFileName()); -// if(pWell->GetWellHead().x!=0&&wellLR.GetXCode()!=pWell->GetWellHead().x) wellLR.SetXCode(pWell->GetWellHead().x); -// if(pWell->GetWellHead().y!=0&&wellLR.GetYCode()!=pWell->GetWellHead().y) wellLR.SetYCode(pWell->GetWellHead().y); -// wellLR.SetTopDepth(pWell->GetWellHead().startDepth); -// wellLR.SetBottomDepth(pWell->GetWellHead().endDepth); -// QString title = pWell->GetName() == "" ? "新建井基本信息":"编辑井基本信息"; -// this->setWindowTitle(title); -// m_pUI->wellName->setText(wellLR.GetWellName().c_str()); -// m_pUI->companyName->setText(QString::fromStdString(wellLR.GetOilCompanyName())); -// m_pUI->wellCode->setText(QString::fromStdString("")); -// m_pUI->areaName->setText(QString::fromStdString(wellLR.GetAreaName())); -// int decimal = -1; -// m_pUI->xCode->setText(DoubleToString(wellLR.GetXCode(),decimal,NULL)); -// m_pUI->xOffset->setText(DoubleToString(wellLR.GetXOffset(),decimal,NULL)); -// m_pUI->yOffset->setText(DoubleToString(wellLR.GetYOffset(),decimal,NULL)); -// m_pUI->TVD->setText(DoubleToString(pWell->GetWellHead().tvd==0?wellLR.GetTVD0():pWell->GetWellHead().tvd,3,NULL)); -// m_pUI->lineEdit->setText(DoubleToString(wellLR.GetTopDepth(),3,NULL)); -// m_pUI->yCode->setText(DoubleToString(wellLR.GetYCode(),decimal,NULL)); -// m_pUI->asl->setText(DoubleToString(wellLR.GetAsl(),decimal,NULL)); -// m_pUI->bsl->setText(DoubleToString(wellLR.GetBsl(),decimal,NULL)); -// m_pUI->endMethod->setText(QString::fromStdString(wellLR.GetCWMethod())); - -// m_pUI->bit1->setText(QString::fromStdString(wellLR.GetBit1Prog())); -// m_pUI->bit2->setText(QString::fromStdString(wellLR.GetBit2Prog())); -// m_pUI->bit3->setText(QString::fromStdString(wellLR.GetBit3Prog())); -// m_pUI->bit4->setText(QString::fromStdString(wellLR.GetBit4Prog())); -// m_pUI->bit5->setText(QString::fromStdString(wellLR.GetBit5Prog())); - -// m_pUI->cas1->setText(QString::fromStdString(wellLR.GetCas1Prog())); -// m_pUI->cas2->setText(QString::fromStdString(wellLR.GetCas2Prog())); -// m_pUI->cas3->setText(QString::fromStdString(wellLR.GetCas3Prog())); -// m_pUI->cas4->setText(QString::fromStdString(wellLR.GetCas4Prog())); -// m_pUI->cas5->setText(QString::fromStdString(wellLR.GetCas5Prog())); - -// m_pUI->caseOneLength->setText(DoubleToString(wellLR.GetCas1Shot(),decimal,NULL)); -// m_pUI->caseOneSD->setText(DoubleToString(wellLR.GetSC1SDep(),decimal,NULL)); -// m_pUI->caseOneED->setText(DoubleToString(wellLR.GetSC1EDep(),decimal,NULL)); - -// m_pUI->caseTwoLength->setText(DoubleToString(wellLR.GetCas2Shot(),decimal,NULL)); -// m_pUI->caseTwoSD->setText(DoubleToString(wellLR.GetSC2SDep(),decimal,NULL)); -// m_pUI->caseTwoED->setText(DoubleToString(wellLR.GetSC2EDep(),decimal,NULL)); - -// // -// // -// // -// ComboxFromConfigFile(m_pUI->wellType,"wellType"); -// if(wellLR.GetWellType() < m_pUI->wellType->count()) -// { -// m_pUI->wellType->setCurrentIndex(wellLR.GetWellType()); -// } - -// QString format = "yyyy年-MM月-dd日"; -// m_pUI->startDrillDate->setCalendarPopup(true); -// m_pUI->startDrillDate->setCalendarWidget(new QCalendarWidget()); -// m_pUI->startDrillDate->setDisplayFormat(format); -// if(wellLR.GetSDrillDate() != "") -// m_pUI->startDrillDate->setDate(QDate::fromString(QString::fromStdString(wellLR.GetSDrillDate()),format)); -// else -// m_pUI->startDrillDate->setDate(QDate::currentDate()); - -// // -// m_pUI->endDrillDate->setCalendarPopup(true); -// m_pUI->endDrillDate->setCalendarWidget(new QCalendarWidget()); -// m_pUI->endDrillDate->setDisplayFormat(format); -// if(wellLR.GetEDrillDate() != "") -// m_pUI->endDrillDate->setDate(QDate::fromString(QString::fromStdString(wellLR.GetEDrillDate()),format)); -// else -// m_pUI->endDrillDate->setDate(QDate::currentDate()); -// // -// m_pUI->endWellDate->setCalendarPopup(true); -// m_pUI->endWellDate->setCalendarWidget(new QCalendarWidget()); -// m_pUI->endWellDate->setDisplayFormat(format); -// if(wellLR.GetCompleteDate() != "") -// m_pUI->endWellDate->setDate(QDate::fromString(QString::fromStdString(wellLR.GetCompleteDate()),format)); -// else -// m_pUI->endWellDate->setDate(QDate::currentDate()); - -// } -// //if(pWell->GetWellFileName()=="") -// // DataToViewOld(pObject);//目前MyWellRound不好使,先覆盖掉 - - - //QString title = pWell->GetName() == "" ? "新建井基本信息":"编辑井基本信息"; - QString title = "编辑井基本信息"; + CObjWell* pWell = m_pObject; + if(pWell != NULL) + { + wellLR.LoadMeesge(pWell->GetWellMessageFileName()); + if(pWell->GetWellHead().x!=0&&wellLR.GetXCode()!=pWell->GetWellHead().x) wellLR.SetXCode(pWell->GetWellHead().x); + if(pWell->GetWellHead().y!=0&&wellLR.GetYCode()!=pWell->GetWellHead().y) wellLR.SetYCode(pWell->GetWellHead().y); + wellLR.SetTopDepth(pWell->GetWellHead().startDepth); + wellLR.SetBottomDepth(pWell->GetWellHead().endDepth); + QString title = pWell->GetName() == "" ? "新建井基本信息":"编辑井基本信息"; this->setWindowTitle(title); m_pUI->wellName->setText(wellLR.GetWellName().c_str()); m_pUI->companyName->setText(QString::fromStdString(wellLR.GetOilCompanyName())); @@ -152,34 +75,33 @@ void CWellDialog::DataToView() m_pUI->xCode->setText(DoubleToString(wellLR.GetXCode(),decimal,NULL)); m_pUI->xOffset->setText(DoubleToString(wellLR.GetXOffset(),decimal,NULL)); m_pUI->yOffset->setText(DoubleToString(wellLR.GetYOffset(),decimal,NULL)); - //m_pUI->TVD->setText(DoubleToString(pWell->GetWellHead().tvd==0?wellLR.GetTVD0():pWell->GetWellHead().tvd,3,NULL)); - //m_pUI->TVD->setText(DoubleToString(wellLR.GetTVD0(),3,NULL)); + m_pUI->TVD->setText(DoubleToString(pWell->GetWellHead().tvd==0?wellLR.GetTVD0():pWell->GetWellHead().tvd,3,NULL)); m_pUI->lineEdit->setText(DoubleToString(wellLR.GetTopDepth(),3,NULL)); m_pUI->yCode->setText(DoubleToString(wellLR.GetYCode(),decimal,NULL)); m_pUI->asl->setText(DoubleToString(wellLR.GetAsl(),decimal,NULL)); m_pUI->bsl->setText(DoubleToString(wellLR.GetBsl(),decimal,NULL)); m_pUI->endMethod->setText(QString::fromStdString(wellLR.GetCWMethod())); - + m_pUI->bit1->setText(QString::fromStdString(wellLR.GetBit1Prog())); m_pUI->bit2->setText(QString::fromStdString(wellLR.GetBit2Prog())); m_pUI->bit3->setText(QString::fromStdString(wellLR.GetBit3Prog())); m_pUI->bit4->setText(QString::fromStdString(wellLR.GetBit4Prog())); m_pUI->bit5->setText(QString::fromStdString(wellLR.GetBit5Prog())); - + m_pUI->cas1->setText(QString::fromStdString(wellLR.GetCas1Prog())); m_pUI->cas2->setText(QString::fromStdString(wellLR.GetCas2Prog())); m_pUI->cas3->setText(QString::fromStdString(wellLR.GetCas3Prog())); m_pUI->cas4->setText(QString::fromStdString(wellLR.GetCas4Prog())); m_pUI->cas5->setText(QString::fromStdString(wellLR.GetCas5Prog())); - + m_pUI->caseOneLength->setText(DoubleToString(wellLR.GetCas1Shot(),decimal,NULL)); m_pUI->caseOneSD->setText(DoubleToString(wellLR.GetSC1SDep(),decimal,NULL)); m_pUI->caseOneED->setText(DoubleToString(wellLR.GetSC1EDep(),decimal,NULL)); - + m_pUI->caseTwoLength->setText(DoubleToString(wellLR.GetCas2Shot(),decimal,NULL)); m_pUI->caseTwoSD->setText(DoubleToString(wellLR.GetSC2SDep(),decimal,NULL)); m_pUI->caseTwoED->setText(DoubleToString(wellLR.GetSC2EDep(),decimal,NULL)); - + // // // @@ -197,7 +119,7 @@ void CWellDialog::DataToView() m_pUI->startDrillDate->setDate(QDate::fromString(QString::fromStdString(wellLR.GetSDrillDate()),format)); else m_pUI->startDrillDate->setDate(QDate::currentDate()); - + // m_pUI->endDrillDate->setCalendarPopup(true); m_pUI->endDrillDate->setCalendarWidget(new QCalendarWidget()); @@ -214,6 +136,87 @@ void CWellDialog::DataToView() m_pUI->endWellDate->setDate(QDate::fromString(QString::fromStdString(wellLR.GetCompleteDate()),format)); else m_pUI->endWellDate->setDate(QDate::currentDate()); + + } + + +// // //if(pWell->GetWellFileName()=="") +// // // DataToViewOld(pObject);//目前MyWellRound不好使,先覆盖掉 + + +// //QString title = pWell->GetName() == "" ? "新建井基本信息":"编辑井基本信息"; +// QString title = "编辑井基本信息"; +// this->setWindowTitle(title); +// m_pUI->wellName->setText(wellLR.GetWellName().c_str()); +// m_pUI->companyName->setText(QString::fromStdString(wellLR.GetOilCompanyName())); +// m_pUI->wellCode->setText(QString::fromStdString("")); +// m_pUI->areaName->setText(QString::fromStdString(wellLR.GetAreaName())); +// int decimal = -1; +// m_pUI->xCode->setText(DoubleToString(wellLR.GetXCode(),decimal,NULL)); +// m_pUI->xOffset->setText(DoubleToString(wellLR.GetXOffset(),decimal,NULL)); +// m_pUI->yOffset->setText(DoubleToString(wellLR.GetYOffset(),decimal,NULL)); +// m_pUI->TVD->setText(DoubleToString(pWell->GetWellHead().tvd==0?wellLR.GetTVD0():pWell->GetWellHead().tvd,3,NULL)); +// m_pUI->TVD->setText(DoubleToString(wellLR.GetTVD0(),3,NULL)); +// m_pUI->lineEdit->setText(DoubleToString(wellLR.GetTopDepth(),3,NULL)); +// m_pUI->yCode->setText(DoubleToString(wellLR.GetYCode(),decimal,NULL)); +// m_pUI->asl->setText(DoubleToString(wellLR.GetAsl(),decimal,NULL)); +// m_pUI->bsl->setText(DoubleToString(wellLR.GetBsl(),decimal,NULL)); +// m_pUI->endMethod->setText(QString::fromStdString(wellLR.GetCWMethod())); + +// m_pUI->bit1->setText(QString::fromStdString(wellLR.GetBit1Prog())); +// m_pUI->bit2->setText(QString::fromStdString(wellLR.GetBit2Prog())); +// m_pUI->bit3->setText(QString::fromStdString(wellLR.GetBit3Prog())); +// m_pUI->bit4->setText(QString::fromStdString(wellLR.GetBit4Prog())); +// m_pUI->bit5->setText(QString::fromStdString(wellLR.GetBit5Prog())); + +// m_pUI->cas1->setText(QString::fromStdString(wellLR.GetCas1Prog())); +// m_pUI->cas2->setText(QString::fromStdString(wellLR.GetCas2Prog())); +// m_pUI->cas3->setText(QString::fromStdString(wellLR.GetCas3Prog())); +// m_pUI->cas4->setText(QString::fromStdString(wellLR.GetCas4Prog())); +// m_pUI->cas5->setText(QString::fromStdString(wellLR.GetCas5Prog())); + +// m_pUI->caseOneLength->setText(DoubleToString(wellLR.GetCas1Shot(),decimal,NULL)); +// m_pUI->caseOneSD->setText(DoubleToString(wellLR.GetSC1SDep(),decimal,NULL)); +// m_pUI->caseOneED->setText(DoubleToString(wellLR.GetSC1EDep(),decimal,NULL)); + +// m_pUI->caseTwoLength->setText(DoubleToString(wellLR.GetCas2Shot(),decimal,NULL)); +// m_pUI->caseTwoSD->setText(DoubleToString(wellLR.GetSC2SDep(),decimal,NULL)); +// m_pUI->caseTwoED->setText(DoubleToString(wellLR.GetSC2EDep(),decimal,NULL)); + +// // +// // +// // +// ComboxFromConfigFile(m_pUI->wellType,"wellType"); +// if(wellLR.GetWellType() < m_pUI->wellType->count()) +// { +// m_pUI->wellType->setCurrentIndex(wellLR.GetWellType()); +// } + +// QString format = "yyyy年-MM月-dd日"; +// m_pUI->startDrillDate->setCalendarPopup(true); +// m_pUI->startDrillDate->setCalendarWidget(new QCalendarWidget()); +// m_pUI->startDrillDate->setDisplayFormat(format); +// if(wellLR.GetSDrillDate() != "") +// m_pUI->startDrillDate->setDate(QDate::fromString(QString::fromStdString(wellLR.GetSDrillDate()),format)); +// else +// m_pUI->startDrillDate->setDate(QDate::currentDate()); + +// // +// m_pUI->endDrillDate->setCalendarPopup(true); +// m_pUI->endDrillDate->setCalendarWidget(new QCalendarWidget()); +// m_pUI->endDrillDate->setDisplayFormat(format); +// if(wellLR.GetEDrillDate() != "") +// m_pUI->endDrillDate->setDate(QDate::fromString(QString::fromStdString(wellLR.GetEDrillDate()),format)); +// else +// m_pUI->endDrillDate->setDate(QDate::currentDate()); +// // +// m_pUI->endWellDate->setCalendarPopup(true); +// m_pUI->endWellDate->setCalendarWidget(new QCalendarWidget()); +// m_pUI->endWellDate->setDisplayFormat(format); +// if(wellLR.GetCompleteDate() != "") +// m_pUI->endWellDate->setDate(QDate::fromString(QString::fromStdString(wellLR.GetCompleteDate()),format)); +// else +// m_pUI->endWellDate->setDate(QDate::currentDate()); } int CWellDialog::Validate() @@ -222,15 +225,31 @@ int CWellDialog::Validate() QString errInfo; if(m_pUI->wellName->text() != NULL) { - // if(!IsValidWellName(m_pUI->wellName->text())) - // { - // errInfo = "井名称由中文(英文字母)、数字字符串构成,且首字符不可以为数字!"; - // m_pUI->wellName->setFocus(); - // } - // else - // { - // pai::datamodel::CObjWell* pWell = dynamic_cast(m_pObject); - // if(!(pWell->isExistsName(m_pUI->wellName->text()))) + if(!IsValidWellName(m_pUI->wellName->text())) + { + errInfo = "井名称由中文(英文字母)、数字字符串构成,且首字符不可以为数字!"; + m_pUI->wellName->setFocus(); + } + else + { + pai::datamodel::CObjWell* pWell = dynamic_cast(m_pObject); + QString oldname=pWell->GetName(); + QString welln = m_pUI->wellName->text(); + QString path=GetLogdataPath(); + path+=pWell->GetPrjname(); + path+="/#"; + path+=welln; + QDir dir(path); + if (dir.exists() && oldname !=welln) { + errInfo ="井名已经存在,无法创建新井,请用其它名字!"; + QMessageBox::information(NULL,"提示",QString(errInfo),QMessageBox::Ok); + flag=false; + return flag; + } + else + flag = true; + // pai::datamodel::CObjWell* pWell = dynamic_cast(m_pObject); + // if(!(pWell->isExistsName(m_pUI->wellName->text()))) // { // flag = true; // } @@ -252,7 +271,7 @@ int CWellDialog::Validate() // m_pUI->wellName->setFocus(); // return flag; // } - // } + } } else { @@ -310,168 +329,254 @@ int CWellDialog::Validate() void CWellDialog::ViewToData() { -// pai::datamodel::CObjWell* pWell = dynamic_cast(pObject); -// QString oldname=pWell->GetName(); -// WellHead &hd=pWell->GetWellHead(); -// QString welln=m_pUI->wellName->text(); -// welln=welln.toUpper(); -// hd.wellName=welln; -// CObjWell *pOldWell=dynamic_cast(::GetProject()->GetObjectByName(welln)); -// pWell->SetName(welln); -// wellLR.SetWellName(welln.toStdString()); -// wellLR.SetAreaName(m_pUI->areaName->text().toStdString()); -// wellLR.SetOilCompanyName(m_pUI->companyName->text().toStdString()); -// QString xcode=m_pUI->xCode->text(); -// char buf[100]; -// strcpy(buf,xcode.toStdString().c_str()); -// wellLR.SetXCode(_atof_l(buf,0)); -// hd.x=_atof_l(buf,0); -// wellLR.SetYCode(m_pUI->yCode->text().toFloat()); -// hd.y=m_pUI->yCode->text().toFloat(); -// wellLR.SetXOffset(m_pUI->xOffset->text().toFloat()); -// wellLR.SetYOffset(m_pUI->yOffset->text().toFloat()); -// wellLR.SetTVD0(m_pUI->TVD->text().toFloat()); -// wellLR.SetTopDepth(m_pUI->lineEdit->text().toFloat()); -// hd.dxe=m_pUI->xOffset->text().toFloat(); -// hd.dyn=m_pUI->yOffset->text().toFloat(); -// hd.tvd=m_pUI->TVD->text().toFloat(); + // pai::datamodel::CObjWell* pWell = dynamic_cast(pObject); + CObjWell* pWell = m_pObject; + QString oldname=pWell->GetName(); + WellHead &hd=pWell->GetWellHead(); + QString welln=m_pUI->wellName->text(); -// wellLR.SetWellType(m_pUI->wellType->currentIndex ()); + QString path=GetLogdataPath(); + path+=pWell->GetPrjname(); + path+="/#"; + path+=pWell->GetName(); + // QDir dir(path); + // if (dir.exists() && oldname !=welln) { + // QString strMessage = welln + "井名已存在修改失败!"; + // AfxMessageBox(strMessage); + // return; + // } + welln=welln.toUpper(); + hd.wellName=welln; + // CObjWell *pOldWell=dynamic_cast(::GetProject()->GetObjectByName(welln)); + pWell->SetName(welln); + wellLR.SetWellName(welln.toStdString()); + wellLR.SetAreaName(m_pUI->areaName->text().toStdString()); + wellLR.SetOilCompanyName(m_pUI->companyName->text().toStdString()); + QString xcode=m_pUI->xCode->text(); + char buf[100]; + strcpy(buf,xcode.toStdString().c_str()); + wellLR.SetXCode(_atof_l(buf,0)); + hd.x=_atof_l(buf,0); + wellLR.SetYCode(m_pUI->yCode->text().toFloat()); + hd.y=m_pUI->yCode->text().toFloat(); + wellLR.SetXOffset(m_pUI->xOffset->text().toFloat()); + wellLR.SetYOffset(m_pUI->yOffset->text().toFloat()); + wellLR.SetTVD0(m_pUI->TVD->text().toFloat()); + wellLR.SetTopDepth(m_pUI->lineEdit->text().toFloat()); + hd.dxe=m_pUI->xOffset->text().toFloat(); + hd.dyn=m_pUI->yOffset->text().toFloat(); + hd.tvd=m_pUI->TVD->text().toFloat(); -// wellLR.SetAsl(m_pUI->asl->text().toFloat()); -// wellLR.SetBsl(m_pUI->bsl->text().toFloat()); -// hd.earthEle=m_pUI->asl->text().toFloat(); -// hd.dEle=m_pUI->bsl->text().toFloat(); + wellLR.SetWellType(m_pUI->wellType->currentIndex ()); -// wellLR.SetCWMethod(m_pUI->endMethod->text().toStdString()); + wellLR.SetAsl(m_pUI->asl->text().toFloat()); + wellLR.SetBsl(m_pUI->bsl->text().toFloat()); + hd.earthEle=m_pUI->asl->text().toFloat(); + hd.dEle=m_pUI->bsl->text().toFloat(); -// wellLR.SetBit1Prog(m_pUI->bit1->text().toStdString()); -// wellLR.SetBit2Prog(m_pUI->bit2->text().toStdString()); -// wellLR.SetBit3Prog(m_pUI->bit3->text().toStdString()); -// wellLR.SetBit4Prog(m_pUI->bit4->text().toStdString()); -// wellLR.SetBit5Prog(m_pUI->bit5->text().toStdString()); + wellLR.SetCWMethod(m_pUI->endMethod->text().toStdString()); -// wellLR.SetCas1Prog(m_pUI->cas1->text().toStdString()); -// wellLR.SetCas2Prog(m_pUI->cas2->text().toStdString()); -// wellLR.SetCas3Prog(m_pUI->cas3->text().toStdString()); -// wellLR.SetCas4Prog(m_pUI->cas4->text().toStdString()); -// wellLR.SetCas5Prog(m_pUI->cas5->text().toStdString()); + wellLR.SetBit1Prog(m_pUI->bit1->text().toStdString()); + wellLR.SetBit2Prog(m_pUI->bit2->text().toStdString()); + wellLR.SetBit3Prog(m_pUI->bit3->text().toStdString()); + wellLR.SetBit4Prog(m_pUI->bit4->text().toStdString()); + wellLR.SetBit5Prog(m_pUI->bit5->text().toStdString()); -// wellLR.SetCas1Shot(m_pUI->caseOneLength->text().toFloat()); -// wellLR.SetSC1SDep(m_pUI->caseOneSD->text().toFloat()); -// wellLR.SetSC1EDep(m_pUI->caseOneED->text().toFloat()); + wellLR.SetCas1Prog(m_pUI->cas1->text().toStdString()); + wellLR.SetCas2Prog(m_pUI->cas2->text().toStdString()); + wellLR.SetCas3Prog(m_pUI->cas3->text().toStdString()); + wellLR.SetCas4Prog(m_pUI->cas4->text().toStdString()); + wellLR.SetCas5Prog(m_pUI->cas5->text().toStdString()); -// wellLR.SetCas2Shot(m_pUI->caseTwoLength->text().toFloat()); -// wellLR.SetSC2SDep(m_pUI->caseTwoSD->text().toFloat()); -// wellLR.SetSC2SDep(m_pUI->caseTwoED->text().toFloat()); + wellLR.SetCas1Shot(m_pUI->caseOneLength->text().toFloat()); + wellLR.SetSC1SDep(m_pUI->caseOneSD->text().toFloat()); + wellLR.SetSC1EDep(m_pUI->caseOneED->text().toFloat()); -// wellLR.SetSDrillDate(m_pUI->startDrillDate->text().toStdString()); -// wellLR.SetEDrillDate(m_pUI->endDrillDate->text().toStdString()); -// wellLR.SetCompleteDate(m_pUI->endWellDate->text().toStdString()); + wellLR.SetCas2Shot(m_pUI->caseTwoLength->text().toFloat()); + wellLR.SetSC2SDep(m_pUI->caseTwoSD->text().toFloat()); + wellLR.SetSC2SDep(m_pUI->caseTwoED->text().toFloat()); + + wellLR.SetSDrillDate(m_pUI->startDrillDate->text().toStdString()); + wellLR.SetEDrillDate(m_pUI->endDrillDate->text().toStdString()); + wellLR.SetCompleteDate(m_pUI->endWellDate->text().toStdString()); -// QList wellroundchildren; -// int count=pWell->GetAllWellRound(wellroundchildren); -// for(int i=0;i(wellroundchildren.at(i)); -// if(pWellR) { -// QString filename=pWellR->GetSlfFileName(); -// if(pWellR->GetName()!=""&&filename!="") -// { -// CLogIO a_cslfio; -// if(a_cslfio.Open(filename.toStdString().c_str(),CSlfIO::modeReadWrite)) -// { -// Slf_FILE_MESSAGE &nmssage=wellLR.GetFileMessage(); + // QList wellroundchildren; + // int count=pWell->GetAllWellRound(wellroundchildren); + // for(int i=0;i(wellroundchildren.at(i)); + // if(pWellR) { + // QString filename=pWellR->GetSlfFileName(); + // if(pWellR->GetName()!=""&&filename!="") + // { + // CLogIO a_cslfio; + // if(a_cslfio.Open(filename.toStdString().c_str(),CSlfIO::modeReadWrite)) + // { + // Slf_FILE_MESSAGE &nmssage=wellLR.GetFileMessage(); -// Slf_FILE_MESSAGE mssage; -// a_cslfio.GetFileMessage(mssage); -// strcpy(mssage.AreaName,nmssage.AreaName); -// strcpy(mssage.OilCompanyName,nmssage.OilCompanyName); -// mssage.TVD=nmssage.TVD; -// mssage.Xcoor=nmssage.Xcoor; -// mssage.Ycoor=nmssage.Ycoor; -// mssage.X0=nmssage.X0; -// mssage.Y0=nmssage.Y0; -// mssage.Kelly=nmssage.Kelly; -// mssage.azca=nmssage.azca; -// mssage.Altitude=nmssage.Altitude; + // Slf_FILE_MESSAGE mssage; + // a_cslfio.GetFileMessage(mssage); + // strcpy(mssage.AreaName,nmssage.AreaName); + // strcpy(mssage.OilCompanyName,nmssage.OilCompanyName); + // mssage.TVD=nmssage.TVD; + // mssage.Xcoor=nmssage.Xcoor; + // mssage.Ycoor=nmssage.Ycoor; + // mssage.X0=nmssage.X0; + // mssage.Y0=nmssage.Y0; + // mssage.Kelly=nmssage.Kelly; + // mssage.azca=nmssage.azca; + // mssage.Altitude=nmssage.Altitude; -// mssage.StartDrillDate=nmssage.StartDrillDate; -// mssage.EndDrillDate=nmssage.EndDrillDate; + // mssage.StartDrillDate=nmssage.StartDrillDate; + // mssage.EndDrillDate=nmssage.EndDrillDate; -// int len=strlen(filename.toStdString().c_str()); -// if(len>sizeof(mssage.WellName)) len=sizeof(mssage.WellName); -// strncpy(mssage.WellName,welln.toStdString().c_str(),len); -// mssage.WellName[len]=0; -// a_cslfio.SetFileMessage(mssage); -// } -// } -// } -// } + // int len=strlen(filename.toStdString().c_str()); + // if(len>sizeof(mssage.WellName)) len=sizeof(mssage.WellName); + // strncpy(mssage.WellName,welln.toStdString().c_str(),len); + // mssage.WellName[len]=0; + // a_cslfio.SetFileMessage(mssage); + // } + // } + // } + // } -// if(m_DialogType==1) { -// QString path=GetLogdataPath(); -// CObjProject *pPrj=GetProject(); -// path+=pPrj->GetName(); -// path+="/#"; -// path+=pWell->GetName(); -// CreateDir((char *)path.toStdString().c_str()); -// path+="/"; -// path+=pWell->GetName()+".well"; -// pWell->SetWellFileName(path); -// wellLR.SaveMeesge(path); -// return; -// } -// else wellLR.SaveMeesge(); -// if(oldname==welln) return; -// if(pOldWell) { -// if(pOldWell&&pWell) { -// if(pWell->isUsed()) { -// AfxMessageBox("文件正被使用中,无法重名名!\n确认后等待进度条结束再操作!"); -// return; -// } -// CDataTree *pDataTree=(CDataTree *)::GetProject()->m_pDataTree; -// QList wellroundchildren; -// int count=pWell->GetAllWellRound(wellroundchildren); -// QTreeWidgetItem *pOldwItem=GetTreeItem(pDataTree,pOldWell); -// QTreeWidgetItem *pwItem=GetTreeItem(pDataTree,pWell); -// RenameWellName(pOldWell,pWell); + QStringList slffiles; + chakan(path, slffiles, "*.slf"); + foreach(QString filename, slffiles ) + { + CLogIO a_cslfio; + if(a_cslfio.Open(filename.toStdString().c_str(),CSlfIO::modeReadWrite)) + { + Slf_FILE_MESSAGE &nmssage=wellLR.GetFileMessage(); -// for(int i=0;i(wellroundchildren.at(i)); -// if(pWellR) { -// QTreeWidgetItem *pItem=GetTreeItem(pDataTree,pWellR); -// if(pItem&&pOldwItem) { -// pwItem->removeChild(pItem); -// } -// } -// } -// if(pwItem) { -// CBaseObject *pBaseObject=(CBaseObject*)( pwItem->data(0,Qt::UserRole + 1).toLongLong() ); -// PaiObject * pObject =pBaseObject->GetPaiObject(); -// if(pObject->GetParent()) pObject->GetParent()->RemoveChild(pObject); -// if(pwItem->parent()) pwItem->parent()->removeChild(pwItem); -// std::vectorvChild; -// CPaiObjectHelper::RecursionGetAllChild(pObject,vChild ); -// foreach(PaiObject*pChild,vChild){ -// pDataTree->m_mapNodeItem.erase(dynamic_cast(pChild)); //cache为了加速根据object查找item -// } -// delete pwItem ; -// pwItem = NULL; -// QAction* ImportConvertorWellLogDataAct= ::GetGlobalCommand().GetAction(GetCmdID_ImportConvertorWellLogData(),true) ; -// ImportConvertorWellLogDataAct->setProperty("CurrentWellName",""); -// ImportConvertorWellLogDataAct->setProperty("CurrentWellRoundName",""); -// } -// } -// } -// else { -// if(pWell->isUsed()) { -// AfxMessageBox("文件正被使用中,无法重名名!\n确认后等待进度条结束再操作!"); -// return; -// } -// pWell->SetName(welln); -// RenameWellName(pWell,welln); -// } + Slf_FILE_MESSAGE mssage; + a_cslfio.GetFileMessage(mssage); + strcpy(mssage.AreaName,nmssage.AreaName); + strcpy(mssage.OilCompanyName,nmssage.OilCompanyName); + mssage.TVD=nmssage.TVD; + mssage.Xcoor=nmssage.Xcoor; + mssage.Ycoor=nmssage.Ycoor; + mssage.X0=nmssage.X0; + mssage.Y0=nmssage.Y0; + mssage.Kelly=nmssage.Kelly; + mssage.azca=nmssage.azca; + mssage.Altitude=nmssage.Altitude; + + mssage.StartDrillDate=nmssage.StartDrillDate; + mssage.EndDrillDate=nmssage.EndDrillDate; + + int len=strlen(filename.toStdString().c_str()); + if(len>sizeof(mssage.WellName)) len=sizeof(mssage.WellName); + strncpy(mssage.WellName,welln.toStdString().c_str(),len); + mssage.WellName[len]=0; + a_cslfio.SetFileMessage(mssage); + } + } + + + if(m_DialogType==1) { + QString path=GetLogdataPath(); + // CObjProject *pPrj=GetProject(); + // path+=pPrj->GetName(); + path+=pWell->GetPrjname(); + path+="/#"; + path+=pWell->GetName(); + CreateDir((char *)path.toStdString().c_str()); + path+="/"; + path+=pWell->GetName()+".well"; + pWell->SetWellFileName(path); + wellLR.SaveMeesge(path); + return; + } + else wellLR.SaveMeesge(); + if(oldname==welln) return; + + if(pWell->isUsed()) { + AfxMessageBox("文件正被使用中,无法重名名!\n确认后等待进度条结束再操作!"); + return; + } + pWell->SetName(welln); + + QString newWellpath=GetLogdataPath(); + newWellpath+=pWell->GetPrjname(); + newWellpath+="/#"; + newWellpath+=welln; + QDir ss; + if(ss.rename(path,newWellpath))//改目录名 + { + QString oldPath = newWellpath + "/" + oldname + ".well"; + QString newPath = newWellpath + "/" + welln + ".well"; + if(ss.rename(oldPath,newPath)) + { + SetWellRoundWellName(newPath, welln); + + QStringList slffiles; + chakan(newWellpath, slffiles, "*.slf"); + foreach(QString slfFile1, slffiles ) + { + SetWellRoundWellName(slfFile1, welln); + } + } + else + { + QMessageBox::warning(NULL,"提示","改目文件名不成功:\n"+oldPath+"\n 到 \n"+newWellpath); + return; + } + } + else { + QMessageBox::warning(NULL,"提示","改目录名不成功:\n"+path+"\n 到 \n"+newWellpath); + return; + } + + +// if(pOldWell) { +// if(pOldWell&&pWell) { +// if(pWell->isUsed()) { +// AfxMessageBox("文件正被使用中,无法重名名!\n确认后等待进度条结束再操作!"); +// return; +// } +// CDataTree *pDataTree=(CDataTree *)::GetProject()->m_pDataTree; +// QList wellroundchildren; +// int count=pWell->GetAllWellRound(wellroundchildren); +// QTreeWidgetItem *pOldwItem=GetTreeItem(pDataTree,pOldWell); +// QTreeWidgetItem *pwItem=GetTreeItem(pDataTree,pWell); +// RenameWellName(pOldWell,pWell); + +// for(int i=0;i(wellroundchildren.at(i)); +// if(pWellR) { +// QTreeWidgetItem *pItem=GetTreeItem(pDataTree,pWellR); +// if(pItem&&pOldwItem) { +// pwItem->removeChild(pItem); +// } +// } +// } +// if(pwItem) { +// CBaseObject *pBaseObject=(CBaseObject*)( pwItem->data(0,Qt::UserRole + 1).toLongLong() ); +// PaiObject * pObject =pBaseObject->GetPaiObject(); +// if(pObject->GetParent()) pObject->GetParent()->RemoveChild(pObject); +// if(pwItem->parent()) pwItem->parent()->removeChild(pwItem); +// std::vectorvChild; +// CPaiObjectHelper::RecursionGetAllChild(pObject,vChild ); +// foreach(PaiObject*pChild,vChild){ +// pDataTree->m_mapNodeItem.erase(dynamic_cast(pChild)); //cache为了加速根据object查找item +// } +// delete pwItem ; +// pwItem = NULL; +// QAction* ImportConvertorWellLogDataAct= ::GetGlobalCommand().GetAction(GetCmdID_ImportConvertorWellLogData(),true) ; +// ImportConvertorWellLogDataAct->setProperty("CurrentWellName",""); +// ImportConvertorWellLogDataAct->setProperty("CurrentWellRoundName",""); +// } +// } +// } +// else { +// if(pWell->isUsed()) { +// AfxMessageBox("文件正被使用中,无法重名名!\n确认后等待进度条结束再操作!"); +// return; +// } +// pWell->SetName(welln); +// RenameWellName(pWell,welln); +// } // // CDataImport::ChangetoSlf(wellLR.GetFileName().toStdString().c_str(),NULL); } CWellDialog::~CWellDialog() diff --git a/WellLogUI/src/WellLogDialog.cpp b/WellLogUI/src/WellLogDialog.cpp index d0b3acb..c6e09a1 100644 --- a/WellLogUI/src/WellLogDialog.cpp +++ b/WellLogUI/src/WellLogDialog.cpp @@ -175,7 +175,7 @@ void WellLogDialog::GetOKAndCancel(QPushButton* &okBtn,QPushButton* &cancelBtn) void WellLogDialog::DataToView(){} void WellLogDialog::ViewToData(){} -void WellLogDialog::Init() +void WellLogDialog::Init(CObjWell* pObject) { QPushButton* okBtn; QPushButton* cancelBtn; @@ -184,7 +184,7 @@ void WellLogDialog::Init() cancelBtn->setIcon(QIcon( ::GetImagePath() + "icon/Cancel.png")); QObject::connect(okBtn, SIGNAL(clicked()), this, SLOT(slotSave())); QObject::connect(cancelBtn, SIGNAL(clicked()), this, SLOT(slotCancel())); - + m_pObject = pObject; DataToView(); } int WellLogDialog::Validate() diff --git a/logPlus/DataImport.cpp b/logPlus/DataImport.cpp new file mode 100644 index 0000000..877fcb3 --- /dev/null +++ b/logPlus/DataImport.cpp @@ -0,0 +1,2098 @@ +/////////////////////// +/// +/// wangwei change part:ImportWellTrajectorys() for add read wis、slf,table、dev + +#pragma warning( push ,0) +#include +#include +#include +#include +// #include "BaseFun.h" +#include +#include "MemRdWt.h" +#include +// #include "ObjGeoLayerData.h" +#include "DepthProgress.h" +#include +// #include "ObjectEvent.h" +// #include "VecSceneManager.h" +#include "ConvertorManager.h" +// #include "ObjDiscreteWellLog.h" +#include "DataImport.h" + +#include "geometryutils.h" +// #include "CoreImageConfigDialog.h" +#include "ObjWell.h" +#include "ObjWelllog.h" +// #include "ObjWellTrajectory.h" +// #include "ObjBitmap.h" +// #include "ObjCrossplot.h" +// #include "VecDisplayObjectCommand.h" +// #include "ObjProject.h" +#include "ConvertorManager.h" +#include "IConvertor.h" +#include "ImportdataDialog.h" +// #include "ObjWellLogTrack.h" +#include "ObjWelllogRound.h" +// #include "ObjWellTrack.h" +#include "ConsoleOutputWidget.h" + +// #include "ObjGeostratums.h" +#include "ObjWelllogWavefile.h" +// #include "ObjWelllogBIN.h" +#include "ObjWelllogINP.h" +// #include "ObjWelllogFMT.h" +// #include "ObjWelllogTDT.h" +#include "ObjWelllogTABLE.h" +#include "InterIConvertor.h" +#include //2020.2.20 whp add +// #include "DataTree.h" +// #include "VecWindowCommand.h" +// #include "cdialog.h"//whp add 2020.3.17 +#include "tishidialog.h" +// #include "Log.h" + +#pragma warning( pop ) +// void OSGFRAMEWORK_EXPORT AppendConsole(pai::log::Priority priority,const QString &output); + +// BEGIN_OSGGRAPHICS_NAMESPACE; +extern QString g_prjname; +int CDataImport::flag1=-1; +int CDataImport::m_flag=-1; +int CDataImport::flag_check=0; +bool CDataImport::m_bImportByFolder = false; + +void CreateWellFile(CLogIO *logio,Slf_FILE_MESSAGE &mssage,QString wellFile,CObjWell *pWell) +{ + if(logio) { + CLogIO * logiowell=new CLogIO(); + Slf_FILE_MESSAGE ms=mssage; + strcpy(ms.Item,"井基本信息"); + logiowell->Open(wellFile.toStdString().c_str(),CSlfIO::modeWrite); + logiowell->SetFileMessage(ms); + QStringList azims=GetSimilarCurves("AZIM"); + int iAZIM=-1; + QString AZIM; + foreach(QString cname,azims) + { + iAZIM=logio->FindObjectName((char *)cname.toStdString().c_str()); + if(iAZIM>-1) { + AZIM=cname; + break; + } + } + int iDev=-1; + QStringList devis=GetSimilarCurves("DEVI"); + QString DEV; + foreach(QString cname,devis) + { + iDev=logio->FindObjectName((char *)cname.toStdString().c_str()); + if(iDev>-1) { + DEV=cname; + break; + } + } +// if(logio->FindObjectIndex("井基本信息")>-1) { +// logiowell->CopyFromFile((CSlfIO &)(*logio),"井基本信息"); +// } + if(iAZIM>-1)logiowell->CopyFromFile((CSlfIO &)(*logio),(char *)AZIM.toStdString().c_str()); + if(iDev>-1)logiowell->CopyFromFile((CSlfIO &)(*logio),(char *)DEV.toStdString().c_str()); + delete logiowell; + if(iDev>-1&&iAZIM>-1) { + pWell->ComputeTrajectory(pWell,wellFile); + } + } +} +// CObjWell * CDataImport::GetWellByName( QString strWellName ) +// { +// //得到或创建well +// CObjWell *pWell = NULL; +// if( GetProject() ) +// { +// PaiObject *pP=GetProject()->GetObjectByName( strWellName,GetClassID_Well()); +// pWell = dynamic_cast(pP); +// } + +// if( !pWell ) +// { +// pWell = new CObjWell(); +// pWell->SetName( strWellName ); +// if( GetProject() ) +// { +// GetProject()->GetWellsFolder(true)->AddChild( pWell ); +// } +// } +// return pWell; +// } + +// void CDataImport::AddWellNode(CVecSceneManager *pSceneManager,CObjWell *pWell,CObjWell *pWellInsertPos ) +// { +// if( !pWell ) return; +// QUuid ID = pWellInsertPos ? pWellInsertPos->GetID(): QUuid(); +// pSceneManager->AddObject( pWell,&ID ); + +// QListlistChild; +// pWell->GetChildren( listChild); +// for( long i = 0 ; i < listChild.size();++i ) +// { +// AddWellLogNode( pSceneManager,dynamic_cast( listChild[i] ),NULL ); +// } +// } + +// void CDataImport::AddWellLogNode(CVecSceneManager * pSceneManager,CObjWellLog *pWellLog,CObjWellLog *pWellLogInsertPos ) +// { +// QUuid ID = pWellLogInsertPos ? pWellLogInsertPos->GetID() : QUuid(); +// pSceneManager->AddObject( pWellLog,&ID ); +// } +int CDataImport::chakan(QList &wells,QString path,QStringList &wellfs,int &num,bool GetNum,DiDepthProgress *DepthProgress,char *pSuffix) +{ + QDir dir(path); + foreach(QFileInfo mfi ,dir.entryInfoList()) + { + if(mfi.isFile()) + { + if(pSuffix) { + if(mfi.fileName().lastIndexOf(pSuffix,-1,Qt::CaseInsensitive)==-1) continue; + } + else { + if(mfi.fileName().endsWith(".well",Qt::CaseInsensitive)) continue; + } + num++; + if(IsInvalidString(mfi.fileName())) { + wellfs.append(mfi.absoluteFilePath()); + continue; + } + if(GetNum) continue; + QString aa= mfi.completeBaseName()+"导入中"; + DepthProgress->SetShowName(aa.toStdString().c_str(),0); + DepthProgress->SetDepth(num,0); + CObjWell *pWell=ChangetoSlf(mfi.absoluteFilePath(),DepthProgress); + if(!pSuffix) { + if(pWell) wells.push_back(pWell); + else wellfs.append(mfi.absoluteFilePath()); + } + }else + { + if(mfi.fileName()=="." || mfi.fileName() == "..")continue; + chakan(wells,mfi.absoluteFilePath(),wellfs,num,GetNum,DepthProgress,pSuffix); + } + } + return num; +} +QList CDataImport::ImportWellTrajectorys(bool IsDir) +{ + CDataImport::flag_check=0; + CDataImport::flag1=-1; + CDataImport::m_flag=-1; + QList wells; + QString path; + if(IsDir) + { + static QString path1=::GetDataPath(); + path1=QFileDialog::getExistingDirectory(NULL,"选择目录",path1,QFileDialog::ShowDirsOnly); + if(path1.isEmpty()) return wells; + path=path1; + } + else { + ConvertorManager::GetInstance().LoadAllConvertorPlugin(); + ConvertorManager &pManager=ConvertorManager::GetInstance(); + pManager.all=0; + QVectorvSuffix=pManager.GetSupportFileExtensions(); + QString fileSuffix("数据文件("); + for (int i=0;iGetObjectByType(GetClassID_WellsFolder()); + // if(pObj) { + // CBaseObject * pBaseObject = dynamic_cast(pObj); + // if(pBaseObject) { + // CDataTree *pDatatree=(CDataTree *)::GetProject()->m_pDataTree; + // if(pDatatree) { + // QTreeWidgetItem* pItem=pDatatree->GetTreeItem(pBaseObject); + // pDatatree->ClickObjectCommand(pItem); + // } + // pBaseObject->SetCheckState(Qt::Checked); + // CVecWindow *pWindow=CVecWindowCommand::GetCurrentWindow(); + // CVecDisplayObjectCommand::ClickObjectCommand( pBaseObject->GetPaiObject(),pWindow); + // } + // } + // } + QStringList lpsFile; + if(wellfs.size()) + { + for(int nIndex =0;nIndexsetMessage("成功导入"+QString::number(wells.size())+"个井次文件,"+QString::number(wellfs.size())+"个文件无法识别:\r\n"+wellfs.join("\r\n")); + // m_dialog->setTitle("提示"); + // m_dialog->exec(); + // delete m_dialog; + } + else { + // AfxMessageBox(QString::number(num)+"个文件全部导入成功!"); + QMessageBox::information(NULL, "提示",QString::number(num)+"个文件全部导入成功!"); + } + QList wells1; + return wells1; +} +QList CDataImport::ImportWells(QString path,QStringList &wellfs,int *pNum,bool IsTran) +{ + char szTemp[64]; + strcpy(szTemp, ".well"); + ImportWells(path,wellfs,szTemp,NULL,IsTran); + wellfs.clear(); + return ImportWells(path,wellfs,(char*)NULL,pNum,IsTran); +} +QString GetWellFileFromDir(QString path,QString &WellName,char *pSuffix) +{ + QDir dir(path); + foreach(QFileInfo mfi ,dir.entryInfoList()) + { + if(mfi.isFile()) + { + QString tem=mfi.absoluteFilePath(); + if(tem.endsWith(pSuffix,Qt::CaseInsensitive)) { + CLogIO tf; + if(tf.Open(tem.toStdString().c_str(),CSlfIO::OpenFlags::modeRead)) { + Slf_FILE_MESSAGE mess; + tf.GetFileMessage(mess); + WellName=mess.WellName; + return tem; + } + } + } + else + { + if(mfi.fileName()=="." || mfi.fileName() == "..")continue; + QString tt=GetWellFileFromDir(mfi.absoluteFilePath(),WellName,pSuffix); + if(tt.isEmpty()) return tt; + } + } + return ""; +} +QString GetWellFileFromCurrentDir(QString path,QString WellName,char *pSuffix) +{ + QDir dir(path); + foreach(QFileInfo mfi ,dir.entryInfoList()) + { + if(mfi.isFile()) + { + QString tem=mfi.absoluteFilePath(); + if(tem.endsWith(pSuffix,Qt::CaseInsensitive)) { + return tem; + } + } + else + { + if(mfi.fileName()=="." || mfi.fileName() == "..")continue; + QString tt=GetWellFileFromCurrentDir(mfi.absoluteFilePath(),WellName,pSuffix); + if(tt.isEmpty()) return tt; + } + } + return ""; +} +QList CDataImport::ImportWells(QString path,QStringList &wellfs,char *pSuffix,int *pNum,bool IsTran) +{ +////////////////////////// +// FIRST is dir + QList wells; + if(path.isEmpty()) return wells; + int num=0; + QStringList listFiles; + QFileInfo mfi(path); + if(!mfi.isDir()) { + if(!mfi.isFile()) return wells; + listFiles.append(path); + if(pSuffix) { + CObjWell *pWell=NULL; + foreach(QString filename,listFiles) + { + QString WellName; + if(filename.endsWith(".slf",Qt::CaseInsensitive)) + { + QString wellname1,path1; + GetWellNameAndPath(filename,wellname1,path1); + QString path2=GetLogdataPath(); + if(path1.indexOf(path2)<0) { + int a=1; + } + CLogIO tem; + if(tem.Open(filename.toStdString().c_str(),CSlfIO::OpenFlags::modeRead)){ + Slf_FILE_MESSAGE mess; + tem.GetFileMessage(mess); + WellName=mess.WellName; + } + } + if(WellName.isEmpty()) continue; + QString wellname,path1; + GetWellNameAndPath(filename,wellname,path1); + QString stem=path1+"\\"; + stem+=wellname; + stem+=pSuffix; + QDir ft(stem); + if(ft.exists()) { + pWell=ChangetoSlf(stem,NULL,IsTran); + continue; + } + path1=GetWellFileFromDir(filename,WellName,pSuffix); + if(path1.isEmpty()) continue; + pWell=ChangetoSlf(path1,NULL,IsTran); + } + return wells; + } + num=listFiles.size(); + } + else { + QString fileSuffix("数据文件("); + ConvertorManager &pManager=ConvertorManager::GetInstance(); + pManager.all=0; + if(pSuffix) { + QString sSuffix="*."; + sSuffix+=pSuffix; + fileSuffix.append(sSuffix); + } + else { + ConvertorManager::GetInstance().LoadAllConvertorPlugin(); + QVectorvSuffix=pManager.GetSupportFileExtensions(); + for (int i=0;i=0) + { + listFiles.append(absolute_file_path); + } + else { + if(!pSuffix)wellfs.append(absolute_file_path); + } + } + } + if(listFiles.size()<1) return wells; + num=chakan(wells,path,wellfs,num,true,NULL,pSuffix); + if(num<1) return wells; + } + DiDepthProgress DepthProgress; + int progress=0; + QString sname="批量加载数据...";// + if(pSuffix) sname="遍历工区井.."; + DepthProgress.CreatProgress(0,num,sname.toStdString().c_str()); + foreach( QString wellFile,listFiles ) + { + QFileInfo w(wellFile); + if(w.isDir()) { + chakan(wells,wellFile,wellfs,progress,0,&DepthProgress,pSuffix); + } + else { + sname=w.completeBaseName()+"数据导入中"; + DepthProgress.SetShowName(sname.toStdString().c_str(),0); + DepthProgress.SetDepth(progress++,0); + CObjWell *pWell=ChangetoSlf(wellFile,&DepthProgress,IsTran); + if(!pSuffix) { + if(pWell) { + wells.push_back(pWell); + } + else wellfs.append(wellFile); + } + } + } + DepthProgress.DelProgress(); + if(pNum) *pNum=num; + return wells; +} +void CDataImport::LoadLayers(QStringList &listFiles) +{ + // CObjProject *pProj=::GetProject(); + // if(!pProj) return; + // if(!listFiles.size()) + // { + // QString path=GetLogdataPath();//GetProjectFolder() + // if(pProj) path=path+pProj->GetName(); + // QDir dir(path); + // if(!dir.exists()) + // { + // return; + // } + // dir.setFilter(QDir::NoDotAndDotDot |QDir::Files | QDir::NoSymLinks); + // QFileInfoList list = dir.entryInfoList(); + + // int file_count = list.count(); + // if(file_count <= 0) + // { + // return; + // } + // QStringList fileSuffix; + // fileSuffix.append("Layer"); + // QStringList string_list; + // listFiles.clear(); + // for(int i=0; i=0) + // { + // QString absolute_file_path = file_info.absoluteFilePath(); + // listFiles.append(absolute_file_path); + // } + // } + // } + // CBaseObject *pOSGObject =pProj->GetFolderObjectByClassID(GetClassID_GeoModelFolder(),true); + // PaiObject * pParentObject= pOSGObject->GetPaiObject(); + // QListlists; + // pParentObject->GetChildren(lists); + // for(int i=0;i(lists[i]); + // pParentObject->RemoveChild(pGeoLayerObj,true); + // } + // foreach( QString wellFile,listFiles ) { + // CObjGeoLayerData * pGeoLayerObj=new CObjGeoLayerData; + // QString sectionName,path0; + // GetWellNameAndPath(wellFile,sectionName,path0); + // if(!sectionName.isEmpty())pGeoLayerObj->SetName(sectionName); + // else pGeoLayerObj->SetName(wellFile); + // pParentObject->AddChild(pGeoLayerObj); + // } +} +void CDataImport::ImporttoTree(QString slfFileName,CLogIO *logio1,CObjWell *pWell,CObjWelllogRound* pWelllogRound,char *curvename) +{ +// // if(!pWelllogRound) return; +// CLogIO *logio=logio1; +// if(!logio) { +// logio=new CLogIO(); +// if(!logio->Open(slfFileName.toStdString().c_str(),CSlfIO::modeRead)) +// { +// delete logio; +// AppendConsole(pai::log::PAI_ERROR,"SLF文件打开失败,请检查!"); +// return; +// } +// } +// int i=logio->FindObjectName(curvename); +// if(i<0) { +// if(!logio1){ +// delete logio; +// } +// return; +// } + +// char aliasname[65]; +// aliasname[64]='\0'; +// logio->GetObjectName(i,curvename,NULL,aliasname); +// CObjWellLog * acurve; +// if(pWelllogRound) acurve=dynamic_cast(pWelllogRound->GetObjectByName(curvename)); +// else acurve=dynamic_cast(pWell->GetObjectByName(curvename)); +// if(dynamic_cast(acurve)) acurve=NULL; +// short curvetype=logio->GetObjectType(i); +// short Attribute=0,SubAttribute=0; +// logio->GetObjectAttribute(i,&Attribute,&SubAttribute); + +// if(acurve) { +// PaiObject *pP=acurve->GetParent(); +// if(dynamic_cast(pP)|| +// dynamic_cast(pP) +// ) acurve=NULL; +// else{ +// CDataTree *pTree=dynamic_cast(::GetProject()->m_pDataTree); +// if(pTree&&pTree->GetTreeItem(acurve)) +// { +// if(!logio1){ +// delete logio; +// } +// return; +// } +// } +// } + + +// PaiObject*pPai=NULL; +// if(curvetype==CURVE_OBJECT) +// { +// Slf_CURVE acurveinfo; +// logio->GetCurveInfo(i,&acurveinfo); +// int curveindex=logio->OpenCurve(curvename); +// if(curveindex<0) +// { +// if(!logio1){ +// delete logio; +// } +// return; +// } +// CObjWellLog * acurve=NULL; +// QStringList cnames=GetSimilarCurves("Trajectory"); +// if(!pWelllogRound&&cnames.contains(curvename)) { +// acurve=(CObjWellLog *) new CObjWellTrajectory(); +// } +// else { +// acurve=new CObjWellLog(); +// acurve->acurveinfo=acurveinfo; +// } +// acurve->m_ObjectType=CURVE_OBJECT; +// acurve->SetSlfFileName(slfFileName); +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetUnit(QString::fromStdString(acurveinfo.Unit)); +// acurve->SetAliasUnit(QString::fromStdString(acurveinfo.AliasUnit)); +// acurve->SetDepthUnit(QString::fromStdString(acurveinfo.DepthUnit)); +// acurve->SetDepthAliasUnit(QString::fromStdString(acurveinfo.DepthHZUnit)); +// acurve->SetpropertyMin(acurveinfo.MinValue); +// acurve->SetpropertyMax(acurveinfo.MaxValue); +// acurve->SetRlev(acurveinfo.DepLevel); +// acurve->SetTopDepth(acurveinfo.StartDepth); +// acurve->SetBottomDepth(acurveinfo.EndDepth); +// acurve->GetLogCurve().SetCurveAlias(acurveinfo.AliasName); +// acurve->GetLogCurve().SetUnit(acurveinfo.Unit); +// acurve->GetLogCurve().SetSampleInterval(acurveinfo.DepLevel); +// acurve->AutoMatchFamily(); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// pPai=acurve; +// } +// else if(curvetype==WAVE_OBJECT) +// { +// Slf_WAVE acurveinfo; +// logio->GetWaveInfo(i,&acurveinfo); +// CObjWellLog * acurve=new CObjWellLogWavefile(); +// acurve->m_ObjectType=WAVE_OBJECT; +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetUnit(QString::fromStdString(acurveinfo.Unit)); +// acurve->SetAliasUnit(QString::fromStdString(acurveinfo.AliasUnit)); +// acurve->SetDepthUnit(QString::fromStdString(acurveinfo.DepthUnit)); +// acurve->SetDepthAliasUnit(QString::fromStdString(acurveinfo.DepthHZUnit)); +// acurve->SetSlfFileName(slfFileName); +// acurve->SetTopDepth(acurveinfo.StartDepth); +// acurve->SetBottomDepth(acurveinfo.EndDepth); +// acurve->SetRlev(acurveinfo.DepLevel); +// acurve->GetLogCurve().SetSampleInterval(acurveinfo.DepLevel); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// pPai=acurve; +// } +// else if(curvetype==CARD_OBJECT) +// { +// if(SubAttribute==PARA_OBJECT) { +// CObjWellLog * acurve=new CObjWellLogINP(); +// acurve->m_ObjectType=CARD_OBJECT; +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetSlfFileName(slfFileName); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// } +// else { +// CObjWellLog * acurve=new CObjWellLogBIN(); +// acurve->m_ObjectType=CARD_OBJECT; +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetSlfFileName(slfFileName); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// } +// pPai=acurve; +// } +// else if(curvetype==FMT_OBJECT) +// { +// CObjWellLog * acurve=new CObjWellLogFMT(); +// acurve->m_ObjectType=FMT_OBJECT; +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetSlfFileName(slfFileName); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// pPai=acurve; +// } +// else if(curvetype==TDT_OBJECT) +// { +// CObjWellLog * acurve=new CObjWellLogTDT(); +// acurve->m_ObjectType=TDT_OBJECT; +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetSlfFileName(slfFileName); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// pPai=acurve; +// } +// else if(curvetype>CARD_OBJECT||curvetype==0) +// { +// if(pWelllogRound&&strcmp(curvename,"井基本信息")==0) return; +// CObjWellLog * acurve=new CObjWellLogTABLE(); +// acurve->m_ObjectType=TABLEE_OBJECT; +// acurve->SetName(QString::fromStdString(curvename)); +// acurve->SetAliasName(QString::fromStdString(aliasname)); +// acurve->SetSlfFileName(slfFileName); +// if(pWelllogRound)pWelllogRound->AddChild(acurve); +// else pWell->AddChild(acurve); +// pPai=acurve; +// } +// CObjWellLog *pLog=dynamic_cast(pPai); +// if(pLog) pLog->SetWell(pWell); +// if(!logio1){ +// delete logio; +// } +// return; +} +CObjWell *CDataImport::ChangetoSlf(QString wellFile1,DiDepthProgress *pDepthProgress) +{ + return ChangetoSlf(wellFile1,pDepthProgress,true); +} +CObjWell *CDataImport::ChangetoSlf(QString wellFile1,DiDepthProgress *pDepthProgress,bool IsTran) +{ + static QString temp = ::GetConfPath()+"data.ini"; + QSettings settings(temp,QSettings::IniFormat,0); + settings.setIniCodec(QTextCodec::codecForName("UTF-8")); + QStringList serials=settings.value("wellType",0).toStringList(); + CObjWell *pWell(NULL); + if(pDepthProgress) pDepthProgress->DelProgress(1); + + QString filename=wellFile1; + QString slffilename=filename; + +/////////////////// +//识别是否为系统格式,否则启动转换模块转换为系统格式 + if(!filename.endsWith(".slf",Qt::CaseInsensitive)&& + !filename.endsWith(".well",Qt::CaseInsensitive)&&IsTran) + { + QString logdata=GetLogdataPath()+g_prjname/*::GetProject()->GetName()*/; + logdata.replace('\\','/'); + logdata.replace("//","/"); + filename.replace("//","/"); + filename.replace("\\","/"); + if(filename.indexOf(logdata,0,Qt::CaseInsensitive)>-1) return pWell; + ConvertorManager &pManager=ConvertorManager::GetInstance(); + //按目录加载原始数据时解编入口 + QString slfName=ConvertorWellLogFiles(pManager,filename,pDepthProgress); + if(slfName!=""&&slfName!="abandoned"){//2020.3.19 放弃加载的文件名如何加入到提示中 + pWell=ChangetoSlf(slfName,pDepthProgress);//whp add 2019.12.12 + } + return pWell; + } + else { + QString wellname1,path1; + GetWellNameAndPath(filename,wellname1,path1); + QString prjname = g_prjname; + // if(GetProject()) prjname=GetProject()->GetName(); + QString path2="LogData\\"+prjname; + QString path3="LogData/"+prjname; + path1=path1.replace("\\\\","\\"); + path1=path1.replace("//","/"); + int a=path1.indexOf(path2,0,Qt::CaseInsensitive); + int b=path1.indexOf(path3,0,Qt::CaseInsensitive); + if(a<0&&b<0) { + QFile dd; + path2=GetLogdataPath(); + path2+=prjname+"\\#"+wellname1; + CreateDir((char *)path2.toStdString().c_str()); + path2+="\\"+wellname1+".slf"; + dd.copy(filename,path2); + slffilename=path2; + filename=path2; + } + + int iX=-1,iY=-1,iZ=-1; + CObjWelllogRound* pWelllogRound=NULL; + ///从文件内部读取井名 + CLogIO * logio=new CLogIO(); + if(!logio->Open(slffilename.toStdString().c_str(),CSlfIO::modeRead)) + { + delete logio; + QString aa=slffilename+"文件打开失败,请检查!"; + // AppendConsole(pai::log::PAI_ERROR,aa); + return pWell; + } + //说明从项目或者井节点发起attachSLF,需要读取slf获得井名和井次信息 + QString wellname=""; + QString wellRoundname=""; + Slf_FILE_MESSAGE mssage; + logio->GetFileMessage(mssage); + wellname=mssage.WellName; + wellname=wellname.toUpper(); + //辨别井名是否有效,无效则采用文件名 + QFileInfo fileInfo(filename); + QString strWellName = fileInfo.completeBaseName(); + strWellName=strWellName.toUpper(); + if (wellname.isEmpty()||wellname.length()>64||wellname.indexOf('&')>-1) + { + wellname=strWellName.toStdString().c_str(); + int len=strlen(strWellName.toStdString().c_str()); + if(len>sizeof(mssage.WellName)) len=sizeof(mssage.WellName); + strncpy(mssage.WellName,strWellName.toStdString().c_str(),len); + mssage.WellName[len]=0; + logio->SetFileMessage(mssage); + } + wellname=wellname.toUpper(); + // if(!GetProject() ) { + // delete logio; + // return NULL; + // } + // //挂接到树 + // PaiObject *pObject=GetProject()->GetObjectByName( wellname,2);//GetClassID_Well()); + // pWell = dynamic_cast( pObject ); + // if(!pWell) { + // CObjWellTrack *pWellTrack = dynamic_cast( pObject); + // if(pWellTrack&&pWellTrack->GetWelllogRound()) { + // pWell=pWellTrack->GetWelllogRound()->GetWell(); + // } + // } + if(!pWell) { + // pWell = CDataImport::GetWellByName(wellname); + // CDataTree *pTree=(CDataTree *)GetDataTree(); + // if(pTree) { + // PaiObject *pJ=GetProject()->GetObjectByType(GetClassID_WellsFolder()); + // QTreeWidgetItem* pItemF=pTree->GetTreeItem(dynamic_cast(pJ)); + // QTreeWidgetItem* pItem=pTree->GetTreeItem(pWell ); + // QTreeWidgetItem* pItemF1=NULL; + // if(pItem)pItemF1=pItem->parent(); + // if(pItemF1!=pItemF) { + // if(pItemF1)pItemF1->removeChild(pItem); + // if(pItemF)pItemF->addChild(pItem); + // } + // } + // if(!pWell) { + // delete logio; + // return NULL; + // } + + if( !pWell ) + { + pWell = new CObjWell(); + pWell->SetName( strWellName ); + } + + QString welln; + if(filename.endsWith(".slf",Qt::CaseInsensitive)) + { + QString dirpath=GetLogdataPath()+g_prjname/*GetProject()->GetName()*/; + + char szTemp[64]; + strcpy(szTemp, ".well"); + welln=GetWellFileFromDir(dirpath,wellname, szTemp); + if(welln.isEmpty()||(!pWell->GetName().isEmpty()&&wellname!=pWell->GetName())) { + wellname=pWell->GetName(); + int index=filename.lastIndexOf("\\"); + int index1=filename.lastIndexOf("/"); + if(index1>index) index=index1; + welln=GetWellFileFromCurrentDir(filename.left(index+1),wellname,szTemp); + if(welln.isEmpty()) { + welln=filename.left(index+1)+wellname+".well"; + CreateWellFile(logio,mssage,welln,pWell); + // CDataTree::SetTree(welln,pWell,NULL,(DepthProgress *)pDepthProgress,1); + } + } + } + else if(filename.endsWith(".well",Qt::CaseInsensitive))welln=filename; + pWell->SetWellFileName(welln); + } + wellRoundname=strWellName; + //查找是否已经存在该井和井次 + int isrefress=0; + if(!filename.endsWith(".well",Qt::CaseInsensitive)) { + pWelllogRound=dynamic_cast( pWell->GetObjectByName(wellRoundname,GetClassID_WellLogRound())); + if(pWelllogRound) + { + QString cs=pWelllogRound->GetSlfFileName(); + cs.replace('\\','/'); + cs.replace("//","/"); + QString cs1=filename; + cs1.replace('\\','/'); + cs1.replace("//","/"); + if(cs1.compare(cs,Qt::CaseInsensitive)!=0) { + QString cs2=cs+"\n"; + cs2+=cs1+"为同一井次文件!\n"; + cs2+="按重名文件加载!"; + // AppendConsole(pai::log::PAI_ERROR,cs2); + wellRoundname+="_重名文件"; + strcpy(mssage.Item,wellRoundname.toStdString().c_str()); + pWelllogRound=NULL;//return 0; + } + } + if(!pWelllogRound) + { + // pWelllogRound=new CObjWelllogRound(); + // pWelllogRound->SetWell(pWell); + // pWell->AddChild(pWelllogRound); + + // pWell->SetCurrentObjWellRound(pWelllogRound); + if(strstr(mssage.Item,"常规")) { + strncpy(mssage.Item,wellRoundname.toStdString().c_str(),sizeof(mssage.Item)); + mssage.Item[strlen(wellRoundname.toStdString().c_str())]=0; + } + if(strlen(mssage.Item)) { + wellRoundname=mssage.Item; + } + else { + int len=strlen(wellRoundname.toStdString().c_str()); + if(len>sizeof(mssage.Item)) len=sizeof(mssage.Item); + strncpy(mssage.Item,wellRoundname.toStdString().c_str(),len); + mssage.Item[len]=0; + logio->SetFileMessage(mssage); + } + // wellRoundname=wellRoundname.toUpper(); + // pWelllogRound->SetName(wellRoundname); + // pWelllogRound->SetSlfFileName(filename); + } + else { + isrefress=true; + } + } + QString temp = ::GetConfPath()+"data.ini"; + QSettings settings(temp,QSettings::IniFormat,0); + settings.setIniCodec(QTextCodec::codecForName("UTF-8")); + QStringList serials=settings.value("wellType",0).toStringList(); + int type=serials.indexOf(mssage.WellType); + + if(type>-1) pWell->SetWellSymbol("well" + QString::number(type) + ".png"); + + //else isrefress=true; + float Altitude=mssage.Altitude; + float X_COORDINATE=mssage.Xcoor; + float Y_COORDINATE=mssage.Ycoor;//井斜x,y坐标 + WellHead &mWellHead=pWell->GetWellHead(); + if(mssage.Kelly==9999999) mssage.Kelly=0; + if(mssage.Kelly==-9999) mssage.Kelly=0; + if(mssage.Kelly==-99999) mssage.Kelly=0; + if(mssage.azca) mWellHead.azca=mssage.azca; + if(mssage.Kelly)mWellHead.dEle=ConvertDataByFloat(mssage.Kelly).toFloat(); + if(mssage.WellName[0])mWellHead.wellName=mssage.WellName; + if(X_COORDINATE)mWellHead.x=X_COORDINATE; + if(Y_COORDINATE)mWellHead.y=Y_COORDINATE; + if(Altitude)mWellHead.earthEle=Altitude; + if(mssage.X0)mWellHead.dxe=mssage.X0; + if(mssage.Y0)mWellHead.dyn=mssage.Y0; + if(mssage.TVD)mWellHead.tvd=mssage.TVD; + Slf_CURVE acurveinfo; + memset(&acurveinfo,0,sizeof(Slf_CURVE)); + int curveCount=logio->GetObjectCount(); + if(isrefress) { + logio->DiscardObject("X"); + logio->DiscardObject("Y"); + logio->DiscardObject("Z"); + logio->DiscardObject("TVD"); + } + iX=logio->OpenCurve("X"); + iY=logio->OpenCurve("Y"); + iZ=logio->OpenCurve("Z"); + if(iX>-1) logio->GetCurveInfo(iX,&acurveinfo); + + mWellHead.depth=acurveinfo.StartDepth; + if(mWellHead.tvd==0&&acurveinfo.StartDepth!=0)mWellHead.tvd=acurveinfo.StartDepth; + mWellHead.z=mWellHead.earthEle-mWellHead.tvd+mWellHead.dEle; + mWellHead.startDepth=acurveinfo.StartDepth; + mWellHead.endDepth=acurveinfo.EndDepth; + mWellHead.rlev=acurveinfo.DepLevel; + int iDepth=-1; + iDepth=logio->OpenCurve("TVD"); + if(iX>=0&&iY>=0&&iZ>=0&&iDepth>=0) { + logio->GetCurveInfo(iX,&acurveinfo); + if(acurveinfo.DepLevel==0) { + logio->DiscardObject(iX); + logio->DiscardObject(iY); + logio->DiscardObject(iZ); + logio->DiscardObject(iDepth); + delete logio; + pWell->ComputeTrajectory(pWell,filename); + } else { + delete logio; + pWell->SetDepth(pWell); + } + } + else { + delete logio; + pWell->ComputeTrajectory(pWell,slffilename); + } + logio=new CLogIO(); + if(!logio->Open(slffilename.toStdString().c_str(),CSlfIO::modeRead)) + { + delete logio; + QString aa=slffilename+"文件打开失败,请检查!"; + // AppendConsole(pai::log::PAI_ERROR,aa); + return pWell; + } + curveCount=logio->GetObjectCount(); + char* curvename=new char[65]; + curvename[64]='\0'; + char* aliasname=new char[65]; + aliasname[64]='\0'; + for(int i=0;iGetObjectName(i,curvename,NULL,aliasname); + if(!logio->IsObject(i)) { + logio->DiscardObject(i); + continue; + }; + if(logio->GetObjectStatus(i)!=OBJECT_NORMAL) continue; + short curvetype=logio->GetObjectType(i); + short Attribute=0,SubAttribute=0; + logio->GetObjectAttribute(i,&Attribute,&SubAttribute); + if(curvetype==CURVE_OBJECT) + { + Slf_CURVE acurveinfo; + logio->GetCurveInfo(i,&acurveinfo); + if(acurveinfo.DepLevel!=0&&(acurveinfo.EndDepth-acurveinfo.StartDepth>0)) + { + if(acurveinfo.MaxValue==acurveinfo.MinValue||acurveinfo.MaxValue==-99999||acurveinfo.MaxValue==-9999||acurveinfo.MinValue==999999||acurveinfo.MinValue==999999||acurveinfo.MinValue==99999||acurveinfo.MinValue==99999||acurveinfo.MinValue==-9999){ + int curveindex=logio->OpenSlfTable(i,-1); + if(curveindex>-1) + { + MyDataTypeEnum vVdl; + DWORD count=(acurveinfo.EndDepth-acurveinfo.StartDepth)/acurveinfo.DepLevel+1.5; + DWORD len=count*acurveinfo.CodeLen; + acurveinfo.MinValue=99999999; + acurveinfo.MaxValue=-99999999; + if(acurveinfo.CodeLen==8) acurveinfo.MinValue=99999999; + vVdl.vchar=new char[len]; + len=logio->ReadCurve(curveindex, acurveinfo.StartDepth,count,(void *)vVdl.vchar); + if(!len) { + QString cs; + char buf[1000]; + sprintf(buf,"%s %f-%f",acurveinfo.Name,acurveinfo.StartDepth,acurveinfo.EndDepth); + cs=buf; + int flag = QMessageBox::warning(NULL,"提示",QString(cs+"\n曲线信息异常!删除该曲线可能需要较长时间,建议复制正常曲线等信息到新文件,然后删除此文件。是否此时直接将该曲线删除?"),QMessageBox::Yes,QMessageBox::No); + if(flag==QMessageBox::Yes) logio->DiscardObject(i); + delete vVdl.vchar; + continue; + } + for(int kk=0;kkGetData(acurveinfo.RepCode,&vVdl.vchar[kk*acurveinfo.CodeLen],buf); + if(_isnan(temp)||!_finite(temp)) continue; + + if(acurveinfo.MaxValuetemp) if(temp!=-9999.0&&temp!=-999.25&&temp!=-99999.0)acurveinfo.MinValue=temp; + } + logio->SetCurveInfo(curveindex,&acurveinfo); + delete vVdl.vchar; + } + } + } + else if(acurveinfo.DepLevel==0||acurveinfo.StartDepth<-100000||acurveinfo.StartDepth>100000) + { + QString cs; + char buf[1000]; + sprintf(buf,"%s %f-%f",acurveinfo.Name,acurveinfo.StartDepth,acurveinfo.EndDepth); + cs=buf; + int flag = QMessageBox::warning(NULL,"提示",QString(cs+"\n曲线信息异常!删除该曲线可能需要较长时间,建议复制正常曲线等信息到新文件,然后删除此文件。是否此时直接将该曲线删除?"),QMessageBox::Yes,QMessageBox::No); + if(flag==QMessageBox::Yes) logio->DiscardObject(i); + continue; + } + } + } + delete []curvename; + delete []aliasname; + DepthProgress *pd=new DepthProgress; + pd->CreatProgress(0,2,"正在整理数据..."); + pd->SetDepth(1); + delete logio; + delete pd; +///////////////////// + pai::ios::welllog::Well& topwell=pWell->GetDBWell(); + topwell.SetTopDepth(pWell->GetTopWellLogDepth()); + topwell.SetBottomDepth(pWell->GetBottomWellLogDepth()); + if(X_COORDINATE)topwell.SetXCode(X_COORDINATE); + if(Y_COORDINATE)topwell.SetYCode(Y_COORDINATE); + if(mssage.Altitude)topwell.SetAsl(mssage.Altitude); + if(mssage.Kelly)topwell.SetBsl(ConvertDataByFloat(mssage.Kelly).toFloat()); + // topwell.SetItem(mssage.Item); + + ///////////// + topwell.LoadMeesge(filename); + // if(pWelllogRound&&pWelllogRound->GetChildrenCount()>2) { + // isrefress=1; + // } + // if(isrefress) { + // QString slfFileName=filename; + // CDataTree::SetTree(slfFileName,pWell,pWelllogRound,(DepthProgress *)pDepthProgress,1); + // } + } + + return pWell; +return NULL; +} +void CDataImport::ImportCoreImage() +{ + // QStringList listFiles=GetFileNames("选择文件","图片文件(*.jpg)"); + // CObjCoreImage* pCoreImage = new CObjCoreImage(); + + // std::vectorvCoreImage; + // foreach( QString imageFile,listFiles ) + // { + // //得到或创建well + // QFileInfo fileInfo(imageFile); + // QString strWellName = fileInfo.completeBaseName(); + + + // CoreImage coreImage; + + // LinePro linePro; + // linePro.lineColor = QColor(Qt::black); + // linePro.lineWidth = 1; + // linePro.lineStyle = Qt::SolidLine; + + // coreImage.m_imageFile = imageFile; + // coreImage.m_startDepth = 0; + // coreImage.m_endDDepth = 0; + // coreImage.m_leftDepth = 0; + // coreImage.m_rightDepth = 0; + // coreImage.m_border = linePro ; + // //pCoreImage->m_childrenItems.push_back(coreImage); + // vCoreImage.push_back(coreImage); + + // } + // pCoreImage->SetImageObjects( vCoreImage ); + + // if(listFiles.size() > 0) + // { + // pai::gui::CoreImageConfigDialog* pDialog = new pai::gui::CoreImageConfigDialog(); + // pDialog->SetCoreImages( pCoreImage ); + // if(pDialog->exec() == QDialog::Accepted) + // { + // //TODO这里要找到当前曲线,不可写死 + // CObjWell *pWell = CDataImport::GetWellByName( "A10" ); + // pWell->AddChild( pCoreImage ); + // } + // } +} + +void CDataImport::ImportBitmaps() +{ + // QStringList listFiles=GetFileNames("选择文件","图片文件(*.jpg)"); + // qsrand(qrand()); + // foreach( QString imageFile,listFiles ) + // { + + // // create Image object + // int nWidth = qBound( 0,qrand(),1000 ); + // int nHeight = nWidth ; + // CObjBitmap *pImageObject = new CObjBitmap( QRectF( qBound( 0,qrand(),1000 ),qBound( 0,qrand(),1000 ), + // nWidth,nHeight ),imageFile ); + + // // set name + // QFileInfo fileInfo( imageFile ); + // pImageObject->SetName( fileInfo.completeBaseName() ); + + // // add to project + // if( ::GetProject() ) + // { + // ::GetProject()->AddChild( pImageObject ); + // } + // } +} + +void CDataImport::ImportConvertorWellLogFiles(QString wellname,QString wellroundname) +{ +// AppendConsole(pai::log::PAI_INFO,QObject::tr("解编模块启动中...")); +// ConvertorManager &pManager=ConvertorManager::GetInstance(); +// QVectorvSuffix=pManager.GetSupportFileExtensions(); +// // if (vSuffix.empty()) +// // return; +// QString fileSuffix("数据文件("); +// for (int i=0;i1) { +// DepthProgress.CreatProgress(0,listFiles.size(),"数据加载",0); +// int progress=0; +// char aa[1000]; +// //whp change 2019.12.08 for 输出成功加载的文件个数 +// int errNum=0,okNum=0,abandonedNum=0;//2020.3.19 放弃加载; +// QStringList errFile,abandonedFile;//2020.3.19 +// //whp add 2020.3.19 +// CDataImport::flag1=-1; +// CDataImport::m_flag=-1; +// CDataImport::flag_check=0;// +// foreach(QString iFile,listFiles ) { +// progress++; +// sprintf(aa,"待加载数据文件%d个,当前正在加载:%s",listFiles.size(),iFile.toStdString().c_str()); +// DepthProgress.SetShowName(aa,0); +// DepthProgress.SetDepth(progress,0); +// //多个测井数据加载时解编入口 +// QString slfName=ConvertorWellLogFiles(pManager,iFile,&DepthProgress); +// if(slfName=="") +// { +// errNum++; +// errFile.append(iFile); +// } +// else if(slfName=="abandoned")//2020.3.19 放弃加载 +// { +// abandonedNum++; +// abandonedFile.append(iFile); +// } +// else +// { +// CObjWell* pWell=ChangetoSlf(slfName,&DepthProgress);//whp add 2019.12.12 +// if(!pWell) { +// errNum++; +// errFile+=iFile; +// errFile+="\r\n"; +// } +// } +// } +// DepthProgress.DelProgress(); +// CObjProject *pPrj=::GetProject(); +// if(pPrj) { +// PaiObject *pObj=pPrj->GetObjectByType(GetClassID_WellsFolder()); +// if(pObj) { +// CBaseObject * pBaseObject = dynamic_cast(pObj); +// if(pBaseObject) { +// CDataTree *pDatatree=(CDataTree *)::GetProject()->m_pDataTree; +// if(pDatatree) { +// QTreeWidgetItem* pItem=pDatatree->GetTreeItem(pBaseObject); +// pDatatree->ClickObjectCommand(pItem); +// } +// pBaseObject->SetCheckState(Qt::Checked); +// CVecWindow *pWindow=CVecWindowCommand::GetCurrentWindow(); +// CVecDisplayObjectCommand::ClickObjectCommand( pBaseObject->GetPaiObject(),pWindow); +// } +// } +// } + +// //2020.3.17需要修改 +// QString mes=""; +// if(errNum||abandonedNum) +// { +// mes="成功导入"+QString::number(listFiles.size()-errNum-abandonedNum)+"个文件;"; +// if(abandonedNum) mes+="放弃导入"+QString::number(abandonedNum)+"个数据文件;"; +// if(errNum)mes+="\r\n"+QString::number(errNum)+"个数据文件无法识别:\r\n"+errFile.join("\r\n"); +// CDialog* m_dialog=new CDialog(); +// m_dialog->setMessage(mes); +// m_dialog->setTitle("提示"); +// m_dialog->exec(); +// delete m_dialog; +// } +// else { +// mes=QString::number(listFiles.size())+"个文件全部导入成功!"; +// QMessageBox::about(NULL,"提示",mes); +// } +// } +// else { +// DepthProgress.CreatProgress(0,1,"数据加载",0); +// DepthProgress.SetDepth(1,0); +// QString us=listFiles[0].toLower(); +// QFileInfo currentfile(us); +// us=currentfile.suffix(); +// // if(us.indexOf("slf")>-1||us.indexOf("wis")>-1) { +// //whp add 2019.12.09 for .well +// if(us.indexOf("slf")>-1||us.indexOf("well")>-1) { +// ChangetoSlf(listFiles[0]); +// QString message=listFiles[0]+"解编结束"; +// AppendConsole(pai::log::PAI_INFO,QObject::tr(message.toStdString().c_str())); +// return; +// } +// DepthProgress.SetShowName("类型识别",0); +// QVector vConvertor=pManager.GetSupportConvertors(listFiles[0],&DepthProgress); +// // if (vConvertor.empty()) return ; +// if (vConvertor.empty()) +// { +// QMessageBox::information(NULL,"无法识别的文件",listFiles[0]); +// return ; +// } +// ImportDataDialog *pDialog = new ImportDataDialog(NULL,wellname,wellroundname); +// pDialog->DisplayFileInformationAreaData(vConvertor,listFiles[0]); +// ::GetObjectEvent().OnActiveConvertorWindow( pDialog ); +// } +// AppendConsole(pai::log::PAI_INFO,QObject::tr("解编模块解编结束")); +} +//whp change 2019.12.08 for 输出成功加载的文件个数 +//void +//bool +//whp add 2020.2.28 for 检查井名文件名是否存在,若存在,获取井次全路径文件名 +QString CDataImport::GetOutName(QString wellname,QString filename) +{ + // CObjProject *pPrj=::GetProject(); + // PaiObject *pObj=pPrj->GetObjectByType(GetClassID_WellsFolder()); + // QList childs; + // pObj->GetChildren(childs); + // int wellnum=childs.count(); + // foreach(PaiObject *pChild,childs) + // { + // CObjWell *pWell=dynamic_cast(pChild); + // if(pWell) + // { + // QString well=pWell->GetName().toUpper(); + // if(well==wellname.toUpper()) + // { + // QList childsRound; + // pChild->GetChildren(childsRound); + // foreach(PaiObject *pChildRound,childsRound) + // { + // CObjWelllogRound *pWellRound=dynamic_cast(pChildRound); + // if(pWellRound) + // { + // QString file=pWellRound->GetName().toUpper(); + // if(file==filename.toUpper()) + // { + // QString outname=pWellRound->GetSlfFileName(); + // return outname; + // } + // } + // } + // } + // } + // } + return ""; + } +////whp change 2020.2.28 for 检查井名、文件名是否存在,若存在,使用已存在的输出路径(主要针对更名后的井文件) +QString CDataImport::ConvertorWellLogFiles(ConvertorManager &pManager,QString wellname,DiDepthProgress *DepthProgress) +{ + QString iFile=wellname; + QString us1=iFile.toLower(); + QFileInfo currentfile(us1); + QString us=currentfile.suffix(); + //whp add 2019.12.09 for .well + if(us.indexOf("slf")>-1||us.indexOf("well")>-1) { + //ChangetoSlf(iFile,DepthProgress); + //return 1; + return iFile;//whp change 2019.12.12 + } + QVector vConvertor=pManager.GetSupportConvertors(iFile,DepthProgress); + if(vConvertor.size()>1) { + QString s=iFile+"解编模块不唯一,无法批量解编!"; + // AppendConsole(pai::log::PAI_INFO,s); + return "";//0;//whp change 2019.12.12 + } + if(vConvertor.size()==0) { + QString s=iFile+"无法识别数据类型,无法解编!"; + // AppendConsole(pai::log::PAI_INFO,s); + return "";//0;//whp change 2019.12.12 + } + InterIConvertor *v=(InterIConvertor *)vConvertor[0]; + QList ObjWellLogs= v->GetWellLogList(iFile); + int c=ObjWellLogs.size(); + for(int i=0;iGetWellInfo(); + MyWelllogRound* r=v->GetWellLogRoundInfo(); + QString WellName=well->GetName().c_str();//取的谁的名字?跟踪遇见的都是空 + + // if(WellName==""){//应用当前选中井名 + // QAction* ImportConvertorWellLogDataAct= ::GetGlobalCommand().GetAction(GetCmdID_ImportConvertorWellLogData(),true) ; + // WellName = ImportConvertorWellLogDataAct->property("CurrentWellName").value(); + // } + + //whp change 2020.2.18 for 汉字井名转换有乱码 + if(WellName=="") WellName=QString(QString::fromLocal8Bit(v->FILE_MESSAGE.WellName)); //QLatin1String(v->FILE_MESSAGE.WellName);//for 带有井名信息的原始数据,如ASCII + //该语句不可用,发现clis文件中的井名 + //add end + if(WellName=="") WellName=r->GetName().c_str(); + QString strWellName; + // CObjProject *pProject = ::GetProject(); + // if(pProject != NULL) + // { + // strWellName = pProject->GetName(); + // } + strWellName = g_prjname; + QString dir0,dir=::GetLogdataPath();//whp add 2020.2.19 for 非法井名,无法产生井目录 + QDir w; + if(!strWellName.isEmpty()) { + dir=dir+strWellName; + bool ok=w.mkdir(dir); + dir+=QDir::separator(); + } + QString tempWellName; + QString filename=r->GetName().c_str(); + if(filename=="") filename=WellName; + //whp add 2020.3.3 删除井名中的空格 + WellName.replace(" ",""); + WellName=WellName.toUpper(); + //whp add 2020.3.3 删除".zh"之类的后缀之类的后缀 + QFileInfo temDir(WellName); + WellName=temDir.baseName(); + +////// + char *pmessage=v->GetfileMessage(); + if(pmessage) { + char *p=pmessage; + p+=strlen(p)+1; + if(strlen(p)>0&&strlen(p)<20) { + p+=strlen(p)+1; + p+=strlen(p)+1; + tempWellName=p; + } + else tempWellName=""; + } + //whp change 2020.2.18 for 文件名中有一个以上的“."时,如3Oq.ZH.716 + //QFileInfo temDir(filename); + //if(tempWellName=="") tempWellName=temDir.completeBaseName(); + if(tempWellName=="") tempWellName=filename; + QString outputfilename=GetOutName(WellName,tempWellName); + if(outputfilename=="") + { + dir0=dir;//whp add 2020.2.19 for 非法井名,无法产生井目录 + dir+="#"+WellName; + bool ok=w.mkdir(dir); + //whp add 2020.2.19 for 非法井名,无法产生井目录 + QDir mdir(dir); + if(mdir.exists())ok=1; + if(!ok) + { + dir=dir0; + QFileInfo temDir(iFile); + WellName=temDir.completeBaseName(); + outputfilename=GetOutName(WellName,tempWellName); + if(outputfilename=="") + { + dir+="#"+WellName; + ok=w.mkdir(dir); + if(!ok) + { + QString mes="解编"+iFile+"文件时,产生井文件目录失败:\r\n井文件目录:"+dir; + QMessageBox::about(NULL, QObject::tr("警告"), mes); + return ""; + } + outputfilename=dir; + outputfilename+=QDir::separator(); + outputfilename+=tempWellName; + outputfilename+=".slf"; + } + } + else outputfilename=dir+QDir::separator()+tempWellName+".slf"; + } + char *outfile = new char[outputfilename.toStdString().size()+200]; + strcpy(outfile, outputfilename.toStdString().c_str()); + +/* //whp add 2019.12.10 for 如果文件存在,提示是否覆盖 + QFileInfo mfi(outfile); + //2020.3.19 + if(mfi.isFile()) + { + + if(CDataImport::flag_check)//&&CDataImport::flag1!=-1) + { + if(CDataImport::flag1==QMessageBox::Cancel)return "abandoned";//放弃加载 + else if(CDataImport::flag1==QMessageBox::No){ + QDir ss;ss.remove(outfile); + } + } + else //if(mfi.isFile()) + {//whp change 2020.2.28 + QMessageBox box(QMessageBox::Warning,"提示","输出文件"+QString::fromLocal8Bit(outfile)+"已存在!"); + //box.setStandardButtons (QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel|QMessageBox::YesAll|QMessageBox::NoAll|QMessageBox::Apply); + box.setStandardButtons (QMessageBox::Yes|QMessageBox::Cancel|QMessageBox::YesAll|QMessageBox::Apply); + box.setButtonText (QMessageBox::Yes,QString("覆盖当前"));//\r\n已存在文件")); + // box.setButtonText (QMessageBox::No,QString("重建\r\n当前文件")); + box.setButtonText (QMessageBox::YesAll,QString("覆盖所有"));//\r\n已存在文件")); + // box.setButtonText (QMessageBox::NoAll,QString("全部\r\n执行重建")); + box.setButtonText (QMessageBox::Cancel,QString("放弃当前"));//\r\n文件解编")); + box.setButtonText (QMessageBox::Apply,QString("放弃所有"));//\r\n已存在文件解编")); + int ret=box.exec(); + if(ret==QMessageBox::YesAll||ret==QMessageBox::Yes) CDataImport::flag1 =QMessageBox::Yes; + //if(ret==QMessageBox::NoAll||ret==QMessageBox::No) CDataImport::flag1 =QMessageBox::No; + if(ret==QMessageBox::Cancel||ret==QMessageBox::Apply) CDataImport::flag1 =QMessageBox::Cancel; + //if(ret==QMessageBox::NoAll||ret==QMessageBox::YesAll||ret==QMessageBox::Apply) CDataImport::flag_check=1; + if(ret==QMessageBox::YesAll||ret==QMessageBox::Apply) CDataImport::flag_check=1; + if(CDataImport::flag1==QMessageBox::Cancel)return "abandoned";//放弃加载 + //else if(CDataImport::flag1==QMessageBox::No)QDir ss;ss.remove(outfile); + } + } + //add end*/ + char *logfilename = new char[iFile.toStdString().size()+1]; + + strcpy(logfilename, iFile.toStdString().c_str()); + + int l=strlen(outfile)+1; + double x=well->GetXCode(); + strcpy(&outfile[l],QString::number(x).toStdString().c_str());//x坐标 + double y=well->GetYCode(); + l+=strlen(&outfile[l])+1; + strcpy(&outfile[l],QString::number(y).toStdString().c_str());//y坐标 + + QString top="-99999.";//QString::number(r->GetTopDepth()); + l+=strlen(&outfile[l])+1; + strcpy(&outfile[l],top.toStdString().c_str());//y坐标 + + QString bottom="-99999.";//QString::number(r->GetBottomDepth()); + l+=strlen(&outfile[l])+1; + strcpy(&outfile[l],bottom.toStdString().c_str());//y坐标 + l+=strlen(&outfile[l])+1; + int iRow=v->GetWellCurves().Curve_Num; + *(int *)&outfile[l]=iRow; + //TODO + vector OutCurveNo; + vector OutCurve=v->GetCurveNames(); + vector strChineseName=v->GetCurveNames(); + vector strUnit=v->GetCurveUnits(); + for(int i=0;i ExistCurveNo; + vector ExistCurve; + int ExistCurveNum=0; + logio->Open(qss.toStdString().c_str(),CSlfIO::modeRead); + for(int i=0;iFindObjectName(OutCurve[i]); + if(logio->FindObjectName(OutCurve[i],-1,-1,OBJECT_NORMAL)<0)continue; + ExistCurve.push_back(OutCurve[i]); + ExistCurveNo.push_back(i); + } + if(ExistCurve.size()>0)//输出对象是否存在 + { + if(!CDataImport::flag_check) + { + QString name=qss; + int index=name.lastIndexOf("/"); + int index1=name.lastIndexOf("\\"); + if(index1>index)index=index1; + name=name.mid(index+1); + name=name.left(name.lastIndexOf(".")); + Slf_FILE_MESSAGE mes; + logio->GetFileMessage(mes); + QString m_WellAndRound=QString::fromLocal8Bit(mes.WellName)+"井"+name; + TiShiDialog *dlg=new TiShiDialog(NULL); + dlg->init(ExistCurve,m_WellAndRound);//qss); + + if(dlg->exec()==QDialog::Accepted) + { + CDataImport::flag1=dlg->flag; + CDataImport::m_flag=dlg->flag; + CDataImport::flag_check=dlg->check; + } + } + int mflag=CDataImport::m_flag; + if(mflag==0)//跳过 + { + for(int i=0;iDiscardObject(ExistCurve[i]); + } + } + else if(mflag==3)//另存 + { + QStringList OutCurveList; + for(int i=0;iGetObjectCount();i++) + { + char name[64]; + if(logio->GetObjectStatus(i)!=OBJECT_NORMAL)continue; + logio->GetObjectName(i,name); + OutCurveList.append(QString(name)); + } + for(int i=0;iClose(); + } +// bool CheckExistCurve(QString outputfilename,int NumLog,vector& OutCurveNo,vector& OutCurve); + + + if(logio->Open(qss.toStdString().c_str(),CSlfIO::modeRead)) + { + Slf_FILE_MESSAGE FILE_MESSAGE=v->FILE_MESSAGE; + logio->GetFileMessage(v->FILE_MESSAGE); + + if(v->FILE_MESSAGE.Xcoor!=FILE_MESSAGE.Xcoor) { + if(FILE_MESSAGE.Xcoor!=0) v->FILE_MESSAGE.Xcoor=FILE_MESSAGE.Xcoor; + } + if(v->FILE_MESSAGE.Ycoor!=FILE_MESSAGE.Ycoor) { + if(FILE_MESSAGE.Ycoor!=0) v->FILE_MESSAGE.Ycoor=FILE_MESSAGE.Ycoor; + } + if(v->FILE_MESSAGE.Altitude!=FILE_MESSAGE.Altitude) { + if(FILE_MESSAGE.Altitude!=0) v->FILE_MESSAGE.Altitude=FILE_MESSAGE.Altitude; + } + if(v->FILE_MESSAGE.Kelly!=FILE_MESSAGE.Kelly) { + if(FILE_MESSAGE.Kelly!=0) v->FILE_MESSAGE.Kelly=FILE_MESSAGE.Kelly; + } + if(v->FILE_MESSAGE.TVD!=FILE_MESSAGE.TVD) { + if(FILE_MESSAGE.TVD!=0) v->FILE_MESSAGE.TVD=FILE_MESSAGE.TVD; + } + if(v->FILE_MESSAGE.X0!=FILE_MESSAGE.X0) { + if(FILE_MESSAGE.X0!=0) v->FILE_MESSAGE.X0=FILE_MESSAGE.X0; + } + if(v->FILE_MESSAGE.Y0!=FILE_MESSAGE.Y0) { + if(FILE_MESSAGE.Y0!=0) v->FILE_MESSAGE.Y0=FILE_MESSAGE.Y0; + } + if(v->FILE_MESSAGE.Z0!=FILE_MESSAGE.Z0) { + if(FILE_MESSAGE.Z0!=0) v->FILE_MESSAGE.Z0=FILE_MESSAGE.Z0; + } + int indexSTable=-1; + int indexDTable=-1; + if(logio->FindObjectIndex("井基本信息")>-1) { + WELL_STATIC_INFO WellStaticInfo=v->WellStaticInfo; + + indexSTable=logio->OpenSTATIC("井基本信息"); + logio->ReadTable(indexSTable,1,&v->WellStaticInfo);//inf); + if(v->WellStaticInfo.XCoor!=WellStaticInfo.XCoor) { + if(WellStaticInfo.XCoor!=0) v->WellStaticInfo.XCoor=WellStaticInfo.XCoor; + } + if(v->WellStaticInfo.YCoor!=WellStaticInfo.YCoor) { + if(WellStaticInfo.YCoor!=0) v->WellStaticInfo.YCoor=WellStaticInfo.YCoor; + } + if(v->WellStaticInfo.As1!=WellStaticInfo.As1) { + if(WellStaticInfo.As1!=0) v->WellStaticInfo.As1=WellStaticInfo.As1; + } + if(v->WellStaticInfo.Bs1!=WellStaticInfo.Bs1) { + if(WellStaticInfo.Bs1!=0) v->WellStaticInfo.Bs1=WellStaticInfo.Bs1; + } + logio->CloseTable(indexSTable); + } + if(logio->FindObjectIndex("测井信息")>-1) { + WELL_DYNAMIC_INFO WellDynamicInfo; + indexDTable=logio->OpenDYNAMIC("测井信息"); + logio->ReadTable(indexDTable,1,&v->WellDynamicInfo);//inf); + logio->CloseTable(indexDTable); + } + } + delete logio; + //v->Transfer(logfilename,outfile,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow); + //whp change 2019.12.10 for写入井名 + if(v->Transfer(logfilename,outfile,&OutCurveNo[0],&OutCurve[0],&strChineseName[0],&strUnit[0],iRow)) + { + CLogIO * logio=new CLogIO(); + logio->Open(outfile,CSlfIO::modeReadWrite); + Slf_FILE_MESSAGE mssage; + logio->GetFileMessage(mssage); + strcpy(mssage.WellName,WellName.toStdString().c_str()); + logio->SetFileMessage(mssage); + delete logio; + } + else return "";//whp add 2019.12.12 + //whp change 2020.2.18 for 汉字井名转换有乱码 + QString slfname=QString(QString::fromLocal8Bit(outfile));//QString(QLatin1String(outfile)); + delete []logfilename; + delete []outfile; + //return 1;////whp add 2019.12.08 for 输出成功加载的文件个数 + return slfname;//whp change 2019.12.12 +} +QStringList CDataImport::GetFileNames(const QString &caption , const QString &filter,QFileDialog::FileMode filemode ) +{ + static QString path=::GetDataPath(); + QStringList sts=QFileDialog::getOpenFileNames(NULL,caption,path,filter); + if(sts.size()) path=sts[0]; + return sts; +// QFileDialog * fileDlg=new QFileDialog(); +// fileDlg->setFileMode(filemode); +// QStringList listFiles; +// if(fileDlg->exec()==QFileDialog::Accepted) +// { +// listFiles=fileDlg->selectedFiles(); +// } +// delete fileDlg; +// return listFiles; +} +void CDataImport::OutPutWellXYCoordinate() +{ + // //井名 磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移 + // //a 0 4394427.9 19308473.9 0 1446.9 0 0 0 0 + // //b 0 4394427.9 19308473.9 0 1446.9 0 0 0 0 + // //c 0 4398164.3 19306076.3 0 1436.5 0 0 0 0 + // //d 0 4398270.1 19311098.4 0 1437.5 0 0 0 0 + // //e 0 4392057.3 19305209.1 0 1461.3 0 0 0 0 + // QString strFileName =QFileDialog::getSaveFileName( NULL,"导出工区井坐标为TXT",::GetOutDataPath(),"文件(*.txt)"); + // FILE *fp=fopen(strFileName.toStdString().c_str(),"wt"); + // if(!fp) return; + // fprintf(fp,"磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移\m"); + // int flag=0; + // CObjProject *pPrj=::GetProject(); + // if(!pPrj) return; + // PaiObject *pObj=pPrj->GetObjectByType(GetClassID_WellsFolder()); + // if(!pObj) return; + // QList childs; + // pObj->GetChildren(childs); + // std::vector wellnames; + // foreach(PaiObject *pChild,childs) { + // CObjWell *pWell=dynamic_cast(pChild); + // if(pWell) + // { + // QString ss=pWell->GetWellFileName(); + // QString wellname,path; + // GetWellNameAndPath(ss,wellname,path); + // WellHead &hd=pWell->GetWellHead(); + // fprintf(fp,"%s\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t%10.3f\t\n", + // hd.wellName.toStdString().c_str(), + // //井名 磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移 + // hd.azca, + // hd.x, + // hd.y, + // hd.depth, + // hd.earthEle, + // hd.dEle, + // hd.tvd, + // hd._HorizBoreXE, + // hd._HorizBoreYN); + // } + // } + // fclose(fp); + // QMessageBox::warning(NULL,"提示",QString("井位信息保存完成!")); +} + +void CDataImport::ImportWellXYCoordinate() +{ +// //井名 磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移 +// //a 0 4394427.9 19308473.9 0 1446.9 0 0 0 0 +// //b 0 4394427.9 19308473.9 0 1446.9 0 0 0 0 +// //c 0 4398164.3 19306076.3 0 1436.5 0 0 0 0 +// //d 0 4398270.1 19311098.4 0 1437.5 0 0 0 0 +// //e 0 4392057.3 19305209.1 0 1461.3 0 0 0 0 + + +// QStringList listFiles=GetFileNames("选择工区井井位信息","数据文件(*.prn;*.txt)"); +// if(!listFiles.size()) +// { +// return; +// } +// int flag=0; +// foreach(QString strFileName, listFiles) +// { +// QFile file(strFileName); +// if (!file.open(QIODevice::ReadOnly )) +// { +// continue; +// } +// flag=0; +// QTextStream in(&file); +// QString lineString = in.readLine(); +// QStringList LineStringList = lineString.split(","); +// if(LineStringList.size()==1) LineStringList = lineString.split(" "); +// if(LineStringList.size()==1) LineStringList = lineString.split(" "); +// LineStringList.removeAll(""); +// LineStringList.removeAll(" "); +// for (int i=0;i-1) LineStringList[i]=LineStringList[i].replace("\t",""); +// LineStringList[i]=LineStringList[i].trimmed(); +// } +// QString strWellName=LineStringList[0]; +// if(strWellName.indexOf("wellname",0,Qt::CaseInsensitive)>=0|| +// strWellName.indexOf("井名",0,Qt::CaseInsensitive)>=0 +// ) { +// flag=1; +// } +// while ( !in.atEnd() ) +// { +// lineString = in.readLine(); +// if(lineString.isEmpty()) continue; +// LineStringList = lineString.split(","); +// if(LineStringList.size()==1) LineStringList = lineString.split(" "); +// if(LineStringList.size()==1) LineStringList = lineString.split(" "); +// LineStringList.removeAll(""); +// LineStringList.removeAll(" "); +// for (int i=0;i-1) LineStringList[i]=LineStringList[i].replace("\t",""); +// LineStringList[i]=LineStringList[i].trimmed(); +// } +// if(LineStringList.size()<1) continue; +// LineStringList.replaceInStrings("-9999.0","0"); +// LineStringList.replaceInStrings("-9999","0"); +// if(flag) { +// CObjWell * pWell = CDataImport::GetWellByName(LineStringList[0]); +// if(!pWell) continue; +// //井名 磁偏角 南北(小) 东西(大) 测量深度 地面海拔 补心高 TVD 东西位移 南北位移 +// // 0 1 2 3 4 5 6 7 8 9 +// WellHead &wh=pWell->GetWellHead(); +// if(LineStringList.size()>1)wh.azca=LineStringList[1].toDouble(); +// if(LineStringList.size()>2)wh.y=LineStringList[2].toDouble(); +// if(LineStringList.size()>3)wh.x=LineStringList[3].toDouble(); +// if(LineStringList.size()>4)wh.depth=LineStringList[4].toDouble(); +// if(LineStringList.size()>5)wh.earthEle=LineStringList[5].toDouble(); +// if(LineStringList.size()>6){ +// wh.dEle=LineStringList[6].toDouble(); +// if(wh.dEle==-9999) wh.dEle=0; +// } +// if(LineStringList.size()>7)wh.tvd=LineStringList[7].toDouble(); +// if(LineStringList.size()>8)wh.dyn=LineStringList[8].toDouble(); +// if(LineStringList.size()>9)wh.dxe=LineStringList[9].toDouble(); +// wh.z=wh.earthEle-wh.tvd+wh.dEle; +// if(pWell->GetWellFileName().isEmpty()) { +// QString fi=GetLogdataPath()+GetProject()->GetName()+"\\#"+LineStringList[0]; +// CreateDir((char *)fi.toStdString().c_str()); +// fi+="\\"+LineStringList[0]+".slf"; +// pWell->SetWellFileName(fi); +// } +// pWell->SaveWellHead(pWell->GetWellFileName()); +// QList wellroundchildren; +// int count=pWell->GetAllWellRound(wellroundchildren); +// for(int i=0;i(wellroundchildren[i]); +// pWell->SaveWellHead(pWR->GetSlfFileName()); +// } +// } +// else { +// } +// } +// } +// AfxMessageBox("导入完成!"); +} +void CDataImport::ImportGeoStraData() +{ + // QStringList listFiles=GetFileNames("选择工区层位数据","数据文件(*.prn;*.txt)"); + // if(listFiles.size()<1) return; + // int flag=0; + // std::vector wellNameVec; + // QList layerNameVec; + // std::vector topDetphVec; + // std::vector bottomDepthVec; + // foreach(QString strFileName, listFiles) + // { + // QFile file(strFileName); + // if (!file.open(QIODevice::ReadOnly )) + // { + // continue; + // } + // flag=0; + // QTextStream in(&file); + // QString lineString = in.readLine(); + // QStringList LineStringList = lineString.split(","); + // if(LineStringList.size()==1) LineStringList = lineString.split(" "); + // if(LineStringList.size()==1) LineStringList = lineString.split(" "); + // LineStringList.removeAll(""); + // LineStringList.removeAll(" "); + // for (int i=0;i-1) LineStringList[i]=LineStringList[i].replace("\t",""); + // LineStringList[i]=LineStringList[i].trimmed(); + // } + // if(LineStringList.size()<1) continue; + // QString strWellName = LineStringList[0] ; + // if(strWellName.indexOf("wellname",0,Qt::CaseInsensitive)>=0|| + // strWellName.indexOf("井名",0,Qt::CaseInsensitive)>=0 + // ) { + // flag=1; + // for(int i=1;i-1) { + // flag=2; + // continue; + // } + // layerNameVec.push_back(LineStringList[i]); + // } + // } + // while ( !in.atEnd() ) + // { + // lineString = in.readLine(); + // LineStringList = lineString.split(","); + // if(LineStringList.size()==1) LineStringList = lineString.split(" "); + // if(LineStringList.size()==1) LineStringList = lineString.split(" "); + // LineStringList.removeAll(" "); + // LineStringList.removeAll(""); + // for (int i=0;i-1) LineStringList[i]=LineStringList[i].replace("\t",""); + // LineStringList[i]=LineStringList[i].trimmed(); + // } + // if(LineStringList.size()<1) continue; + // if(flag) { + // wellNameVec.push_back(LineStringList[0]); + // if(flag==1) { + // for(int i=2;iGetWellFileName().isEmpty()) { + // QString fi=GetLogdataPath()+GetProject()->GetName()+"\\#"+wellNameVec[i]; + // CreateDir((char *)fi.toStdString().c_str()); + // fi+="\\"+wellNameVec[i]+".slf"; + // pWell->SetWellFileName(fi); + // } + // CObjGeostratums* pGeostratum = dynamic_cast(pWell->GetObjectByType(GetClassID_OGGeostratums(), 2)); + // if(!pGeostratum) { + // pGeostratum = new CObjGeostratums(); + // pGeostratum->SetName("LAYER_DATA"); + // pWell->AddChild( pGeostratum ); + // } + // if (flag1==QMessageBox::Yes) { + // pGeostratum->ClearItems(); + // } + // pGeostratum->SetSlfFileName(pWell->GetWellFileName()); + // int index = 0; + // if(flag) { + // int size=layerNameVec.size()-1; + // if(flag==2) size=layerNameVec.size(); + // for(int j=0;jGetItemByName(layerNameVec[j]); + // if(!pItem) { + // pItem = pGeostratum->AddItem(top,bottom); + // OGGeostratumItem * pGeoItem = dynamic_cast(pItem); + // if(pGeoItem) { + // pGeoItem->SetName(layerNameVec[j]); + // pGeoItem->SetDEST(layerNameVec[j]); + // pGeoItem->SetSDEP(top); + // pGeoItem->SetEDEP(bottom); + // } + // } + // else { + // OGGeostratumItem * pGeoItem = dynamic_cast(pItem); + // { + // pGeoItem->SetTopDepth(top); + // pGeoItem->SetBottomDepth(bottom); + // pGeoItem->SetSDEP(top); + // pGeoItem->SetEDEP(bottom); + // pGeoItem->SetDEST(layerNameVec[j]); + // } + // } + // } + // } + // else { + // if(topDetphVec[i]==-9999||bottomDepthVec[i]==-9999) continue; + // pai::datamodel::WelllogItem* pItem =pGeostratum->GetItemByName(layerNameVec[i]); + // if(!pItem) { + // pItem = pGeostratum->AddItem(topDetphVec[i],bottomDepthVec[i]); + // OGGeostratumItem * pGeoItem = dynamic_cast(pItem); + // pGeoItem->SetName(layerNameVec[i]); + // pGeoItem->SetDEST(layerNameVec[i]); + // pGeoItem->SetSDEP(topDetphVec[i]); + // pGeoItem->SetEDEP(bottomDepthVec[i]); + // } + // else { + // OGGeostratumItem * pGeoItem = dynamic_cast(pItem); + // pGeoItem->SetTopDepth(topDetphVec[i]); + // pGeoItem->SetBottomDepth(bottomDepthVec[i]); + // pGeoItem->SetSDEP(topDetphVec[i]); + // pGeoItem->SetEDEP(bottomDepthVec[i]); + // pGeoItem->SetDEST(layerNameVec[i]); + // } + // } + // pGeostratum->SaveToSLF(); + // } + + // AfxMessageBox("导入分层完成!"); +} + +void CDataImport::OutPutGeoStraData() +{ +// QString strFileName =QFileDialog::getSaveFileName( NULL,"输出层位数据为TXT",::GetOutDataPath(), +// "文件(*.txt)"); +// int flag=0; +// std::vector wellNameVec; +// std::vector layerNameVec; +// std::vector topDetphVec; +// std::vector bottomDepthVec; + +// CObjProject *pPrj=::GetProject(); +// if(!pPrj) return; +// PaiObject *pObj=pPrj->GetObjectByType(GetClassID_WellsFolder()); +// if(!pObj) return; +// QList childs; +// pObj->GetChildren(childs); +// QStringList LayerNameVec; +// std::vectorLayerNameVecS; +// std::vector> TopDepthVecS; +// std::vector> BottomDepthVecS; +// std::vector wellnames; +// foreach(PaiObject *pChild,childs) { +// CObjWell *pWell=dynamic_cast(pChild); +// if(pWell) { +// QString ss=pWell->GetWellFileName(); +// if(!ss.isEmpty()) { +// QString name="LAYER_DATA"; +// LAYER_DATA m_Result; +// CLogIO *logio=new CLogIO(); +// if(!logio->Open(ss.toStdString().c_str(),CSlfIO::modeRead)) +// { +// delete logio; +// return; +// } +// int iIndex=logio->OpenTable(name.toStdString().c_str()); +// if (iIndex >=0) +// { +// wellnames.push_back(pWell->GetName()); +// QStringList layerNameVec; +// std::vector TopDepthVec; +// std::vector BottomDepthVec; +// int count=logio->GetTableRecordCount(iIndex); +// for(int j=0;jReadTable(iIndex,j+1,&m_Result); +// char buf[490]; +// GetDescription(m_Result,buf); +// if(!strlen(buf)) continue; +// if(!LayerNameVec.contains(buf)) LayerNameVec.append(buf); +// layerNameVec.append(buf); +// TopDepthVec.push_back(m_Result.StartDepth); +// BottomDepthVec.push_back(m_Result.EndDepth); +// } +// LayerNameVecS.push_back(layerNameVec); +// TopDepthVecS.push_back(TopDepthVec); +// BottomDepthVecS.push_back(BottomDepthVec); +// } +// delete logio; +// } +// } +// } +// FILE *fp=fopen(strFileName.toStdString().c_str(),"wt"); +// if(!fp) return; +// fprintf(fp,"%s","wellname\t"); +// for(int j=0;j-1) { +// // if(j!=LayerNameVec.size()) +// fprintf(fp,"%10.3f\t%10.3f",TopDepthVecS[i][pos],BottomDepthVecS[i][pos]); +// // else fprintf(fp,"%10.3f",BottomDepthVecS[i][pos]); +// } +// else fprintf(fp,"%10.3f\t%10.3f",-9999.0,-9999.0); +// if(j!=LayerNameVec.size()-1) fprintf(fp,"%s","\t"); +// else fprintf(fp,"%s","\n"); +// } +// } +// fclose(fp); +// QMessageBox::warning(NULL,"提示",QString("分层数据保存完成!")); +} + +// END_OSGGRAPHICS_NAMESPACE diff --git a/logPlus/DataImport.h b/logPlus/DataImport.h new file mode 100644 index 0000000..478de23 --- /dev/null +++ b/logPlus/DataImport.h @@ -0,0 +1,73 @@ +#ifndef PAI_FRAME_COSGDataImport_H +#define PAI_FRAME_COSGDataImport_H +#pragma warning( push ,0) +#include +// #include "OSGWindowShared.h" +#include "ObjWell.h" +#include "ObjWelllog.h" +// #include "VecSceneManager.h" +//#include "ConvertorManager.h" +#include "DepthProgress.h" +#include "ConvertorManager.h" +#pragma warning( pop ) + +// class QUuid; +// class QString; +// using namespace pai::datamodel; + +// BEGIN_OSGGRAPHICS_NAMESPACE; +// class ConvertorManager; +// class CVecWindow; +// class CTestDialog; +// class CCompositeWindow; + +// void /*OSGWINDOWSHARED_EXPORT*/ slotImportSingleWellLogData(CVecViewCommand &viewCommand,QUuid /*e*/,bool bShow); + +class /*OSGWINDOWSHARED_EXPORT*/ CDataImport +{ +public: + static bool m_bImportByFolder; + + // //把Well 加入到OSGSceneManager + // static void AddWellNode( CVecSceneManager *pSceneManager,CObjWell *pWell,CObjWell *pWellInsertPos ); + + // //把Well log 加入到OSGSceneManager + // static void AddWellLogNode( CVecSceneManager *pSceneManager,CObjWellLog *pWellLog,CObjWellLog *pWellLogInsertPos ); + static void ImporttoTree(QString slfFileName,CLogIO *logio,CObjWell *pWell,CObjWelllogRound* pWelllogRound,char *curvename); + + //import well path object to project + static QList ImportWellTrajectorys(bool IsDir); + + //import bitmap object to project + static void ImportBitmaps(); + + static QList CDataImport::ImportWells(QString path,QStringList &wellfs,int *pNum=NULL,bool IsTran=true); + static QList CDataImport::ImportWells(QString path,QStringList &wellfs,char *pSuffix,int *pNum=NULL,bool IsTran=true); + + //import core image to project + static void ImportCoreImage(); + static void LoadLayers(QStringList &listFiles); + + //根据well name查找或新建一Well + static CObjWell * GetWellByName( QString strWellName ); + static void ImportConvertorWellLogFiles(QString wellname="",QString wellroundname=""); + static void ImportGeoStraData(); + static void OutPutGeoStraData(); + static void ImportWellXYCoordinate(); + static void OutPutWellXYCoordinate(); + + static int chakan(QList &wells,QString path,QStringList &wellfs,int &num,bool GetNum=false,DiDepthProgress *DepthProgress=NULL,char *pSuffix=NULL); + static QStringList GetFileNames(const QString &caption = QString(), const QString &filter = QString(),QFileDialog::FileMode filemode=QFileDialog::ExistingFiles); + static CObjWell *ChangetoSlf(QString wellFile,DiDepthProgress *DepthProgress=NULL); + //whp change 2019.12.12 + static QString ConvertorWellLogFiles(ConvertorManager &pManager,QString wellname,DiDepthProgress *DepthProgress=NULL); + static int flag1; + static int flag_check; + static int m_flag; + //whp add 2020.2.28 for 检查井名文件名是否存在,若存在,获取井次全路径文件名 + static QString CDataImport::GetOutName(QString wellname,QString filename); + static CObjWell *ChangetoSlf(QString wellFile1,DiDepthProgress *pDepthProgress,bool IsTran); +}; + +// END_OSGGRAPHICS_NAMESPACE +#endif diff --git a/logPlus/logPlus.pro b/logPlus/logPlus.pro index c5114de..325d7a4 100644 --- a/logPlus/logPlus.pro +++ b/logPlus/logPlus.pro @@ -32,6 +32,7 @@ SOURCES += \ CStringType.cpp \ ConsoleOutputWidget.cpp \ CurveLine.cpp \ + DataImport.cpp \ DepPairs.cpp \ DrawNrad.cpp \ DrawTvd.cpp \ @@ -84,6 +85,7 @@ SOURCES += \ qtcommonclass.cpp \ qtprojectwidgets.cpp \ selectwelldialog.cpp \ + tishidialog.cpp \ totalTitleBar.cpp \ transparentdraggableGuan.cpp \ transparentdraggableRightList.cpp \ @@ -98,6 +100,7 @@ HEADERS += \ CStringType.h \ ConsoleOutputWidget.h \ CurveLine.h \ + DataImport.h \ DepPairs.h \ DraggablePixmap.h \ DrawNrad.h \ @@ -150,6 +153,7 @@ HEADERS += \ qtcommonclass.h \ qtprojectwidgets.h \ selectwelldialog.h \ + tishidialog.h \ totalTitleBar.h \ transparentdraggableGuan.h \ transparentdraggableRightList.h \ @@ -175,7 +179,8 @@ FORMS += \ mainwindowsplitter.ui \ newheaddialog.ui \ qtprojectwidgets.ui \ - selectwelldialog.ui + selectwelldialog.ui \ + tishidialog.ui INCLUDEPATH += ../include/ \ ../CallManage \ diff --git a/logPlus/qtprojectwidgets.cpp b/logPlus/qtprojectwidgets.cpp index 380c687..8b5869f 100644 --- a/logPlus/qtprojectwidgets.cpp +++ b/logPlus/qtprojectwidgets.cpp @@ -23,7 +23,9 @@ #include "ImportdataDialog.h" #include "CDataOutput.h" #include "DataManagger.h" +#include "ObjWell.h" #include "ObjWelllog.h" +#include "DataImport.h" extern QString g_prjname; extern void AppendConsole(Priority priority, const QString &output); @@ -371,6 +373,7 @@ void QtProjectWidgets::loadIndexSysTree(QTreeWidgetItem *parent, QString fileFul itemIndex->setData(0, Qt::UserRole, "wellname"); // 存储额外数据,如ID itemIndex->setData(0, Qt::UserRole + 1, wellFile1); // 存储额外数据,项目名 itemIndex->setData(0, Qt::UserRole + 2, wellname); // 存储额外数据,井名 + itemIndex->setData(0, Qt::UserRole + 3, wellname); // 存储额外数据,井名 QMyTreeWidget::closeEditor里判断是否修改 // QIcon icon; icon.addPixmap(QPixmap(GetImagePath() + "well.png"), QIcon::Selected); @@ -479,6 +482,7 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q itemwell->setText(0, wellname); itemwell->setData(0, Qt::UserRole, "wellItem"); // 存储额外数据,如ID itemwell->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,slf文件路径 + itemwell->setData(0, Qt::UserRole + 3, wellname); // 存储额外数据,表井次名 // QIcon iconwell; iconwell.addPixmap(QPixmap(GetImagePath() + "icon/WellRound.png"), QIcon::Selected); @@ -744,7 +748,12 @@ void QtProjectWidgets::initRootTreeMenu(QMenu *menu, QTreeWidget *treeWidget) //初始化根节点(项目名称)-右键菜单 void QtProjectWidgets::initWellsTreeMenu(QMenu *menu, QTreeWidget *treeWidget) { - QAction* action_New = new QAction("数据导入", treeWidget); + QAction* action_New = new QAction("按目录导入测井数据", treeWidget); + action_New->setIcon(QIcon(GetImagePath() + "AddFolder.png")); // 设置图标 + connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onImportFolder())); + menu->addAction(action_New); + + action_New = new QAction("数据导入", treeWidget); action_New->setIcon(QIcon(GetImagePath() + "wellog.png")); // 设置图标 connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onImportSingleWellLogData())); menu->addAction(action_New); @@ -1043,7 +1052,7 @@ void QtProjectWidgets::s_NewProject() // 创建对话框 CWellLogProjectDialog* dialog = new CWellLogProjectDialog(); - dialog->Init(); + dialog->Init(NULL); int result = dialog->exec();//对话框 if (result == QDialog::Accepted) { // 处理用户点击了确定按钮的逻辑 @@ -1795,25 +1804,48 @@ void QtProjectWidgets::onEditWelllogRound() { QTreeWidgetItem *wellItem = *ui->treeWidget->selectedItems().begin(); - QString strTreeTag = wellItem->data(0, Qt::UserRole + 1).toString(); + QString strWellFile = wellItem->data(0, Qt::UserRole + 1).toString(); //WellLogDialog* wdia = new WellLogDialog(); //CWellLogRoundDialog* wdia = new CWellLogRoundDialog(); MyWelllogRound WelllogRound; - WelllogRound.LoadMeesge(strTreeTag); + WelllogRound.LoadMeesge(strWellFile); CWellDialog* wdia = new CWellDialog(); + CObjWell* pWell = new CObjWell; + pWell->SetWellFileName(strWellFile); + QString oldWellName = wellItem->text(0); + pWell->SetName(wellItem->text(0)); + pWell->SetPrjname(g_prjname); wdia->wellLR = WelllogRound; - wdia->Init(); + wdia->Init(pWell); if ( wdia->exec() == QDialog::Accepted ) { // if(strWelllogRoundName != "") // { // pWelllogRound->setObjectName(strWelllogRoundName); // } - QMessageBox::information(this,"2",strTreeTag); + QString newWellName = pWell->GetName(); + if (newWellName != oldWellName) + { + QString strProjectFolder = GetProjectFolder(); + QString strProjectFile = strProjectFolder + g_prjname; + strProjectFile += ".wwl"; + s_OpenProject(strProjectFile); + } } - //QMessageBox::information(this,"1",strTreeTag); + //QMessageBox::information(this,"1",strWellFile); +} + +void QtProjectWidgets::onImportFolder() +{ + CDataImport::ImportWellTrajectorys(1); + + QString strProjectFolder = GetProjectFolder(); + QString strProjectFile = strProjectFolder + g_prjname; + strProjectFile += ".wwl"; + s_OpenProject(strProjectFile); + return; } void QtProjectWidgets::onImportSingleWellLogData() diff --git a/logPlus/qtprojectwidgets.h b/logPlus/qtprojectwidgets.h index 7bf42b7..0a1e586 100644 --- a/logPlus/qtprojectwidgets.h +++ b/logPlus/qtprojectwidgets.h @@ -59,6 +59,7 @@ public slots: void onSlfbackup(); //备份井次 void onCutSlf(); //剪切井次 void onEditWelllogRound(); + void onImportFolder(); //按目录导入测井数据 void onImportSingleWellLogData(); void onImportSlfTable(); void onOutWellLogRound(); diff --git a/logPlus/tishidialog.cpp b/logPlus/tishidialog.cpp new file mode 100644 index 0000000..05d69cf --- /dev/null +++ b/logPlus/tishidialog.cpp @@ -0,0 +1,55 @@ +#include "tishidialog.h" + +TiShiDialog::TiShiDialog(QWidget *parent) + : QDialog(parent) +{ + m_pUI.setupUi(this); + QObject::connect(m_pUI.pushButtonTH, SIGNAL(clicked()), this, SLOT(slotTH())); + QObject::connect(m_pUI.pushButtonHB, SIGNAL(clicked()), this, SLOT(slotHB())); + QObject::connect(m_pUI.pushButtonLC, SIGNAL(clicked()), this, SLOT(slotLC())); + QObject::connect(m_pUI.pushButtonTG, SIGNAL(clicked()), this, SLOT(slotTG())); + QObject::connect(m_pUI.checkBox, SIGNAL(clicked()), this, SLOT(slotCheck())); + check=0; + m_pUI.checkBox->setCheckState(Qt::Unchecked); +} +void TiShiDialog::slotCheck() +{ + if(m_pUI.checkBox->checkState()==Qt::Unchecked)check=0; + else check=1; +} +TiShiDialog::~TiShiDialog() +{ + +} +void TiShiDialog::slotTH() +{ + flag=1; + accept(); + return ; +} +void TiShiDialog::slotHB() +{ + flag=2; + accept(); + return ; +} +void TiShiDialog::slotLC() +{ + flag=3; + accept(); + return ; +} +void TiShiDialog::slotTG() +{ + flag=0; + accept(); + return ; +} +void TiShiDialog::init(std::vector OutCurve,QString qss) +{ + for(int i=0;iappend(QString(OutCurve[i])); + } + m_pUI.label->setText(qss+"井次中下列数据已存在"); +} \ No newline at end of file diff --git a/logPlus/tishidialog.h b/logPlus/tishidialog.h new file mode 100644 index 0000000..fa41aa9 --- /dev/null +++ b/logPlus/tishidialog.h @@ -0,0 +1,28 @@ +#ifndef TISHIDIALOG_H +#define TISHIDIALOG_H + +#include +#include "ui_tishidialog.h" +#include +#pragma execution_character_set("utf-8") +class TiShiDialog : public QDialog +{ + Q_OBJECT + +public: + TiShiDialog(QWidget *parent = 0); + ~TiShiDialog(); + void init(std::vector OutCurve,QString); + int flag; + int check; +private: + Ui::TiShiDialog m_pUI; +private slots: + void slotTH(); + void slotHB(); + void slotLC(); + void slotTG(); + void slotCheck(); +}; + +#endif // TISHIDIALOG_H diff --git a/logPlus/tishidialog.ui b/logPlus/tishidialog.ui new file mode 100644 index 0000000..2804b89 --- /dev/null +++ b/logPlus/tishidialog.ui @@ -0,0 +1,180 @@ + + + TiShiDialog + + + + 0 + 0 + 382 + 333 + + + + TiShiDialog + + + + + + + + 当前井次中下列数据已存在 + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 200 + 0 + + + + + + + + 后面所有井均执行此操作 + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + 替换 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + 合并 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + 另存 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + + + + 跳过 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + diff --git a/tran/LISConvertor/src/LisConvertor.cpp b/tran/LISConvertor/src/LisConvertor.cpp index 7c569df..45e9fd1 100644 --- a/tran/LISConvertor/src/LisConvertor.cpp +++ b/tran/LISConvertor/src/LisConvertor.cpp @@ -146,8 +146,7 @@ int CLisConvertor::ScanLogFile(char *FileName,char *Message,char **CurveName,ch int pos1=GetBeginPosit(FileName,szTemp); mWellDynamicInfo=&WellDynamicInfo; if((fp=fopen(FileName,"rb"))==NULL) { - strcpy(szTemp, "Open Not File:"); - MessageBox(NULL,FileName,szTemp,MB_OK); + QMessageBox::information(NULL,FileName,"Open Not File:",QMessageBox::Ok); return 0; } char path[256]; @@ -736,11 +735,9 @@ bool CLisConvertor::Transfer(char *FileName,char *outfile,int *OutCurveNo,char * int maxcurv=100; // format spcification number int nfmsp=0 ,nfrmob; - - char szTemp[128]; - strcpy(szTemp, "Open Not File:"); + if((fp=fopen(FileName,"rb")) == NULL) { - MessageBox(NULL,FileName,szTemp,MB_OK); + QMessageBox::information(NULL,FileName,"Open Not File:",QMessageBox::Ok); return 0; } diff --git a/tran/LISConvertor/src/LisConvertor.pro b/tran/LISConvertor/src/LisConvertor.pro index 8bf3998..63a37a7 100644 --- a/tran/LISConvertor/src/LisConvertor.pro +++ b/tran/LISConvertor/src/LisConvertor.pro @@ -15,6 +15,17 @@ INCLUDEPATH += $(OSGHOME)/include \ ../../../Slfio/include\ ../../../ConvertorManager/include\ ../../../OSGDataModel/include\ +../../../Workflow/include\ +../../../Workflow/WFCrystal/Crystal/include\ +../../../Workflow/WFCrystal/Plugin/include\ +../../../Workflow/WFCrystal/SysUtility/utils/include\ +../../../Workflow/WFEngine/IOService/include\ +../../../Workflow/WFEngine/Module/include\ +../../../Workflow/WFEngine/Component/WorkflowWidget/include\ +../../../Workflow/WFEngine/ObjectModel/ObjectModel/include\ +../../../Workflow/WFEngine/WorkflowEngine/include\ +../../../Workflow/WFEngine/ObjectModel/ObjectModelBase/include\ +../../../Workflow/WFWidget/include\ ./GeneratedFiles #include(../../OSGDataModel/paiobjectmodel.libinfo) diff --git a/tran/SLFAscIIConvertor/src/SLFAsciiConvertor.pro b/tran/SLFAscIIConvertor/src/SLFAsciiConvertor.pro index 78663ba..c91ae18 100644 --- a/tran/SLFAscIIConvertor/src/SLFAsciiConvertor.pro +++ b/tran/SLFAscIIConvertor/src/SLFAsciiConvertor.pro @@ -16,6 +16,17 @@ INCLUDEPATH += $(OSGHOME)/include \ ../../../Slfio/include\ ../../../ConvertorManager/include\ ../../../OSGDataModel/include\ +../../../Workflow/include\ +../../../Workflow/WFCrystal/Crystal/include\ +../../../Workflow/WFCrystal/Plugin/include\ +../../../Workflow/WFCrystal/SysUtility/utils/include\ +../../../Workflow/WFEngine/IOService/include\ +../../../Workflow/WFEngine/Module/include\ +../../../Workflow/WFEngine/Component/WorkflowWidget/include\ +../../../Workflow/WFEngine/ObjectModel/ObjectModel/include\ +../../../Workflow/WFEngine/WorkflowEngine/include\ +../../../Workflow/WFEngine/ObjectModel/ObjectModelBase/include\ +../../../Workflow/WFWidget/include\ ./GeneratedFiles #include(../../OSGDataModel/paiobjectmodel.libinfo)