#include #include #include #include "WellLogDialog.h" #include "WellLogRoundDialog.h" #include "ui_WellLogRoundDialog.h" //#include "ObjWelllogRound.h" //#include "WelllogRound.h" #include "MyWelllogRound.h" #include "geometryutils.h" #include "MyWelllogRound.h" //#include "ObjWell.h" CWellLogRoundDialog::CWellLogRoundDialog(QWidget *parent, Qt::WindowFlags flags) : WellLogDialog(parent, flags) { m_pUI = new Ui::wellLogRoundDialog(); m_pUI->setupUi(this); } void CWellLogRoundDialog::GetOKAndCancel(QPushButton* &okBtn,QPushButton* &cancelBtn) { okBtn = m_pUI->okbtn; cancelBtn = m_pUI->cancelbtn; okBtn->setIcon(QIcon( ::GetImagePath() + "icon/OK.png")); cancelBtn->setIcon(QIcon( ::GetImagePath() + "icon/Cancel.png")); } void CWellLogRoundDialog::DataToView() { // pai::datamodel::CObjWelllogRound* pWelllogRound = dynamic_cast(pObject); // if(pWelllogRound != NULL) // { // wellLR.LoadMeesge(pWelllogRound->GetSlfFileName()); // setWindowTitle(pWelllogRound->GetName() == "" ? "新建测井信息":"编辑测井信息"); // m_pUI->wellName->setText(wellLR.GetItem().c_str()); // CObjWell *pWell=pWelllogRound->GetWell(); // if(m_pUI->wellName->text()==""&&pWell){ // QString w=pWell->GetName(); // m_pUI->wellName->setText(w); // } // m_pUI->compayName->setText(QString::fromStdString(wellLR.GetCompanyName())); // m_pUI->team->setText(QString::fromStdString(wellLR.GetTeam())); // m_pUI->operaters->setText(QString::fromStdString(wellLR.GetOperator())); // //操作日期 // QString format = "yyyy年-MM月-dd日"; // m_pUI->date->setCalendarPopup(true); // m_pUI->date->setCalendarWidget(new QCalendarWidget()); // m_pUI->date->setDisplayFormat(format); // if(wellLR.GetDate() != "") // m_pUI->date->setDate(QDate::fromString(QString::fromStdString(wellLR.GetDate()),format)); // else // m_pUI->date->setDate(QDate::currentDate()); // //测井系列 // ComboxFromConfigFile(m_pUI->serial,"serial"); // if(wellLR.GetSerial() != "") // { // QString tempSerialValue = QString::fromStdString(wellLR.GetSerial()); // if((m_pUI->serial->findText(tempSerialValue))) // { // m_pUI->serial->setCurrentIndex(m_pUI->serial->findText(tempSerialValue)); // } // } // //测井项目 // ComboxFromConfigFile(m_pUI->item,"wellItem"); // if(wellLR.GetItem() != "") // { // QString tempItemValue = QString::fromStdString(wellLR.GetItem()); // if((m_pUI->item->findText(tempItemValue))) // { // m_pUI->item->setCurrentIndex(m_pUI->item->findText(tempItemValue)); // } // } // //泥浆类型 // ComboxFromConfigFile(m_pUI->mudType,"mudType"); // if(wellLR.GetMudType() != "") // { // QString tempMudType = QString::fromStdString(wellLR.GetMudType()); // if((m_pUI->mudType->findText(tempMudType))) // { // m_pUI->mudType->setCurrentIndex(m_pUI->mudType->findText(tempMudType)); // } // } // int decimal = -1; // //泥浆粘度 // m_pUI->mudViscosity->setText(DoubleToString(wellLR.GetMudViscosity(),decimal,NULL)); // m_pUI->waterLoss->setText(DoubleToString(wellLR.GetWaterLoss(),decimal,NULL)); // m_pUI->density->setText(DoubleToString(wellLR.GetDensity(),decimal,NULL)); // m_pUI->resi->setText(DoubleToString(wellLR.GetResi(),decimal,NULL)); // m_pUI->temp->setText(DoubleToString(wellLR.GetTemp(),decimal,NULL)); // m_pUI->tempBot->setText(DoubleToString(wellLR.GetTempBot(),decimal,NULL)); // m_pUI->INTLog->setText(QString::fromStdString(wellLR.GetINTLog())); // m_pUI->NITINT->setText(QString::fromStdString(wellLR.GetNITINT())); // m_pUI->IntProg->setText(QString::fromStdString(wellLR.GetIntProg())); // m_pUI->InteDress->setText(QString::fromStdString(wellLR.GetInteDress())); // m_pUI->audit->setText(QString::fromStdString(wellLR.GetAudit())); // m_pUI->remark->setText(QString::fromStdString(wellLR.GetRemark())); //} } void CWellLogRoundDialog::ViewToData() { // pai::datamodel::CObjWelllogRound* pW = dynamic_cast(pObject); // QString name=m_pUI->wellName->text(); // name=name.toUpper(); // CObjWell *pWell=pW->GetWell(); // QString wellname=pWell->GetName(); // if(wellname.isEmpty()) wellname=pWell->GetWellHead().wellName; // wellname=wellname.toUpper(); // wellLR.SetWellName(wellname.toStdString()); // // pW->SetName(m_pUI->wellName->text()); // wellLR.SetItem(name.toStdString()); // // pai::ios::welllog::WelllogRound& wellLR = pW->GetDBWelllogRound(); // wellLR.SetCompanyName(m_pUI->compayName->text().toStdString()); // wellLR.SetTeam(m_pUI->team->text().toStdString()); // wellLR.SetOperator(m_pUI->operaters->text().toStdString()); // wellLR.SetDate(m_pUI->date->text().toStdString()); // wellLR.SetSerial((m_pUI->serial->itemText(m_pUI->serial->currentIndex())).toStdString()); // // wellLR.SetItem((m_pUI->item->itemText(m_pUI->item->currentIndex())).toStdString()); // wellLR.SetMudType((m_pUI->mudType->itemText(m_pUI->mudType->currentIndex())).toStdString()); // wellLR.SetMudViscosity(m_pUI->mudViscosity->text().toFloat()); // wellLR.SetWaterLoss(m_pUI->waterLoss->text().toFloat()); // wellLR.SetDensity(m_pUI->density->text().toFloat()); // wellLR.SetResi(m_pUI->resi->text().toFloat()); // wellLR.SetTemp(m_pUI->temp->text().toFloat()); // wellLR.SetTempBot(m_pUI->tempBot->text().toFloat()); // wellLR.SetINTLog(m_pUI->INTLog->text().toStdString()); // wellLR.SetNITINT(m_pUI->NITINT->text().toStdString()); // wellLR.SetIntProg(m_pUI->IntProg->text().toStdString()); // wellLR.SetInteDress(m_pUI->InteDress->text().toStdString()); // wellLR.SetAudit(m_pUI->audit->text().toStdString()); // wellLR.SetRemark(m_pUI->remark->toHtml().toStdString()); // ViewToDataOld(pObject); } int CWellLogRoundDialog::Validate() { int flag = true; QString errInfo; if(m_pUI->wellName->text() != NULL) { /* QString pattern("^[\\w ]{1,20}-$"); QRegExp rx(pattern); if(!rx.exactMatch(m_pUI->wellName->text())) { errInfo = "井次名称由数字,英文字母或者中文或者下划线组成且长度为1-20的字符串"; flag = false; m_pUI->wellName->setFocus(); } else*/ // { // pai::datamodel::CObjWelllogRound* pWR = dynamic_cast(m_pObject); // QString name=m_pUI->wellName->text(); // name=name.toUpper(); // if(!(pWR->isExistsName(name))) // { // pWR->SetName(name); // } // else // { // errInfo =name; // errInfo+="井次名称已经存在!"; // m_pUI->wellName->setFocus(); // flag = -1; // } // } } else { errInfo = "请输入井次名!"; m_pUI->wellName->setFocus(); flag = false; } if(flag!=1) { QMessageBox::about(NULL, "提示", errInfo); } return flag; } CWellLogRoundDialog::~CWellLogRoundDialog() { delete m_pUI; m_pUI = NULL; } void CWellLogRoundDialog::slotSave() { // pai::datamodel::CObjWelllogRound* pW = dynamic_cast(m_pObject); // if(!pW) return; // int ret=Validate(); // if(ret==1) // { // ViewToData(m_pObject); // wellLR.SaveMeesge(pW->GetName()); // QString name=GetLogdataPath(); // name+=GetProject()->GetName(); // name+="\\#"; // name+=pW->GetWell()->GetName(); // name+="\\"+pW->GetName(); // name+=".slf"; // pW->SetSlfFileName(name); // accept(); // } // else if(!ret) // { // QMessageBox::warning(NULL,"警告","请将相关参数填写完毕"); // } } void CWellLogRoundDialog::DataToViewOld() { // pai::datamodel::CObjWelllogRound* pWelllogRound = dynamic_cast(pObject); // if(pWelllogRound != NULL) // { // pai::ios::welllog::WelllogRound& wellLR = pWelllogRound->GetDBWelllogRound(); // m_pUI->wellName->setText(pWelllogRound->GetName()); // m_pUI->compayName->setText(QString::fromStdString(wellLR.GetCompanyName())); // m_pUI->team->setText(QString::fromStdString(wellLR.GetTeam())); // m_pUI->operaters->setText(QString::fromStdString(wellLR.GetOperator())); // //操作日期 // QString format = "yyyy年-MM月-dd日"; // m_pUI->date->setCalendarPopup(true); // m_pUI->date->setCalendarWidget(new QCalendarWidget()); // m_pUI->date->setDisplayFormat(format); // if(wellLR.GetDate() != "") // m_pUI->date->setDate(QDate::fromString(QString::fromStdString(wellLR.GetDate()),format)); // else // m_pUI->date->setDate(QDate::currentDate()); // //测井系列 // ComboxFromConfigFile(m_pUI->serial,"serial"); // if(wellLR.GetSerial() != "") // { // QString tempSerialValue = QString::fromStdString(wellLR.GetSerial()); // if((m_pUI->serial->findText(tempSerialValue))) // { // m_pUI->serial->setCurrentIndex(m_pUI->serial->findText(tempSerialValue)); // } // } // //测井项目 // ComboxFromConfigFile(m_pUI->item,"wellItem"); // if(wellLR.GetItem() != "") // { // QString tempItemValue = QString::fromStdString(wellLR.GetItem()); // if((m_pUI->item->findText(tempItemValue))) // { // m_pUI->item->setCurrentIndex(m_pUI->item->findText(tempItemValue)); // } // } // //泥浆类型 // ComboxFromConfigFile(m_pUI->mudType,"mudType"); // if(wellLR.GetMudType() != "") // { // QString tempMudType = QString::fromStdString(wellLR.GetMudType()); // if((m_pUI->mudType->findText(tempMudType))) // { // m_pUI->mudType->setCurrentIndex(m_pUI->mudType->findText(tempMudType)); // } // } // int decimal = -1; // //泥浆粘度 // m_pUI->mudViscosity->setText(DoubleToString(wellLR.GetMudViscosity(),decimal,NULL)); // m_pUI->waterLoss->setText(DoubleToString(wellLR.GetWaterLoss(),decimal,NULL)); // m_pUI->density->setText(DoubleToString(wellLR.GetDensity(),decimal,NULL)); // m_pUI->resi->setText(DoubleToString(wellLR.GetResi(),decimal,NULL)); // m_pUI->temp->setText(DoubleToString(wellLR.GetTemp(),decimal,NULL)); // m_pUI->tempBot->setText(DoubleToString(wellLR.GetTempBot(),decimal,NULL)); // m_pUI->INTLog->setText(QString::fromStdString(wellLR.GetINTLog())); // m_pUI->NITINT->setText(QString::fromStdString(wellLR.GetNITINT())); // m_pUI->IntProg->setText(QString::fromStdString(wellLR.GetIntProg())); // m_pUI->InteDress->setText(QString::fromStdString(wellLR.GetInteDress())); // m_pUI->audit->setText(QString::fromStdString(wellLR.GetAudit())); // m_pUI->remark->setText(QString::fromStdString(wellLR.GetRemark())); // } } void CWellLogRoundDialog::ViewToDataOld() { // pai::datamodel::CObjWelllogRound* pW = dynamic_cast(pObject); // pW->SetName(m_pUI->wellName->text()); // pai::ios::welllog::WelllogRound& wellLR = pW->GetDBWelllogRound(); // wellLR.SetCompanyName(m_pUI->compayName->text().toStdString()); // wellLR.SetTeam(m_pUI->team->text().toStdString()); // wellLR.SetOperator(m_pUI->operaters->text().toStdString()); // wellLR.SetDate(m_pUI->date->text().toStdString()); // wellLR.SetSerial((m_pUI->serial->itemText(m_pUI->serial->currentIndex())).toStdString()); // wellLR.SetItem((m_pUI->item->itemText(m_pUI->item->currentIndex())).toStdString()); // wellLR.SetMudType((m_pUI->mudType->itemText(m_pUI->mudType->currentIndex())).toStdString()); // wellLR.SetMudViscosity(m_pUI->mudViscosity->text().toFloat()); // wellLR.SetWaterLoss(m_pUI->waterLoss->text().toFloat()); // wellLR.SetDensity(m_pUI->density->text().toFloat()); // wellLR.SetResi(m_pUI->resi->text().toFloat()); // wellLR.SetTemp(m_pUI->temp->text().toFloat()); // wellLR.SetTempBot(m_pUI->tempBot->text().toFloat()); // wellLR.SetINTLog(m_pUI->INTLog->text().toStdString()); // wellLR.SetNITINT(m_pUI->NITINT->text().toStdString()); // wellLR.SetIntProg(m_pUI->IntProg->text().toStdString()); // wellLR.SetInteDress(m_pUI->InteDress->text().toStdString()); // wellLR.SetAudit(m_pUI->audit->text().toStdString()); // wellLR.SetRemark(m_pUI->remark->toHtml().toStdString()); }