From 018bb2d40d04d3075e5c5e1851f2c5ebc7bd6191 Mon Sep 17 00:00:00 2001 From: crqiqi77 Date: Wed, 29 Apr 2026 15:48:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=B1=E5=BA=A6=20=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- logPlus/PropertyWidget.cpp | 30 ++++++++++-- logPlus/PropertyWidget.h | 4 ++ logPlus/formdraw.cpp | 6 ++- logPlus/formwell.cpp | 35 ++++++++------ logPlus/mainwindowcurve.cpp | 2 +- logPlus/qmycustomplot.cpp | 95 ++++++++++++++++++++++++++++++++----- 6 files changed, 137 insertions(+), 35 deletions(-) diff --git a/logPlus/PropertyWidget.cpp b/logPlus/PropertyWidget.cpp index 365348f..bc10943 100644 --- a/logPlus/PropertyWidget.cpp +++ b/logPlus/PropertyWidget.cpp @@ -646,6 +646,22 @@ void PropertyWidget::SlotPropertyChanged( QtProperty *pProperty, const QVariant listCond << variant; emit CallManage::getInstance()->sig_changeTrackProperty(listCond); } + if("道宽(cm)" == m_propertyData[pProperty]) + { + m_strLineName = "深度"; + QVariantList listCond; + listCond << m_strUuid; + listCond << m_strSlfName; + listCond << m_strWellName; + listCond << m_strTrackName; + listCond << m_strLineName; + listCond << m_propertyData[pProperty]; + listCond << variant; + listCond << m_sdMeasuredDepthPosition; + listCond << m_sdVerticalDepthPosition; + listCond << m_sdElevationVerticalDepthPosition; + emit CallManage::getInstance()->sig_changeDepthProperty(listCond); + } return; } else if (m_strCurrentProperty == Wave_Property) @@ -3166,8 +3182,9 @@ void PropertyWidget::initDepthProperty(FormInfo *formInfo) _CreateVariantPropertyItem("次刻度线", "次刻度线长度", formInfo->m_sdMinorTickLineLength, QVariant::Int); _CreateVariantPropertyItem("次刻度线", "次刻度线宽度", formInfo->m_sdMinorTickLineWidth, QVariant::Int); - - + m_sdMeasuredDepthPosition = formInfo->m_sdMeasuredDepthPosition; + m_sdVerticalDepthPosition = formInfo->m_sdVerticalDepthPosition; + m_sdElevationVerticalDepthPosition = formInfo->m_sdElevationVerticalDepthPosition; m_strCurrentProperty = Depth_Property; } @@ -4340,15 +4357,18 @@ void PropertyWidget::changedDepthProperty(QString strProperty, QVariant varVal) } else if ("斜深位置" == strProperty) { - this->m_formInfo->m_sdMeasuredDepthPosition = varVal.toInt(); + this->m_formInfo->m_sdMeasuredDepthPosition = varVal.toInt(); + m_sdMeasuredDepthPosition = varVal.toInt(); } else if ("垂深位置" == strProperty) { - this->m_formInfo->m_sdVerticalDepthPosition = varVal.toInt(); + this->m_formInfo->m_sdVerticalDepthPosition = varVal.toInt(); + m_sdVerticalDepthPosition = varVal.toInt(); } else if ("海拔垂深位置" == strProperty) { - this->m_formInfo->m_sdElevationVerticalDepthPosition = varVal.toInt(); + this->m_formInfo->m_sdElevationVerticalDepthPosition = varVal.toInt(); + m_sdElevationVerticalDepthPosition = varVal.toInt(); } else if ("垂深" == strProperty) { diff --git a/logPlus/PropertyWidget.h b/logPlus/PropertyWidget.h index 9011a9d..b025118 100644 --- a/logPlus/PropertyWidget.h +++ b/logPlus/PropertyWidget.h @@ -162,6 +162,10 @@ public: TransparentDraggableGuan* m_tdGuan; TransparentDraggableCorePhysics* m_tdCorePhysics; + int m_sdMeasuredDepthPosition = 0; + int m_sdVerticalDepthPosition = 0; + int m_sdElevationVerticalDepthPosition = 0; + public: QWidget* GetPropertyWidget(); diff --git a/logPlus/formdraw.cpp b/logPlus/formdraw.cpp index b826dce..9980fe7 100644 --- a/logPlus/formdraw.cpp +++ b/logPlus/formdraw.cpp @@ -5958,8 +5958,9 @@ void FormDraw::initDepth(QMyCustomPlot *curv) curv->m_yAxis2->setRange(0, 100); curv->m_yAxis2->setOffset(40); curv->m_yAxis2->setTickLabelPadding(10); + curv->m_yAxis2->ticker()->setTickCount(60); + curv->m_yAxis2->setTickLabelPadding(5); } - if(!curv->m_yAxis3) { curv->m_yAxis3 = new QCPAxis(curv->axisRect(), QCPAxis::atLeft); @@ -5967,8 +5968,9 @@ void FormDraw::initDepth(QMyCustomPlot *curv) curv->m_yAxis3->setRange(0, 100); curv->m_yAxis3->setOffset(40); curv->m_yAxis3->setTickLabelPadding(10); + curv->m_yAxis3->ticker()->setTickCount(60); + curv->m_yAxis3->setTickLabelPadding(5); } - } void FormDraw::initFgrq(QMyCustomPlot *widget) diff --git a/logPlus/formwell.cpp b/logPlus/formwell.cpp index 855b34d..20afcf3 100644 --- a/logPlus/formwell.cpp +++ b/logPlus/formwell.cpp @@ -151,7 +151,10 @@ QVector FormWell::new_track(QStringList listdt, QString strTrackName) if(dW <= 0) dW = g_iOneWidth; - + if(strType == "depthObject") + { + dW = 1.2; + } //增加1列 int columnCount = this->insertColumn(dW); @@ -161,7 +164,9 @@ QVector FormWell::new_track(QStringList listdt, QString strTrackName) QStringList listTrackName = getTrackNameList(); // if(strType == "depthObject") + { strTrackName = "深度"; + } else if(strType == "roseObject") strTrackName = "玫瑰图" + QString::number(columnCount+1); else if(strType == "dcaObject") @@ -225,21 +230,9 @@ QVector FormWell::new_track(QStringList listdt, QString strTrackName) trackTop->m_strUuid = m_strUuid; trackTop->m_nTrackW = dW;// / static_cast(g_dPixelPerCm); - - if(strTrackName.contains("深度")) - { - trackTop->m_nTrackW = 1.2; - QVariantList listCond; - listCond << strUuid; - listCond << strSlfName; - listCond << strWellName; - listCond << columnCount; - listCond << "道宽(cm)"; - listCond << "1.2"; - emit CallManage::getInstance()->sig_changeTrackProperty(listCond); - } - ui->tableWidget->setCellWidget(i, columnCount, trackTop); + + } else if(i==1) { @@ -309,6 +302,18 @@ QVector FormWell::new_track(QStringList listdt, QString strTrackName) } } m_mapFormDraw.insert(formTrack->getTrackUuid(), vec); + + if(strTrackName.contains("深度")) + { + QVariantList listCond; + listCond << strUuid; + listCond << strSlfName; + listCond << strWellName; + listCond << columnCount; + listCond << "道宽(cm)"; + listCond << "1.2"; + emit CallManage::getInstance()->sig_changeTrackProperty(listCond); + } return vec; } diff --git a/logPlus/mainwindowcurve.cpp b/logPlus/mainwindowcurve.cpp index 8d611a9..1e42f3d 100644 --- a/logPlus/mainwindowcurve.cpp +++ b/logPlus/mainwindowcurve.cpp @@ -3456,7 +3456,7 @@ void MainWindowCurve::s_NewTrack() void MainWindowCurve::s_NewDepth() { int column = -1; - int nW = 2; + int nW = 1.2; QStringList sret = this->insertCol(nW); if (sret.length() <= 0) return; diff --git a/logPlus/qmycustomplot.cpp b/logPlus/qmycustomplot.cpp index 38943bc..be334b3 100644 --- a/logPlus/qmycustomplot.cpp +++ b/logPlus/qmycustomplot.cpp @@ -5412,14 +5412,14 @@ void QMyCustomPlot::s_changeDepthProperty(QVariantList vlist) this->m_yAxis3->setTickLabels(temp); this->m_yAxis3->setTickLabelSide(QCPAxis::lsInside); } - else if ("斜深位置" == strProperty) + else if ("斜深位置" == strProperty || "道宽(cm)" == strProperty) { - QSize size = this->size(); // 包含宽高的QSize对象 - int width2 = size.width(); - int center = width2 / 2 - this->yAxis->tickLabelFont().pointSize(); - int right = width2 - this->yAxis->tickLabelFont().pointSize() - 5; + int width2 = this->size().width(); + QFontMetrics fm(this->yAxis->tickLabelFont()); + int h = fm.height(); + int center = width2 / 2 - h / 2; + int right = width2 - h - 5; - // 没有直接设置偏移方法 动态计算太麻烦 int temp = varVal.toInt(); switch(temp) { @@ -5436,8 +5436,14 @@ void QMyCustomPlot::s_changeDepthProperty(QVariantList vlist) break; } } - else if ("垂深位置" == strProperty) + else if ("垂深位置" == strProperty || "道宽(cm)" == strProperty) { + int width2 = this->size().width(); + QFontMetrics fm(this->yAxis->tickLabelFont()); + int h = fm.height(); + int center = width2 / 2 - h / 2; + int right = width2 - h - 5; + int temp = varVal.toInt(); switch(temp) { @@ -5447,15 +5453,21 @@ void QMyCustomPlot::s_changeDepthProperty(QVariantList vlist) break; case 1: // 居中 - this->m_yAxis3->setTickLabelPadding(30 + 10); + this->m_yAxis3->setTickLabelPadding(center); break; case 2: - this->m_yAxis3->setTickLabelPadding(50 + 10); + this->m_yAxis3->setTickLabelPadding(right); break; } } - else if ("海拔垂深位置" == strProperty) + else if ("海拔垂深位置" == strProperty || "道宽(cm)" == strProperty) { + int width2 = this->size().width(); + QFontMetrics fm(this->yAxis->tickLabelFont()); + int h = fm.height(); + int center = width2 / 2 - h / 2; + int right = width2 - h - 5; + int temp = varVal.toInt(); switch(temp) { @@ -5465,10 +5477,10 @@ void QMyCustomPlot::s_changeDepthProperty(QVariantList vlist) break; case 1: // 居中 - this->m_yAxis2->setTickLabelPadding(30); + this->m_yAxis2->setTickLabelPadding(center); break; case 2: - this->m_yAxis2->setTickLabelPadding(50 + 10); + this->m_yAxis2->setTickLabelPadding(right); break; } } @@ -5496,6 +5508,65 @@ void QMyCustomPlot::s_changeDepthProperty(QVariantList vlist) tickPen.setWidth(temp); this->yAxis->setSubTickPen(tickPen); } + + if ("道宽(cm)" == strProperty && vlist.size() > 6) + { + int temp1 = vlist.at(7).toInt(); + int temp2 = vlist.at(8).toInt(); + int temp3 = vlist.at(9).toInt(); + + int width2 = this->size().width(); + QFontMetrics fm(this->yAxis->tickLabelFont()); + int h = fm.height(); + int center = width2 / 2 - h / 2; + int right = width2 - h - 5; + + switch(temp1) + { + case 0: + // 靠左 + this->yAxis->setTickLabelPadding(5); + break; + case 1: + // 居中 + this->yAxis->setTickLabelPadding(center); + break; + case 2: + this->yAxis->setTickLabelPadding(right); + break; + } + + switch(temp2) + { + case 0: + // 偏左 + this->m_yAxis3->setTickLabelPadding(5 + 10); + break; + case 1: + // 居中 + this->m_yAxis3->setTickLabelPadding(center); + break; + case 2: + this->m_yAxis3->setTickLabelPadding(right); + break; + } + + switch(temp3) + { + case 0: + // 偏左 + this->m_yAxis2->setTickLabelPadding(5 + 10); + break; + case 1: + // 居中 + this->m_yAxis2->setTickLabelPadding(center); + break; + case 2: + this->m_yAxis2->setTickLabelPadding(right); + break; + } + + } this->replot(); } }