diff --git a/logPlus/CallManage.h b/logPlus/CallManage.h index 1a58bfe..86f54e5 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); //删除波列 @@ -333,9 +336,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 96556d1..6980986 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -576,34 +576,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); @@ -804,32 +808,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"); @@ -889,10 +902,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());//名称颜色 @@ -921,32 +930,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"); @@ -1063,10 +1081,6 @@ void FormDraw::DisplayTable_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { QStringList listOtherProperty; @@ -1151,32 +1165,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"); @@ -1236,10 +1259,6 @@ void FormDraw::DisplayGujing_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { QStringList listOtherProperty; @@ -1274,32 +1293,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"); @@ -1326,10 +1354,6 @@ void FormDraw::DisplayKedouAndOthers_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { //蝌蚪图、杆状、井眼垮塌矢量图、井斜方位图 @@ -1347,32 +1371,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"); @@ -1399,10 +1432,6 @@ void FormDraw::DisplayMCals_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { //多臂井径 @@ -1420,32 +1449,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"); @@ -1487,10 +1525,6 @@ void FormDraw::DisplayJiegutext_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { QStringList listOtherProperty; @@ -1514,32 +1548,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"); @@ -1608,10 +1651,6 @@ void FormDraw::DisplayFac_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { QStringList listOtherProperty; @@ -1662,32 +1701,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"); @@ -1850,10 +1898,6 @@ void FormDraw::DisplayTubing_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { QStringList listOtherProperty; @@ -1938,32 +1982,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"); @@ -2006,10 +2059,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)); @@ -2663,32 +2712,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"); @@ -2834,10 +2892,6 @@ void FormDraw::DisplayLine_One(QJsonObject lineObjInfo) } } -// QString folderPath = GetLogdataPath(); -// folderPath = folderPath + g_prjname; -// strSlfName = folderPath + "/" + "#" + strWellName + "/" + strSlfName; - if (strLineName != "") { //此处属性注意顺序,后续使用按照顺序 @@ -2988,8 +3042,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); @@ -7448,8 +7510,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/formdraw.h b/logPlus/formdraw.h index 75deb65..5afbef5 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/forminfo.cpp b/logPlus/forminfo.cpp index 977e768..5eb965f 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/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 3e7ed17..773b944 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 @@ -640,11 +642,14 @@ 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 openMultiProjIcon(::GetImagePath()+"WellInterp/打开.png"); //多井的打开工程,使用模板的井名和slf名 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,15 +657,18 @@ 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"); + QIcon wellsSpaceIcon(::GetImagePath()+"WellInterp/井间距离.png"); //Main工具栏 m_selectWellAc = new QAction(selectWellIcon, "设置井", this); 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); @@ -674,23 +682,57 @@ 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); //此种方式为文字显示在图标右侧 + // 缩放 + 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); //另存为图文件 + menuTemplate->addAction(m_openMultiProjAc); //多井的打开工程,使用模板的井名和slf名 + 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_ModuleOpenAc); //处理方法 + ui->mainToolBar->addAction(m_blackAc); //黑白图 ui->mainToolBar->addAction(m_doubleHeadAc); //单曲线头 ui->mainToolBar->addAction(m_executeDepthShiftAc); //校深 @@ -701,7 +743,7 @@ void MainWindowCurve::initMainToolBar() ui->mainToolBar->addSeparator(); // ui->mainToolBar->addAction(m_wellTopAlignAc); //井顶对齐 - + ui->mainToolBar->addAction(m_wellsSpaceAc); //井间距 // 设置为可选中 m_fixwellsectionHeaderAc->setCheckable(true); //锁头 @@ -718,6 +760,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); @@ -733,6 +776,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())); @@ -2941,7 +2985,10 @@ void MainWindowCurve::loadStyle(const QString &qssFile) } void MainWindowCurve::s_Open() -{ +{ + //多井的打开工程,使用模板的井名和slf名 + m_bMultiProject = false; + //--------------------------------- //左侧树图选中井次 //针对“加载图文件”,支持井或井次 @@ -2987,7 +3034,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(); @@ -3002,7 +3049,6 @@ void MainWindowCurve::s_Open() void MainWindowCurve::s_Save() { - //Logdata QString folderPath; folderPath = GetLogdataPath(); @@ -3021,6 +3067,8 @@ void MainWindowCurve::s_Save() file.write(doc.toJson(QJsonDocument::Indented)); file.close(); qDebug() << "JSON文件写入成功!"; + // + m_fileJson = exPortPath; } else { qWarning() << "文件打开失败:" << file.errorString(); return; @@ -3028,6 +3076,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; @@ -3129,6 +3205,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() { @@ -4269,6 +4375,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); @@ -5165,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); @@ -5195,6 +5308,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)) @@ -5312,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) { @@ -5728,8 +5900,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")) { @@ -6486,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 b62892b..8cd14c4 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -142,7 +142,10 @@ public: void DisplayTrack_Top(int id, QJsonObject trackTop, QJsonObject trackInfo); void Open(QString fileFull);//打开 + void OpenMultiWell(QString fileFull);//打开 + QString m_fileJson=""; + bool m_bMultiProject = false; //多井的打开工程,使用模板的井名和slf名 public: //样式 void loadStyle(const QString &qssFile); @@ -231,11 +234,15 @@ 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; //锁头 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; //导出长图 @@ -249,6 +256,7 @@ public: QAction* m_autorollAc = nullptr; //图像自滚 QAction* m_PreviewPrintAc = nullptr; //预览图 QAction* m_wellTopAlignAc = nullptr; //井顶对齐 + QAction* m_wellsSpaceAc = nullptr; //井间距 QAction* m_ModuleOpenAc = nullptr; //处理方法 public slots: @@ -329,6 +337,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 @@ -342,6 +351,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); diff --git a/logPlus/preqtablewidget.cpp b/logPlus/preqtablewidget.cpp index 3674132..4fc8bef 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,例如: