logplus/WellLogUI/src/WellDialog.cpp

709 lines
30 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <QCalendarWidget>
//#include "ObjWell.h"
#include "WellLogDialog.h"
#include "WellDialog.h"
#include "geometryutils.h"
#include "ui_WellDialog.h"
//#include "ObjWelllogRound.h"
//#include "DepthProgress.h"
//#include "DataImport.h"
//#include "DataTree.h"
//#include "VecViewCommand.h"
CWellDialog::CWellDialog(QWidget *parent, Qt::WindowFlags flags) : WellLogDialog(parent, flags)
{
m_pUI = new Ui::WellDialog();
m_pUI->setupUi(this);
QDoubleValidator* dv = new QDoubleValidator(this);
dv->setRange(-99999999.00,99999999.00,3);
m_pUI->xCode->setValidator(dv);
m_pUI->yCode->setValidator(dv);
m_pUI->xOffset->setValidator(dv);
m_pUI->yOffset->setValidator(dv);
m_pUI->TVD->setValidator(dv);
m_pUI->asl->setValidator(dv);
m_pUI->bsl->setValidator(dv);
m_pUI->endMethod->setValidator(dv);
m_pUI->bit1->setValidator(dv);
m_pUI->bit2->setValidator(dv);
m_pUI->bit3->setValidator(dv);
m_pUI->bit4->setValidator(dv);
m_pUI->bit5->setValidator(dv);
m_pUI->cas1->setValidator(dv);
m_pUI->cas2->setValidator(dv);
m_pUI->cas3->setValidator(dv);
m_pUI->cas4->setValidator(dv);
m_pUI->cas5->setValidator(dv);
m_pUI->caseOneLength->setValidator(dv);
m_pUI->caseOneSD->setValidator(dv);
m_pUI->caseOneED->setValidator(dv);
m_pUI->caseTwoLength->setValidator(dv);
m_pUI->caseTwoSD->setValidator(dv);
m_pUI->caseTwoED->setValidator(dv);
//Qt::WindowFlags flags = windowFlags();
flags |= Qt::WindowCloseButtonHint;
setWindowFlags(flags);
}
void CWellDialog::GetOKAndCancel(QPushButton* &okBtn,QPushButton* &cancelBtn)
{
okBtn = m_pUI->okbtn;
cancelBtn = m_pUI->cancelbtn;
}
void CWellDialog::DataToView()
{
// pai::datamodel::CObjWell* pWell = dynamic_cast<pai::datamodel::CObjWell*>(pObject);
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()));
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 = "编辑井基本信息";
// 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()
{
bool flag = false;
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<pai::datamodel::CObjWell*>(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<pai::datamodel::CObjWell*>(m_pObject);
// if(!(pWell->isExistsName(m_pUI->wellName->text())))
// {
// flag = true;
// }
// else
// {
// if(m_DialogType==0) {
// errInfo ="井名称已经存在!是否要继续改名?\n如果继续更名当前井数据将被移入同名井下原始数据被备份于Logdata/temp目录下";
// int ret = QMessageBox::warning(NULL,"提示",QString(errInfo),QMessageBox::Yes,QMessageBox::No);
// if(ret==QMessageBox::Yes) {
// flag = true;
// }
// else flag = false;
// }
// else {
// errInfo ="井名已经存在,无法创建新井,请用其它名字!";
// QMessageBox::information(NULL,"提示",QString(errInfo),QMessageBox::Ok);
// flag=false;
// }
// m_pUI->wellName->setFocus();
// return flag;
// }
}
}
else
{
errInfo ="请输入井名!";
m_pUI->wellName->setFocus();
}
QDate sdate=QDate::fromString(m_pUI->startDrillDate->text(),"yyyy年-MM月-dd日");
QDate edate=QDate::fromString(m_pUI->endDrillDate->text(),"yyyy年-MM月-dd日");
QDate cdate=QDate::fromString(m_pUI->endWellDate->text(),"yyyy年-MM月-dd日");
long long sv=sdate.year()*365+sdate.month()*31+sdate.day();
long long ev=edate.year()*365+edate.month()*31+edate.day();
long long cv=cdate.year()*365+cdate.month()*31+cdate.day();
if(sv>ev||sv>cv)
{
errInfo ="开钻时间不能大于完钻时间及完井时间!";
QMessageBox::information(NULL,"提示",QString(errInfo),QMessageBox::Ok);
flag=false;
m_pUI->startDrillDate->setFocus();
return flag;
}
if(cv<ev)
{
errInfo ="完井时间不能小于完钻时间!";
QMessageBox::information(NULL,"提示",QString(errInfo),QMessageBox::Ok);
flag=false;
m_pUI->startDrillDate->setFocus();
return flag;
}
if(!flag)
{
QMessageBox::about(NULL, "提示", errInfo);
}
return flag;
}
// void GetAllChildItem( QTreeWidgetItem* pItem ,QList<QTreeWidgetItem*> & listAllItem )
// {
// listAllItem << pItem;
// int nChildCount = pItem->childCount();
// for(long i = 0 ; i < nChildCount ;++i )
// {
// GetAllChildItem( pItem->child( i ),listAllItem );
// }
// }
// QTreeWidgetItem* CWellDialog::GetTreeItem(CDataTree *pTree, CBaseObject* pObject )
// {
// std::map< CBaseObject*,QTreeWidgetItem* >::iterator it = pTree->m_mapNodeItem.find( pObject );
// if( it != pTree->m_mapNodeItem.end() )
// {
// return it->second;
// }
// return NULL;
// }
void CWellDialog::ViewToData()
{
// pai::datamodel::CObjWell* pWell = dynamic_cast<pai::datamodel::CObjWell*>(pObject);
CObjWell* pWell = m_pObject;
QString oldname=pWell->GetName();
WellHead &hd=pWell->GetWellHead();
QString welln=m_pUI->wellName->text();
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<CObjWell *>(::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.SetWellType(m_pUI->wellType->currentIndex ());
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.SetCWMethod(m_pUI->endMethod->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.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.SetCas1Shot(m_pUI->caseOneLength->text().toFloat());
wellLR.SetSC1SDep(m_pUI->caseOneSD->text().toFloat());
wellLR.SetSC1EDep(m_pUI->caseOneED->text().toFloat());
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<PaiObject*> wellroundchildren;
// int count=pWell->GetAllWellRound(wellroundchildren);
// for(int i=0;i<count;i++) {
// CObjWelllogRound *pWellR=dynamic_cast<CObjWelllogRound *>(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;
// 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);
// }
// }
// }
// }
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();
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<PaiObject*> wellroundchildren;
// int count=pWell->GetAllWellRound(wellroundchildren);
// QTreeWidgetItem *pOldwItem=GetTreeItem(pDataTree,pOldWell);
// QTreeWidgetItem *pwItem=GetTreeItem(pDataTree,pWell);
// RenameWellName(pOldWell,pWell);
// for(int i=0;i<count;i++) {
// CObjWelllogRound *pWellR=dynamic_cast<CObjWelllogRound *>(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::vector<PaiObject*>vChild;
// CPaiObjectHelper::RecursionGetAllChild(pObject,vChild );
// foreach(PaiObject*pChild,vChild){
// pDataTree->m_mapNodeItem.erase(dynamic_cast<CBaseObject*>(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()
{
delete m_pUI;
m_pUI = NULL;
}
void CWellDialog::DataToViewOld()
{
// pai::datamodel::CObjWell* pWell = dynamic_cast<pai::datamodel::CObjWell*>(pObject);
// if(pWell != NULL)
// {
// pai::ios::welllog::Well& well = pWell->GetDBWell();
// QString title = pWell->GetName() == "" ? "新建井基本信息":"编辑井基本信息";
// this->setWindowTitle(title);
// m_pUI->wellName->setText(pWell->GetName());
// m_pUI->wellCode->setText(pWell->GetWellCode());
// m_pUI->companyName->setText(QString::fromStdString(well.GetCompanyName()));
// m_pUI->areaName->setText(QString::fromStdString(well.GetAreaName()));
// int decimal = 1;
// m_pUI->xCode->setText(DoubleToString(well.GetXCode(),decimal,NULL));
// m_pUI->yCode->setText(DoubleToString(well.GetYCode(),decimal,NULL));
// m_pUI->asl->setText(DoubleToString(well.GetAsl(),decimal,NULL));
// m_pUI->bsl->setText(DoubleToString(well.GetBsl(),decimal,NULL));
// m_pUI->endMethod->setText(QString::fromStdString(well.GetCWMethod()));
// m_pUI->bit1->setText(QString::fromStdString(well.GetBit1Prog()));
// m_pUI->bit2->setText(QString::fromStdString(well.GetBit2Prog()));
// m_pUI->bit3->setText(QString::fromStdString(well.GetBit3Prog()));
// m_pUI->bit4->setText(QString::fromStdString(well.GetBit4Prog()));
// m_pUI->bit5->setText(QString::fromStdString(well.GetBit5Prog()));
// m_pUI->cas1->setText(QString::fromStdString(well.GetCas1Prog()));
// m_pUI->cas2->setText(QString::fromStdString(well.GetCas2Prog()));
// m_pUI->cas3->setText(QString::fromStdString(well.GetCas3Prog()));
// m_pUI->cas4->setText(QString::fromStdString(well.GetCas4Prog()));
// m_pUI->cas5->setText(QString::fromStdString(well.GetCas5Prog()));
// m_pUI->caseOneLength->setText(DoubleToString(well.GetCas1Shot(),decimal,NULL));
// m_pUI->caseOneSD->setText(DoubleToString(well.GetSC1SDep(),decimal,NULL));
// m_pUI->caseOneED->setText(DoubleToString(well.GetSC1EDep(),decimal,NULL));
// m_pUI->caseTwoLength->setText(DoubleToString(well.GetCas2Shot(),decimal,NULL));
// m_pUI->caseTwoSD->setText(DoubleToString(well.GetSC2SDep(),decimal,NULL));
// m_pUI->caseTwoED->setText(DoubleToString(well.GetSC2EDep(),decimal,NULL));
// ComboxFromConfigFile(m_pUI->wellType,"wellType");
// if(well.GetWellType() < m_pUI->wellType->count())
// {
// m_pUI->wellType->setCurrentIndex(well.GetWellType());
// }
// QString format = "yyyy年-MM月-dd日";
// m_pUI->startDrillDate->setCalendarPopup(true);
// m_pUI->startDrillDate->setCalendarWidget(new QCalendarWidget());
// m_pUI->startDrillDate->setDisplayFormat(format);
// if(well.GetSDrillDate() != "")
// m_pUI->startDrillDate->setDate(QDate::fromString(QString::fromStdString(well.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(well.GetEDrillDate() != "")
// m_pUI->endDrillDate->setDate(QDate::fromString(QString::fromStdString(well.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(well.GetCompleteDate() != "")
// m_pUI->endWellDate->setDate(QDate::fromString(QString::fromStdString(well.GetCompleteDate()),format));
// else
// m_pUI->endWellDate->setDate(QDate::currentDate());
// }
}
void CWellDialog::ViewToDataOld()
{
// pai::datamodel::CObjWell* pWell = dynamic_cast<pai::datamodel::CObjWell*>(pObject);
// pWell->SetName(m_pUI->wellName->text());
// pWell->SetWellCode(m_pUI->wellCode->text());
// pai::ios::welllog::Well& well = pWell->GetDBWell();
// well.SetAreaName(m_pUI->areaName->text().toStdString());
// well.SetCompanyName(m_pUI->companyName->text().toStdString());
// well.SetCompanyName(m_pUI->companyName->text().toStdString());
// well.SetXCode(m_pUI->xCode->text().toDouble());
// well.SetYCode(m_pUI->yCode->text().toDouble());
// well.SetWellType(m_pUI->wellType->currentIndex ());
// well.SetAsl(m_pUI->asl->text().toFloat());
// well.SetBsl(m_pUI->bsl->text().toFloat());
// well.SetCWMethod(m_pUI->endMethod->text().toStdString());
// well.SetBit1Prog(m_pUI->bit1->text().toStdString());
// well.SetBit2Prog(m_pUI->bit2->text().toStdString());
// well.SetBit3Prog(m_pUI->bit3->text().toStdString());
// well.SetBit4Prog(m_pUI->bit4->text().toStdString());
// well.SetBit5Prog(m_pUI->bit5->text().toStdString());
// well.SetCas1Prog(m_pUI->cas1->text().toStdString());
// well.SetCas2Prog(m_pUI->cas2->text().toStdString());
// well.SetCas3Prog(m_pUI->cas3->text().toStdString());
// well.SetCas4Prog(m_pUI->cas4->text().toStdString());
// well.SetCas5Prog(m_pUI->cas5->text().toStdString());
// well.SetCas1Shot(m_pUI->caseOneLength->text().toFloat());
// well.SetSC1SDep(m_pUI->caseOneSD->text().toFloat());
// well.SetSC1EDep(m_pUI->caseOneED->text().toFloat());
// well.SetCas2Shot(m_pUI->caseTwoLength->text().toFloat());
// well.SetSC2SDep(m_pUI->caseTwoSD->text().toFloat());
// well.SetSC2EDep(m_pUI->caseTwoED->text().toFloat());
// well.SetSDrillDate(m_pUI->startDrillDate->text().toStdString());
// well.SetEDrillDate(m_pUI->endDrillDate->text().toStdString());
// well.SetCompleteDate(m_pUI->endWellDate->text().toStdString());
// //accept();
}