diff --git a/Bin/Config/Lang/cn/nmNum_cn.qm b/Bin/Config/Lang/cn/nmNum_cn.qm index bdc7725..8cdbc9b 100644 Binary files a/Bin/Config/Lang/cn/nmNum_cn.qm and b/Bin/Config/Lang/cn/nmNum_cn.qm differ diff --git a/Bin/Config/Lang/cn/nmNum_cn.ts b/Bin/Config/Lang/cn/nmNum_cn.ts index 5879529..42ef643 100644 --- a/Bin/Config/Lang/cn/nmNum_cn.ts +++ b/Bin/Config/Lang/cn/nmNum_cn.ts @@ -5663,6 +5663,14 @@ Please check your input coordinates. Draw Region 绘制区域 + + Wells + + + + Show or hide well names and well lines + 显示或隐藏井名和井线 + No cells were found within the defined contour. 在已绘制的区域范围内未找到任何单元格。 diff --git a/Include/nmNum/nmSubWxs/nmWxPostprocessingAnimationWidget.h b/Include/nmNum/nmSubWxs/nmWxPostprocessingAnimationWidget.h index fa4ab3a..a8728d9 100644 --- a/Include/nmNum/nmSubWxs/nmWxPostprocessingAnimationWidget.h +++ b/Include/nmNum/nmSubWxs/nmWxPostprocessingAnimationWidget.h @@ -1,4 +1,4 @@ -#ifndef NMWXPOSTPROCESSINGANIMATIONWIDGET_H +#ifndef NMWXPOSTPROCESSINGANIMATIONWIDGET_H #define NMWXPOSTPROCESSINGANIMATIONWIDGET_H #include "nmSubWxs_global.h" @@ -184,6 +184,8 @@ private slots: void slotContourFinished(); // 清理轮廓 void slotClearContour(); + // 控制井名和井线的整体显示状态 + void slotSetWellActorsVisible(bool visible); private: // 布局 @@ -223,6 +225,7 @@ private: // === 新增:用于绘制井的 VTK 对象 (全部使用 vtkActor 指针,因为 vtkTextActor3D/vtkBillboardTextActor3D 都继承自 vtkActor) === QMap> m_mapWellNameActors; // 存储井名称的 vtkBillboardTextActor3D 文本 Actor QMap> m_mapWellLineActors; // 存储井线的 3D Actor + bool m_bShowWellActors; // 是否显示井名和井线 // 阈值过滤器 vtkSmartPointer m_thresholdFilter; diff --git a/Src/nmNum/nmSubWxs/nmWxPostprocessingAnimationWidget.cpp b/Src/nmNum/nmSubWxs/nmWxPostprocessingAnimationWidget.cpp index 645c185..552a75f 100644 --- a/Src/nmNum/nmSubWxs/nmWxPostprocessingAnimationWidget.cpp +++ b/Src/nmNum/nmSubWxs/nmWxPostprocessingAnimationWidget.cpp @@ -1,4 +1,4 @@ -#include "nmWxPostprocessingAnimationWidget.h" +#include "nmWxPostprocessingAnimationWidget.h" #include // 用于调试输出 #include // 用于 std::sort 排序算法 @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -177,6 +178,7 @@ nmWxPostprocessingAnimationWidget::nmWxPostprocessingAnimationWidget(QWidget* pa m_dMinValue = 0.0; m_bBelowMaxEnabled = false; m_dMaxValue = 0.0; + m_bShowWellActors = true; // 初始化区域平均压力计算内容 m_bIsDrawingMode = false; @@ -593,6 +595,7 @@ void nmWxPostprocessingAnimationWidget::initWellDrawing() textProperty->SetColor(0.898, 0.898, 0.0); textProperty->SetBold(true); // 文本加粗 //textActor->GetTextProperty()->SetJustificationToCentered(); // 文本中心对齐到其位置点 + textActor->SetVisibility(m_bShowWellActors ? 1 : 0); m_renderer->AddActor(textActor); // 对于所有 3D Actor,都使用 m_renderer->AddActor() m_mapWellNameActors.insert(sWellName, textActor); // 将 Actor 存储在 QMap 中,以便后续管理和清除 @@ -628,6 +631,7 @@ void nmWxPostprocessingAnimationWidget::initWellDrawing() lineActor->SetMapper(lineMapper); lineActor->GetProperty()->SetColor(0.647, 0.165, 0.165); lineActor->GetProperty()->SetLineWidth(1.1); + lineActor->SetVisibility(m_bShowWellActors ? 1 : 0); m_renderer->AddActor(lineActor); // 将 3D Actor 添加到渲染器 m_mapWellLineActors.insert(sWellName, lineActor); // 存储井线 Actor @@ -664,6 +668,27 @@ void nmWxPostprocessingAnimationWidget::clearWellActors() } } +void nmWxPostprocessingAnimationWidget::slotSetWellActorsVisible(bool visible) +{ + m_bShowWellActors = visible; + + for(auto it = m_mapWellNameActors.begin(); it != m_mapWellNameActors.end(); ++it) { + if(it.value()) { + it.value()->SetVisibility(visible ? 1 : 0); + } + } + + for(auto it = m_mapWellLineActors.begin(); it != m_mapWellLineActors.end(); ++it) { + if(it.value()) { + it.value()->SetVisibility(visible ? 1 : 0); + } + } + + if(m_pVtkWidget && m_pVtkWidget->GetRenderWindow()) { + m_pVtkWidget->GetRenderWindow()->Render(); + } +} + void nmWxPostprocessingAnimationWidget::initOperPannel() { QHBoxLayout* operLayout = new QHBoxLayout; // 创建操作面板的水平布局 @@ -717,6 +742,12 @@ void nmWxPostprocessingAnimationWidget::initOperPannel() operLayout->addWidget(drawButton, 2); connect(drawButton, SIGNAL(clicked()), this, SLOT(slotStartDrawPolygon())); + QCheckBox* wellActorsCheckBox = new QCheckBox(tr("Wells"), this); + wellActorsCheckBox->setToolTip(tr("Show or hide well names and well lines")); + wellActorsCheckBox->setChecked(m_bShowWellActors); + operLayout->addWidget(wellActorsCheckBox, 1); + connect(wellActorsCheckBox, SIGNAL(toggled(bool)), this, SLOT(slotSetWellActorsVisible(bool))); + // 创建切换显示模式的下拉框 QComboBox* showModeSelector = new QComboBox(this); // 创建下拉框 showModeSelector->addItem(tr("face")); // 添加“面”模式