feat: 添加后处理井显示开关

- 新增井名和井线显示开关
- 切换时同步更新现有井名和井线 Actor
- 补充中文翻译并更新 qm 文件
feature/prepost-render-refactor
lh 2 weeks ago
parent c7bafd1c9f
commit 9d823f4772

Binary file not shown.

@ -5663,6 +5663,14 @@ Please check your input coordinates.</source>
<source>Draw Region</source>
<translation></translation>
</message>
<message>
<source>Wells</source>
<translation></translation>
</message>
<message>
<source>Show or hide well names and well lines</source>
<translation>线</translation>
</message>
<message>
<source>No cells were found within the defined contour.</source>
<translation></translation>

@ -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<QString, vtkSmartPointer<vtkBillboardTextActor3D>> m_mapWellNameActors; // 存储井名称的 vtkBillboardTextActor3D 文本 Actor
QMap<QString, vtkSmartPointer<vtkActor>> m_mapWellLineActors; // 存储井线的 3D Actor
bool m_bShowWellActors; // 是否显示井名和井线
// 阈值过滤器
vtkSmartPointer<vtkThreshold> m_thresholdFilter;

@ -1,4 +1,4 @@
#include "nmWxPostprocessingAnimationWidget.h"
#include "nmWxPostprocessingAnimationWidget.h"
#include <QDebug> // 用于调试输出
#include <algorithm> // 用于 std::sort 排序算法
@ -10,6 +10,7 @@
#include <QLabel>
#include <QTimer>
#include <QComboBox>
#include <QCheckBox>
#include <QSlider>
#include <QList>
#include <QEvent>
@ -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")); // 添加“面”模式

Loading…
Cancel
Save