From d847d428f5e0ec495ddc67e89a9e30b2df47bb44 Mon Sep 17 00:00:00 2001 From: lh <2334563547@qq.com> Date: Fri, 14 Aug 2026 17:35:57 +0800 Subject: [PATCH] =?UTF-8?q?refactor(nmNum):=20=E4=BC=98=E5=8C=96=E5=A4=8D?= =?UTF-8?q?=E5=90=88=E5=8C=BA=E5=92=8C=E5=8C=BA=E5=9F=9F=E6=A0=87=E8=AE=B0?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=B8=83=E5=B1=80=E5=8F=8A=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bin/Config/Lang/cn/nmNum_cn.qm | Bin 112543 -> 112710 bytes Bin/Config/Lang/cn/nmNum_cn.ts | 8 +++-- .../nmSubWxs/nmReservoirParameterCatalog.h | 1 + .../nmSubWxs/nmReservoirParameterField.h | 11 ++++-- .../nmSubWxs/nmReservoirParameterCatalog.cpp | 33 +++++++++++------ .../nmSubWxs/nmReservoirParameterField.cpp | 23 ++++++------ .../nmSubWxs/nmReservoirParameterPage.cpp | 34 ++++++++++++++---- 7 files changed, 77 insertions(+), 33 deletions(-) diff --git a/Bin/Config/Lang/cn/nmNum_cn.qm b/Bin/Config/Lang/cn/nmNum_cn.qm index b0806ed38e70a34dd02a8e15b97ac17122c3cc39..003de21ebdb765f01ee6b20642773fef7a370739 100644 GIT binary patch delta 1300 zcmZ9KYfO_@7{{OI*teyxEtl2;3cVq1!6@pMqGS;_b)cI?HzrJD>up65dZDF7Zbifb zf>p^w?bu+(MB_q+a}Xgib(;>C>Eb2CO|y|LTe>A~OkH$|%gFX>ryq8bbABJr|GE6n zd5+u_U%DqgGy~mTDnDyeb%nI}N7ulg8C6>VxEBDMevdJ@KE`%gjGbW`!vlQ44N!Ot zup@rR%HBi1Z6$zL3An$CI8nizP9=!08vrHyK{UP{aC>r$P3<7M5Mz%*mAugAN>S&D9;tv$%@>v6rLHq@tp-HiZwb)56(J+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cn/nmNum_cn.ts @@ -6815,9 +6815,11 @@ Average pressure in contour: %2 MPa Homogeneous均质储层 Dual porosity pseudo steady state双重介质拟稳态 Fault flow model断层流动模型 - Region flow model复合区流动模型 + Boundary type边界类型 Leaky泄漏 Composite limit复合边界 + Permeable boundary可渗透边界 + Composite boundary复合边界 Fracture flow model裂缝流动模型 Finite conductivity有限导流 Infinite conductivity无限导流 @@ -6830,11 +6832,11 @@ Average pressure in contour: %2 MPa Basic properties基础特性 Fluid parameters流体参数 Compression and saturation压缩与饱和度 - Dual-medium parameters双重介质参数 + Reservoir medium parameters储层介质参数 Geometry几何位置 Flow properties流动属性 Conductivity properties导流属性 - Region properties区域属性 + Boundary properties边界属性 nmSubWndMain diff --git a/Include/nmNum/nmSubWxs/nmReservoirParameterCatalog.h b/Include/nmNum/nmSubWxs/nmReservoirParameterCatalog.h index 0824746..37b6783 100644 --- a/Include/nmNum/nmSubWxs/nmReservoirParameterCatalog.h +++ b/Include/nmNum/nmSubWxs/nmReservoirParameterCatalog.h @@ -72,6 +72,7 @@ struct NM_SUB_WXS_EXPORT nmReservoirParameterGroupInfo int m_nRowSpan; ///< 分组纵向跨越的行数。 int m_nColumnSpan; ///< 分组横跨的列数。 bool m_bValueRightAligned; ///< 数值输入是否右对齐。 + bool m_bFieldsCentered; ///< 分组内字段是否水平居中并随宽度伸展。 QList m_listFields; ///< 分组内按显示顺序排列的字段。 }; diff --git a/Include/nmNum/nmSubWxs/nmReservoirParameterField.h b/Include/nmNum/nmSubWxs/nmReservoirParameterField.h index 8e7a3fe..d1d67a2 100644 --- a/Include/nmNum/nmSubWxs/nmReservoirParameterField.h +++ b/Include/nmNum/nmSubWxs/nmReservoirParameterField.h @@ -70,10 +70,14 @@ public: * @brief 将字段的三个直接控件加入分组网格。 * @param pLayout 所属分组的网格布局。 * @param nRow 字段所在行。 + * @param nColumnOffset 字段起始列偏移。 * @param sError 初始化失败原因。 * @return 参数元数据和单位绑定均成功时返回true。 */ - bool initialize(QGridLayout* pLayout, int nRow, QString& sError); + bool initialize(QGridLayout* pLayout, + int nRow, + int nColumnOffset, + QString& sError); /** @brief 返回编辑会话使用的稳定参数ID。 */ QString parameterId() const; @@ -131,10 +135,13 @@ private: /** @brief 创建数值输入框及单位控件。 */ bool createNumericEditor(QGridLayout* pLayout, int nRow, + int nColumnOffset, QString& sError); /** @brief 创建稳定code枚举下拉框。 */ - void createEnumEditor(QGridLayout* pLayout, int nRow); + void createEnumEditor(QGridLayout* pLayout, + int nRow, + int nColumnOffset); /** @brief 按XML精度格式化无单位或整数参数。 */ QString formatBaseValue(double dValue) const; diff --git a/Src/nmNum/nmSubWxs/nmReservoirParameterCatalog.cpp b/Src/nmNum/nmSubWxs/nmReservoirParameterCatalog.cpp index 6dd421d..d9f8beb 100644 --- a/Src/nmNum/nmSubWxs/nmReservoirParameterCatalog.cpp +++ b/Src/nmNum/nmSubWxs/nmReservoirParameterCatalog.cpp @@ -20,9 +20,11 @@ static const char* const s_pCatalogTranslationMarkers[] = QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Homogeneous"), QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Dual porosity pseudo steady state"), QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Fault flow model"), - QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Region flow model"), + QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Boundary type"), QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Leaky"), QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Composite limit"), + QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Permeable boundary"), + QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Composite boundary"), QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Fracture flow model"), QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Finite conductivity"), QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Infinite conductivity"), @@ -36,11 +38,11 @@ static const char* const s_pCatalogTranslationMarkers[] = QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Vertical well"), QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Fractured vertical well"), QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Multistage fractured horizontal well"), - QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Dual-medium parameters"), + QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Reservoir medium parameters"), QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Geometry"), QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Flow properties"), QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Conductivity properties"), - QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Region properties") + QT_TRANSLATE_NOOP("nmWxReservoirPropertiesEditor", "Boundary properties") }; /** @brief 返回当前语言下的界面文字。 */ @@ -108,19 +110,21 @@ nmReservoirParameterFieldInfo reservoirModelField( return oField; } -/** @brief 创建断层或复合区流动模型字段。 */ +/** @brief 按指定显示文字创建断层或复合区流动模型字段。 */ nmReservoirParameterFieldInfo leakageModelField( const QString& sParameterId, - const char* pLabel) + const char* pLabel, + const char* pLeakyText, + const char* pCompositeText) { nmReservoirParameterFieldInfo oField; oField.m_sParameterId = sParameterId; oField.m_sLabel = editorText(pLabel); oField.m_eEditorType = NM_RESERVOIR_EDITOR_ENUM; oField.m_bUnitEnabled = false; - oField.m_listOptions.append(enumOption("leaky", "Leaky")); + oField.m_listOptions.append(enumOption("leaky", pLeakyText)); oField.m_listOptions.append(enumOption( - "composite_limit", "Composite limit")); + "composite_limit", pCompositeText)); return oField; } @@ -154,6 +158,7 @@ nmReservoirParameterGroupInfo parameterGroup( oGroup.m_nRowSpan = 1; oGroup.m_nColumnSpan = nColumnSpan; oGroup.m_bValueRightAligned = false; + oGroup.m_bFieldsCentered = false; return oGroup; } @@ -535,7 +540,8 @@ nmReservoirParameterCatalog::createObjectInfos( oSnapshot.m_vecRegionMarks[nIndex].getRegionMarkName(); nmReservoirParameterGroupInfo oDual = - parameterGroup("Dual-medium parameters", 0, 0, 2); + parameterGroup("Reservoir medium parameters", 0, 0, 2); + oDual.m_bFieldsCentered = true; oDual.m_listFields << reservoirModelField(prefixed( oInfo.m_sObjectCode, "RM_ReservoirType")) @@ -584,7 +590,9 @@ nmReservoirParameterCatalog::createObjectInfos( oFlow.m_listFields << leakageModelField(prefixed( oInfo.m_sObjectCode, "FT_FlowModel"), - "Fault flow model") + "Fault flow model", + "Leaky", + "Composite limit") << numericField(prefixed( oInfo.m_sObjectCode, "FT_Leakage"), "FT_Leakage"); @@ -659,11 +667,14 @@ nmReservoirParameterCatalog::createObjectInfos( oSnapshot.m_vecRegions[nIndex].getRegoinName(); nmReservoirParameterGroupInfo oRegion = - parameterGroup("Region properties", 0, 0, 2); + parameterGroup("Boundary properties", 0, 0, 2); + oRegion.m_bFieldsCentered = true; oRegion.m_listFields << leakageModelField(prefixed( oInfo.m_sObjectCode, "R_FlowModel"), - "Region flow model") + "Boundary type", + "Permeable boundary", + "Composite boundary") << numericField(prefixed( oInfo.m_sObjectCode, "R_Leakage"), "R_Leakage"); diff --git a/Src/nmNum/nmSubWxs/nmReservoirParameterField.cpp b/Src/nmNum/nmSubWxs/nmReservoirParameterField.cpp index 23a1755..6e80ce8 100644 --- a/Src/nmNum/nmSubWxs/nmReservoirParameterField.cpp +++ b/Src/nmNum/nmSubWxs/nmReservoirParameterField.cpp @@ -64,6 +64,7 @@ nmReservoirParameterField::~nmReservoirParameterField() bool nmReservoirParameterField::initialize(QGridLayout* pLayout, int nRow, + int nColumnOffset, QString& sError) { if (pLayout == nullptr) @@ -75,7 +76,7 @@ bool nmReservoirParameterField::initialize(QGridLayout* pLayout, // 第一步:枚举字段不依赖XML数值定义,直接创建稳定code下拉框。 if (isEnum()) { - createEnumEditor(pLayout, nRow); + createEnumEditor(pLayout, nRow, nColumnOffset); sError.clear(); return true; } @@ -91,7 +92,7 @@ bool nmReservoirParameterField::initialize(QGridLayout* pLayout, } // 第三步:创建原型中的标签、输入框和单位列,不增加字段外框。 - return createNumericEditor(pLayout, nRow, sError); + return createNumericEditor(pLayout, nRow, nColumnOffset, sError); } QString nmReservoirParameterField::parameterId() const @@ -137,6 +138,7 @@ int nmReservoirParameterField::editorHeight() bool nmReservoirParameterField::createNumericEditor( QGridLayout* pLayout, int nRow, + int nColumnOffset, QString& sError) { QWidget* pParentWidget = pLayout->parentWidget(); @@ -153,8 +155,8 @@ bool nmReservoirParameterField::createNumericEditor( m_pLineEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - pLayout->addWidget(m_pLabel, nRow, 0); - pLayout->addWidget(m_pLineEdit, nRow, 1); + pLayout->addWidget(m_pLabel, nRow, nColumnOffset); + pLayout->addWidget(m_pLineEdit, nRow, nColumnOffset + 1); // 有单位参数直接注册到主对话框绑定器;字段只按控件指针读写, // 因此多口井共用同一基础参数ID时也不会发生串值。 @@ -166,7 +168,7 @@ bool nmReservoirParameterField::createNumericEditor( m_pUnitComboBox->setMinimumWidth(unitMinimumWidth()); m_pUnitComboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - pLayout->addWidget(m_pUnitComboBox, nRow, 2); + pLayout->addWidget(m_pUnitComboBox, nRow, nColumnOffset + 2); if (m_pUnitService == nullptr || !m_pUnitService->bindUnitField( m_pLineEdit, @@ -186,7 +188,7 @@ bool nmReservoirParameterField::createNumericEditor( m_pUnitLabel->setMinimumWidth(unitMinimumWidth()); m_pUnitLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - pLayout->addWidget(m_pUnitLabel, nRow, 2); + pLayout->addWidget(m_pUnitLabel, nRow, nColumnOffset + 2); } updateValidationAppearance(true); @@ -195,7 +197,8 @@ bool nmReservoirParameterField::createNumericEditor( } void nmReservoirParameterField::createEnumEditor(QGridLayout* pLayout, - int nRow) + int nRow, + int nColumnOffset) { QWidget* pParentWidget = pLayout->parentWidget(); m_pLabel = new QLabel(m_oFieldInfo.m_sLabel, pParentWidget); @@ -224,9 +227,9 @@ void nmReservoirParameterField::createEnumEditor(QGridLayout* pLayout, m_pUnitLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); - pLayout->addWidget(m_pLabel, nRow, 0); - pLayout->addWidget(m_pValueComboBox, nRow, 1); - pLayout->addWidget(m_pUnitLabel, nRow, 2); + pLayout->addWidget(m_pLabel, nRow, nColumnOffset); + pLayout->addWidget(m_pValueComboBox, nRow, nColumnOffset + 1); + pLayout->addWidget(m_pUnitLabel, nRow, nColumnOffset + 2); } void nmReservoirParameterField::setBaseValue(const QVariant& oValue) diff --git a/Src/nmNum/nmSubWxs/nmReservoirParameterPage.cpp b/Src/nmNum/nmSubWxs/nmReservoirParameterPage.cpp index 3a0f630..b1d2884 100644 --- a/Src/nmNum/nmSubWxs/nmReservoirParameterPage.cpp +++ b/Src/nmNum/nmSubWxs/nmReservoirParameterPage.cpp @@ -234,14 +234,31 @@ bool nmReservoirParameterPage::buildGroup( pFieldLayout->setContentsMargins(8, 15, 8, 10); pFieldLayout->setHorizontalSpacing(6); pFieldLayout->setVerticalSpacing(6); - // 标签列由本组最长标签的自然宽度决定,数值列和单位列按比例使用剩余空间。 - pFieldLayout->setColumnStretch(0, 0); - pFieldLayout->setColumnStretch(1, 8); - pFieldLayout->setColumnStretch(2, 5); + int nFieldColumnOffset = 0; + // 字段较少的通栏分组使用独立的左右弹性列, + // 使参数区域保持居中,输入列仍可随窗口宽度适度伸展。 + if (oGroupInfo.m_bFieldsCentered) + { + nFieldColumnOffset = 1; + pFieldLayout->setColumnStretch(0, 1); + pFieldLayout->setColumnStretch(1, 0); + pFieldLayout->setColumnStretch(2, 1); + pFieldLayout->setColumnStretch(3, 0); + pFieldLayout->setColumnStretch(4, 1); + } + else + { + // 常规分组由最长标签决定标签列宽,数值列和单位列按比例伸展。 + pFieldLayout->setColumnStretch(0, 0); + pFieldLayout->setColumnStretch(1, 8); + pFieldLayout->setColumnStretch(2, 5); + } pFieldLayout->setColumnMinimumWidth( - 1, nmReservoirParameterField::editorMinimumWidth()); + nFieldColumnOffset + 1, + nmReservoirParameterField::editorMinimumWidth()); pFieldLayout->setColumnMinimumWidth( - 2, nmReservoirParameterField::unitMinimumWidth()); + nFieldColumnOffset + 2, + nmReservoirParameterField::unitMinimumWidth()); // 每个字段只把三个直接控件放入此网格,不产生字段外框或子面板。 for (int nFieldIndex = 0; @@ -253,7 +270,10 @@ bool nmReservoirParameterPage::buildGroup( oGroupInfo.m_listFields[nFieldIndex], m_pUnitService, pGroupBox); - if (!pField->initialize(pFieldLayout, nFieldIndex, sError)) + if (!pField->initialize(pFieldLayout, + nFieldIndex, + nFieldColumnOffset, + sError)) { delete pGroupContainer; return false;