From 1197f5873424a00dc4f9fc55abe4b1945fc83df1 Mon Sep 17 00:00:00 2001 From: lh <2334563547@qq.com> Date: Sun, 20 Sep 2026 10:00:38 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E8=B0=83=E6=95=B4=E5=AF=B9?= =?UTF-8?q?=E6=95=B0=E8=89=B2=E6=A0=87=E6=A0=87=E9=A2=98=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 根据线性或对数模式生成对应的色标标题 - 对数模式使用 log(属性符号) 并将单位保留在括号外 - 使用已校验的比例模式构造 Scene 显示候选 --- Include/nmNum/nmSubWxs/nmPebiResultPropertyDisplayText.h | 6 ++++-- Src/nmNum/nmSubWxs/nmPebiResultPropertyDisplayText.cpp | 7 ++++++- Src/nmNum/nmSubWxs/nmPebiResultSceneController.cpp | 3 ++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Include/nmNum/nmSubWxs/nmPebiResultPropertyDisplayText.h b/Include/nmNum/nmSubWxs/nmPebiResultPropertyDisplayText.h index 8fe9402a..4c3a0a92 100644 --- a/Include/nmNum/nmSubWxs/nmPebiResultPropertyDisplayText.h +++ b/Include/nmNum/nmSubWxs/nmPebiResultPropertyDisplayText.h @@ -21,10 +21,12 @@ public: */ static QString getDisplayName(const QString& sPropertyId); /** - * @brief 返回 VTK 色标使用的固定 ASCII 短标题。 + * @brief 根据比例模式返回 VTK 色标使用的固定 ASCII 短标题。 + * @param bLogarithmic 为 true 时只用 log(...) 包裹属性符号,单位仍置于括号外。 * @note 标题不参与翻译;未知属性返回空字符串。 */ - static QString getScalarBarTitle(const QString& sPropertyId); + static QString getScalarBarTitle(const QString& sPropertyId, + bool bLogarithmic); /** * @brief 返回 Catalog 中的默认显示单位。 * @return 单位原文;未知属性或无量纲属性返回空字符串。 diff --git a/Src/nmNum/nmSubWxs/nmPebiResultPropertyDisplayText.cpp b/Src/nmNum/nmSubWxs/nmPebiResultPropertyDisplayText.cpp index 89382d3f..ca1f29ed 100644 --- a/Src/nmNum/nmSubWxs/nmPebiResultPropertyDisplayText.cpp +++ b/Src/nmNum/nmSubWxs/nmPebiResultPropertyDisplayText.cpp @@ -35,7 +35,8 @@ QString nmPebiResultPropertyDisplayText::getDisplayName( } QString nmPebiResultPropertyDisplayText::getScalarBarTitle( - const QString& sPropertyId) + const QString& sPropertyId, + bool bLogarithmic) { nmPebiResultPropertyDescriptor oDescriptor; if(!nmPebiResultPropertyCatalog::findDescriptor( @@ -61,6 +62,10 @@ QString nmPebiResultPropertyDisplayText::getScalarBarTitle( return QString(); } + if(bLogarithmic) { + sTitle = QString::fromLatin1("log(") + sTitle + + QString::fromLatin1(")"); + } if(!oDescriptor.m_sDefaultDisplayUnit.isEmpty()) { sTitle += QString::fromLatin1(" ") + oDescriptor.m_sDefaultDisplayUnit; diff --git a/Src/nmNum/nmSubWxs/nmPebiResultSceneController.cpp b/Src/nmNum/nmSubWxs/nmPebiResultSceneController.cpp index c7b0b562..e68e4171 100644 --- a/Src/nmNum/nmSubWxs/nmPebiResultSceneController.cpp +++ b/Src/nmNum/nmSubWxs/nmPebiResultSceneController.cpp @@ -316,7 +316,8 @@ bool prepareDisplayCandidate( pLookupTable->ResetAnnotations(); const QString sTitle = - nmPebiResultPropertyDisplayText::getScalarBarTitle(sPropertyId); + nmPebiResultPropertyDisplayText::getScalarBarTitle( + sPropertyId, bLogarithmic); oCandidate.m_oSettings = oSettings; oCandidate.m_dBusinessRange[0] = dBusinessRange[0];