From 86a57052ef91dad70a397765c584429d3a099ac6 Mon Sep 17 00:00:00 2001 From: jiayulong Date: Fri, 29 May 2026 16:47:49 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96json=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E9=80=BB=E8=BE=91=E3=80=82=E9=92=88=E5=AF=B9?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E6=89=93=E5=BC=80=E7=9A=84=E8=A7=86=E5=9B=BE?= =?UTF-8?q?=E4=B8=8A=E2=80=9C=E5=8A=A0=E8=BD=BD=E5=9B=BE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E2=80=9D=E6=8C=89=E9=92=AE=E4=B9=9F=E5=81=9A=E4=BA=86=E5=A4=84?= =?UTF-8?q?=E7=90=86=E3=80=822.=E5=8F=82=E7=85=A7=E8=80=81=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E9=80=BB=E8=BE=91=E5=A4=84=E7=90=86=E5=A4=9A=E4=BA=95?= =?UTF-8?q?=E7=9A=84=E6=A8=A1=E6=9D=BF=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/formdraw.cpp | 663 ++++++++++++++++++----------------- logPlus/formwell.cpp | 22 +- logPlus/mainwindow.cpp | 49 ++- logPlus/mainwindowcurve.cpp | 123 ++++--- logPlus/mainwindowcurve.h | 2 - logPlus/qmytreewidget.cpp | 48 +++ logPlus/qmytreewidget.h | 4 + logPlus/qtprojectwidgets.cpp | 16 + logPlus/qtprojectwidgets.h | 3 + 9 files changed, 526 insertions(+), 404 deletions(-) diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index 1665062..b473d35 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -34,6 +34,10 @@ extern QString g_prjname; extern int g_iSupport3D; +//左侧树图选中井次 +extern QString g_strSlfName; +extern QString g_strWellName; + // extern void AppendConsole(Priority priority, const QString &output); //曲线绘制(多个) @@ -565,38 +569,41 @@ void FormDraw::DisplayLines(QJsonArray linesArray) void FormDraw::displayCorePhysics(QJsonObject jsonObject) { QStringList listOtherProperty; - QString strSlfName; - QString strWellName; + QString strSlfName = g_strSlfName; + QString strWellName = g_strWellName; 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; - } +// 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; - } - } - QString folderPath = GetLogdataPath(); - folderPath = folderPath + g_prjname; - strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; +// } +// } +// 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; + + //此处改为直接使用左侧树图的值 listOtherProperty.append(strSlfName); // 例区高度 @@ -788,39 +795,39 @@ void FormDraw::displayCorePhysics(QJsonObject jsonObject) void FormDraw::displayImageData(QJsonObject lineObjInfo) { - QString strSlfName = ""; - QString strWellName = ""; + QString strSlfName = g_strSlfName; + QString strWellName = g_strWellName; QString strLineName = ""; QString strAliasName = "";//显示名称 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; +// 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 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"); @@ -880,9 +887,9 @@ void FormDraw::displayImageData(QJsonObject lineObjInfo) } } - QString folderPath = GetLogdataPath(); - folderPath = folderPath + g_prjname; - strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; +// QString folderPath = GetLogdataPath(); +// folderPath = folderPath + g_prjname; +// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; QStringList listOtherProperty; listOtherProperty.append(strAliasName);//别名 @@ -905,39 +912,39 @@ void FormDraw::displayImageData(QJsonObject lineObjInfo) //表格 void FormDraw::DisplayTable_One(QJsonObject lineObjInfo) { - QString strSlfName = ""; - QString strWellName = ""; + QString strSlfName = g_strSlfName; + QString strWellName = g_strWellName; QString strLineName = ""; QString strAliasName = "";//显示名称 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; +// 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 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"); @@ -1054,9 +1061,9 @@ void FormDraw::DisplayTable_One(QJsonObject lineObjInfo) } } - QString folderPath = GetLogdataPath(); - folderPath = folderPath + g_prjname; - strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; +// QString folderPath = GetLogdataPath(); +// folderPath = folderPath + g_prjname; +// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; if (strLineName != "") { @@ -1135,39 +1142,39 @@ void FormDraw::DisplayTable_One(QJsonObject lineObjInfo) //固井结论 void FormDraw::DisplayGujing_One(QJsonObject lineObjInfo) { - QString strSlfName = ""; - QString strWellName = ""; + QString strSlfName = g_strSlfName; + QString strWellName = g_strWellName; QString strLineName = ""; QString strAliasName = "";//显示名称 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; +// 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 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"); @@ -1227,9 +1234,9 @@ void FormDraw::DisplayGujing_One(QJsonObject lineObjInfo) } } - QString folderPath = GetLogdataPath(); - folderPath = folderPath + g_prjname; - strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; +// QString folderPath = GetLogdataPath(); +// folderPath = folderPath + g_prjname; +// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; if (strLineName != "") { @@ -1258,39 +1265,39 @@ void FormDraw::DisplayGujing_One(QJsonObject lineObjInfo) //蝌蚪图 void FormDraw::DisplayKedouAndOthers_One(QJsonObject lineObjInfo) { - QString strSlfName = ""; - QString strWellName = ""; + QString strSlfName = g_strSlfName; + QString strWellName = g_strWellName; QString strLineName = ""; QString strAliasName = "";//显示名称 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; +// 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 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"); @@ -1317,9 +1324,9 @@ void FormDraw::DisplayKedouAndOthers_One(QJsonObject lineObjInfo) } } - QString folderPath = GetLogdataPath(); - folderPath = folderPath + g_prjname; - strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; +// QString folderPath = GetLogdataPath(); +// folderPath = folderPath + g_prjname; +// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; if (strLineName != "") { @@ -1331,39 +1338,39 @@ void FormDraw::DisplayKedouAndOthers_One(QJsonObject lineObjInfo) //多臂井径 void FormDraw::DisplayMCals_One(QJsonObject lineObjInfo) { - QString strSlfName = ""; - QString strWellName = ""; + QString strSlfName = g_strSlfName; + QString strWellName = g_strWellName; QString strLineName = ""; QString strAliasName = "";//显示名称 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; +// 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 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"); @@ -1390,9 +1397,9 @@ void FormDraw::DisplayMCals_One(QJsonObject lineObjInfo) } } - QString folderPath = GetLogdataPath(); - folderPath = folderPath + g_prjname; - strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; +// QString folderPath = GetLogdataPath(); +// folderPath = folderPath + g_prjname; +// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; if (strLineName != "") { @@ -1404,39 +1411,39 @@ void FormDraw::DisplayMCals_One(QJsonObject lineObjInfo) //气测/FMT/射孔/文本 void FormDraw::DisplayJiegutext_One(QJsonObject lineObjInfo) { - QString strSlfName = ""; - QString strWellName = ""; + QString strSlfName = g_strSlfName; + QString strWellName = g_strWellName; QString strLineName = ""; QString strAliasName = "";//显示名称 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; +// 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 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"); @@ -1478,9 +1485,9 @@ void FormDraw::DisplayJiegutext_One(QJsonObject lineObjInfo) } } - QString folderPath = GetLogdataPath(); - folderPath = folderPath + g_prjname; - strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; +// QString folderPath = GetLogdataPath(); +// folderPath = folderPath + g_prjname; +// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; if (strLineName != "") { @@ -1498,39 +1505,39 @@ void FormDraw::DisplayJiegutext_One(QJsonObject lineObjInfo) //沉积相 void FormDraw::DisplayFac_One(QJsonObject lineObjInfo) { - QString strSlfName = ""; - QString strWellName = ""; + QString strSlfName = g_strSlfName; + QString strWellName = g_strWellName; QString strLineName = ""; QString strAliasName = "";//显示名称 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; +// 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 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"); @@ -1599,9 +1606,9 @@ void FormDraw::DisplayFac_One(QJsonObject lineObjInfo) } } - QString folderPath = GetLogdataPath(); - folderPath = folderPath + g_prjname; - strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; +// QString folderPath = GetLogdataPath(); +// folderPath = folderPath + g_prjname; +// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; if (strLineName != "") { @@ -1645,40 +1652,40 @@ void FormDraw::DisplayFac_One(QJsonObject lineObjInfo) //套管組件 void FormDraw::DisplayTubing_One(QJsonObject lineObjInfo) { - QString strSlfName = ""; - QString strWellName = ""; + QString strSlfName = g_strSlfName; + QString strWellName = g_strWellName; QString strLineName = ""; QString strUnit = "";//单位 QString strAliasName = "";//显示名称 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; +// 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 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"); @@ -1841,9 +1848,9 @@ void FormDraw::DisplayTubing_One(QJsonObject lineObjInfo) } } - QString folderPath = GetLogdataPath(); - folderPath = folderPath + g_prjname; - strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; +// QString folderPath = GetLogdataPath(); +// folderPath = folderPath + g_prjname; +// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; if (strLineName != "") { @@ -1922,39 +1929,39 @@ void FormDraw::DisplayTubing_One(QJsonObject lineObjInfo) //斜井三图一表 void FormDraw::DisplayTvd_One(QJsonObject lineObjInfo) { - QString strSlfName = ""; - QString strWellName = ""; + QString strSlfName = g_strSlfName; + QString strWellName = g_strWellName; QString strLineName = ""; QString strAliasName = "";//显示名称 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; +// 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 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"); @@ -1997,9 +2004,9 @@ void FormDraw::DisplayTvd_One(QJsonObject lineObjInfo) } } - QString folderPath = GetLogdataPath(); - folderPath = folderPath + g_prjname; - strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; +// QString folderPath = GetLogdataPath(); +// folderPath = folderPath + g_prjname; +// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; QStringList listOtherProperty; //FormInfo高度 @@ -2626,8 +2633,8 @@ void FormDraw::GetTvdProperty(CDrawTvd *drawTvd, QJsonObject lineObjInfo) void FormDraw::DisplayLine_One(QJsonObject lineObjInfo) { - QString strSlfName = ""; - QString strWellName = ""; + QString strSlfName = g_strSlfName; + QString strWellName = g_strWellName; // QString strTrackName = ""; QString strLineName = ""; QString strAliasName = "";//显示名称 @@ -2654,32 +2661,32 @@ 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; +// 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 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"); @@ -2825,9 +2832,9 @@ void FormDraw::DisplayLine_One(QJsonObject lineObjInfo) } } - QString folderPath = GetLogdataPath(); - folderPath = folderPath + g_prjname; - strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; +// QString folderPath = GetLogdataPath(); +// folderPath = folderPath + g_prjname; +// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; if (strLineName != "") { diff --git a/logPlus/formwell.cpp b/logPlus/formwell.cpp index 7c52032..42917f4 100644 --- a/logPlus/formwell.cpp +++ b/logPlus/formwell.cpp @@ -18,6 +18,10 @@ extern int g_iShow; //显示刻度 extern int g_iHeight_MyCustom; extern int g_WorkSpace_Height; +//左侧树图选中井次 +extern QString g_strSlfName; +extern QString g_strWellName; + //井+道名 FormWell::FormWell(QWidget *parent, QString strWellName) : QWidget(parent), @@ -581,16 +585,16 @@ void FormWell::s_NewTrack_No_Line(QString strUuid, QString strWellName, QString void FormWell::slot_NewTrack_No_Line(QString strUuid, QJsonObject topObj, QJsonObject infoObj) { - QString strWellName=""; + QString strWellName=g_strWellName; QString strTrackName=""; - if (topObj.contains("WellName")) - { - QJsonValue value = topObj.value("WellName"); - if (value.isString()) { - strWellName = value.toString(); - qDebug() << "WellName:" << strWellName; - } - } +// 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/mainwindow.cpp b/logPlus/mainwindow.cpp index 7003b16..ccd78fc 100644 --- a/logPlus/mainwindow.cpp +++ b/logPlus/mainwindow.cpp @@ -61,6 +61,10 @@ int g_iSmallPrint = 0; int g_iStep = 300; int g_iPageStep = 1500; +//左侧树图选中井次 +QString g_strSlfName = ""; +QString g_strWellName = ""; + MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) @@ -623,23 +627,31 @@ void MainWindow::s_showView() return; } - QString strSlfName = ""; - QString strWellName = ""; - QString strLeft = m_projectWidgets->getLeftTreeString(); - if (strLeft.length() > 0) - { - QStringList list = strLeft.split("#@@#");//QString字符串分割函数 - if (list.size() > 3) - { - QFileInfo finfo(list[0]); - strSlfName = finfo.fileName(); - strWellName = list[1]; - } - } - else { - QMessageBox::warning(this, "提示", "请先选中待处理井次!"); - return; - } + + //--------------------------------- + //左侧树图选中井次 + g_strSlfName = ""; + g_strWellName = ""; + QString strLeft = m_projectWidgets->getLeftTreeString(); + if(strLeft.length() > 0) + { + QStringList list = strLeft.split("#@@#");//QString字符串分割函数 + if (list.size() > 3) + { + g_strSlfName = list[0]; + g_strWellName = list[1]; + } + } + else { + QMessageBox::warning(this, "提示", "请先选中待处理井次!"); + return; + } + if(g_strSlfName=="" || g_strWellName=="") + { + QMessageBox::warning(this, "提示", "请先选中待处理井次!"); + return; + } + //--------------------------------- //Logdata QString folderPath; @@ -680,8 +692,7 @@ void MainWindow::s_showView() m_centerWidgets->addTab(mainSplitter, fileName); MainWindowCurve *mainWindowCurve = mainSplitter->getMainWindowCurve(); - mainWindowCurve->m_strSlfName = strSlfName; - mainWindowCurve->m_strWellName = strWellName; + mainWindowCurve->Open(fileFull); //QFuture future = QtConcurrent::run(std::bind(&MainWindowCurve::s_Open, mainWindowCurve, fileFull)); diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index 76f7c3e..8bf2afb 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -59,6 +59,10 @@ extern int g_iSmallPrint; int g_iLoadingJson = 0; +//左侧树图选中井次 +extern QString g_strSlfName; +extern QString g_strWellName; + MainWindowCurve::MainWindowCurve(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindowCurve) @@ -2926,6 +2930,32 @@ void MainWindowCurve::loadStyle(const QString &qssFile) void MainWindowCurve::s_Open() { + //--------------------------------- + //左侧树图选中井次 + //针对“加载图文件”,支持井或井次 + g_strSlfName = ""; + g_strWellName = ""; + QString strLeft = m_leftWidgets->getLeftTreeString_Import(); + if(strLeft.length() > 0) + { + QStringList list = strLeft.split("#@@#");//QString字符串分割函数 + if (list.size() > 3) + { + g_strSlfName = list[0]; + g_strWellName = list[1]; + } + } + else { + QMessageBox::warning(this, "提示", "请先选中待处理井或井次!"); + return; + } + if(g_strSlfName=="" || g_strWellName=="") + { + QMessageBox::warning(this, "提示", "请先选中待处理井次!"); + return; + } + //--------------------------------- + //Logdata QString folderPath; folderPath = GetLogdataPath(); @@ -5132,21 +5162,21 @@ void MainWindowCurve::Open(QString fileFull) { QJsonObject object = document.object(); // - if (object.contains("prjname")) - { - QJsonValue value = object.value("prjname"); - if (value.isString()) { - strPrjname = value.toString(); - qDebug() << "prjname:" << strPrjname; +// if (object.contains("prjname")) +// { +// QJsonValue value = object.value("prjname"); +// if (value.isString()) { +// strPrjname = value.toString(); +// qDebug() << "prjname:" << strPrjname; - if(strPrjname != g_prjname) - { - file.close(); - qDebug() << "JSON 模板文件项目名称与当前项目不一致!"; - return; - } - } - } +// if(strPrjname != g_prjname) +// { +// file.close(); +// qDebug() << "JSON 模板文件项目名称与当前项目不一致!"; +// return; +// } +// } +// } // if (object.contains("iScale")) { @@ -5655,6 +5685,11 @@ void MainWindowCurve::DisplayWells(QJsonArray wellsArray) int id = 0; int iCount = wellsArray.size(); + if(iCount>1) + { + int flag = QMessageBox::warning(NULL,"提示",QString("图文件或模板中存在多个井文件,\n是否用当前选中井替换原井文件?"),QMessageBox::Yes,QMessageBox::No); + if(flag!=QMessageBox::Yes) return; + } for(int i=0; i0) { - QString strWellName = ""; - if (trackTop.contains("WellName")) - { - QJsonValue value = trackTop.value("WellName"); - if (value.isString()) { - strWellName = value.toString(); - qDebug() << "WellName:" << strWellName; - } - } + QString strWellName = g_strWellName; +// 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 ef0dfe8..89ecc27 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -74,8 +74,6 @@ public slots: public: MainWindowSplitter* m_pParentWin = NULL; - QString m_strSlfName = ""; - QString m_strWellName = ""; QString m_strUuid; QStringList m_listWell; diff --git a/logPlus/qmytreewidget.cpp b/logPlus/qmytreewidget.cpp index 4bdda5d..310d8cd 100644 --- a/logPlus/qmytreewidget.cpp +++ b/logPlus/qmytreewidget.cpp @@ -38,6 +38,54 @@ QString QMyTreeWidget::getCurrentItemString() } return sret; } + +//针对“加载图文件”,支持井或井次 +QString QMyTreeWidget::getCurrentItemString_Import() +{ + QString sret = ""; + QTreeWidgetItem *item = currentItem(); + if(!item) + return sret; + if(item->parent()==NULL) + { + return sret; + } + + QString strTreeTag = item->data(0, Qt::UserRole).toString(); + if (strTreeTag == "wellItem")//井次名称 + { + //曲线 + QString strSlfName = item->data(0, Qt::UserRole+1).toString(); + //井名 + QString strWellName = item->text(0); + + sret = strSlfName + "#@@#"+ strWellName + "#@@#" +item->text(0)+ "#@@#" + strTreeTag; + } + else if (strTreeTag == "wellname" || //井 父节点 + // + strTreeTag == "Sheet" || //表格数据 + strTreeTag == "ParameterCard" || //参数卡 + strTreeTag == "Curve" || //曲线 + strTreeTag == "Wave" || //波列数据 + strTreeTag == "TDT" || //TDT + // + strTreeTag == "tableObject" || + strTreeTag == "curveObject" || + strTreeTag == "cardObject" || + strTreeTag == "waveObject" || + strTreeTag == "TDTObject")//井名称 + { + //曲线 + QString strSlfName = item->data(0, Qt::UserRole+1).toString(); + //井名 + QString strWellName = item->data(0, Qt::UserRole+2).toString(); + + sret = strSlfName + "#@@#"+ strWellName + "#@@#" +item->text(0)+ "#@@#" + strTreeTag; + } + + return sret; +} + void QMyTreeWidget::closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEditHint hint ) { QTreeWidget::closeEditor(editor,hint); diff --git a/logPlus/qmytreewidget.h b/logPlus/qmytreewidget.h index 64bb7a7..9952862 100644 --- a/logPlus/qmytreewidget.h +++ b/logPlus/qmytreewidget.h @@ -18,6 +18,10 @@ public: ~QMyTreeWidget(); QString getCurrentItemString(); + + //针对“加载图文件”,支持井或井次 + QString getCurrentItemString_Import(); + Q_SIGNALS: void closeTreeEditor(); diff --git a/logPlus/qtprojectwidgets.cpp b/logPlus/qtprojectwidgets.cpp index bee47fd..12ae797 100644 --- a/logPlus/qtprojectwidgets.cpp +++ b/logPlus/qtprojectwidgets.cpp @@ -94,6 +94,12 @@ QString QtProjectWidgets::getLeftTreeString() return ui->treeWidget->getCurrentItemString(); } +//针对“加载图文件”,支持井或井次 +QString QtProjectWidgets::getLeftTreeString_Import() +{ + return ui->treeWidget->getCurrentItemString_Import(); +} + void QtProjectWidgets::slotButtonCancel() { m_ReFlag=QDialogButtonBox::StandardButton::Cancel; @@ -415,6 +421,8 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q QTreeWidgetItem *itemSheet = new QTreeWidgetItem(); itemSheet->setText(0, "表格数据"); itemSheet->setData(0, Qt::UserRole, "Sheet"); // 存储额外数据,如ID + itemSheet->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径 + itemSheet->setData(0, Qt::UserRole + 2, parentWellname); // 存储额外数据,井名 //itemSheet->setData(0, Qt::UserRole + 1, indexSysInfo.at(1).toString()); // 存储额外数据,如ID // QIcon iconSheet; @@ -427,6 +435,8 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q QTreeWidgetItem *itemParameterCard = new QTreeWidgetItem(); itemParameterCard->setText(0, "参数卡"); itemParameterCard->setData(0, Qt::UserRole, "ParameterCard"); // 存储额外数据,如ID + itemParameterCard->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径 + itemParameterCard->setData(0, Qt::UserRole + 2, parentWellname); // 存储额外数据,井名 //itemParameterCard->setData(0, Qt::UserRole + 1, indexSysInfo.at(1).toString()); // 存储额外数据,如ID // QIcon iconParameterCard; @@ -438,6 +448,8 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q QTreeWidgetItem *itemCurve = new QTreeWidgetItem(); itemCurve->setText(0, "曲线"); itemCurve->setData(0, Qt::UserRole, "Curve"); // 存储额外数据,如ID + itemCurve->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径 + itemCurve->setData(0, Qt::UserRole + 2, parentWellname); // 存储额外数据,井名 //itemAddLog->setData(0, Qt::UserRole + 1, indexSysInfo.at(1).toString()); // 存储额外数据,如ID // QIcon iconCurve; @@ -449,6 +461,8 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q QTreeWidgetItem *itemWave = new QTreeWidgetItem(); itemWave->setText(0, "波列数据"); itemWave->setData(0, Qt::UserRole, "Wave"); // 存储额外数据,如ID + itemWave->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径 + itemWave->setData(0, Qt::UserRole + 2, parentWellname); // 存储额外数据,井名 //itemWave->setData(0, Qt::UserRole + 1, indexSysInfo.at(1).toString()); // 存储额外数据,如ID // QIcon iconWave; @@ -460,6 +474,8 @@ void QtProjectWidgets::loadWellTree(QTreeWidgetItem *parent, QString fileFull, Q QTreeWidgetItem *itemTDT = new QTreeWidgetItem(); itemTDT->setText(0, "TDT数据"); itemTDT->setData(0, Qt::UserRole, "TDT"); // 存储额外数据,如ID + itemTDT->setData(0, Qt::UserRole + 1, fileFull); // 存储额外数据,井次文件路径 + itemTDT->setData(0, Qt::UserRole + 2, parentWellname); // 存储额外数据,井名 //itemTDT->setData(0, Qt::UserRole + 1, indexSysInfo.at(1).toString()); // 存储额外数据,如ID // QIcon iconWTDT; diff --git a/logPlus/qtprojectwidgets.h b/logPlus/qtprojectwidgets.h index ef0baea..32aea54 100644 --- a/logPlus/qtprojectwidgets.h +++ b/logPlus/qtprojectwidgets.h @@ -20,6 +20,9 @@ public: QString getLeftTreeString(); + //针对“加载图文件”,支持井或井次 + QString getLeftTreeString_Import(); + private: Ui::QtProjectWidgetsClass *ui;