diff --git a/logPlus/mainwindow.cpp b/logPlus/mainwindow.cpp index 1f1aa9d..7003b16 100644 --- a/logPlus/mainwindow.cpp +++ b/logPlus/mainwindow.cpp @@ -623,6 +623,24 @@ 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; + } + //Logdata QString folderPath; folderPath = GetLogdataPath(); @@ -662,6 +680,8 @@ 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 878d4bd..6c43264 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -406,7 +406,8 @@ void MainWindowCurve::resizeEvent(QResizeEvent *event) QSize sz = event->size(); m_nObjDrawH = sz.height() - nhei - m_nObjLayerH - 100 - 100; // nhei mainToolBar的高度 m_nObjLyrH,对象单元格高度 100头高度,100井头高度 - emit CallManage::getInstance()->sig_ResizeHeight(m_strUuid, m_nObjDrawH); + int che = ui->centralwidget->height(); + emit CallManage::getInstance()->sig_ResizeHeight(m_strUuid, che); //2个滚动条位置 SetScrollBar_Geometry(); @@ -5666,27 +5667,29 @@ void MainWindowCurve::DisplayWells(QJsonArray wellsArray) //展示其中一口井 void MainWindowCurve::DisplayWell_One(QJsonObject wellObjInfo) { - QString strWellName = ""; - QString strSlfName = ""; + QString strWellName = m_strWellName; + QString strSlfName = m_strSlfName; QJsonArray tracksArray; + if (strSlfName.length() <= 0) + { + if (wellObjInfo.contains("WellName")) + { + QJsonValue value = wellObjInfo.value("WellName"); + if (value.isString()) { + strWellName = value.toString(); + qDebug() << "WellName:" << strWellName; + } + } - if (wellObjInfo.contains("WellName")) - { - QJsonValue value = wellObjInfo.value("WellName"); - if (value.isString()) { - strWellName = value.toString(); - qDebug() << "WellName:" << strWellName; - } - } - - if (wellObjInfo.contains("SlfName")) - { - QJsonValue value = wellObjInfo.value("SlfName"); - if (value.isString()) { - strSlfName = value.toString(); - qDebug() << "strSlfName:" << strSlfName; - } - } + if (wellObjInfo.contains("SlfName")) + { + QJsonValue value = wellObjInfo.value("SlfName"); + if (value.isString()) { + strSlfName = value.toString(); + qDebug() << "strSlfName:" << strSlfName; + } + } + } if (wellObjInfo.contains("bShowTrackHead")) { @@ -5759,6 +5762,8 @@ void MainWindowCurve::DisplayTracks(QJsonArray tracksArray) if (topVal.isObject() && infoVal.isObject()) { QJsonObject topObj = topVal.toObject(); QJsonObject infoObj = infoVal.toObject(); + + topObj["WellName"] = m_strWellName; //展示其中一道 DisplayTrack_Top(id, topObj, infoObj); diff --git a/logPlus/mainwindowcurve.h b/logPlus/mainwindowcurve.h index 7e06b36..1da87b5 100644 --- a/logPlus/mainwindowcurve.h +++ b/logPlus/mainwindowcurve.h @@ -74,6 +74,8 @@ public slots: public: MainWindowSplitter* m_pParentWin = NULL; + QString m_strSlfName = ""; + QString m_strWellName = ""; QString m_strUuid; QStringList m_listWell; diff --git a/logPlus/mainwindowcurve.ui b/logPlus/mainwindowcurve.ui index 80a19d7..8c697c3 100644 --- a/logPlus/mainwindowcurve.ui +++ b/logPlus/mainwindowcurve.ui @@ -6,14 +6,17 @@ 0 0 - 800 - 600 + 681 + 513 MainWindow + + + 9 @@ -32,8 +35,15 @@ 0 + + 10 + - + + + + + diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index c6d5d4d..1cd72cc 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -75,7 +75,7 @@ QMyCustomPlot::QMyCustomPlot(QWidget *parent, QString strSlfName, QString strWel // ===== 性能优化: 启用 OpenGL 硬件加速 ===== // 优先尝试 OpenGL, 如果硬件不支持会自动回退到软件渲染 - this->setOpenGl(true, 16); + //this->setOpenGl(true, 16); m_newColor = Qt::black; // ===== 性能优化: 仅对曲线开抗锯齿, 关闭轴/网格/图例抗锯齿 ===== @@ -876,7 +876,7 @@ void QMyCustomPlot::mouseMoveEvent(QMouseEvent *event) y_val = xAxis->pixelToCoord(y_pos); else y_val = yAxis->pixelToCoord(y_pos); - //qDebug() << "MouseMove:" << y_pos; + //qDebug() << "MouseMove pixel:" << y_pos << "Y轴: " << y_val; emit CallManage::getInstance()->sig_MouseMove(m_strUuid, m_strWellName, m_strTrackName, 0-y_val); } } @@ -12274,9 +12274,33 @@ void QMyCustomPlot::vertScrollBarChanged_setGeometry(QString strUuid, double val //move(0, -(dPercent*geoRect.height())); setGeometry(0, -(dPercent*geoRect.height()), geoRect.width(), geoRect.height()); + + //qDebug() << "visibleTopDepth: " << visibleTopDepth(); + //qDebug() << "visibleBottomDepth: " << visibleBottomDepth(); return; } +float QMyCustomPlot::visibleTopDepth() const +{ + // widget 被父容器从顶部裁切的像素量 = -geometry().y() + int pixTop = -geometry().y(); + if (m_bX2Y) + return (float)xAxis->pixelToCoord(pixTop); + else + return (float)yAxis->pixelToCoord(pixTop); +} + +float QMyCustomPlot::visibleBottomDepth() const +{ + QWidget* p = parentWidget(); + int viewportH = p ? p->height() : height(); + int pixBottom = -geometry().y() + viewportH; + if (m_bX2Y) + return (float)xAxis->pixelToCoord(pixBottom); + else + return (float)yAxis->pixelToCoord(pixBottom); +} + void QMyCustomPlot::s_ResizeHeight(QString strUuid, int nPixVal) { if (m_strUuid == strUuid) @@ -12285,6 +12309,7 @@ void QMyCustomPlot::s_ResizeHeight(QString strUuid, int nPixVal) m_fBottomY = xAxis->pixelToCoord(nPixVal); else m_fBottomY = yAxis->pixelToCoord(nPixVal); + emit CallManage::getInstance()->sig_ResizeDepth(m_strUuid, nPixVal, m_fBottomY); } } diff --git a/logPlus/qmycustomplot.h b/logPlus/qmycustomplot.h index c8bde17..af5d807 100644 --- a/logPlus/qmycustomplot.h +++ b/logPlus/qmycustomplot.h @@ -129,6 +129,9 @@ public: void setDepthY(float fy1, float fy2); //改变深度更新绘图 void updateDepthY(float fy1, float fy2); + // 获取可视区域顶部/底部深度(滚动偏移后实时有效,基于像素反算) + float visibleTopDepth() const; + float visibleBottomDepth() const; //绘制网格 void drawRowGrid(bool b = false);