From 42434b58162d4256f2fc39d80cc546fd51fbca61 Mon Sep 17 00:00:00 2001 From: lvjunjie Date: Wed, 28 Oct 2026 14:28:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E6=B5=8B=E9=87=8F=E7=82=B9=E5=9B=9E=E5=8E=9F=E7=82=B9=E5=8F=8A?= =?UTF-8?q?=E8=B5=B7=E7=BB=88=E7=82=B9=E6=8B=9F=E5=90=88=E9=A1=BA=E5=BA=8F?= =?UTF-8?q?=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/nmNum/nmPlot/nmPlotGraphicBinder.cpp | 10 ++++------ Src/nmNum/nmSubWxs/nmWxMeasureDlg.cpp | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Src/nmNum/nmPlot/nmPlotGraphicBinder.cpp b/Src/nmNum/nmPlot/nmPlotGraphicBinder.cpp index 96e42110..faa9c41b 100644 --- a/Src/nmNum/nmPlot/nmPlotGraphicBinder.cpp +++ b/Src/nmNum/nmPlot/nmPlotGraphicBinder.cpp @@ -974,12 +974,10 @@ void nmPlotGraphicBinder::createMeasureForGraphic(nmObjLineMeasure* pGraphic) QPointF pStart = pts[0]; QPointF pEnd = pts[1]; double dLength = QLineF(pStart, pEnd).length(); - if (pEnd != pStart) { - pData->setStartPoint(pStart); - pData->setEndPoint(pEnd); - } else { - pData->setCurrentPoint(pStart); - } + // 单击测量也保存起终点,避免重绘时被尚未更新的原点坐标覆盖。 + pData->setStartPoint(pStart); + pData->setEndPoint(pEnd); + pData->setCurrentPoint(pEnd == pStart ? pStart : QPointF(0, 0)); nmDataAttribute lenAttr = pData->getLength(); lenAttr.setValue(dLength); pData->setLength(lenAttr); diff --git a/Src/nmNum/nmSubWxs/nmWxMeasureDlg.cpp b/Src/nmNum/nmSubWxs/nmWxMeasureDlg.cpp index 267ac3d5..7a4a4779 100644 --- a/Src/nmNum/nmSubWxs/nmWxMeasureDlg.cpp +++ b/Src/nmNum/nmSubWxs/nmWxMeasureDlg.cpp @@ -83,6 +83,12 @@ void nmWxMeasureDlg::initComponents() { void nmWxMeasureDlg::onFitStartClicked() { + // 使用当前井列表;没有可拟合的井时保留测量点,避免写入默认原点。 + m_vecWellList = nmDataAnalyzeManager::getCurrentInstance()->getWellDataList(); + if (m_vecWellList.isEmpty()) { + return; + } + m_pFitStartButton->setEnabled(false); // 先取出当前点 @@ -131,9 +137,9 @@ void nmWxMeasureDlg::onFitStartClicked() nearest = pt; } } - // 更新起点和终点 - m_pData->setStartPoint(startPt); - m_pData->setEndPoint(nearest); + // 单点测量先拟合起点时,将起点移到井上,终点保留在点击位置。 + m_pData->setStartPoint(nearest); + m_pData->setEndPoint(startPt); // 重新计算长度 double newLen = QLineF(startPt, nearest).length(); @@ -148,6 +154,12 @@ void nmWxMeasureDlg::onFitStartClicked() void nmWxMeasureDlg::onFitEndClicked() { + // 使用当前井列表;没有可拟合的井时保留测量点,避免写入默认原点。 + m_vecWellList = nmDataAnalyzeManager::getCurrentInstance()->getWellDataList(); + if (m_vecWellList.isEmpty()) { + return; + } + m_pFitEndButton->setEnabled(false); // 先取出当前点