|
|
#ifndef NMPEBIRESULTSCENECONTROLLER_H
|
|
|
#define NMPEBIRESULTSCENECONTROLLER_H
|
|
|
|
|
|
#include "nmSubWxs_global.h"
|
|
|
|
|
|
#include <QSharedPointer>
|
|
|
#include <QString>
|
|
|
#include <QStringList>
|
|
|
|
|
|
class nmPebiResultSceneControllerPrivate;
|
|
|
class nmPebiResultSnapshot;
|
|
|
class nmWxVTKRenderContainerWidget;
|
|
|
|
|
|
/**
|
|
|
* @brief 将不可变 PEBI 结果快照组合为独立的通用 VTK 场景。
|
|
|
*
|
|
|
* Scene 拥有 Mesh、ScalarBar 和平面比例网格图层;控制器独占活动
|
|
|
* RenderAdapter 和快照强引用,并通过稳定 ID 校验所观察的图层身份。
|
|
|
* 外部提前清空业务 Scene 时,控制器会丢弃活动结果而不会解引用旧图层。
|
|
|
*/
|
|
|
class NM_SUB_WXS_EXPORT nmPebiResultSceneController
|
|
|
{
|
|
|
public:
|
|
|
/**
|
|
|
* @param pContainer 非所有权指针,必须比控制器生命周期更长。
|
|
|
* @note 析构会从业务 Scene 移除本控制器创建的稳定 ID 图层。
|
|
|
*/
|
|
|
explicit nmPebiResultSceneController(
|
|
|
nmWxVTKRenderContainerWidget* pContainer);
|
|
|
~nmPebiResultSceneController();
|
|
|
|
|
|
/**
|
|
|
* @brief 事务式绑定新快照,成功后恢复顶视图、适配网格并渲染一次。
|
|
|
* @note 候选初始化失败时保留当前 Adapter、画面、范围和相机状态;
|
|
|
* 若发现 Scene 已由外部清空,则采用一致的无快照状态。
|
|
|
*/
|
|
|
bool setSnapshot(
|
|
|
const QSharedPointer<const nmPebiResultSnapshot>& pSnapshot,
|
|
|
QString* pError = nullptr);
|
|
|
/** @brief 解除管线和快照引用并隐藏结果图层,不销毁 Scene。 */
|
|
|
void clear();
|
|
|
|
|
|
/**
|
|
|
* @brief 原子切换同一快照内的属性和帧,成功时仅渲染一次。
|
|
|
* @note 静态属性只接受帧 0;失败时恢复 Adapter、Mapper 和范围。
|
|
|
*/
|
|
|
bool applyPropertyFrame(const QString& sPropertyId,
|
|
|
int nFrameIndex,
|
|
|
QString* pError = nullptr);
|
|
|
|
|
|
/** 以下显示设置会作为偏好保留,并在存在活动快照时渲染一次。 */
|
|
|
void setMeshVisible(bool bVisible);
|
|
|
void setScalarBarVisible(bool bVisible);
|
|
|
void setScaleGridVisible(bool bVisible);
|
|
|
void setCellEdgesVisible(bool bVisible);
|
|
|
|
|
|
bool hasSnapshot() const;
|
|
|
QString getCurrentSnapshotId() const;
|
|
|
QStringList getAvailablePropertyIds() const;
|
|
|
QString getCurrentPropertyId() const;
|
|
|
int getCurrentFrameIndex() const;
|
|
|
/** @brief 返回快照中的业务范围;常量属性保持 [c,c]。 */
|
|
|
bool getCurrentPropertyRange(double dRange[2]) const;
|
|
|
bool isMeshVisible() const;
|
|
|
bool isScalarBarVisible() const;
|
|
|
bool isScaleGridVisible() const;
|
|
|
bool areCellEdgesVisible() const;
|
|
|
|
|
|
private:
|
|
|
Q_DISABLE_COPY(nmPebiResultSceneController)
|
|
|
|
|
|
nmPebiResultSceneControllerPrivate* m_pPrivate; ///< 独占实现对象。
|
|
|
};
|
|
|
|
|
|
#endif // NMPEBIRESULTSCENECONTROLLER_H
|