diff --git a/CallManage/CallManage.h b/CallManage/CallManage.h index 1153c12..9de0d1b 100644 --- a/CallManage/CallManage.h +++ b/CallManage/CallManage.h @@ -38,8 +38,9 @@ signals: void sig_CloseProject();//关闭项目 void sig_ShowCurve(QString strSlfName, QString strName);//曲线数据查看 + void sig_DepthShift(QString strSlfName, QString strName, double DepthOffset);//深度移动 void sig_ShowTable(QString strSlfName, QString strName);//表格数据查看 - void sig_WelllogInformation(QString strSlfName, QString strName);//编辑测井信息 + void sig_WelllogInformation(QString strSlfName);//编辑测井信息 // 0.Uuid 1.WellName 2.SlfName 3.lineName 4.Type 5.W void sig_NewCol(QStringList listdt); diff --git a/logPlus/mainwindow.cpp b/logPlus/mainwindow.cpp index c80338e..77eb607 100644 --- a/logPlus/mainwindow.cpp +++ b/logPlus/mainwindow.cpp @@ -87,7 +87,7 @@ MainWindow::MainWindow(QWidget *parent) : connect(CallManage::getInstance(), SIGNAL(sig_ShowTable(QString, QString)), this, SLOT(s_ShowTable(QString, QString))); //关联信号槽,测井信息表数据查看 - connect(CallManage::getInstance(), SIGNAL(sig_WelllogInformation(QString, QString)), this, SLOT(s_WelllogInformation(QString, QString))); + connect(CallManage::getInstance(), SIGNAL(sig_WelllogInformation(QString)), this, SLOT(s_WelllogInformation(QString))); } MainWindow::~MainWindow() @@ -519,7 +519,7 @@ void MainWindow::s_ShowTable(QString strSlfName, QString strName) } //编辑测井信息 -void MainWindow::s_WelllogInformation(QString strSlfName, QString strName) +void MainWindow::s_WelllogInformation(QString strSlfName) { if(m_centerWidgets) { diff --git a/logPlus/mainwindow.h b/logPlus/mainwindow.h index 75e203d..1386a14 100644 --- a/logPlus/mainwindow.h +++ b/logPlus/mainwindow.h @@ -91,7 +91,7 @@ public slots: void s_ShowCurve(QString strSlfName, QString strName);//曲线数据查看 void s_ShowTable(QString strSlfName, QString strName);//表格数据查看 - void s_WelllogInformation(QString strSlfName, QString strName);//编辑测井信息 + void s_WelllogInformation(QString strSlfName);//编辑测井信息 }; diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index 79ac7c3..07b9adf 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -116,6 +116,7 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) : //曲线选中,置顶 connect(CallManage::getInstance(), SIGNAL(sig_Raise(QString, QString, QString, QString, QString, int)), this, SLOT(s_Raise(QString, QString, QString, QString, QString, int))); + //图头 m_dock1=new QDockWidget(tr(""),this); m_dock1->setFeatures(QDockWidget::NoDockWidgetFeatures);//QDockWidget::DockWidgetMovable @@ -617,9 +618,171 @@ void MainWindowCurve::s_Shift() } } +void MainWindowCurve::MoveShift(QString strSlfName, QString strLineName, float sdep,float edep,float delta) +{ + if(sdep>=edep&&delta==0) return; + if(strSlfName=="") return; + CMemRdWt * logio=new CMemRdWt(); + if(!logio->Open(strSlfName.toStdString().c_str(),CSlfIO::modeReadWrite)) + { + delete logio; + //AppendConsole(pai::log::PAI_ERROR,"SLF文件打开失败,请检查!"); + return; + } + + int curveindex=logio->FindObjectName((char*)strLineName.toStdString().c_str()); + if(curveindex<0) + { + delete logio; + return; + } + CString szBuffer=""; + + if(sdep==edep&&sdep==-9999.0) { + szBuffer=QString::number(delta,'f',3)+"\r\n"; + WriteShiftMessage(*logio,szBuffer,strLineName); + logio->CorrectObjectDepth(curveindex,delta); + delete logio; +// if(isRun) { +// isLoad=false; +// LoadFromSLF(); +// } + return; + } + curveindex=logio->OpenChannel(strLineName.toStdString().c_str()); + if(curveindex>-1) { + szBuffer.Format("%10.3f %10.3f %10.3f\r\n",sdep,edep,delta); + WriteShiftMessage(*logio,szBuffer,strLineName); + logio->MoveDepth(curveindex,sdep,edep,delta); + } + else { + int ObjectType=logio->GetObjectType(strLineName.toStdString().c_str()); + float sdeps[2],edeps[2]; + sdeps[0]=sdep; + edeps[0]=sdep+delta; + sdeps[1]=edep; + edeps[1]=edep+delta; + szBuffer.Format("%10.3f %10.3f\r\n%10.3f %10.3f\r\n",sdeps[0],edeps[0],sdeps[1],edeps[1]); + WriteShiftMessage(*logio,szBuffer,strLineName); + if(ObjectType >CARD_OBJECT||ObjectType==0) + { + int index=logio->OpenTable(strLineName.toStdString().c_str()); + if(index>-1) + { + logio->EShiftTableDepth((char*)strLineName.toStdString().c_str(),2,sdeps,edeps); + } + } + else if(ObjectType==CARD_OBJECT) { + logio->EshiftStreamDepth((char *)strLineName.toStdString().c_str(),2,sdeps,edeps); + } + } + delete logio; +// if(isRun) { +// isLoad=false; +// LoadFromSLF(); +// } +} + +void MainWindowCurve::slotRun() +{ + double depthshift=spinbox3->text().toFloat(); + if(depthshift==0) return; + + float sdep=spinbox1->text().toFloat(); + float edep=spinbox2->text().toFloat(); + if(sdep>edep) { + float depp=sdep; + sdep=edep; + edep=sdep; + } + + if(m_SelectTableItem.m_iTableType==2) + { + //道 + QStringList listLine = getLineList(m_SelectTableItem.m_strWellName, m_SelectTableItem.m_strTrackName); + if(listLine.size()>0) + { + for(int i=0; isetText(toString(((int)(yGeoNormal*10+0.5))/10.0)); + } + else spinbox1->setText("-9999.0"); + form.addRow(value1, spinbox1); + value1 = QString("终止深度: "); + spinbox2 = new QLineEdit(&dialog); + form.addRow(value1, spinbox2); + if(1) + { + spinbox2->setText(toString(-g_iY1)); + } + else spinbox2->setText("-9999.0"); + value1 = QString("移动量(上移-,下移+): "); + spinbox3 = new QLineEdit(&dialog); + form.addRow(value1, spinbox3); + spinbox3->setText("0"); + QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, + Qt::Horizontal, &dialog); + //m_ButtonBox=&buttonBox; + form.addWidget(&buttonBox); + + //m_LOGS=logs; + //QObject::connect(spinbox1, SIGNAL(returnPressed()), this, SLOT(slotSetDep())); + //QObject::connect(spinbox2, SIGNAL(returnPressed()), this, SLOT(slotSetDep())); + QObject::connect(buttonBox.button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(slotRun())); + QObject::connect(&buttonBox, SIGNAL(rejected()), &dialog, SLOT(reject())); + buttonBox.button(QDialogButtonBox::Ok)->setAutoDefault(false); + //slotSetDep(); + dialog.show(); + if (dialog.exec() == QDialog::Accepted) { + // Do something here + } + } } QStringList MainWindowCurve::insertCol(int nW) diff --git a/logPlus/mainwindowcurve.h b/logPlus/mainwindowcurve.h index f9d6e24..d4be5b7 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -76,6 +76,10 @@ public: QtProjectWidgets *m_leftWidgets = NULL; //左侧工程区 + QLineEdit *spinbox1; + QLineEdit *spinbox2; + QLineEdit *spinbox3; + public: //展示所有井 void DisplayWells(QJsonArray wellsArray); @@ -157,8 +161,9 @@ public slots: //校深 void ApplyShiftDepth(QString strSlfName, QString strLineName, double DepthOffset); void s_Shift(); // 整体深度平移校正 - void s_MoveShift(); // 深度分段平移校正 - + void MoveShift(QString strSlfName, QString strLineName, float sdep,float edep,float delta); + void s_MoveShift(); // 深度分段平移校正 + void slotRun(); // void s_showHeadTable(); //显示/隐藏图头 diff --git a/logPlus/qmytreewidget.cpp b/logPlus/qmytreewidget.cpp index 3c5b847..4b95504 100644 --- a/logPlus/qmytreewidget.cpp +++ b/logPlus/qmytreewidget.cpp @@ -25,7 +25,7 @@ QString QMyTreeWidget::getCurrentItemString() } QString strTreeTag = item->data(0, Qt::UserRole).toString(); - if (strTreeTag == "wellItem") + if (strTreeTag == "wellItem")//井次名称 { //曲线 QString strSlfName = item->data(0, Qt::UserRole+1).toString(); diff --git a/logPlus/qtprojectwidgets.cpp b/logPlus/qtprojectwidgets.cpp index 42d6119..5b596ca 100644 --- a/logPlus/qtprojectwidgets.cpp +++ b/logPlus/qtprojectwidgets.cpp @@ -424,7 +424,7 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q QTreeWidgetItem *itemwell = new QTreeWidgetItem(); itemwell->setText(0, wellname); itemwell->setData(0, Qt::UserRole, "wellItem"); // 存储额外数据,如ID - itemwell->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径 + itemwell->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,slf文件路径 // QIcon iconwell; iconwell.addPixmap(QPixmap(":/image/left_index.png"), QIcon::Selected); @@ -627,13 +627,13 @@ void QtProjectWidgets::initMenu() void QtProjectWidgets::initRootTreeMenu(QMenu *menu, QTreeWidget *treeWidget) { m_action_New = new QAction("新建项目", treeWidget); - m_action_New->setIcon(QIcon(":/image/u174.png")); // 设置图标 + m_action_New->setIcon(QIcon(GetImagePath() + "newproject.png")); // 设置图标 connect(m_action_New, SIGNAL(triggered(bool)), this, SLOT(onNewProject(bool))); menu->addAction(m_action_New); // m_action_Open = new QAction("打开项目", treeWidget); - m_action_Open->setIcon(QIcon(":/image/u174.png")); // 设置图标 + m_action_Open->setIcon(QIcon(GetImagePath() + "openproject.png")); // 设置图标 connect(m_action_Open, SIGNAL(triggered(bool)), this, SLOT(onOpenProject(bool))); menu->addAction(m_action_Open); @@ -643,40 +643,50 @@ void QtProjectWidgets::initRootTreeMenu(QMenu *menu, QTreeWidget *treeWidget) void QtProjectWidgets::initCurveObjectTreeMenu(QMenu *menu, QTreeWidget *treeWidget) { m_action_ShowCurve = new QAction("数据查看", treeWidget); - m_action_ShowCurve->setIcon(QIcon(":/image/u174.png")); // 设置图标 + m_action_ShowCurve->setIcon(QIcon(GetImagePath() + "icon/Sheet.png")); // 设置图标":/image/u174.png" connect(m_action_ShowCurve, SIGNAL(triggered(bool)), this, SLOT(onShowCurve(bool))); menu->addAction(m_action_ShowCurve); + // + m_action_DepthShift = new QAction("深度移动", treeWidget); + m_action_DepthShift->setIcon(QIcon(GetImagePath() + "icon/RigidDepthShifting.png")); // 设置图标 + connect(m_action_DepthShift, SIGNAL(triggered(bool)), this, SLOT(onDepthShift(bool))); + menu->addAction(m_action_DepthShift); } //初始化表格对象-右键菜单 void QtProjectWidgets::initTableObjectTreeMenu(QMenu *menu, QTreeWidget *treeWidget) { QAction* action_TableObject = new QAction("数据查看", treeWidget); - action_TableObject->setIcon(QIcon(":/image/u174.png")); // 设置图标 + action_TableObject->setIcon(QIcon(GetImagePath() + "icon/Sheet.png")); // 设置图标 connect(action_TableObject, SIGNAL(triggered(bool)), this, SLOT(onShowTable(bool))); menu->addAction(action_TableObject); + // + QAction* action_DepthShift = new QAction("深度移动", treeWidget); + action_DepthShift->setIcon(QIcon(GetImagePath() + "icon/RigidDepthShifting.png")); // 设置图标 + connect(action_DepthShift, SIGNAL(triggered(bool)), this, SLOT(onDepthShift(bool))); + menu->addAction(action_DepthShift); } //初始化根节点(井名称)-右键菜单 void QtProjectWidgets::initWellNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget) { QAction* action_New = new QAction("导入数据", treeWidget); - action_New->setIcon(QIcon(":/image/u174.png")); // 设置图标 + action_New->setIcon(QIcon(GetImagePath() + "wellog.png")); // 设置图标 connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onImportSingleWellLogData())); menu->addAction(action_New); action_New = new QAction("导入离散数据", treeWidget); - action_New->setIcon(QIcon(":/image/u174.png")); // 设置图标 + action_New->setIcon(QIcon(GetImagePath() + "icon/intable.png")); // 设置图标 connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onImportSlfTable())); menu->addAction(action_New); action_New = new QAction("编辑井基本信息", treeWidget); - action_New->setIcon(QIcon(":/image/u174.png")); // 设置图标 + action_New->setIcon(QIcon(GetImagePath() + "icon/Edit.png")); // 设置图标 connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onEditWelllogRound())); menu->addAction(action_New); action_New = new QAction("输出数据", treeWidget); - action_New->setIcon(QIcon(":/image/u174.png")); // 设置图标 + action_New->setIcon(QIcon(GetImagePath() + "icon/outcurves.png")); // 设置图标 connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onOutWellLogRound())); menu->addAction(action_New); } @@ -685,16 +695,22 @@ void QtProjectWidgets::initWellNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget void QtProjectWidgets::initSlfNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget) { QAction* action_New = new QAction("编辑测井信息", treeWidget); - action_New->setIcon(QIcon(":/image/u174.png")); // 设置图标 + action_New->setIcon(QIcon(GetImagePath() + "icon/Edit.png")); // 设置图标 connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onWelllogInformation())); menu->addAction(action_New); + + // + QAction* action_DepthShift = new QAction("深度移动", treeWidget); + action_DepthShift->setIcon(QIcon(GetImagePath() + "icon/RigidDepthShifting.png")); // 设置图标 + connect(action_DepthShift, SIGNAL(triggered(bool)), this, SLOT(onDepthShift_Well(bool))); + menu->addAction(action_DepthShift); } //初始化根节点(表目录)-右键菜单 void QtProjectWidgets::initTableFolderTreeMenu(QMenu *menu, QTreeWidget *treeWidget) { QAction* action_New = new QAction("创建新表", treeWidget); - action_New->setIcon(QIcon(":/image/u174.png")); // 设置图标 + action_New->setIcon(QIcon(GetImagePath() + "icon/CreateTable.png")); // 设置图标 connect(action_New, SIGNAL(triggered(bool)), this, SLOT(onCreateNewTable())); menu->addAction(action_New); } @@ -753,6 +769,47 @@ void QtProjectWidgets::onShowCurve(bool checked) emit CallManage::getInstance()->sig_ShowCurve(m_strSlfName, m_strCurveObjectName); } +//深度移动 +void QtProjectWidgets::onDepthShift(bool checked) +{ + //道,曲线 + bool ok=0; + double depthshift=QInputDialog::getDouble(NULL,"深度移动","请输入移动的深度量(上移-,下移+)",0.0,-2147483647, 2147483647,4,&ok); + if(!ok) return; + if(depthshift==0) return; + if(depthshift>10) + { + int flag = QMessageBox::warning(this->parentWidget(),"提示",QString("深度移动量 =")+QString::number(depthshift)+"m\n"+"\n您确定执行校正?", + QMessageBox::Yes,QMessageBox::No); + if(flag==QMessageBox::No) + { + return; + } + } + + //emit CallManage::getInstance()->sig_DepthShift(m_strSlfName, m_strCurveObjectName, depthshift); + //1.修改内存数据 + if(m_strSlfName=="") return ; + CMemRdWt * logio=new CMemRdWt(); + if(!logio->Open(m_strSlfName.toStdString().c_str(),CSlfIO::modeReadWrite)) + { + delete logio; + //AppendConsole(pai::log::PAI_ERROR,"SLF文件打开失败,请检查!"); + return ; + }; + bool isok=0; + //TODO 目前对于表格类,参数卡类不支持,会崩溃 + int curveindex=logio->FindObjectName((char *)m_strCurveObjectName.toStdString().c_str()); + if(curveindex>=0) { + CString szBuffer=""; + szBuffer=QString::number(depthshift,'f',3)+"\r\n"; + WriteShiftMessage(*logio,szBuffer,m_strCurveObjectName); + logio->CorrectObjectDepth(curveindex, depthshift); + isok=1; + } + delete logio; +} + //表格数据查看 void QtProjectWidgets::onShowTable(bool checked) { @@ -762,7 +819,7 @@ void QtProjectWidgets::onShowTable(bool checked) //编辑测井信息 void QtProjectWidgets::onWelllogInformation() { - emit CallManage::getInstance()->sig_WelllogInformation(m_strSlfName, m_strCurveObjectName); + emit CallManage::getInstance()->sig_WelllogInformation(m_strSlfName); foreach(QTreeWidgetItem *pItem, ui->treeWidget->selectedItems()) { QTreeWidgetItem *parentItem = pItem; @@ -791,6 +848,53 @@ void QtProjectWidgets::onWelllogInformation() } } +//深度移动(井次) +void QtProjectWidgets::onDepthShift_Well(bool checked) +{ + //道,曲线 + bool ok=0; + double depthshift=QInputDialog::getDouble(NULL,"深度移动","请输入移动的深度量(上移-,下移+)",0.0,-2147483647, 2147483647,4,&ok); + if(!ok) return; + if(depthshift==0) return; + if(depthshift>10) + { + int flag = QMessageBox::warning(this->parentWidget(),"提示",QString("深度移动量 =")+QString::number(depthshift)+"m\n"+"\n您确定执行校正?", + QMessageBox::Yes,QMessageBox::No); + if(flag==QMessageBox::No) + { + return; + } + } + + //emit CallManage::getInstance()->sig_DepthShift(m_strSlfName, m_strCurveObjectName, depthshift); + //1.修改内存数据 + if(m_strSlfName=="") return ; + CMemRdWt * logio=new CMemRdWt(); + if(!logio->Open(m_strSlfName.toStdString().c_str(),CSlfIO::modeReadWrite)) + { + delete logio; + return ; + }; + int Count=logio->GetObjectCount(); + char objname[100]; + for(int i=0;iGetObjectStatus(i)!=OBJECT_NORMAL) continue; + logio->GetObjectName(i,objname); + int index=logio->OpenChannel(objname); + if(index==-1) continue; + int iIndex=logio->FindObjectName(objname); + if(iIndex>-1) + { + logio->CorrectObjectDepth(iIndex,depthshift); + } + CString szBuffer=""; + szBuffer=QString::number(depthshift,'f',3); + szBuffer+="\r\n"; + WriteShiftMessage(*logio,szBuffer,objname); + } + delete logio; +} + //创建新表 void QtProjectWidgets::onCreateNewTable() { @@ -966,15 +1070,15 @@ void QtProjectWidgets::onItemClicked(QTreeWidgetItem* item, int index) } else if (strTreeTag == "wellItem") { - //根节点(项目名称)-右键菜单 + //井次名称-右键菜单 popMenu = _menuSlfName; m_strSlfName = item->data(0, Qt::UserRole+1).toString(); } else if (strTreeTag == "Sheet") { - //根节点(项目名称)-右键菜单 + //表格数据-右键菜单 popMenu = _menuTableFolder; - m_strSlfName = item->parent()->data(0, Qt::UserRole+1).toString(); + m_strSlfName = item->parent()->data(0, Qt::UserRole+1).toString();//从父节点(井次)获取slf } // diff --git a/logPlus/qtprojectwidgets.h b/logPlus/qtprojectwidgets.h index 736e1af..a99a18f 100644 --- a/logPlus/qtprojectwidgets.h +++ b/logPlus/qtprojectwidgets.h @@ -40,13 +40,17 @@ public slots: //曲线 void onShowCurve(bool checked = false); //数据查看 + void onDepthShift(bool checked = false); //深度移动 //表格 void onShowTable(bool checked = false); //数据查看 void onEditWelllogRound(); void onImportSingleWellLogData(); void onImportSlfTable(); void onOutWellLogRound(); + //井次 void onWelllogInformation(); //编辑测井信息 + void onDepthShift_Well(bool checked = false); //深度移动 + //表格数据 根节点 void onCreateNewTable(); //创建新表 public: //初始化树图控件 @@ -69,6 +73,7 @@ public: //曲线对象(AC、BS...)-右键菜单 QAction* m_action_ShowCurve; + QAction* m_action_DepthShift; QString m_strSlfName; QString m_strCurveObjectName;