You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nmWTAI-Platform/Include/nmNum/nmRender/nmVTKInteractionManager.h

55 lines
2.1 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef NMVTKINTERACTIONMANAGER_H
#define NMVTKINTERACTIONMANAGER_H
#include "nmRender_global.h"
#include <vtkSmartPointer.h>
class vtkInteractorStyleTrackballCamera;
class vtkInteractorStyle;
class vtkRenderWindowInteractor;
/**
* @brief 管理一个 Interactor 的默认 TrackballCamera 交互样式。
*
* 本阶段只定义单一活动交互模式的绑定和解除边界,不包含拾取或轮廓工具。
*/
class NM_RENDER_EXPORT nmVTKInteractionManager
{
public:
/** @brief 创建当前实例独占的默认 TrackballCamera 样式。 */
nmVTKInteractionManager();
/** @brief 先解除 InteractorStyle再释放默认样式。 */
~nmVTKInteractionManager();
/** @brief 绑定非所有权 Interactor并立即安装默认样式。 */
bool bindInteractor(vtkRenderWindowInteractor* pInteractor);
/**
* @brief 安装并持有一个活动交互样式;传入对象通过 VTK 引用计数共享。
* @return Interactor 和样式均有效时返回 true。
*/
bool installInteractionStyle(vtkInteractorStyle* pStyle);
/** @brief 将当前 Interactor 恢复为默认 TrackballCamera 样式。 */
bool restoreDefaultInteraction();
/** @brief 清除活动 InteractorStyle但保留 Interactor 绑定。 */
void clearInteractionStyle();
/** @brief 清除当前 InteractorStyle 并解除 Interactor。 */
void unbindInteractor();
/** @brief 返回当前绑定的 Interactor 非所有权指针。 */
vtkRenderWindowInteractor* getInteractor() const;
/** @brief 返回管理器持有的默认样式非所有权指针。 */
vtkInteractorStyleTrackballCamera* getDefaultStyle() const;
/** @brief 返回当前活动样式的非所有权指针;未安装时返回 nullptr。 */
vtkInteractorStyle* getActiveStyle() const;
private:
Q_DISABLE_COPY(nmVTKInteractionManager)
vtkRenderWindowInteractor* m_pInteractor; ///< 非所有权指针。
vtkSmartPointer<vtkInteractorStyleTrackballCamera> m_pDefaultStyle; ///< 当前实例独占。
vtkSmartPointer<vtkInteractorStyle> m_pActiveStyle; ///< 保持当前活动样式的 VTK 引用。
};
#endif // NMVTKINTERACTIONMANAGER_H