vtk自定义相机操作方式

1.头文件

#ifndef CCAMERASTYLE_H
#define CCAMERASTYLE_H

#include 
#include 

class CCameraStyle : public vtkInteractorStyleTrackballCamera
{
public:
    static CCameraStyle* New();
    vtkTypeMacro(CCameraStyle, vtkInteractorStyleTrackballCamera);

    // 将鼠标右键改为平移图像
    virtual void OnRightButtonDown(void) override;
    virtual void OnRightButtonUp(void) override;
    virtual void OnMouseMove(void) override;
};

#endif // CCAMERASTYLE_H

2.源文件

#include "ccamerastyle.h"

vtkStandardNewMacro(CCameraStyle);

void CCameraStyle::OnRightButtonDown()
{
    vtkInteractorStyleTrackballCamera::OnMiddleButtonDown();
}

void CCameraStyle::OnRightButtonUp()
{
    vtkInteractorStyleTrackballCamera::OnMiddleButtonUp();
}

void CCameraStyle::OnMouseMove()
{
    vtkInteractorStyleTrackballCamera::OnMouseMove();
}

你可能感兴趣的:(vtk自定义相机操作方式)