feat: 优化结果视图井名与引线显示

- 移除独立井位标记及其显示开关
- 使用逐井文字 Actor 和引线 Actor 锚定真实井位
- 井名按钮统一控制文字与引线显隐
- 调整字体、屏幕偏移、阴影和引线样式
- 将井名与引线置于前景层,改善密集网格下的可读性
- 保持井标注候选构造和事务提交机制
- 清理井位标记翻译并更新中文语言包
feature/nmNum-postprocessing-view-20260910
lh 2 weeks ago
parent 8c12fb5dd0
commit 01ccc2b88c

Binary file not shown.

@ -2888,7 +2888,6 @@ Reason: %1</source>
<message><source>No result data.</source><translation>暂无结果数据。</translation></message> <message><source>No result data.</source><translation>暂无结果数据。</translation></message>
<message><source>Color Scale</source><translation>色标</translation></message> <message><source>Color Scale</source><translation>色标</translation></message>
<message><source>Scale Grid</source><translation>比例网格</translation></message> <message><source>Scale Grid</source><translation>比例网格</translation></message>
<message><source>Well Markers</source><translation>井位标记</translation></message>
<message><source>Well Names</source><translation>井名</translation></message> <message><source>Well Names</source><translation>井名</translation></message>
<message><source>Unable to display the latest result.</source><translation>无法显示最新结果。</translation></message> <message><source>Unable to display the latest result.</source><translation>无法显示最新结果。</translation></message>
<message><source>Unable to display the latest result: %1</source><translation>无法显示最新结果:%1</translation></message> <message><source>Unable to display the latest result: %1</source><translation>无法显示最新结果:%1</translation></message>

@ -69,9 +69,7 @@ public:
void setScalarBarVisible(bool bVisible); void setScalarBarVisible(bool bVisible);
/** @brief 设置平面比例网格显隐;偏好跨快照保留。 */ /** @brief 设置平面比例网格显隐;偏好跨快照保留。 */
void setScaleGridVisible(bool bVisible); void setScaleGridVisible(bool bVisible);
/** @brief 设置二维井位标记显隐;偏好跨快照保留。 */ /** @brief 设置二维井名及其引线显隐;偏好跨快照保留。 */
void setWellMarkersVisible(bool bVisible);
/** @brief 设置二维井名显隐;偏好跨快照保留。 */
void setWellNamesVisible(bool bVisible); void setWellNamesVisible(bool bVisible);
/** @brief 返回当前是否持有可用快照且稳定结果图层仍完整。 */ /** @brief 返回当前是否持有可用快照且稳定结果图层仍完整。 */
@ -111,9 +109,7 @@ public:
bool isScalarBarVisible() const; bool isScalarBarVisible() const;
/** @brief 返回比例网格显示偏好,不要求当前存在快照。 */ /** @brief 返回比例网格显示偏好,不要求当前存在快照。 */
bool isScaleGridVisible() const; bool isScaleGridVisible() const;
/** @brief 返回二维井位标记显示偏好。 */ /** @brief 返回二维井名及其引线显示偏好。 */
bool areWellMarkersVisible() const;
/** @brief 返回二维井名显示偏好。 */
bool areWellNamesVisible() const; bool areWellNamesVisible() const;
private: private:

@ -12,7 +12,7 @@ class nmPebiResultSnapshot;
class vtkPropAssembly; class vtkPropAssembly;
/** /**
* @brief 显示快照中全部二维井位和井名的业务图层。 * @brief 显示快照中全部二维井名和引线的业务图层。
* *
* 图层只读取快照冻结的 XY 和井名,不访问 DataManager,不伪造井深或轨迹。 * 图层只读取快照冻结的 XY 和井名,不访问 DataManager,不伪造井深或轨迹。
* 稳定根 Assembly 始终挂在 Scene 中;新快照通过候选子 Assembly 无失败交换。 * 稳定根 Assembly 始终挂在 Scene 中;新快照通过候选子 Assembly 无失败交换。
@ -27,7 +27,7 @@ public:
virtual ~nmPebiResultWellAnnotationLayer(); virtual ~nmPebiResultWellAnnotationLayer();
/** /**
* @brief 在未挂载候选对象中构造快照全部井位和井名。 * @brief 在未挂载候选对象中构造快照全部井名和二维引线。
* @note 失败时活动子 Assembly 完全不变;再次准备会丢弃旧候选。 * @note 失败时活动子 Assembly 完全不变;再次准备会丢弃旧候选。
*/ */
bool prepareCandidate( bool prepareCandidate(
@ -45,11 +45,8 @@ public:
/** @brief 返回活动快照是否已有完整井标注子树。 */ /** @brief 返回活动快照是否已有完整井标注子树。 */
bool hasActiveAnnotations() const; bool hasActiveAnnotations() const;
/** @brief 独立设置约 9px 的二维井位标记显隐。 */ /** @brief 统一设置二维井名及其引线显隐。 */
void setWellMarkersVisible(bool bVisible);
/** @brief 独立设置约 12px 的二维井名显隐。 */
void setWellNamesVisible(bool bVisible); void setWellNamesVisible(bool bVisible);
bool areWellMarkersVisible() const;
bool areWellNamesVisible() const; bool areWellNamesVisible() const;
private: private:
@ -57,13 +54,10 @@ private:
vtkSmartPointer<vtkPropAssembly> m_pRootAssembly; ///< Scene 挂载的稳定根。 vtkSmartPointer<vtkPropAssembly> m_pRootAssembly; ///< Scene 挂载的稳定根。
vtkSmartPointer<vtkPropAssembly> m_pActiveSnapshotAssembly; ///< 当前快照子树。 vtkSmartPointer<vtkPropAssembly> m_pActiveSnapshotAssembly; ///< 当前快照子树。
vtkSmartPointer<vtkPropAssembly> m_pActiveMarkerGroup; ///< 当前井位组。 vtkSmartPointer<vtkPropAssembly> m_pActiveAnnotationGroup; ///< 当前井名与引线组。
vtkSmartPointer<vtkPropAssembly> m_pActiveNameGroup; ///< 当前井名组。
vtkSmartPointer<vtkPropAssembly> m_pCandidateSnapshotAssembly; ///< 待提交子树。 vtkSmartPointer<vtkPropAssembly> m_pCandidateSnapshotAssembly; ///< 待提交子树。
vtkSmartPointer<vtkPropAssembly> m_pCandidateMarkerGroup; ///< 候选井位组。 vtkSmartPointer<vtkPropAssembly> m_pCandidateAnnotationGroup; ///< 候选井名与引线组。
vtkSmartPointer<vtkPropAssembly> m_pCandidateNameGroup; ///< 候选井名组。 bool m_bWellNamesVisible; ///< 跨快照保留的文字与引线显隐偏好。
bool m_bWellMarkersVisible; ///< 跨快照保留的井位显隐偏好。
bool m_bWellNamesVisible; ///< 跨快照保留的井名显隐偏好。
}; };
#endif // NMPEBIRESULTWELLANNOTATIONLAYER_H #endif // NMPEBIRESULTWELLANNOTATIONLAYER_H

@ -67,8 +67,6 @@ private slots:
void onScalarBarToggled(bool bVisible); void onScalarBarToggled(bool bVisible);
/** @brief 切换比例网格显隐。 */ /** @brief 切换比例网格显隐。 */
void onScaleGridToggled(bool bVisible); void onScaleGridToggled(bool bVisible);
/** @brief 切换二维井位标记显隐。 */
void onWellMarkersToggled(bool bVisible);
/** @brief 切换二维井名显隐。 */ /** @brief 切换二维井名显隐。 */
void onWellNamesToggled(bool bVisible); void onWellNamesToggled(bool bVisible);
@ -86,7 +84,7 @@ private:
const QSharedPointer<const nmPebiResultSnapshot>& pSnapshot, const QSharedPointer<const nmPebiResultSnapshot>& pSnapshot,
const QString& sSnapshotId, const QString& sSnapshotId,
bool bCurrent); bool bCurrent);
/** @brief 从 SceneController 镜像四个业务 QAction 的勾选和可用状态。 */ /** @brief 从 SceneController 镜像三个业务 QAction 的勾选和可用状态。 */
void synchronizeBusinessActions(); void synchronizeBusinessActions();
/** @brief 根据“绑定失败、过期、操作错误”的固定优先级刷新提示栏。 */ /** @brief 根据“绑定失败、过期、操作错误”的固定优先级刷新提示栏。 */
void refreshStatusBar(); void refreshStatusBar();
@ -102,7 +100,6 @@ private:
QAction* m_pScalarBarAction; ///< 色标显隐动作。 QAction* m_pScalarBarAction; ///< 色标显隐动作。
QAction* m_pScaleGridAction; ///< 比例网格显隐动作。 QAction* m_pScaleGridAction; ///< 比例网格显隐动作。
QAction* m_pWellMarkersAction; ///< 二维井位标记显隐动作。
QAction* m_pWellNamesAction; ///< 二维井名显隐动作。 QAction* m_pWellNamesAction; ///< 二维井名显隐动作。
/** @brief Manager 最近一次通知后观察到的快照强引用。 */ /** @brief Manager 最近一次通知后观察到的快照强引用。 */

@ -403,7 +403,6 @@ public:
m_bHasBounds(false), m_bHasBounds(false),
m_bScalarBarVisible(true), m_bScalarBarVisible(true),
m_bScaleGridVisible(false), m_bScaleGridVisible(false),
m_bWellMarkersVisible(true),
m_bWellNamesVisible(true) m_bWellNamesVisible(true)
{ {
m_dBusinessRange[0] = 0.0; m_dBusinessRange[0] = 0.0;
@ -598,7 +597,6 @@ public:
new nmPebiResultWellAnnotationLayer( new nmPebiResultWellAnnotationLayer(
QString::fromLatin1(RESULT_WELLS_LAYER_ID)); QString::fromLatin1(RESULT_WELLS_LAYER_ID));
pLayer->setVisible(false); pLayer->setVisible(false);
pLayer->setWellMarkersVisible(m_bWellMarkersVisible);
pLayer->setWellNamesVisible(m_bWellNamesVisible); pLayer->setWellNamesVisible(m_bWellNamesVisible);
if(!pScene->addLayer(pLayer)) { if(!pScene->addLayer(pLayer)) {
delete pLayer; delete pLayer;
@ -723,7 +721,6 @@ public:
bHasData && m_bScaleGridVisible); bHasData && m_bScaleGridVisible);
} }
if(m_pWellLayer != nullptr) { if(m_pWellLayer != nullptr) {
m_pWellLayer->setWellMarkersVisible(m_bWellMarkersVisible);
m_pWellLayer->setWellNamesVisible(m_bWellNamesVisible); m_pWellLayer->setWellNamesVisible(m_bWellNamesVisible);
m_pWellLayer->setVisible(bHasData); m_pWellLayer->setVisible(bHasData);
} }
@ -883,7 +880,6 @@ public:
bool m_bHasBounds; bool m_bHasBounds;
bool m_bScalarBarVisible; bool m_bScalarBarVisible;
bool m_bScaleGridVisible; bool m_bScaleGridVisible;
bool m_bWellMarkersVisible;
bool m_bWellNamesVisible; bool m_bWellNamesVisible;
}; };
@ -1348,25 +1344,6 @@ void nmPebiResultSceneController::setScaleGridVisible(bool bVisible)
} }
} }
void nmPebiResultSceneController::setWellMarkersVisible(bool bVisible)
{
Q_ASSERT(isResultSceneGuiThread());
if(!isResultSceneGuiThread() || m_pPrivate == nullptr) {
return;
}
m_pPrivate->discardActiveDataIfLayersLost();
if(m_pPrivate->m_bWellMarkersVisible == bVisible) {
return;
}
m_pPrivate->m_bWellMarkersVisible = bVisible;
if(m_pPrivate->m_pWellLayer != nullptr) {
m_pPrivate->m_pWellLayer->setWellMarkersVisible(bVisible);
}
if(hasSnapshot()) {
m_pPrivate->m_pContainer->renderView();
}
}
void nmPebiResultSceneController::setWellNamesVisible(bool bVisible) void nmPebiResultSceneController::setWellNamesVisible(bool bVisible)
{ {
Q_ASSERT(isResultSceneGuiThread()); Q_ASSERT(isResultSceneGuiThread());
@ -1506,11 +1483,6 @@ bool nmPebiResultSceneController::isScaleGridVisible() const
return m_pPrivate != nullptr && m_pPrivate->m_bScaleGridVisible; return m_pPrivate != nullptr && m_pPrivate->m_bScaleGridVisible;
} }
bool nmPebiResultSceneController::areWellMarkersVisible() const
{
return m_pPrivate != nullptr && m_pPrivate->m_bWellMarkersVisible;
}
bool nmPebiResultSceneController::areWellNamesVisible() const bool nmPebiResultSceneController::areWellNamesVisible() const
{ {
return m_pPrivate != nullptr && m_pPrivate->m_bWellNamesVisible; return m_pPrivate != nullptr && m_pPrivate->m_bWellNamesVisible;

@ -2,22 +2,18 @@
#include "nmPebiResultSnapshot.h" #include "nmPebiResultSnapshot.h"
#include <QByteArray>
#include <QCoreApplication> #include <QCoreApplication>
#include <QSet> #include <QSet>
#include <QThread> #include <QThread>
#include <vtkActor2D.h> #include <vtkActor2D.h>
#include <vtkCellArray.h>
#include <vtkCoordinate.h> #include <vtkCoordinate.h>
#include <vtkLabeledDataMapper.h> #include <vtkLeaderActor2D.h>
#include <vtkMath.h> #include <vtkMath.h>
#include <vtkPointData.h>
#include <vtkPoints.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper2D.h>
#include <vtkPropAssembly.h> #include <vtkPropAssembly.h>
#include <vtkProperty2D.h> #include <vtkProperty2D.h>
#include <vtkStringArray.h> #include <vtkTextMapper.h>
#include <vtkTextProperty.h> #include <vtkTextProperty.h>
namespace { namespace {
@ -29,6 +25,17 @@ bool isWellAnnotationGuiThread()
pApplication->thread() == QThread::currentThread(); pApplication->thread() == QThread::currentThread();
} }
// Saphir 风格标注使用固定像素偏移,缩放相机时文字和引线长度保持不变。
const int WELL_NAME_FONT_SIZE = 16;
const int WELL_NAME_OFFSET_X = 18;
const int WELL_NAME_OFFSET_Y = 40;
const int WELL_LEADER_OFFSET_X = 14;
const int WELL_LEADER_OFFSET_Y = 36;
const double WELL_LEADER_RED = 140.0 / 255.0;
const double WELL_LEADER_GREEN = 87.0 / 255.0;
const double WELL_LEADER_BLUE = 59.0 / 255.0;
} }
nmPebiResultWellAnnotationLayer::nmPebiResultWellAnnotationLayer( nmPebiResultWellAnnotationLayer::nmPebiResultWellAnnotationLayer(
@ -36,12 +43,9 @@ nmPebiResultWellAnnotationLayer::nmPebiResultWellAnnotationLayer(
: nmVTKRenderLayer(sLayerId), : nmVTKRenderLayer(sLayerId),
m_pRootAssembly(vtkSmartPointer<vtkPropAssembly>::New()), m_pRootAssembly(vtkSmartPointer<vtkPropAssembly>::New()),
m_pActiveSnapshotAssembly(nullptr), m_pActiveSnapshotAssembly(nullptr),
m_pActiveMarkerGroup(nullptr), m_pActiveAnnotationGroup(nullptr),
m_pActiveNameGroup(nullptr),
m_pCandidateSnapshotAssembly(nullptr), m_pCandidateSnapshotAssembly(nullptr),
m_pCandidateMarkerGroup(nullptr), m_pCandidateAnnotationGroup(nullptr),
m_pCandidateNameGroup(nullptr),
m_bWellMarkersVisible(true),
m_bWellNamesVisible(true) m_bWellNamesVisible(true)
{ {
Q_ASSERT(isWellAnnotationGuiThread()); Q_ASSERT(isWellAnnotationGuiThread());
@ -67,16 +71,6 @@ bool nmPebiResultWellAnnotationLayer::prepareCandidate(
return false; return false;
} }
vtkSmartPointer<vtkPoints> pMarkerPoints =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> pMarkerVertices =
vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPoints> pNamePoints =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkStringArray> pWellNames =
vtkSmartPointer<vtkStringArray>::New();
pWellNames->SetName("WellName");
QSet<QString> setWellIds; QSet<QString> setWellIds;
for(int nIndex = 0; nIndex < pSnapshot->getWellCount(); ++nIndex) { for(int nIndex = 0; nIndex < pSnapshot->getWellCount(); ++nIndex) {
const nmPebiResultWellSnapshot* pWell = pSnapshot->getWellAt(nIndex); const nmPebiResultWellSnapshot* pWell = pSnapshot->getWellAt(nIndex);
@ -89,90 +83,103 @@ bool nmPebiResultWellAnnotationLayer::prepareCandidate(
return false; return false;
} }
setWellIds.insert(pWell->m_sWellInstanceId); setWellIds.insert(pWell->m_sWellInstanceId);
// 保持快照存储顺序;二维 Overlay 不向业务位置写入虚构 Z 值。
const vtkIdType nPointId = pMarkerPoints->InsertNextPoint(
pWell->m_oLocation.x(), pWell->m_oLocation.y(), 0.0);
pMarkerVertices->InsertNextCell(1);
pMarkerVertices->InsertCellPoint(nPointId);
pNamePoints->InsertNextPoint(
pWell->m_oLocation.x(), pWell->m_oLocation.y(), 0.0);
const QByteArray aWellName = pWell->m_sWellName.toUtf8();
pWellNames->InsertNextValue(aWellName.constData());
} }
vtkSmartPointer<vtkPropAssembly> pSnapshotAssembly = vtkSmartPointer<vtkPropAssembly> pSnapshotAssembly =
vtkSmartPointer<vtkPropAssembly>::New(); vtkSmartPointer<vtkPropAssembly>::New();
vtkSmartPointer<vtkPropAssembly> pMarkerGroup = vtkSmartPointer<vtkPropAssembly> pAnnotationGroup =
vtkSmartPointer<vtkPropAssembly>::New();
vtkSmartPointer<vtkPropAssembly> pNameGroup =
vtkSmartPointer<vtkPropAssembly>::New(); vtkSmartPointer<vtkPropAssembly>::New();
if(pSnapshot->getWellCount() > 0) { if(pSnapshot->getWellCount() > 0) {
vtkSmartPointer<vtkPolyData> pMarkerData = for(int nIndex = 0; nIndex < pSnapshot->getWellCount(); ++nIndex) {
vtkSmartPointer<vtkPolyData>::New(); const nmPebiResultWellSnapshot* pWell =
pMarkerData->SetPoints(pMarkerPoints); pSnapshot->getWellAt(nIndex);
pMarkerData->SetVerts(pMarkerVertices); vtkSmartPointer<vtkCoordinate> pWorldAnchor =
vtkSmartPointer<vtkCoordinate>::New();
vtkSmartPointer<vtkCoordinate> pWorldCoordinate = // Z=0 仅表示冻结 XY 所在平面,不表示井深、井斜或井轨迹。
vtkSmartPointer<vtkCoordinate>::New(); pWorldAnchor->SetCoordinateSystemToWorld();
pWorldCoordinate->SetCoordinateSystemToWorld(); pWorldAnchor->SetValue(
vtkSmartPointer<vtkPolyDataMapper2D> pMarkerMapper = pWell->m_oLocation.x(),
vtkSmartPointer<vtkPolyDataMapper2D>::New(); pWell->m_oLocation.y(), 0.0);
pMarkerMapper->SetInputData(pMarkerData);
pMarkerMapper->SetTransformCoordinate(pWorldCoordinate); vtkSmartPointer<vtkPropAssembly> pWellAnnotation =
pMarkerMapper->ScalarVisibilityOff(); vtkSmartPointer<vtkPropAssembly>::New();
vtkSmartPointer<vtkLeaderActor2D> pLeader =
vtkSmartPointer<vtkActor2D> pMarkerActor = vtkSmartPointer<vtkLeaderActor2D>::New();
vtkSmartPointer<vtkActor2D>::New();
pMarkerActor->SetMapper(pMarkerMapper); // 引线两个端点都引用同一 World 锚点,只叠加固定 Display 像素偏移。
pMarkerActor->GetProperty()->SetColor(0.12, 0.12, 0.12); vtkCoordinate* pStartCoordinate =
pMarkerActor->GetProperty()->SetPointSize(9.0); pLeader->GetPositionCoordinate();
pMarkerGroup->AddPart(pMarkerActor); pStartCoordinate->SetCoordinateSystemToDisplay();
pStartCoordinate->SetReferenceCoordinate(pWorldAnchor);
vtkSmartPointer<vtkPolyData> pNameData = pStartCoordinate->SetValue(0.0, 0.0, 0.0);
vtkSmartPointer<vtkPolyData>::New(); vtkCoordinate* pEndCoordinate =
pNameData->SetPoints(pNamePoints); pLeader->GetPosition2Coordinate();
pNameData->GetPointData()->AddArray(pWellNames); pEndCoordinate->SetCoordinateSystemToDisplay();
vtkSmartPointer<vtkLabeledDataMapper> pNameMapper = pEndCoordinate->SetReferenceCoordinate(pWorldAnchor);
vtkSmartPointer<vtkLabeledDataMapper>::New(); pEndCoordinate->SetValue(
pNameMapper->SetInputData(pNameData); WELL_LEADER_OFFSET_X, WELL_LEADER_OFFSET_Y, 0.0);
pNameMapper->SetLabelModeToLabelFieldData();
pNameMapper->SetFieldDataName("WellName"); pLeader->AutoLabelOff();
pNameMapper->SetLabelFormat("%s"); pLeader->SetLabel("");
pNameMapper->GetLabelTextProperty()->SetFontSize(12); pLeader->SetArrowPlacementToNone();
pNameMapper->GetLabelTextProperty()->SetColor(0.10, 0.10, 0.10); pLeader->SetRadius(0.0);
pNameMapper->GetLabelTextProperty()->BoldOff(); pLeader->GetProperty()->SetColor(
pNameMapper->GetLabelTextProperty()->ItalicOff(); WELL_LEADER_RED,
pNameMapper->GetLabelTextProperty()->ShadowOff(); WELL_LEADER_GREEN,
pNameMapper->GetLabelTextProperty()->SetJustificationToLeft(); WELL_LEADER_BLUE);
pNameMapper->GetLabelTextProperty()->SetVerticalJustificationToBottom(); pLeader->GetProperty()->SetLineWidth(1.0);
// 二维引线始终绘制在三维网格前方,避免被致密单元边线遮挡。
vtkSmartPointer<vtkActor2D> pNameActor = pLeader->GetProperty()->SetDisplayLocationToForeground();
vtkSmartPointer<vtkActor2D>::New(); pWellAnnotation->AddPart(pLeader);
pNameActor->SetMapper(pNameMapper);
// Actor2D 的显示坐标偏移固定为像素,不随相机缩放改变。 vtkSmartPointer<vtkTextMapper> pNameMapper =
pNameActor->SetDisplayPosition(7, 6); vtkSmartPointer<vtkTextMapper>::New();
pNameGroup->AddPart(pNameActor); const QByteArray aWellName = pWell->m_sWellName.toUtf8();
pNameMapper->SetInput(aWellName.constData());
vtkTextProperty* pTextProperty =
pNameMapper->GetTextProperty();
pTextProperty->SetFontFamilyToArial();
pTextProperty->SetFontSize(WELL_NAME_FONT_SIZE);
pTextProperty->SetColor(1.0, 1.0, 0.0);
pTextProperty->BoldOff();
pTextProperty->ItalicOff();
pTextProperty->ShadowOn();
pTextProperty->SetShadowOffset(1, -1);
pTextProperty->SetJustificationToLeft();
pTextProperty->SetVerticalJustificationToBottom();
vtkSmartPointer<vtkActor2D> pNameActor =
vtkSmartPointer<vtkActor2D>::New();
pNameActor->SetMapper(pNameMapper);
// 井名与引线使用相同的前景层级,保证顶视图下仍清晰可读。
pNameActor->GetProperty()->SetDisplayLocationToForeground();
vtkCoordinate* pNameCoordinate =
pNameActor->GetPositionCoordinate();
pNameCoordinate->SetCoordinateSystemToDisplay();
pNameCoordinate->SetReferenceCoordinate(pWorldAnchor);
pNameCoordinate->SetValue(
WELL_NAME_OFFSET_X, WELL_NAME_OFFSET_Y, 0.0);
pWellAnnotation->AddPart(pNameActor);
// 每口井的文字与引线形成一个不可拆分的候选注记单元。
pAnnotationGroup->AddPart(pWellAnnotation);
}
} }
pMarkerGroup->SetVisibility(m_bWellMarkersVisible ? 1 : 0); pAnnotationGroup->SetVisibility(m_bWellNamesVisible ? 1 : 0);
pNameGroup->SetVisibility(m_bWellNamesVisible ? 1 : 0); pSnapshotAssembly->AddPart(pAnnotationGroup);
pSnapshotAssembly->AddPart(pMarkerGroup);
pSnapshotAssembly->AddPart(pNameGroup);
// 所有校验和 VTK 对象构造成功后才记录候选;活动子树仍未触碰。 // 所有校验和 VTK 对象构造成功后才记录候选;活动子树仍未触碰。
m_pCandidateSnapshotAssembly = pSnapshotAssembly; m_pCandidateSnapshotAssembly = pSnapshotAssembly;
m_pCandidateMarkerGroup = pMarkerGroup; m_pCandidateAnnotationGroup = pAnnotationGroup;
m_pCandidateNameGroup = pNameGroup;
return true; return true;
} }
void nmPebiResultWellAnnotationLayer::discardCandidate() void nmPebiResultWellAnnotationLayer::discardCandidate()
{ {
Q_ASSERT(isWellAnnotationGuiThread()); Q_ASSERT(isWellAnnotationGuiThread());
m_pCandidateNameGroup = nullptr; m_pCandidateAnnotationGroup = nullptr;
m_pCandidateMarkerGroup = nullptr;
m_pCandidateSnapshotAssembly = nullptr; m_pCandidateSnapshotAssembly = nullptr;
} }
@ -185,8 +192,7 @@ void nmPebiResultWellAnnotationLayer::commitCandidate()
m_pRootAssembly->RemovePart(m_pActiveSnapshotAssembly); m_pRootAssembly->RemovePart(m_pActiveSnapshotAssembly);
} }
m_pActiveSnapshotAssembly = m_pCandidateSnapshotAssembly; m_pActiveSnapshotAssembly = m_pCandidateSnapshotAssembly;
m_pActiveMarkerGroup = m_pCandidateMarkerGroup; m_pActiveAnnotationGroup = m_pCandidateAnnotationGroup;
m_pActiveNameGroup = m_pCandidateNameGroup;
m_pRootAssembly->AddPart(m_pActiveSnapshotAssembly); m_pRootAssembly->AddPart(m_pActiveSnapshotAssembly);
discardCandidate(); discardCandidate();
} }
@ -199,8 +205,7 @@ void nmPebiResultWellAnnotationLayer::clear()
m_pActiveSnapshotAssembly != nullptr) { m_pActiveSnapshotAssembly != nullptr) {
m_pRootAssembly->RemovePart(m_pActiveSnapshotAssembly); m_pRootAssembly->RemovePart(m_pActiveSnapshotAssembly);
} }
m_pActiveNameGroup = nullptr; m_pActiveAnnotationGroup = nullptr;
m_pActiveMarkerGroup = nullptr;
m_pActiveSnapshotAssembly = nullptr; m_pActiveSnapshotAssembly = nullptr;
} }
@ -209,21 +214,6 @@ bool nmPebiResultWellAnnotationLayer::hasActiveAnnotations() const
return m_pActiveSnapshotAssembly != nullptr; return m_pActiveSnapshotAssembly != nullptr;
} }
void nmPebiResultWellAnnotationLayer::setWellMarkersVisible(bool bVisible)
{
Q_ASSERT(isWellAnnotationGuiThread());
if(!isWellAnnotationGuiThread()) {
return;
}
m_bWellMarkersVisible = bVisible;
if(m_pActiveMarkerGroup != nullptr) {
m_pActiveMarkerGroup->SetVisibility(bVisible ? 1 : 0);
}
if(m_pCandidateMarkerGroup != nullptr) {
m_pCandidateMarkerGroup->SetVisibility(bVisible ? 1 : 0);
}
}
void nmPebiResultWellAnnotationLayer::setWellNamesVisible(bool bVisible) void nmPebiResultWellAnnotationLayer::setWellNamesVisible(bool bVisible)
{ {
Q_ASSERT(isWellAnnotationGuiThread()); Q_ASSERT(isWellAnnotationGuiThread());
@ -231,19 +221,14 @@ void nmPebiResultWellAnnotationLayer::setWellNamesVisible(bool bVisible)
return; return;
} }
m_bWellNamesVisible = bVisible; m_bWellNamesVisible = bVisible;
if(m_pActiveNameGroup != nullptr) { if(m_pActiveAnnotationGroup != nullptr) {
m_pActiveNameGroup->SetVisibility(bVisible ? 1 : 0); m_pActiveAnnotationGroup->SetVisibility(bVisible ? 1 : 0);
} }
if(m_pCandidateNameGroup != nullptr) { if(m_pCandidateAnnotationGroup != nullptr) {
m_pCandidateNameGroup->SetVisibility(bVisible ? 1 : 0); m_pCandidateAnnotationGroup->SetVisibility(bVisible ? 1 : 0);
} }
} }
bool nmPebiResultWellAnnotationLayer::areWellMarkersVisible() const
{
return m_bWellMarkersVisible;
}
bool nmPebiResultWellAnnotationLayer::areWellNamesVisible() const bool nmPebiResultWellAnnotationLayer::areWellNamesVisible() const
{ {
return m_bWellNamesVisible; return m_bWellNamesVisible;

@ -58,7 +58,6 @@ nmWxPebiResultViewWidget::nmWxPebiResultViewWidget(
m_pStatusLabel(nullptr), m_pStatusLabel(nullptr),
m_pScalarBarAction(nullptr), m_pScalarBarAction(nullptr),
m_pScaleGridAction(nullptr), m_pScaleGridAction(nullptr),
m_pWellMarkersAction(nullptr),
m_pWellNamesAction(nullptr), m_pWellNamesAction(nullptr),
m_bObservedSnapshotCurrent(false), m_bObservedSnapshotCurrent(false),
m_bObservedStateValid(false), m_bObservedStateValid(false),
@ -173,7 +172,6 @@ void nmWxPebiResultViewWidget::appendContextMenuActions(QMenu* pMenu)
} }
pMenu->addAction(m_pScalarBarAction); pMenu->addAction(m_pScalarBarAction);
pMenu->addAction(m_pScaleGridAction); pMenu->addAction(m_pScaleGridAction);
pMenu->addAction(m_pWellMarkersAction);
pMenu->addAction(m_pWellNamesAction); pMenu->addAction(m_pWellNamesAction);
} }
@ -213,13 +211,6 @@ void nmWxPebiResultViewWidget::onScaleGridToggled(bool bVisible)
} }
} }
void nmWxPebiResultViewWidget::onWellMarkersToggled(bool bVisible)
{
if(m_pSceneController != nullptr && m_pSceneController->hasSnapshot()) {
m_pSceneController->setWellMarkersVisible(bVisible);
}
}
void nmWxPebiResultViewWidget::onWellNamesToggled(bool bVisible) void nmWxPebiResultViewWidget::onWellNamesToggled(bool bVisible)
{ {
if(m_pSceneController != nullptr && m_pSceneController->hasSnapshot()) { if(m_pSceneController != nullptr && m_pSceneController->hasSnapshot()) {
@ -269,18 +260,14 @@ void nmWxPebiResultViewWidget::createUi()
m_pScaleGridAction = new QAction( m_pScaleGridAction = new QAction(
QIcon(resultViewIconPath("NmScaleGrid.png")), QIcon(resultViewIconPath("NmScaleGrid.png")),
tr("Scale Grid"), this); tr("Scale Grid"), this);
m_pWellMarkersAction = new QAction(
QIcon(resultViewIconPath("NmWell.png")),
tr("Well Markers"), this);
m_pWellNamesAction = new QAction( m_pWellNamesAction = new QAction(
QIcon(resultViewIconPath("NmShow.png")), QIcon(resultViewIconPath("NmShow.png")),
tr("Well Names"), this); tr("Well Names"), this);
QAction* const pBusinessActions[] = { QAction* const pBusinessActions[] = {
m_pScalarBarAction, m_pScaleGridAction, m_pScalarBarAction, m_pScaleGridAction, m_pWellNamesAction
m_pWellMarkersAction, m_pWellNamesAction
}; };
for(int nIndex = 0; nIndex < 4; ++nIndex) { for(int nIndex = 0; nIndex < 3; ++nIndex) {
pBusinessActions[nIndex]->setCheckable(true); pBusinessActions[nIndex]->setCheckable(true);
pBusinessActions[nIndex]->setToolTip( pBusinessActions[nIndex]->setToolTip(
pBusinessActions[nIndex]->text()); pBusinessActions[nIndex]->text());
@ -312,7 +299,7 @@ void nmWxPebiResultViewWidget::createUi()
if(pFrontAction != nullptr) m_pToolBar->addAction(pFrontAction); if(pFrontAction != nullptr) m_pToolBar->addAction(pFrontAction);
if(pPickCenterAction != nullptr) m_pToolBar->addAction(pPickCenterAction); if(pPickCenterAction != nullptr) m_pToolBar->addAction(pPickCenterAction);
m_pToolBar->addSeparator(); m_pToolBar->addSeparator();
for(int nIndex = 0; nIndex < 4; ++nIndex) { for(int nIndex = 0; nIndex < 3; ++nIndex) {
m_pToolBar->addAction(pBusinessActions[nIndex]); m_pToolBar->addAction(pBusinessActions[nIndex]);
} }
m_pToolBar->addSeparator(); m_pToolBar->addSeparator();
@ -323,8 +310,6 @@ void nmWxPebiResultViewWidget::createUi()
this, SLOT(onScalarBarToggled(bool))); this, SLOT(onScalarBarToggled(bool)));
connect(m_pScaleGridAction, SIGNAL(toggled(bool)), connect(m_pScaleGridAction, SIGNAL(toggled(bool)),
this, SLOT(onScaleGridToggled(bool))); this, SLOT(onScaleGridToggled(bool)));
connect(m_pWellMarkersAction, SIGNAL(toggled(bool)),
this, SLOT(onWellMarkersToggled(bool)));
connect(m_pWellNamesAction, SIGNAL(toggled(bool)), connect(m_pWellNamesAction, SIGNAL(toggled(bool)),
this, SLOT(onWellNamesToggled(bool))); this, SLOT(onWellNamesToggled(bool)));
connect(m_pRenderContainer, SIGNAL(contextMenuAboutToShow(QMenu*)), connect(m_pRenderContainer, SIGNAL(contextMenuAboutToShow(QMenu*)),
@ -484,15 +469,12 @@ void nmWxPebiResultViewWidget::synchronizeBusinessActions()
m_pScalarBarAction, m_pSceneController->isScalarBarVisible()); m_pScalarBarAction, m_pSceneController->isScalarBarVisible());
setActionCheckedWithoutSignal( setActionCheckedWithoutSignal(
m_pScaleGridAction, m_pSceneController->isScaleGridVisible()); m_pScaleGridAction, m_pSceneController->isScaleGridVisible());
setActionCheckedWithoutSignal(
m_pWellMarkersAction, m_pSceneController->areWellMarkersVisible());
setActionCheckedWithoutSignal( setActionCheckedWithoutSignal(
m_pWellNamesAction, m_pSceneController->areWellNamesVisible()); m_pWellNamesAction, m_pSceneController->areWellNamesVisible());
const bool bEnabled = m_pSceneController->hasSnapshot(); const bool bEnabled = m_pSceneController->hasSnapshot();
m_pScalarBarAction->setEnabled(bEnabled); m_pScalarBarAction->setEnabled(bEnabled);
m_pScaleGridAction->setEnabled(bEnabled); m_pScaleGridAction->setEnabled(bEnabled);
m_pWellMarkersAction->setEnabled(bEnabled);
m_pWellNamesAction->setEnabled(bEnabled); m_pWellNamesAction->setEnabled(bEnabled);
} }

Loading…
Cancel
Save