From 2ecd79660f173b267e81fc8b6bafba8e135c3668 Mon Sep 17 00:00:00 2001 From: jiayulong Date: Fri, 27 Feb 2026 16:35:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BA=E4=BA=95=E7=BB=93=E8=AE=BA=E5=8F=B3?= =?UTF-8?q?=E9=94=AE=E8=8F=9C=E5=8D=95=EF=BC=8C=E8=BF=BD=E5=8A=A0=EF=BC=9A?= =?UTF-8?q?=E5=88=86=E5=89=B2=E3=80=81=E5=88=A0=E9=99=A4=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E3=80=81=E8=AE=BE=E7=BD=AE=E6=B7=B1=E5=BA=A6?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E9=87=8F=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=AE=9E=E6=97=B6=E6=9B=B4=E6=96=B0=E5=88=B0?= =?UTF-8?q?slf=E6=96=87=E4=BB=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CallManage/CallManage.h | 3 + logPlus/PropertyWidget.cpp | 6 ++ logPlus/TransparentDraggableGujing.cpp | 83 +++++++++++++++++ logPlus/TransparentDraggableGujing.h | 7 +- logPlus/formdraw.cpp | 6 +- logPlus/mainwindow.cpp | 26 +++--- logPlus/qmycustomplot.cpp | 119 ++++++++++++++++++++++++- logPlus/qmycustomplot.h | 6 ++ logPlus/qtprojectwidgets.cpp | 44 +++++++++ logPlus/qtprojectwidgets.h | 7 +- 编译说明.txt | 5 ++ 11 files changed, 292 insertions(+), 20 deletions(-) diff --git a/CallManage/CallManage.h b/CallManage/CallManage.h index 92bb761..aec6787 100644 --- a/CallManage/CallManage.h +++ b/CallManage/CallManage.h @@ -191,6 +191,9 @@ signals: //编辑曲线,框选拉伸/压缩 void sig_EShiftDepth(QString strSlfName, QString strLineName, int count, QList left_Low_List, QList right_Hight_List); + //向左侧树图,追加固井结论表格 + void sig_AddGujingToTree(QString strSlfName, QString strWellName, QString strLineName); + // //void sig_addImageToPlot(QMyCustomPlot* customPlot, double left_Low, double right_Hight, QString imagePath); diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index f9689f1..992a6cf 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -233,6 +233,8 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant { double upper = variant.value(); m_tdGujing->setUpper(-upper); + //保存 + m_tdGujing->mPlot->SaveToSLF_Gujing(); } } else if("底深(m)" == m_propertyData[pProperty]) @@ -242,6 +244,8 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant { double lower = variant.value(); m_tdGujing->setLower(-lower); + //保存 + m_tdGujing->mPlot->SaveToSLF_Gujing(); } } else if("固井结论" == m_propertyData[pProperty]) @@ -254,6 +258,8 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant // QCPRange currentRange = m_tdGujing->getRange(); m_tdGujing->setRange(currentRange.lower, currentRange.upper); + //保存 + m_tdGujing->mPlot->SaveToSLF_Gujing(); } } } diff --git a/logPlus/TransparentDraggableGujing.cpp b/logPlus/TransparentDraggableGujing.cpp index 4137812..f5f949f 100644 --- a/logPlus/TransparentDraggableGujing.cpp +++ b/logPlus/TransparentDraggableGujing.cpp @@ -306,11 +306,84 @@ void TransparentDraggableGujing::updateHandles() } +//分割 +void TransparentDraggableGujing::onSplitRect() +{ + QCPRange currentRange = getRange(); + //分割后显示上半部分 + setRange((currentRange.lower+currentRange.upper)/2.0, currentRange.upper); + + //添加下半部分 + mPlot->addGujingToPlot(currentRange.lower, (currentRange.lower+currentRange.upper)/2.0, m_Result); + + double low = mRect->topLeft->coords().x(); + double hight = mRect->bottomRight->coords().x(); + PropertyService()->initGujingItemProperty(this, low, hight, m_Result); + //保存 + mPlot->SaveToSLF_Gujing(); + + //取消所有选中单元格 + emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 1, ""); +} + +//删除 void TransparentDraggableGujing::onDelRect() { //mDragMode = DragNone; //删除框图 deleteRect(); + //保存 + mPlot->SaveToSLF_Gujing(); +} + +//全部清空 +void TransparentDraggableGujing::onDelAll() +{ + if(QMessageBox::information(NULL,QObject::tr("提示"),QObject::tr("该功能将清除当前组件展示的全部信息,清除后无法恢复,但会备份到对应的\"_BAK\"中,确定清除吗?"),QMessageBox::Yes|QMessageBox::No)!=QMessageBox::Yes) return; + QString obj=mPlot->m_strLineName + "BAK"; + +} + +//设置深度移动量 +void TransparentDraggableGujing::setItemDepthOffset() +{ + bool ok=0; + double depthshift=QInputDialog::getDouble(NULL,"深度移动","请输入移动的深度量(上移-,下移+)",0.0,-2147483647, 2147483647,4,&ok); + if(!ok) return; + + QCPRange currentRange = getRange(); + QCPRange newRange = currentRange; + + newRange.lower = currentRange.lower-depthshift; + newRange.upper = currentRange.upper-depthshift; + + // + double width = currentRange.size(); +// //double center = mDragStartRange.center() + dx; +// double center = currentRange.center() - depthshift; +// newRange.lower = center - width/2; +// newRange.upper = center + width/2; + + // 检查是否超出轴范围 + if(newRange.lower < getMyLower()) { + return; + } + else if(newRange.upper > getMyUpper()) { + return; + } + // + setRange(newRange.lower, newRange.upper); + + { + double low = mRect->topLeft->coords().x(); + double hight = mRect->bottomRight->coords().x(); + PropertyService()->initGujingItemProperty(this, low, hight, m_Result); + //保存 + mPlot->SaveToSLF_Gujing(); + + //取消所有选中单元格 + emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 1, ""); + } } //设置顶深 @@ -379,8 +452,15 @@ void TransparentDraggableGujing::onMousePress(QMouseEvent *event) //event->accept(); + double low = mRect->topLeft->coords().x(); + double hight = mRect->bottomRight->coords().x(); + PropertyService()->initGujingItemProperty(this, low, hight, m_Result); + QMenu menu(nullptr); + menu.addAction(QIcon(::GetImagePath() + "icon/Split.png"), "分割", this, &TransparentDraggableGujing::onSplitRect); menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "删除选中对象", this, &TransparentDraggableGujing::onDelRect); + menu.addAction(QIcon(::GetImagePath() + "icon/Shift.png"), "设置深度移动量", this, &TransparentDraggableGujing::setItemDepthOffset); + menu.addAction(QIcon(::GetImagePath() + "icon/Delete.png"), "全部清空", this, &TransparentDraggableGujing::onDelAll); menu.exec(event->globalPos()); return; @@ -525,6 +605,9 @@ void TransparentDraggableGujing::onMouseRelease(QMouseEvent *event) double low = mRect->topLeft->coords().x(); double hight = mRect->bottomRight->coords().x(); PropertyService()->initGujingItemProperty(this, low, hight, m_Result); + //保存 + mPlot->SaveToSLF_Gujing(); + //取消所有选中单元格 emit CallManage::getInstance()->sig_Raise(mPlot->m_strUuid, "", "", "", "", 1, ""); } diff --git a/logPlus/TransparentDraggableGujing.h b/logPlus/TransparentDraggableGujing.h index f87a027..12b43df 100644 --- a/logPlus/TransparentDraggableGujing.h +++ b/logPlus/TransparentDraggableGujing.h @@ -58,14 +58,17 @@ private: void updateHandles() ; private slots: - void onDelRect(); + void onSplitRect(); //分割 + void onDelRect(); //删除 + void onDelAll(); //全部清空 + void setItemDepthOffset(); //设置深度移动量 void onMousePress(QMouseEvent *event); void onMouseMove(QMouseEvent *event); void onMouseRelease(QMouseEvent *event); double getMyLower(); double getMyUpper(); -private: +public: QMyCustomPlot *mPlot; QCPItemRect *mRect; QCPItemRect *mLeftHandle; diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 07123ae..ab4075e 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -4059,9 +4059,9 @@ bool FormDraw::LoadFromSLF_Gujing(QMyCustomPlot *widget, QString strSlfName, QSt file.close(); } - QMap zoneOrder; + //QMap zoneOrder; for(int i=0;izoneOrder_Gujing.insert(lines[i],QString::number(i)); } int iIndex=logio->OpenTable(strLineName.toStdString().c_str()); @@ -4083,7 +4083,7 @@ bool FormDraw::LoadFromSLF_Gujing(QMyCustomPlot *widget, QString strSlfName, QSt QString result = ""; // - QString iconshotname=zoneOrder.key(QString::number(m_Result->RESULT)); + QString iconshotname=widget->zoneOrder_Gujing.key(QString::number(m_Result->RESULT)); if(iconshotname!="") result=::GetGujingSymbolDir()+iconshotname+".svg"; int len=2; diff --git a/logPlus/mainwindow.cpp b/logPlus/mainwindow.cpp index 9910822..883ba97 100644 --- a/logPlus/mainwindow.cpp +++ b/logPlus/mainwindow.cpp @@ -336,21 +336,21 @@ void MainWindow::s_Open() void MainWindow::s_SaveProject() { - //加载插件显示 - QWidget * pMyWidget = CallPlugin::getInstance()->getPluginWidget(PLUGINUNIT, (QWidget *)this); - if (pMyWidget != nullptr) - { - // - m_centerWidgets->addTab(pMyWidget, "插件视图"); - } +// //加载插件显示 +// QWidget * pMyWidget = CallPlugin::getInstance()->getPluginWidget(PLUGINUNIT, (QWidget *)this); +// if (pMyWidget != nullptr) +// { +// // +// m_centerWidgets->addTab(pMyWidget, "插件视图"); +// } - //设置参数 - QString strParams = "hello"; - CallPlugin::getInstance()->setPluginParams(PLUGINUNIT, strParams); +// //设置参数 +// QString strParams = "hello"; +// CallPlugin::getInstance()->setPluginParams(PLUGINUNIT, strParams); - //获取参数 - QString strParams2 = CallPlugin::getInstance()->getPluginParams(PLUGINUNIT); - qDebug() << "getPluginParams: " << strParams2; +// //获取参数 +// QString strParams2 = CallPlugin::getInstance()->getPluginParams(PLUGINUNIT); +// qDebug() << "getPluginParams: " << strParams2; // //加载插件显示 // QWidget * pMyWidget = CallPlugin::getInstance()->getPluginWidget(MYUNITPLUGIN, NULL); diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index d155f11..dc003d8 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -18,6 +18,7 @@ #include "transparentdraggableRightList.h" #include "qtcommonclass.h" #include "slf.h" +#include "MemRdWt.h" //是否隐藏刻度 extern int g_iShow; @@ -881,7 +882,7 @@ void QMyCustomPlot::contextMenuEvent(QContextMenuEvent *event) { QMenu menu(this); //固井 - menu.addAction(QIcon(::GetImagePath() + "curve.png"), "添加固井结论", this, &QMyCustomPlot::onEditGujing); + menu.addAction(QIcon(::GetImagePath() + "curve.png"), "开始编辑固井结论", this, &QMyCustomPlot::onEditGujing); menu.exec(event->globalPos()); } @@ -1043,10 +1044,41 @@ void QMyCustomPlot::onEditGujing() double right_Hight = this->xAxis->pixelToCoord(top); double left_Low = this->xAxis->pixelToCoord(bottom); + //追加判断,避免框选重叠 + TransparentDraggableGujing *pDraggableRect =NULL; + { + QMap::Iterator it = m_mapDraggable_Gujing.begin(); + while( it != m_mapDraggable_Gujing.end() ) + { + pDraggableRect = (TransparentDraggableGujing*)it.value(); + // + QCPRange tmpRange = pDraggableRect->getRange(); + if(tmpRange.lower >= left_Low && tmpRange.upper <= right_Hight) + { + return; + } + + if(tmpRange.upper >= left_Low && tmpRange.upper <= right_Hight) + { + return; + } + + if(tmpRange.lower >= left_Low && tmpRange.lower <= right_Hight) + { + return; + } + + it++; + } + } + { //添加固井结论 this->addGujingToPlot(left_Low, right_Hight, ::GetGujingSymbolDir());//left_Low, right_Hight + //保存 + this->SaveToSLF_Gujing(); + //取消框选 this->setInteractions(QCP::iSelectLegend | QCP::iSelectPlottables); this->setSelectionRectMode(QCP::srmNone); @@ -1056,6 +1088,90 @@ void QMyCustomPlot::onEditGujing() } } + +bool QMyCustomPlot::SaveToSLF_Gujing() +{ + static int isrun=false; + if(isrun) return false; + QString ss=m_strSlfName; + if(ss=="") return false; + isrun=true; + + GUJING_DATA m_Result; + CMemRdWt *logio=new CMemRdWt(); + if(ss==""||!logio->Open(ss.toStdString().c_str(),CSlfIO::modeReadWrite)) + { + delete logio; + QMessageBox::information(NULL,"提示","SLF文件打开失败,请检查!!",QMessageBox::Yes); + isrun=false; + return false; + } + + int iIndex=logio->OpenTable(m_strLineName.toStdString().c_str()); + bool isfirst=false; + if (iIndex < 0) + { + if(!m_mapDraggable_Gujing.size()) { + delete logio; + isrun=false; + return false; + } + iIndex=logio->Open_Set_Table(m_strLineName.toStdString().c_str(),GUJING_OBJECT,4, + "NO,SDEP,EDEP,RESULT", + "4,4,4,4",//字段长度 + "1,4,4,1",//字段类型 + "0,0,0,2");//字段备注 + isfirst=true; + } + logio->SetTableRecordCount(iIndex,m_mapDraggable_Gujing.size()); + int j=0; + if(!m_mapDraggable_Gujing.size()) { + delete logio; + if(isfirst)AddTableToWellRound(); + isrun=false; + return false; + } + + TransparentDraggableGujing *pDraggableRect =NULL; + for (QMap::Iterator iter = m_mapDraggable_Gujing.begin(); iter != m_mapDraggable_Gujing.end(); iter++,j++) + { + pDraggableRect = (TransparentDraggableGujing*)iter.value(); + // + QCPRange tmpRange = pDraggableRect->getRange(); + + memset(&m_Result,0,sizeof(GUJING_DATA)); + m_Result.SDEP = -tmpRange.upper; + m_Result.EDEP = -tmpRange.lower; + m_Result.NO=j+1; + m_Result.RESULT=0; + QString innerresult=GetIntResult_Gujing(pDraggableRect->m_Result); + if(innerresult!="") + m_Result.RESULT=innerresult.toInt(); + if(m_Result.RESULT<0) m_Result.RESULT=0; + logio->WriteTable(iIndex,j+1,&m_Result); + } + logio->CloseTable(iIndex); + delete logio; + if(isfirst)AddTableToWellRound(); + isrun=false; + return true; +} + +QString QMyCustomPlot::GetIntResult_Gujing(QString result) +{ + if(result=="") return ""; + QFileInfo afile(result); + QString strBaseName = afile.completeBaseName(); + + return zoneOrder_Gujing.value(strBaseName); +} + +//向左侧树图,追加固井结论表格 +void QMyCustomPlot::AddTableToWellRound() +{ + emit CallManage::getInstance()->sig_AddGujingToTree(m_strSlfName, m_strWellName, m_strLineName); +} + void QMyCustomPlot::onAddRect() { double right_Hight = xAxis->pixelToCoord(m_event->pos().y());//x轴展示深度 @@ -1675,6 +1791,7 @@ void QMyCustomPlot::addGujingToPlot(double left_Low, double right_Hight, const Q //dragRect->setTitle(strText); m_mapDraggable_Gujing[strUuid] = dragRect; + } //气测/FMT/射孔/文本 diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index 390c7ea..fb67706 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -137,6 +137,12 @@ public: QObject* m_SelectShiftLine=nullptr;//当前选中的分段线 QObject* m_SelectRect=nullptr;//当前选中的曲线编辑框 + //固井 + QMap zoneOrder_Gujing; + bool SaveToSLF_Gujing(); + QString GetIntResult_Gujing(QString result); + void AddTableToWellRound();//将固井结论表,添加到左侧树图 + public slots: void slot_time(); diff --git a/logPlus/qtprojectwidgets.cpp b/logPlus/qtprojectwidgets.cpp index 08ae122..2c4a824 100644 --- a/logPlus/qtprojectwidgets.cpp +++ b/logPlus/qtprojectwidgets.cpp @@ -51,6 +51,8 @@ QtProjectWidgets::QtProjectWidgets(QWidget *parent) connect(CallManage::getInstance(), SIGNAL(sig_NewProject()), this, SLOT(s_NewProject())); //关联信号槽,打开评估工程 connect(CallManage::getInstance(), SIGNAL(sig_OpenProject(QString)), this, SLOT(s_OpenProject(QString))); + //向左侧树图,追加固井结论表格 + connect(CallManage::getInstance(), SIGNAL(sig_AddGujingToTree(QString,QString,QString)), this, SLOT(s_AddGujingToTree(QString,QString,QString))); //初始化树形控件中的右键菜单 initMenu(); @@ -1272,3 +1274,45 @@ void QtProjectWidgets::onItemChanged(QTreeWidgetItem* item, int index) // emit CallManage::getInstance()->sig_testPlugin(m_strCurveObjectName); // } } + +//向左侧树图,追加固井结论表格 +void QtProjectWidgets::s_AddGujingToTree(QString strSlfName, QString strWellName, QString strLineName) +{ + int topCount = ui->treeWidget->topLevelItemCount(); // 获取顶级节点数量 + if(topCount<1) + { + return; + } + + QTreeWidgetItem *item = ui->treeWidget->topLevelItem(0); + int childCount = item->childCount(); // 获取子节点数量 + for (int i = 0; i < childCount; ++i) + { + //井组,数据分析... + QTreeWidgetItem *wellGroupItem = item->child(i); + QString wellGroupname = wellGroupItem->text(0); + if (wellGroupname == "井组") + { + int wellCount = wellGroupItem->childCount(); // 获取井节点数量 + for (int j = 0; j < wellCount; ++j) + { + //井组,数据分析... + QTreeWidgetItem *wellItem = wellGroupItem->child(j); + QString wellname = wellItem->text(0); + if(wellname==strWellName)//井 + { + // 获取井次节点数量 + int wellLogCount = wellItem->childCount(); + for (int k = 0; k < wellLogCount; ++k) + { + QTreeWidgetItem *wellLogItem = wellItem->child(k); + wellItem->removeChild(wellLogItem); + } + //井重新加载井次信息 + loadWellTree(wellItem, strSlfName, strWellName); + wellItem->setExpanded(true); + } + } + } + } +} diff --git a/logPlus/qtprojectwidgets.h b/logPlus/qtprojectwidgets.h index b77904a..55e7efe 100644 --- a/logPlus/qtprojectwidgets.h +++ b/logPlus/qtprojectwidgets.h @@ -56,7 +56,11 @@ public slots: void onWelllogInformation(); //编辑测井信息 void onDepthShift_Well(bool checked = false); //深度移动 //表格数据 根节点 - void onCreateNewTable(); //创建新表 + void onCreateNewTable(); //创建新表 + + //向左侧树图,追加固井结论表格 + void s_AddGujingToTree(QString strSlfName, QString strWellName, QString strLineName); + public: //初始化树图控件 //void initTreeWidget(QString fullPath, QString strProjectName); @@ -111,6 +115,7 @@ public: void initSlfNameTreeMenu(QMenu *menu, QTreeWidget *treeWidget); //初始化根节点(表目录)-右键菜单 void initTableFolderTreeMenu(QMenu *menu, QTreeWidget *treeWidget); + private: }; diff --git a/编译说明.txt b/编译说明.txt index e06674b..20bb342 100644 --- a/编译说明.txt +++ b/编译说明.txt @@ -23,4 +23,9 @@ https://www.cnblogs.com/ys0103/p/4562493.html 20.logPlus +powershell统计代码行数 +Get-ChildItem -Recurse -Include *.h | Get-Content | Measure-Object -Line +Get-ChildItem -Recurse -Include *.cpp | Get-Content | Measure-Object -Line + +Get-ChildItem -Recurse -Include *.ui | Get-Content | Measure-Object -Line