From 2c70f61b6f7c70c33e49d68361dd8a55ed8fe953 Mon Sep 17 00:00:00 2001 From: jiayulong Date: Tue, 2 Jun 2026 14:22:50 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A4=9A=E4=BA=95=EF=BC=8C=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=9D=A1=E8=BF=BD=E5=8A=A0=E2=80=9C=E4=BA=95=E9=97=B4?= =?UTF-8?q?=E8=B7=9D=E2=80=9D=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/mainwindowcurve.cpp | 34 ++++++++++++++++++++++++++++++++++ logPlus/mainwindowcurve.h | 2 ++ 2 files changed, 36 insertions(+) diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index 034a19a..42f862a 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -655,6 +655,7 @@ void MainWindowCurve::initMainToolBar() QIcon zoominIcon(::GetImagePath()+"icon/zoomin.png"); QIcon zoomoutIcon(::GetImagePath()+"icon/zoomout.png"); QIcon wellTopAlignIcon(::GetImagePath()+"WellInterp/井顶对齐.png"); + QIcon wellsSpaceIcon(::GetImagePath()+"WellInterp/井间距离.png"); //Main工具栏 m_selectWellAc = new QAction(selectWellIcon, "设置井", this); @@ -674,6 +675,7 @@ void MainWindowCurve::initMainToolBar() m_autorollAc = new QAction(autorollIcon, "图像自滚", this); m_PreviewPrintAc = new QAction(blackIcon, "预览图", this); m_wellTopAlignAc = new QAction(wellTopAlignIcon, "井顶对齐", this); + m_wellsSpaceAc = new QAction(wellsSpaceIcon, "井间距", this); m_ModuleOpenAc = new QAction(ModuleOpenIcon, "处理方法", this); ui->mainToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); //此种方式为文字显示在图标右侧 @@ -700,6 +702,7 @@ void MainWindowCurve::initMainToolBar() ui->mainToolBar->addSeparator(); // ui->mainToolBar->addAction(m_wellTopAlignAc); //井顶对齐 + ui->mainToolBar->addAction(m_wellsSpaceAc); //井间距 ui->mainToolBar->addAction(m_ModuleOpenAc); //处理方法 // 设置为可选中 @@ -732,6 +735,7 @@ void MainWindowCurve::initMainToolBar() connect(m_autorollAc, &QAction::triggered, this, &MainWindowCurve::s_Autoroll); connect(m_PreviewPrintAc, &QAction::triggered, this, &MainWindowCurve::s_PreviewPrint); connect(m_wellTopAlignAc, &QAction::triggered, this, &MainWindowCurve::s_wellTopAlign); + connect(m_wellsSpaceAc, &QAction::triggered, this, &MainWindowCurve::s_wellsSpace); connect(m_ModuleOpenAc, &QAction::triggered, this, &MainWindowCurve::s_ModuleOpen); connect(CallManage::getInstance(), SIGNAL(sig_SaveAsPicture()), this, SLOT(s_SaveAsPicture())); @@ -3128,6 +3132,36 @@ void MainWindowCurve::s_wellTopAlign() } } +//井间距 +void MainWindowCurve::s_wellsSpace() +{ + bool ok=0; + QString Formtiom=QInputDialog::getText(NULL,"井位间距设置","井位等间距(mm)",QLineEdit::Normal,"",&ok); + if(!ok) return; + if(Formtiom.toFloat()) + { + float dSpace=Formtiom.toFloat();//mm + + int iNewWidth = static_cast(dSpace/10.0 * g_dPixelPerCm); + //设置列宽 + int columnCount = ui->tableWidget_2->columnCount();//总列数 + for(int i=0; itableWidget_2->setColumnWidth(i, iNewWidth); + } + } +} + //预览图 void MainWindowCurve::s_PreviewPrint() { diff --git a/logPlus/mainwindowcurve.h b/logPlus/mainwindowcurve.h index b62892b..5ef8716 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -249,6 +249,7 @@ public: QAction* m_autorollAc = nullptr; //图像自滚 QAction* m_PreviewPrintAc = nullptr; //预览图 QAction* m_wellTopAlignAc = nullptr; //井顶对齐 + QAction* m_wellsSpaceAc = nullptr; //井间距 QAction* m_ModuleOpenAc = nullptr; //处理方法 public slots: @@ -342,6 +343,7 @@ public slots: void s_Autoroll(); //图像自滚 void s_PreviewPrint(); //预览图 void s_wellTopAlign(); //井顶对齐 + void s_wellsSpace(); //井间距 void s_ModuleOpen(); //处理算法 // void _slotExport(QPrinter &printer, int IsBmp, QString pngName, QString strTmpName); From 53a2891e6cfe66711bc8d4276dfff2dd3abb8cf9 Mon Sep 17 00:00:00 2001 From: jiayulong Date: Tue, 2 Jun 2026 15:16:02 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=B7=A5=E5=85=B7=E6=A0=8F=E6=8C=89?= =?UTF-8?q?=E9=92=AE=EF=BC=8C=E5=90=88=E6=88=90=E4=B8=BA=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/mainwindowcurve.cpp | 49 +++++++++++++++++++++++++++++++------ 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index 42f862a..b15919a 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -640,11 +640,13 @@ void MainWindowCurve::initMainToolBar() QIcon selectWellIcon(::GetImagePath()+"icon/SelectWells.png"); QIcon fixwellsectionHeaderIcon(::GetImagePath()+"icon/fixwellsectionHeader.png"); + QIcon templateIcon(::GetImagePath()+"WellInterp/导出模板.png"); QIcon opentemplateIcon(::GetImagePath()+"icon/currtemplite.png"); QIcon saveastemplateIcon(::GetImagePath()+"icon/SaveAsTemplate.png"); QIcon executeDepthShiftIcon(::GetImagePath()+"icon/ExecuteDepthShift.png"); QIcon joindepthIcon(::GetImagePath()+"icon/joindepth.png"); QIcon ModuleOpenIcon(::GetImagePath()+"icon/ModuleOne.png"); + QIcon printIcon(::GetImagePath()+"WellInterp/导出图片.png"); QIcon SaveAsPictureIcon(::GetImagePath()+"icon/SaveAsPicture.png"); QIcon SaveAsPdfIcon(::GetImagePath()+"icon/ExportPDF.png"); QIcon SaveAsSvgIcon(::GetImagePath()+"icon/ExportSVG.png"); @@ -652,6 +654,7 @@ void MainWindowCurve::initMainToolBar() QIcon crossIcon(::GetImagePath()+"icon/Cross.png"); QIcon autorollIcon(::GetImagePath()+"icon/autoroll.png"); QIcon blackIcon(::GetImagePath()+"icon/black.png"); + QIcon zoomIcon(::GetImagePath()+"icon/Scale.png"); QIcon zoominIcon(::GetImagePath()+"icon/zoomin.png"); QIcon zoomoutIcon(::GetImagePath()+"icon/zoomout.png"); QIcon wellTopAlignIcon(::GetImagePath()+"WellInterp/井顶对齐.png"); @@ -680,18 +683,50 @@ void MainWindowCurve::initMainToolBar() ui->mainToolBar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); //此种方式为文字显示在图标右侧 + // 缩放 + QAction* zoomMenuAction = new QAction(zoomIcon, "缩放", this); + // 创建下拉菜单 + QMenu* menuZoom = new QMenu(this); + menuZoom->addAction(m_zoominAc); //放大 + menuZoom->addAction(m_zoomoutAc); //缩小 + zoomMenuAction->setMenu(menuZoom); + + // 导出成果图 + QAction* printMenuAction = new QAction(printIcon, "导出成果图", this); + // 创建下拉菜单 + QMenu* menuPrint = new QMenu(this); + menuPrint->addAction(m_SaveAsPictureAc); //导出长图 + menuPrint->addAction(m_SaveAsPdfAc); //导出PDF + menuPrint->addAction(m_SaveAsSvgAc); //导出SVG + printMenuAction->setMenu(menuPrint); + + + // 图文件 + QAction* templateAction = new QAction(templateIcon, "图文件", this); + // 创建下拉菜单 + QMenu* menuTemplate = new QMenu(this); + menuTemplate->addAction(m_opentemplateAc); //加载图文件 + menuTemplate->addAction(m_saveastemplateAc); //另存为图文件 + templateAction->setMenu(menuTemplate); + //add QAction to Widget. ui->mainToolBar->addAction(m_selectWellAc); ui->mainToolBar->addAction(m_fixwellsectionHeaderAc); //锁头 - ui->mainToolBar->addAction(m_opentemplateAc); //加载图文件 - ui->mainToolBar->addAction(m_saveastemplateAc); //另存为图文件 + ui->mainToolBar->addAction(templateAction); //图文件菜单 +// ui->mainToolBar->addAction(m_opentemplateAc); //加载图文件 +// ui->mainToolBar->addAction(m_saveastemplateAc); //另存为图文件 ui->mainToolBar->addSeparator(); - ui->mainToolBar->addAction(m_zoominAc); //放大 - ui->mainToolBar->addAction(m_zoomoutAc); //缩小 - ui->mainToolBar->addAction(m_SaveAsPictureAc); //导出长图 - ui->mainToolBar->addAction(m_SaveAsPdfAc); //导出PDF - ui->mainToolBar->addAction(m_SaveAsSvgAc); //导出SVG + + ui->mainToolBar->addAction(zoomMenuAction); //缩放菜单 +// ui->mainToolBar->addAction(m_zoominAc); //放大 +// ui->mainToolBar->addAction(m_zoomoutAc); //缩小 + + ui->mainToolBar->addAction(printMenuAction); //导出成果图菜单 +// ui->mainToolBar->addAction(m_SaveAsPictureAc); //导出长图 +// ui->mainToolBar->addAction(m_SaveAsPdfAc); //导出PDF +// ui->mainToolBar->addAction(m_SaveAsSvgAc); //导出SVG ui->mainToolBar->addSeparator(); + ui->mainToolBar->addAction(m_blackAc); //黑白图 ui->mainToolBar->addAction(m_doubleHeadAc); //单曲线头 ui->mainToolBar->addAction(m_executeDepthShiftAc); //校深 From b195449efb9d0b6e4d5c679f37c2975eb26f2ce4 Mon Sep 17 00:00:00 2001 From: jiayulong Date: Tue, 2 Jun 2026 17:31:33 +0800 Subject: [PATCH 3/4] =?UTF-8?q?toolbar=E5=B7=A5=E5=85=B7=E6=9D=A1=E7=9A=84?= =?UTF-8?q?=E5=9B=BE=E6=96=87=E4=BB=B6=E8=8F=9C=E5=8D=95=E4=B8=8B=EF=BC=8C?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E5=A4=9A=E4=BA=95=E7=9A=84=E2=80=9C=E6=89=93?= =?UTF-8?q?=E5=BC=80=E5=B7=A5=E7=A8=8B=E2=80=9D=E6=8C=89=E9=92=AE=EF=BC=8C?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8A=A0=E8=BD=BD=E5=A4=9A=E4=BA=95json?= =?UTF-8?q?=E6=96=87=E4=BB=B6=EF=BC=8C=E6=8C=89=E7=85=A7json=E8=AE=B0?= =?UTF-8?q?=E5=BD=95=E7=9A=84=E4=BA=95=E4=BF=A1=E6=81=AF=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/CallManage.h | 4 +- logPlus/customtabwidget.cpp | 6 +- logPlus/customtabwidget.h | 2 +- logPlus/formdraw.cpp | 698 ++++++++++++++++++++---------------- logPlus/formdraw.h | 2 + logPlus/formwell.cpp | 23 +- logPlus/formwell.h | 1 + logPlus/mainwindow.cpp | 6 +- logPlus/mainwindow.h | 2 +- logPlus/mainwindowcurve.cpp | 122 +++++-- logPlus/mainwindowcurve.h | 4 + 11 files changed, 502 insertions(+), 368 deletions(-) diff --git a/logPlus/CallManage.h b/logPlus/CallManage.h index 49ad82f..975ef17 100644 --- a/logPlus/CallManage.h +++ b/logPlus/CallManage.h @@ -333,9 +333,9 @@ signals: void sig_changeMCalsProperty(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, QString strNewLineName); //关闭当前tab页,重新打开新模板 - void sig_tabCloseCurrent(QString fileFull, QString fileName); + void sig_tabCloseCurrent(QString fileFull, QString fileName, bool bMultiProject); //加载视图(重新打开) - void sig_ReOpen(QString fileFull, QString fileName); + void sig_ReOpen(QString fileFull, QString fileName, bool bMultiProject); //重新设置滚动条范围(头) void sig_setRangeVScrollBar2(QString strUuid); diff --git a/logPlus/customtabwidget.cpp b/logPlus/customtabwidget.cpp index 8aeecc7..03b0290 100644 --- a/logPlus/customtabwidget.cpp +++ b/logPlus/customtabwidget.cpp @@ -39,7 +39,7 @@ CustomTabWidget::CustomTabWidget(QWidget *parent) //关闭tab时,信号槽触发的函数 connect(m_pTabBar, SIGNAL(tabCloseRequested(int)),this,SLOT(slot_tabClose(int))); //关闭当前tab页,重新打开新模板 - connect(CallManage::getInstance(), SIGNAL(sig_tabCloseCurrent(QString, QString)), this, SLOT(slot_tabCloseCurrent(QString, QString))); + connect(CallManage::getInstance(), SIGNAL(sig_tabCloseCurrent(QString, QString, bool)), this, SLOT(slot_tabCloseCurrent(QString, QString, bool))); } @@ -239,7 +239,7 @@ void CustomTabWidget::slot_tabClose(int index) } //关闭 -void CustomTabWidget::slot_tabCloseCurrent(QString fileFull, QString fileName) +void CustomTabWidget::slot_tabCloseCurrent(QString fileFull, QString fileName, bool bMultiProject) { QWidget *selectWidget = m_pStackedWidget->currentWidget(); if (selectWidget == NULL) @@ -260,5 +260,5 @@ void CustomTabWidget::slot_tabCloseCurrent(QString fileFull, QString fileName) PropertyService()->InitCurrentViewInfo(); //重新打开新模板 - emit CallManage::getInstance()->sig_ReOpen(fileFull, fileName); + emit CallManage::getInstance()->sig_ReOpen(fileFull, fileName, bMultiProject); } diff --git a/logPlus/customtabwidget.h b/logPlus/customtabwidget.h index 9be376a..12d7212 100644 --- a/logPlus/customtabwidget.h +++ b/logPlus/customtabwidget.h @@ -35,7 +35,7 @@ public: public slots: void setCurrentIndex(int); void slot_tabClose(int index); - void slot_tabCloseCurrent(QString fileFull, QString fileName); + void slot_tabCloseCurrent(QString fileFull, QString fileName, bool bMultiProject); signals: void tabIsEmpty(); diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 6558848..952dc05 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -575,34 +575,38 @@ void FormDraw::displayCorePhysics(QJsonObject jsonObject) QString strType = jsonObject.value("Type").toString(); QString strLineName = jsonObject.value("LineName").toString(); -// if (jsonObject.contains("SlfName")) -// { -// QJsonValue value = jsonObject.value("SlfName"); -// if (value.isString()) { -// strSlfName = value.toString(); -// QString slffilename = QString(""); -// int ind = strSlfName.lastIndexOf('\\'); -// int ind2 = strSlfName.lastIndexOf('/'); -// if (ind2 > ind) ind = ind2; -// if (ind > -1) { -// slffilename = strSlfName.mid(ind + 1); -// strSlfName = slffilename; -// } + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + if (jsonObject.contains("SlfName")) + { + QJsonValue value = jsonObject.value("SlfName"); + if (value.isString()) { + strSlfName = value.toString(); + QString slffilename = QString(""); + int ind = strSlfName.lastIndexOf('\\'); + int ind2 = strSlfName.lastIndexOf('/'); + if (ind2 > ind) ind = ind2; + if (ind > -1) { + slffilename = strSlfName.mid(ind + 1); + strSlfName = slffilename; + } -// } -// } -// if (jsonObject.contains("WellName")) -// { -// QJsonValue value = jsonObject.value("WellName"); -// if (value.isString()) { -// strWellName = value.toString(); -// //qDebug() << "WellName:" << strWellName; -// } -// } + } + } + if (jsonObject.contains("WellName")) + { + QJsonValue value = jsonObject.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + //qDebug() << "WellName:" << strWellName; + } + } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; + QString folderPath = GetLogdataPath(); + folderPath = folderPath + g_prjname; + strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; + } //此处改为直接使用左侧树图的值 listOtherProperty.append(strSlfName); @@ -803,32 +807,41 @@ void FormDraw::displayImageData(QJsonObject lineObjInfo) QFont curveNameFont("微软雅黑", 10); // 名称字体 QColor lineColor = QColor(0, 0, 0);//颜色 -// if (lineObjInfo.contains("SlfName")) -// { -// QJsonValue value = lineObjInfo.value("SlfName"); -// if (value.isString()) { -// strSlfName = value.toString(); -// //qDebug() << "SlfName:" << strSlfName; + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + if (lineObjInfo.contains("SlfName")) + { + QJsonValue value = lineObjInfo.value("SlfName"); + if (value.isString()) { + strSlfName = value.toString(); + //qDebug() << "SlfName:" << strSlfName; + + // + QString slffilename = QString(""); + int ind = strSlfName.lastIndexOf('\\'); + int ind2 = strSlfName.lastIndexOf('/'); + if (ind2 > ind) ind = ind2; + if (ind > -1) { + slffilename = strSlfName.mid(ind + 1); + strSlfName = slffilename; + } + } + } + if (lineObjInfo.contains("WellName")) + { + QJsonValue value = lineObjInfo.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + //qDebug() << "WellName:" << strWellName; + } + } + + QString folderPath = GetLogdataPath(); + folderPath = folderPath + g_prjname; + strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; + } -// // -// QString slffilename = QString(""); -// int ind = strSlfName.lastIndexOf('\\'); -// int ind2 = strSlfName.lastIndexOf('/'); -// if (ind2 > ind) ind = ind2; -// if (ind > -1) { -// slffilename = strSlfName.mid(ind + 1); -// strSlfName = slffilename; -// } -// } -// } -// if (lineObjInfo.contains("WellName")) -// { -// QJsonValue value = lineObjInfo.value("WellName"); -// if (value.isString()) { -// strWellName = value.toString(); -// //qDebug() << "WellName:" << strWellName; -// } -// } if (lineObjInfo.contains("LineName")) { QJsonValue value = lineObjInfo.value("LineName"); @@ -888,10 +901,6 @@ void FormDraw::displayImageData(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - QStringList listOtherProperty; listOtherProperty.append(strAliasName);//别名 listOtherProperty.append(lineColor.name());//名称颜色 @@ -920,32 +929,41 @@ void FormDraw::DisplayTable_One(QJsonObject lineObjInfo) QFont curveNameFont("微软雅黑", 10); // 名称字体 QColor lineColor = QColor(0, 0, 0);//颜色 -// if (lineObjInfo.contains("SlfName")) -// { -// QJsonValue value = lineObjInfo.value("SlfName"); -// if (value.isString()) { -// strSlfName = value.toString(); -// //qDebug() << "SlfName:" << strSlfName; + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + if (lineObjInfo.contains("SlfName")) + { + QJsonValue value = lineObjInfo.value("SlfName"); + if (value.isString()) { + strSlfName = value.toString(); + //qDebug() << "SlfName:" << strSlfName; + + // + QString slffilename = QString(""); + int ind = strSlfName.lastIndexOf('\\'); + int ind2 = strSlfName.lastIndexOf('/'); + if (ind2 > ind) ind = ind2; + if (ind > -1) { + slffilename = strSlfName.mid(ind + 1); + strSlfName = slffilename; + } + } + } + if (lineObjInfo.contains("WellName")) + { + QJsonValue value = lineObjInfo.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + //qDebug() << "WellName:" << strWellName; + } + } + + QString folderPath = GetLogdataPath(); + folderPath = folderPath + g_prjname; + strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; + } -// // -// QString slffilename = QString(""); -// int ind = strSlfName.lastIndexOf('\\'); -// int ind2 = strSlfName.lastIndexOf('/'); -// if (ind2 > ind) ind = ind2; -// if (ind > -1) { -// slffilename = strSlfName.mid(ind + 1); -// strSlfName = slffilename; -// } -// } -// } -// if (lineObjInfo.contains("WellName")) -// { -// QJsonValue value = lineObjInfo.value("WellName"); -// if (value.isString()) { -// strWellName = value.toString(); -// //qDebug() << "WellName:" << strWellName; -// } -// } if (lineObjInfo.contains("LineName")) { QJsonValue value = lineObjInfo.value("LineName"); @@ -1062,10 +1080,6 @@ void FormDraw::DisplayTable_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { QStringList listOtherProperty; @@ -1150,32 +1164,41 @@ void FormDraw::DisplayGujing_One(QJsonObject lineObjInfo) QFont curveNameFont("微软雅黑", 10); // 名称字体 QColor lineColor = QColor(0, 0, 0);//颜色 -// if (lineObjInfo.contains("SlfName")) -// { -// QJsonValue value = lineObjInfo.value("SlfName"); -// if (value.isString()) { -// strSlfName = value.toString(); -// //qDebug() << "SlfName:" << strSlfName; + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + if (lineObjInfo.contains("SlfName")) + { + QJsonValue value = lineObjInfo.value("SlfName"); + if (value.isString()) { + strSlfName = value.toString(); + //qDebug() << "SlfName:" << strSlfName; + + // + QString slffilename = QString(""); + int ind = strSlfName.lastIndexOf('\\'); + int ind2 = strSlfName.lastIndexOf('/'); + if (ind2 > ind) ind = ind2; + if (ind > -1) { + slffilename = strSlfName.mid(ind + 1); + strSlfName = slffilename; + } + } + } + if (lineObjInfo.contains("WellName")) + { + QJsonValue value = lineObjInfo.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + //qDebug() << "WellName:" << strWellName; + } + } + + QString folderPath = GetLogdataPath(); + folderPath = folderPath + g_prjname; + strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; + } -// // -// QString slffilename = QString(""); -// int ind = strSlfName.lastIndexOf('\\'); -// int ind2 = strSlfName.lastIndexOf('/'); -// if (ind2 > ind) ind = ind2; -// if (ind > -1) { -// slffilename = strSlfName.mid(ind + 1); -// strSlfName = slffilename; -// } -// } -// } -// if (lineObjInfo.contains("WellName")) -// { -// QJsonValue value = lineObjInfo.value("WellName"); -// if (value.isString()) { -// strWellName = value.toString(); -// //qDebug() << "WellName:" << strWellName; -// } -// } if (lineObjInfo.contains("LineName")) { QJsonValue value = lineObjInfo.value("LineName"); @@ -1235,10 +1258,6 @@ void FormDraw::DisplayGujing_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { QStringList listOtherProperty; @@ -1273,32 +1292,41 @@ void FormDraw::DisplayKedouAndOthers_One(QJsonObject lineObjInfo) QFont curveNameFont("微软雅黑", 10); // 名称字体 QColor lineColor = QColor(0, 0, 0);//颜色 -// if (lineObjInfo.contains("SlfName")) -// { -// QJsonValue value = lineObjInfo.value("SlfName"); -// if (value.isString()) { -// strSlfName = value.toString(); -// //qDebug() << "SlfName:" << strSlfName; + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + if (lineObjInfo.contains("SlfName")) + { + QJsonValue value = lineObjInfo.value("SlfName"); + if (value.isString()) { + strSlfName = value.toString(); + //qDebug() << "SlfName:" << strSlfName; + + // + QString slffilename = QString(""); + int ind = strSlfName.lastIndexOf('\\'); + int ind2 = strSlfName.lastIndexOf('/'); + if (ind2 > ind) ind = ind2; + if (ind > -1) { + slffilename = strSlfName.mid(ind + 1); + strSlfName = slffilename; + } + } + } + if (lineObjInfo.contains("WellName")) + { + QJsonValue value = lineObjInfo.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + //qDebug() << "WellName:" << strWellName; + } + } + + QString folderPath = GetLogdataPath(); + folderPath = folderPath + g_prjname; + strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; + } -// // -// QString slffilename = QString(""); -// int ind = strSlfName.lastIndexOf('\\'); -// int ind2 = strSlfName.lastIndexOf('/'); -// if (ind2 > ind) ind = ind2; -// if (ind > -1) { -// slffilename = strSlfName.mid(ind + 1); -// strSlfName = slffilename; -// } -// } -// } -// if (lineObjInfo.contains("WellName")) -// { -// QJsonValue value = lineObjInfo.value("WellName"); -// if (value.isString()) { -// strWellName = value.toString(); -// //qDebug() << "WellName:" << strWellName; -// } -// } if (lineObjInfo.contains("LineName")) { QJsonValue value = lineObjInfo.value("LineName"); @@ -1325,10 +1353,6 @@ void FormDraw::DisplayKedouAndOthers_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { //蝌蚪图、杆状、井眼垮塌矢量图、井斜方位图 @@ -1346,32 +1370,41 @@ void FormDraw::DisplayMCals_One(QJsonObject lineObjInfo) QFont curveNameFont("微软雅黑", 10); // 名称字体 QColor lineColor = QColor(0, 0, 0);//颜色 -// if (lineObjInfo.contains("SlfName")) -// { -// QJsonValue value = lineObjInfo.value("SlfName"); -// if (value.isString()) { -// strSlfName = value.toString(); -// //qDebug() << "SlfName:" << strSlfName; + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + if (lineObjInfo.contains("SlfName")) + { + QJsonValue value = lineObjInfo.value("SlfName"); + if (value.isString()) { + strSlfName = value.toString(); + //qDebug() << "SlfName:" << strSlfName; + + // + QString slffilename = QString(""); + int ind = strSlfName.lastIndexOf('\\'); + int ind2 = strSlfName.lastIndexOf('/'); + if (ind2 > ind) ind = ind2; + if (ind > -1) { + slffilename = strSlfName.mid(ind + 1); + strSlfName = slffilename; + } + } + } + if (lineObjInfo.contains("WellName")) + { + QJsonValue value = lineObjInfo.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + //qDebug() << "WellName:" << strWellName; + } + } + + QString folderPath = GetLogdataPath(); + folderPath = folderPath + g_prjname; + strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; + } -// // -// QString slffilename = QString(""); -// int ind = strSlfName.lastIndexOf('\\'); -// int ind2 = strSlfName.lastIndexOf('/'); -// if (ind2 > ind) ind = ind2; -// if (ind > -1) { -// slffilename = strSlfName.mid(ind + 1); -// strSlfName = slffilename; -// } -// } -// } -// if (lineObjInfo.contains("WellName")) -// { -// QJsonValue value = lineObjInfo.value("WellName"); -// if (value.isString()) { -// strWellName = value.toString(); -// //qDebug() << "WellName:" << strWellName; -// } -// } if (lineObjInfo.contains("LineName")) { QJsonValue value = lineObjInfo.value("LineName"); @@ -1398,10 +1431,6 @@ void FormDraw::DisplayMCals_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { //多臂井径 @@ -1419,32 +1448,41 @@ void FormDraw::DisplayJiegutext_One(QJsonObject lineObjInfo) QFont curveNameFont("微软雅黑", 10); // 名称字体 QColor lineColor = QColor(0, 0, 0);//颜色 -// if (lineObjInfo.contains("SlfName")) -// { -// QJsonValue value = lineObjInfo.value("SlfName"); -// if (value.isString()) { -// strSlfName = value.toString(); -// //qDebug() << "SlfName:" << strSlfName; + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + if (lineObjInfo.contains("SlfName")) + { + QJsonValue value = lineObjInfo.value("SlfName"); + if (value.isString()) { + strSlfName = value.toString(); + //qDebug() << "SlfName:" << strSlfName; + + // + QString slffilename = QString(""); + int ind = strSlfName.lastIndexOf('\\'); + int ind2 = strSlfName.lastIndexOf('/'); + if (ind2 > ind) ind = ind2; + if (ind > -1) { + slffilename = strSlfName.mid(ind + 1); + strSlfName = slffilename; + } + } + } + if (lineObjInfo.contains("WellName")) + { + QJsonValue value = lineObjInfo.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + //qDebug() << "WellName:" << strWellName; + } + } + + QString folderPath = GetLogdataPath(); + folderPath = folderPath + g_prjname; + strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; + } -// // -// QString slffilename = QString(""); -// int ind = strSlfName.lastIndexOf('\\'); -// int ind2 = strSlfName.lastIndexOf('/'); -// if (ind2 > ind) ind = ind2; -// if (ind > -1) { -// slffilename = strSlfName.mid(ind + 1); -// strSlfName = slffilename; -// } -// } -// } -// if (lineObjInfo.contains("WellName")) -// { -// QJsonValue value = lineObjInfo.value("WellName"); -// if (value.isString()) { -// strWellName = value.toString(); -// //qDebug() << "WellName:" << strWellName; -// } -// } if (lineObjInfo.contains("LineName")) { QJsonValue value = lineObjInfo.value("LineName"); @@ -1486,10 +1524,6 @@ void FormDraw::DisplayJiegutext_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { QStringList listOtherProperty; @@ -1513,32 +1547,41 @@ void FormDraw::DisplayFac_One(QJsonObject lineObjInfo) QFont curveNameFont("微软雅黑", 10); // 名称字体 QColor lineColor = QColor(0, 0, 0);//颜色 -// if (lineObjInfo.contains("SlfName")) -// { -// QJsonValue value = lineObjInfo.value("SlfName"); -// if (value.isString()) { -// strSlfName = value.toString(); -// //qDebug() << "SlfName:" << strSlfName; + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + if (lineObjInfo.contains("SlfName")) + { + QJsonValue value = lineObjInfo.value("SlfName"); + if (value.isString()) { + strSlfName = value.toString(); + //qDebug() << "SlfName:" << strSlfName; + + // + QString slffilename = QString(""); + int ind = strSlfName.lastIndexOf('\\'); + int ind2 = strSlfName.lastIndexOf('/'); + if (ind2 > ind) ind = ind2; + if (ind > -1) { + slffilename = strSlfName.mid(ind + 1); + strSlfName = slffilename; + } + } + } + if (lineObjInfo.contains("WellName")) + { + QJsonValue value = lineObjInfo.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + //qDebug() << "WellName:" << strWellName; + } + } + + QString folderPath = GetLogdataPath(); + folderPath = folderPath + g_prjname; + strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; + } -// // -// QString slffilename = QString(""); -// int ind = strSlfName.lastIndexOf('\\'); -// int ind2 = strSlfName.lastIndexOf('/'); -// if (ind2 > ind) ind = ind2; -// if (ind > -1) { -// slffilename = strSlfName.mid(ind + 1); -// strSlfName = slffilename; -// } -// } -// } -// if (lineObjInfo.contains("WellName")) -// { -// QJsonValue value = lineObjInfo.value("WellName"); -// if (value.isString()) { -// strWellName = value.toString(); -// //qDebug() << "WellName:" << strWellName; -// } -// } if (lineObjInfo.contains("LineName")) { QJsonValue value = lineObjInfo.value("LineName"); @@ -1607,10 +1650,6 @@ void FormDraw::DisplayFac_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { QStringList listOtherProperty; @@ -1661,32 +1700,41 @@ void FormDraw::DisplayTubing_One(QJsonObject lineObjInfo) QFont curveNameFont("微软雅黑", 10); // 名称字体 QColor lineColor = QColor(0, 0, 0);//颜色 -// if (lineObjInfo.contains("SlfName")) -// { -// QJsonValue value = lineObjInfo.value("SlfName"); -// if (value.isString()) { -// strSlfName = value.toString(); -// //qDebug() << "SlfName:" << strSlfName; + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + if (lineObjInfo.contains("SlfName")) + { + QJsonValue value = lineObjInfo.value("SlfName"); + if (value.isString()) { + strSlfName = value.toString(); + //qDebug() << "SlfName:" << strSlfName; + + // + QString slffilename = QString(""); + int ind = strSlfName.lastIndexOf('\\'); + int ind2 = strSlfName.lastIndexOf('/'); + if (ind2 > ind) ind = ind2; + if (ind > -1) { + slffilename = strSlfName.mid(ind + 1); + strSlfName = slffilename; + } + } + } + if (lineObjInfo.contains("WellName")) + { + QJsonValue value = lineObjInfo.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + //qDebug() << "WellName:" << strWellName; + } + } + + QString folderPath = GetLogdataPath(); + folderPath = folderPath + g_prjname; + strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; + } -// // -// QString slffilename = QString(""); -// int ind = strSlfName.lastIndexOf('\\'); -// int ind2 = strSlfName.lastIndexOf('/'); -// if (ind2 > ind) ind = ind2; -// if (ind > -1) { -// slffilename = strSlfName.mid(ind + 1); -// strSlfName = slffilename; -// } -// } -// } -// if (lineObjInfo.contains("WellName")) -// { -// QJsonValue value = lineObjInfo.value("WellName"); -// if (value.isString()) { -// strWellName = value.toString(); -// //qDebug() << "WellName:" << strWellName; -// } -// } if (lineObjInfo.contains("LineName")) { QJsonValue value = lineObjInfo.value("LineName"); @@ -1849,10 +1897,6 @@ void FormDraw::DisplayTubing_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { QStringList listOtherProperty; @@ -1937,32 +1981,41 @@ void FormDraw::DisplayTvd_One(QJsonObject lineObjInfo) QFont curveNameFont("微软雅黑", 10); // 名称字体 QColor lineColor = QColor(0, 0, 0);//颜色 -// if (lineObjInfo.contains("SlfName")) -// { -// QJsonValue value = lineObjInfo.value("SlfName"); -// if (value.isString()) { -// strSlfName = value.toString(); -// //qDebug() << "SlfName:" << strSlfName; + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + if (lineObjInfo.contains("SlfName")) + { + QJsonValue value = lineObjInfo.value("SlfName"); + if (value.isString()) { + strSlfName = value.toString(); + //qDebug() << "SlfName:" << strSlfName; + + // + QString slffilename = QString(""); + int ind = strSlfName.lastIndexOf('\\'); + int ind2 = strSlfName.lastIndexOf('/'); + if (ind2 > ind) ind = ind2; + if (ind > -1) { + slffilename = strSlfName.mid(ind + 1); + strSlfName = slffilename; + } + } + } + if (lineObjInfo.contains("WellName")) + { + QJsonValue value = lineObjInfo.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + //qDebug() << "WellName:" << strWellName; + } + } + + QString folderPath = GetLogdataPath(); + folderPath = folderPath + g_prjname; + strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; + } -// // -// QString slffilename = QString(""); -// int ind = strSlfName.lastIndexOf('\\'); -// int ind2 = strSlfName.lastIndexOf('/'); -// if (ind2 > ind) ind = ind2; -// if (ind > -1) { -// slffilename = strSlfName.mid(ind + 1); -// strSlfName = slffilename; -// } -// } -// } -// if (lineObjInfo.contains("WellName")) -// { -// QJsonValue value = lineObjInfo.value("WellName"); -// if (value.isString()) { -// strWellName = value.toString(); -// //qDebug() << "WellName:" << strWellName; -// } -// } if (lineObjInfo.contains("LineName")) { QJsonValue value = lineObjInfo.value("LineName"); @@ -2005,10 +2058,6 @@ void FormDraw::DisplayTvd_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - QStringList listOtherProperty; //FormInfo高度 listOtherProperty.append(QString::number(headHeight)); @@ -2662,32 +2711,41 @@ void FormDraw::DisplayLine_One(QJsonObject lineObjInfo) QColor frontColor(0, 0, 0);//岩性前景色 QColor backColor(255, 255, 255);//岩性背景色 -// if (lineObjInfo.contains("SlfName")) -// { -// QJsonValue value = lineObjInfo.value("SlfName"); -// if (value.isString()) { -// strSlfName = value.toString(); -// //qDebug() << "SlfName:" << strSlfName; + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + if (lineObjInfo.contains("SlfName")) + { + QJsonValue value = lineObjInfo.value("SlfName"); + if (value.isString()) { + strSlfName = value.toString(); + //qDebug() << "SlfName:" << strSlfName; + + // + QString slffilename = QString(""); + int ind = strSlfName.lastIndexOf('\\'); + int ind2 = strSlfName.lastIndexOf('/'); + if (ind2 > ind) ind = ind2; + if (ind > -1) { + slffilename = strSlfName.mid(ind + 1); + strSlfName = slffilename; + } + } + } + if (lineObjInfo.contains("WellName")) + { + QJsonValue value = lineObjInfo.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + //qDebug() << "WellName:" << strWellName; + } + } + + QString folderPath = GetLogdataPath(); + folderPath = folderPath + g_prjname; + strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; + } -// // -// QString slffilename = QString(""); -// int ind = strSlfName.lastIndexOf('\\'); -// int ind2 = strSlfName.lastIndexOf('/'); -// if (ind2 > ind) ind = ind2; -// if (ind > -1) { -// slffilename = strSlfName.mid(ind + 1); -// strSlfName = slffilename; -// } -// } -// } -// if (lineObjInfo.contains("WellName")) -// { -// QJsonValue value = lineObjInfo.value("WellName"); -// if (value.isString()) { -// strWellName = value.toString(); -// //qDebug() << "WellName:" << strWellName; -// } -// } // if (lineObjInfo.contains("TrackName")) // { // QJsonValue value = lineObjInfo.value("TrackName"); @@ -2833,10 +2891,6 @@ void FormDraw::DisplayLine_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { //此处属性注意顺序,后续使用按照顺序 @@ -2987,8 +3041,16 @@ void FormDraw::DisplayType_One(QJsonObject objInfo) { QStringList dt; dt << m_strUuid; - dt << g_strWellName; - dt << g_strSlfName; + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + dt << m_strWellName; + dt << m_strSlfName; + } + else{ + dt << g_strWellName; + dt << g_strSlfName; + } dt << strLineName; dt << strType; dt << QString::number(m_nTrackW); diff --git a/logPlus/formdraw.h b/logPlus/formdraw.h index 6df85d3..d3a049c 100644 --- a/logPlus/formdraw.h +++ b/logPlus/formdraw.h @@ -148,6 +148,8 @@ public: float m_vmax; float m_vmin; + bool m_bMultiProject = false; //多井的打开工程,使用模板的井名和slf名 + public: void initForm(QMyCustomPlot *widget, QString strSlfName, QString strLineName, double newLeftScale=-9999, double newRightScale=-9999, QString strScaleType="线性", QColor lineColor=QColor(0,0,0), double width=1, Qt::PenStyle lineStyle=Qt::SolidLine, QStringList listOtherProperty={}); diff --git a/logPlus/formwell.cpp b/logPlus/formwell.cpp index 42917f4..d22b177 100644 --- a/logPlus/formwell.cpp +++ b/logPlus/formwell.cpp @@ -304,6 +304,8 @@ QVector FormWell::new_track(QStringList listdt, QString strTrackName) formDraw->m_iScale = m_iScale; formDraw->m_nTrackW = dW; formDraw->m_nObjDrawH = m_nObjDrawH; + //多井的打开工程,使用模板的井名和slf名 + formDraw->m_bMultiProject = m_bMultiProject; ui->tableWidget->setCellWidget(i, columnCount, formDraw);//默认用formDraw填充满 } @@ -587,14 +589,19 @@ void FormWell::slot_NewTrack_No_Line(QString strUuid, QJsonObject topObj, QJsonO { QString strWellName=g_strWellName; QString strTrackName=""; -// if (topObj.contains("WellName")) -// { -// QJsonValue value = topObj.value("WellName"); -// if (value.isString()) { -// strWellName = value.toString(); -// qDebug() << "WellName:" << strWellName; -// } -// } + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + if (topObj.contains("WellName")) + { + QJsonValue value = topObj.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + qDebug() << "WellName:" << strWellName; + } + } + } + if (topObj.contains("TrackName")) { QJsonValue value = topObj.value("TrackName"); diff --git a/logPlus/formwell.h b/logPlus/formwell.h index 7125b51..db4ac12 100644 --- a/logPlus/formwell.h +++ b/logPlus/formwell.h @@ -66,6 +66,7 @@ public: double m_iY2=0; QWidget *m_parent; bool m_bShowTrackHead = true; //显示道头 + bool m_bMultiProject = false; //多井的打开工程,使用模板的井名和slf名 // 道图形 QMap> m_mapFormDraw; diff --git a/logPlus/mainwindow.cpp b/logPlus/mainwindow.cpp index ccd78fc..99c06b0 100644 --- a/logPlus/mainwindow.cpp +++ b/logPlus/mainwindow.cpp @@ -122,7 +122,7 @@ MainWindow::MainWindow(QWidget *parent) : //向左侧树图,刷新新加对象 connect(CallGlobalManage::getInstance(), SIGNAL(sig_AppendConsole(Priority, const QString)), this, SLOT(s_AppendConsole(Priority, const QString))); //加载视图(重新打开) - connect(CallManage::getInstance(), SIGNAL(sig_ReOpen(QString, QString)), this, SLOT(s_ReOpen(QString, QString))); + connect(CallManage::getInstance(), SIGNAL(sig_ReOpen(QString, QString, bool)), this, SLOT(s_ReOpen(QString, QString, bool))); ConvertorManager::GetInstance().LoadAllConvertorPlugin(); QTimer::singleShot(100, this, [=]() { @@ -608,13 +608,15 @@ void MainWindow::s_PluginMsg(QString msg) } //加载视图(重新打开) -void MainWindow::s_ReOpen(QString fileFull, QString fileName) +void MainWindow::s_ReOpen(QString fileFull, QString fileName, bool bMultiProject) { MainWindowSplitter* mainSplitter = new MainWindowSplitter(); mainSplitter->setSplitterWidget(m_projectWidgets); m_centerWidgets->addTab(mainSplitter, fileName); MainWindowCurve *mainWindowCurve = mainSplitter->getMainWindowCurve(); + //多井的打开工程,使用模板的井名和slf名 + mainWindowCurve->m_bMultiProject = bMultiProject; mainWindowCurve->Open(fileFull); } diff --git a/logPlus/mainwindow.h b/logPlus/mainwindow.h index 6e89f2e..3ea6e94 100644 --- a/logPlus/mainwindow.h +++ b/logPlus/mainwindow.h @@ -87,7 +87,7 @@ public slots: void s_DrawLine(); //加载视图(重新打开) - void s_ReOpen(QString fileFull, QString fileName); + void s_ReOpen(QString fileFull, QString fileName, bool bMultiProject); //可视解释 void s_showView(); //开发工具 diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index b15919a..dd606a7 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -643,6 +643,7 @@ void MainWindowCurve::initMainToolBar() QIcon templateIcon(::GetImagePath()+"WellInterp/导出模板.png"); QIcon opentemplateIcon(::GetImagePath()+"icon/currtemplite.png"); QIcon saveastemplateIcon(::GetImagePath()+"icon/SaveAsTemplate.png"); + QIcon openMultiProjIcon(::GetImagePath()+"WellInterp/打开.png"); //多井的打开工程,使用模板的井名和slf名 QIcon executeDepthShiftIcon(::GetImagePath()+"icon/ExecuteDepthShift.png"); QIcon joindepthIcon(::GetImagePath()+"icon/joindepth.png"); QIcon ModuleOpenIcon(::GetImagePath()+"icon/ModuleOne.png"); @@ -665,6 +666,7 @@ void MainWindowCurve::initMainToolBar() m_fixwellsectionHeaderAc = new QAction(fixwellsectionHeaderIcon, "锁头", this); m_opentemplateAc = new QAction(opentemplateIcon, "加载图文件", this); m_saveastemplateAc = new QAction(saveastemplateIcon, "另存为图文件", this); + m_openMultiProjAc = new QAction(openMultiProjIcon, "打开工程", this); //多井的打开工程,使用模板的井名和slf名 m_zoominAc = new QAction(zoominIcon, "放大", this); m_zoomoutAc = new QAction(zoomoutIcon, "缩小", this); m_SaveAsPictureAc = new QAction(SaveAsPictureIcon, "导出长图", this); @@ -707,6 +709,7 @@ void MainWindowCurve::initMainToolBar() QMenu* menuTemplate = new QMenu(this); menuTemplate->addAction(m_opentemplateAc); //加载图文件 menuTemplate->addAction(m_saveastemplateAc); //另存为图文件 + menuTemplate->addAction(m_openMultiProjAc); //多井的打开工程,使用模板的井名和slf名 templateAction->setMenu(menuTemplate); //add QAction to Widget. @@ -755,6 +758,7 @@ void MainWindowCurve::initMainToolBar() connect(m_fixwellsectionHeaderAc, &QAction::triggered, this, &MainWindowCurve::s_showHeadTable); connect(m_opentemplateAc, &QAction::triggered, this, &MainWindowCurve::s_Open); connect(m_saveastemplateAc, &QAction::triggered, this, &MainWindowCurve::s_Save); + connect(m_openMultiProjAc, &QAction::triggered, this, &MainWindowCurve::s_OpenMultiProj); connect(m_zoominAc, &QAction::triggered, this, &MainWindowCurve::s_ZoomIn); connect(m_zoomoutAc, &QAction::triggered, this, &MainWindowCurve::s_ZoomOut); @@ -2979,7 +2983,10 @@ void MainWindowCurve::loadStyle(const QString &qssFile) } void MainWindowCurve::s_Open() -{ +{ + //多井的打开工程,使用模板的井名和slf名 + m_bMultiProject = false; + //--------------------------------- //左侧树图选中井次 //针对“加载图文件”,支持井或井次 @@ -3025,7 +3032,7 @@ void MainWindowCurve::s_Open() QFileInfo fileInfo(fileFull); QString fileName = fileInfo.fileName(); // 获取文件名 - emit CallManage::getInstance()->sig_tabCloseCurrent(fileFull, fileName); + emit CallManage::getInstance()->sig_tabCloseCurrent(fileFull, fileName, m_bMultiProject); // //先清空 // ui->tableWidget_2->clear(); @@ -3040,7 +3047,6 @@ void MainWindowCurve::s_Open() void MainWindowCurve::s_Save() { - //Logdata QString folderPath; folderPath = GetLogdataPath(); @@ -3059,6 +3065,8 @@ void MainWindowCurve::s_Save() file.write(doc.toJson(QJsonDocument::Indented)); file.close(); qDebug() << "JSON文件写入成功!"; + // + m_fileJson = exPortPath; } else { qWarning() << "文件打开失败:" << file.errorString(); return; @@ -3066,6 +3074,34 @@ void MainWindowCurve::s_Save() } } +//打开工程--多井的打开工程,使用模板的井名和slf名 +void MainWindowCurve::s_OpenMultiProj() +{ + //多井的打开工程,使用模板的井名和slf名 + m_bMultiProject = true; + + //Logdata + QString folderPath; + folderPath = GetLogdataPath(); + folderPath = folderPath + g_prjname; + //folderPath = folderPath + "/multiwell.json"; + + //打开 + QString fileFull = ""; + fileFull = QFileDialog::getOpenFileName(this, + tr("选择模板"), + folderPath, + tr("多井图文件(*.json)")); + if (fileFull.isEmpty()) + { + return; + } + + QFileInfo fileInfo(fileFull); + QString fileName = fileInfo.fileName(); // 获取文件名 + emit CallManage::getInstance()->sig_tabCloseCurrent(fileFull, fileName, m_bMultiProject); +} + bool MainWindowCurve::GetIsColorPrint() { return m_isColorPrint; @@ -4337,6 +4373,8 @@ void MainWindowCurve::s_NewWell(QString strWellName, QString strSlfName, bool bS widgetWell->setWellHeader(wellH); //显示道头 widgetWell->m_bShowTrackHead = bShowTrackHead; + //多井的打开工程,使用模板的井名和slf名 + widgetWell->m_bMultiProject = m_bMultiProject; // ui->tableWidget_2->setCellWidget(i, columnCount, widgetWell);//默认用widgetWell填充满 m_mapFWell.insert(strWellName, widgetWell); @@ -5263,6 +5301,9 @@ void MainWindowCurve::Open(QString fileFull) QFile file(fileFull); if(file.open(QIODevice::ReadOnly)) { + // + m_fileJson = fileFull; + // 解析JSON QJsonDocument document = QJsonDocument::fromJson(file.readAll(), &jsonError); if (!document.isNull() && (jsonError.error == QJsonParseError::NoError)) @@ -5796,8 +5837,14 @@ void MainWindowCurve::DisplayWells(QJsonArray wellsArray) int iCount = wellsArray.size(); if(iCount>1) { - int flag = QMessageBox::warning(NULL,"提示",QString("图文件或模板中存在多个井文件,\n是否用当前选中井替换原井文件?"),QMessageBox::Yes,QMessageBox::No); - if(flag!=QMessageBox::Yes) return; + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + } + else{ + int flag = QMessageBox::warning(NULL,"提示",QString("图文件或模板中存在多个井文件,\n是否用当前选中井替换原井文件?"),QMessageBox::Yes,QMessageBox::No); + if(flag!=QMessageBox::Yes) return; + } } for(int i=0; i0) { QString strWellName = g_strWellName; -// if (trackTop.contains("WellName")) -// { -// QJsonValue value = trackTop.value("WellName"); -// if (value.isString()) { -// strWellName = value.toString(); -// qDebug() << "WellName:" << strWellName; -// } -// } + //多井的打开工程,使用模板的井名和slf名 + if(m_bMultiProject) + { + if (trackTop.contains("WellName")) + { + QJsonValue value = trackTop.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + qDebug() << "WellName:" << strWellName; + } + } + } + double nW = 0; if (trackTop.contains("TrackW")) { diff --git a/logPlus/mainwindowcurve.h b/logPlus/mainwindowcurve.h index 5ef8716..02b9390 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -142,7 +142,9 @@ public: void DisplayTrack_Top(int id, QJsonObject trackTop, QJsonObject trackInfo); void Open(QString fileFull);//打开 + QString m_fileJson; + bool m_bMultiProject = false; //多井的打开工程,使用模板的井名和slf名 public: //样式 void loadStyle(const QString &qssFile); @@ -236,6 +238,7 @@ public: QAction* m_fixwellsectionHeaderAc = nullptr; //锁头 QAction* m_opentemplateAc = nullptr; //加载图文件 QAction* m_saveastemplateAc = nullptr; //另存为图文件 + QAction* m_openMultiProjAc = nullptr; //多井的打开工程,使用模板的井名和slf名 QAction* m_zoominAc = nullptr; //放大 QAction* m_zoomoutAc = nullptr; //缩小 QAction* m_SaveAsPictureAc = nullptr; //导出长图 @@ -330,6 +333,7 @@ public slots: void s_showHeadTable(); //显示/隐藏图头 void s_Open(); //加载图文件 void s_Save(); //保存图文件 + void s_OpenMultiProj(); //打开工程--多井的打开工程,使用模板的井名和slf名 void s_SaveAsPicture(); //导出长图 void s_SaveAsPdf(); //导出PDF void s_SaveAsSvg(); //导出SVG From 99c19344b550c4c590636482de2372e34b6f46f3 Mon Sep 17 00:00:00 2001 From: jiayulong Date: Tue, 2 Jun 2026 21:55:06 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=B7=A6=E4=BE=A7=E6=A0=91=E5=9B=BE?= =?UTF-8?q?=EF=BC=8C=E6=8B=96=E6=8B=BD=E4=BA=95=E6=AC=A1=EF=BC=8C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8json=E6=A8=A1=E6=9D=BF=E7=94=9F=E6=88=90=E5=A4=9A?= =?UTF-8?q?=E4=BA=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/CallManage.h | 3 ++ logPlus/formdraw.cpp | 15 ++++++- logPlus/forminfo.cpp | 15 ++++++- logPlus/formtracktop.cpp | 15 ++++++- logPlus/mainwindowcurve.cpp | 84 +++++++++++++++++++++++++++++++++++++ logPlus/mainwindowcurve.h | 6 ++- logPlus/preqtablewidget.cpp | 15 ++++++- logPlus/qmytreewidget.cpp | 9 +++- 8 files changed, 151 insertions(+), 11 deletions(-) diff --git a/logPlus/CallManage.h b/logPlus/CallManage.h index 975ef17..502e991 100644 --- a/logPlus/CallManage.h +++ b/logPlus/CallManage.h @@ -106,6 +106,9 @@ signals: //LogMud void sig_AddLogMud(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strLineName, int nW = 0); + //拖拽井次,生成多井 + void sig_AddMultiWell(QString strUuid, QString strSlfName, QString strWellName); + //新建波列 void sig_AddWave(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, QString strWaveName); //删除波列 diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 952dc05..50f2239 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -7484,8 +7484,19 @@ void FormDraw::dropEvent(QDropEvent* event) } else { - // 如果井名不正确,不接受拖拽事件 - event->ignore(); + if(strType=="wellItem")//井次名称对应多井,统一处理 + { + //拖拽井次,生成多井 + emit CallManage::getInstance()->sig_AddMultiWell(m_strUuid, strSlfName, strWellName); + // 接受拖拽事件 + event->setDropAction(Qt::MoveAction); + event->accept(); + } + else + { + // 如果井名不正确,不接受拖拽事件 + event->ignore(); + } } } else diff --git a/logPlus/forminfo.cpp b/logPlus/forminfo.cpp index 4a117f5..6a8c619 100644 --- a/logPlus/forminfo.cpp +++ b/logPlus/forminfo.cpp @@ -2508,8 +2508,19 @@ void FormInfo::dropEvent(QDropEvent* event) } else { - // 如果井名不正确,不接受拖拽事件 - event->ignore(); + if(strType=="wellItem")//井次名称对应多井,统一处理 + { + //拖拽井次,生成多井 + emit CallManage::getInstance()->sig_AddMultiWell(m_strUuid, strSlfName, strWellName); + // 接受拖拽事件 + event->setDropAction(Qt::MoveAction); + event->accept(); + } + else + { + // 如果井名不正确,不接受拖拽事件 + event->ignore(); + } } } else diff --git a/logPlus/formtracktop.cpp b/logPlus/formtracktop.cpp index f37bd84..a0b45b5 100644 --- a/logPlus/formtracktop.cpp +++ b/logPlus/formtracktop.cpp @@ -271,8 +271,19 @@ void FormTrackTop::dropEvent(QDropEvent* event) } else { - // 如果井名不正确,不接受拖拽事件 - event->ignore(); + if(strType=="wellItem")//井次名称对应多井,统一处理 + { + //拖拽井次,生成多井 + emit CallManage::getInstance()->sig_AddMultiWell(m_strUuid, strSlfName, strWellName); + // 接受拖拽事件 + event->setDropAction(Qt::MoveAction); + event->accept(); + } + else + { + // 如果井名不正确,不接受拖拽事件 + event->ignore(); + } } } else diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index dd606a7..eee23cd 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -188,6 +188,8 @@ MainWindowCurve::MainWindowCurve(QWidget *parent) : //重新设置滚动条范围(头) connect(CallManage::getInstance(), SIGNAL(sig_setRangeVScrollBar2(QString)), this, SLOT(s_setRangeVScrollBar2(QString))); + connect(CallManage::getInstance(), SIGNAL(sig_AddMultiWell(QString, QString, QString)), this, SLOT(s_AddMultiWell(QString, QString, QString))); + //图头---------- m_dock1=new QDockWidget(tr(""),this); m_dock1->setFeatures(QDockWidget::NoDockWidgetFeatures);//QDockWidget::DockWidgetMovable @@ -5271,6 +5273,11 @@ void MainWindowCurve::dropEvent(QDropEvent* event) //新建井+道+曲线(首条) NewWellAndTrack(strWellName, strSlfName, strLineName, strType); } + else if(strType=="wellItem")//井次名称对应多井,统一处理 + { + //拖拽井次,生成多井 + emit CallManage::getInstance()->sig_AddMultiWell(m_strUuid, strSlfName, strWellName); + } } //QMessageBox::information(this, "提示", strExtern); @@ -5421,6 +5428,62 @@ void MainWindowCurve::Open(QString fileFull) } } +void MainWindowCurve::OpenMultiWell(QString fileFull) +{ + QString strPrjname = ""; + QJsonArray wellsArray; + + QJsonParseError jsonError; + // 文件 + QFile file(fileFull); + if(file.open(QIODevice::ReadOnly)) + { + // 解析JSON + QJsonDocument document = QJsonDocument::fromJson(file.readAll(), &jsonError); + if (!document.isNull() && (jsonError.error == QJsonParseError::NoError)) + { + if (document.isObject()) + { + QJsonObject object = document.object(); + // + if (object.contains("wells")) + { + QJsonValue value = object.value("wells"); + if (value.isArray()) { + wellsArray = value.toArray(); + qDebug() << "wellsArray number:" << QString::number(wellsArray.size()); + + //是否正在加载json + g_iLoadingJson = 1; + //展示所有井 + DisplayWells(wellsArray); + g_iLoadingJson = 0; + + //统一处理头部滚动条 + s_setRangeVScrollBar2(m_strUuid); + } + } + } + } + + // + file.close(); + qDebug() << "JSON 模板文件读取成功!"; + + //重置右侧滚动条 +// ui->verticalScrollBar->setRange(-m_iY2*100, -m_iY1*100); +// ui->verticalScrollBar->setValue(-m_iY2*100); + vertScrollBarChanged(-m_iY2*100); + + QMessageBox::information(NULL,"提示","模板加载完成!",QMessageBox::Ok); + emit sig_resizeWindow(); + + } else { + qWarning() << "JSON 模板文件打开失败:" << file.errorString(); + QMessageBox::information(NULL,"提示","模板加载失败!",QMessageBox::Ok); + } +} + //改变道宽 void MainWindowCurve::s_changeWidth(QString strUuid, QString strSlfName, QString strWellName, QString strTrackName, int iCurrentCol, int iNewWidth) { @@ -6610,3 +6673,24 @@ void MainWindowCurve::onSectionResized(int logicalIndex, int oldSize, int newSiz //居中 emit sig_resizeWindow(); } + +//拖拽井次,生成多井 +void MainWindowCurve::s_AddMultiWell(QString strUuid, QString strSlfName, QString strWellName) +{ + if(strUuid != m_strUuid) + { + return; + } + if(m_fileJson=="") + { + return; + } + + g_strSlfName = strSlfName; + g_strWellName = strWellName; + //多井的打开工程,使用模板的井名和slf名 + m_bMultiProject = false; + + // + OpenMultiWell(m_fileJson); +} diff --git a/logPlus/mainwindowcurve.h b/logPlus/mainwindowcurve.h index 02b9390..8cd14c4 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -142,7 +142,8 @@ public: void DisplayTrack_Top(int id, QJsonObject trackTop, QJsonObject trackInfo); void Open(QString fileFull);//打开 - QString m_fileJson; + void OpenMultiWell(QString fileFull);//打开 + QString m_fileJson=""; bool m_bMultiProject = false; //多井的打开工程,使用模板的井名和slf名 public: @@ -233,6 +234,9 @@ public slots: //列宽改变 void onSectionResized(int logicalIndex, int oldSize, int newSize); + //拖拽井次,生成多井 + void s_AddMultiWell(QString strUuid, QString strSlfName, QString strWellName); + public: QAction* m_selectWellAc = nullptr; //选择井 QAction* m_fixwellsectionHeaderAc = nullptr; //锁头 diff --git a/logPlus/preqtablewidget.cpp b/logPlus/preqtablewidget.cpp index 3feb147..aa71052 100644 --- a/logPlus/preqtablewidget.cpp +++ b/logPlus/preqtablewidget.cpp @@ -377,8 +377,19 @@ void PreQTableWidget::dropEvent(QDropEvent *event) } else { - // 如果井名不正确,不接受拖拽事件 - event->ignore(); + if(strType=="wellItem")//井次名称对应多井,统一处理 + { + //拖拽井次,生成多井 + emit CallManage::getInstance()->sig_AddMultiWell(m_strUuid, strSlfName, strWellName); + // 接受拖拽事件 + event->setDropAction(Qt::MoveAction); + event->accept(); + } + else + { + // 如果井名不正确,不接受拖拽事件 + event->ignore(); + } } } } diff --git a/logPlus/qmytreewidget.cpp b/logPlus/qmytreewidget.cpp index 310d8cd..f96d60e 100644 --- a/logPlus/qmytreewidget.cpp +++ b/logPlus/qmytreewidget.cpp @@ -145,11 +145,16 @@ void QMyTreeWidget::startDrag(Qt::DropActions supportedActions) { //根节点(项目名称) } - else if (strTreeTag == "curveObject" || strTreeTag == "waveObject" || strTreeTag == "tableObject"){ + else if (strTreeTag == "curveObject" || strTreeTag == "waveObject" || strTreeTag == "tableObject" || + strTreeTag == "wellItem")//井次名称对应多井,统一处理 + { //曲线 QString strSlfName = item->data(0, Qt::UserRole+1).toString(); QString strWellName = item->data(0, Qt::UserRole+2).toString(); - + if (strTreeTag == "wellItem")//井次名称 + { + strWellName = item->text(0); + } //曲线对象(AC、BS...) QMimeData *mimeData = new QMimeData; // 这里需要根据你的item数据来设置mimeData,例如: