[vtkusers] vtkInteractorStyle : inherit from two vtkInteractorStyle
David Doria
daviddoria at gmail.com
Wed Mar 23 13:12:05 EDT 2011
On Wed, Mar 23, 2011 at 1:04 PM, nsarrasin <nsarrasin at phenix-systems.com> wrote:
> hi all,
>
> I am building my own vtkInteractorStyle for my vtkRenderWindow.
>
> I have first inherited from vtkInteractorStyleTrackballActor to be able to
> rotate each actor independently.
> Then I call Spin() instead of Rotate() to constrain the rotation to be in
> the plane view.
>
> Here is my working code :
>
> class myInteractor : public vtkInteractorStyleTrackballActor
> {
> public:
>
> static myInteractor * New();
> vtkTypeRevisionMacro(myInteractor , vtkInteractorStyleTrackballActor);
>
> myInteractor () :
> {
> }
>
> virtual void Rotate()
> {
> vtkInteractorStyleTrackballActor::Spin();
> }
> };
> vtkCxxRevisionMacro(myInteractor , "$Revision: 1.1 $");
> vtkStandardNewMacro(myInteractor );
>
> Now I would like to add a "Zoom all the actor together" function.
> This function doesn't exist in vtkInteractorStyleTrackballActor (where it is
> "Zoom one actor at time") but in other style like
> vtkInteractorStyleTrackballCamera for example.
>
> So I was thinking of inheriting from a second InteractorStyle but I don't
> know how to proceed with vtkTypeRevisionMacro which only takes two
> arguments.
>
> How can I manage my problem ?
> Maybe it's not the right way to do ?
>
> Thanks by advance for reading/helping me.
>
> Nicolas.
I believe it is no-no to use multiple inheritance in VTK. Can you just
call the functions manually in your custom interactor style? I.e. why
does it need to be inherited?
David
More information about the vtkusers
mailing list