[vtkusers] vtkInteractorStyle overrides fail to fire!

Nikhil Sharma pingnikhil at yahoo.com
Wed Oct 4 01:19:08 EDT 2006


Good to know that I'm not alone, then!
 
Now, I gave the problem some more thought since I my earlier post.  Looks to me a class design flaw in VTK.  Here's why.
 
Though the user is free to override vtkInteractorStyle and pass it polymorphically to vtkRenderWindowInteractor::SetInteractorStyle(), the argument would most likely be internally cached as vtkInteractorObserver (the base class). Which means, the callback mechanism cannot and will not know about vtkInteractorStyle (or, the derived class') members (and their overrides). 
 
It's quite possible that VTK may have a workaround for this, making it not so much of a flaw!  In which case, would any of the VTK veterans / power-users please suggest a better/alternate (set of) class(es) to accomplish what I'm trying to... ?
 
I'm trying to:
  1. plug in my own event handlers into VTK, and
  2. have the ability to conditionally use (or not use) base class' (or the default) version of the event handlers.
 
Regards,
-Nikhil.
 
-----Original Message-----
From: vtkusers-bounces+pingnikhil=yahoo.com at vtk.org [mailto:vtkusers-bounces+pingnikhil=yahoo.com at vtk.org]On Behalf Of Harry Simons
Sent: Wednesday, October 04, 2006 9:01 a
To: vtkusers at vtk.org
Subject: RE: [vtkusers] vtkInteractorStyle overrides fail to fire!


Yep, me too.  Frustrated, gave up on this one   eventually.

> 
> Hello,
> 
> I'm trying to   implement custom mouse event handling for my 2D (image
> actor) as   follows. The image slice shows up fine but my event override 
> fails to   fire! Anything I'm missing?
> 
> Regards,
> A VTK   Newbie.
> 
> 
> class MyInteractorStyle extends   vtkInteractorStyle {
>     public void   OnLeftButtonDown() {
>           System.out.println("left button pressed");
>       }
> }
> 
> // ...
> myIS = new   MyInteractorStyle();
> rwi = new vtkRenderWindowInteractor();
>   rwi.SetInteractorStyle (myIS);
> 
> // ...
>   rwi.SetRenderWindow(renderWindow);
> renderWindow.Render();
>   rwi.Start();
> 


 		
---------------------------------
Do you Yahoo!?
 Get on board. You're invited to try the new Yahoo! Mail.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061003/97a37cbc/attachment.htm>


More information about the vtkusers mailing list