From b195449efb9d0b6e4d5c679f37c2975eb26f2ce4 Mon Sep 17 00:00:00 2001 From: jiayulong Date: Tue, 2 Jun 2026 17:31:33 +0800 Subject: [PATCH] =?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