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

#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