[vtkusers] which classes can use "AddObserver" work in addition to vtkInteractorObserver and its subclasses

Bryn Lloyd lloyd at itis.ethz.ch
Wed Oct 19 05:24:05 EDT 2011


Hi

 

Your observer does not receive any interaction events. This is because
certain events are only invoked by a specific type of object.

In your case the interactor obtains all the GUI mouse/key interaction events
(e.g. from your GUI, for instance MFC, Qt, etc.).

 

The interactor then emits/invokes vtk events, which you can catch with your
observer.

 

If you look inside vtkActor (or similar), you will most likely NOT find a
call to InvokeEvent(vtkCommand::RightButtonPressEvent, .). InvokeEvent is a
member of vtkObject, and part of the observer design pattern used.

 

Cheers

Bryn

 

 

 

 

 

 

 

 

 

From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf
Of Phoenix Chen
Sent: Wednesday, October 19, 2011 2:44 AM
To: vtkusers at vtk.org
Subject: [vtkusers] which classes can use "AddObserver" work in addition to
vtkInteractorObserver and its subclasses

 

the AddObserver is member function of vtkObject, however when I try to do:

spherePickTestActor->AddObserver(vtkCommand::RightButtonPressEvent,interacto
rCallBack);

spherePickTestActor->AddObserver(vtkCommand::RightButtonReleaseEvent,
interactorCallBack);

it does not work, I can only make callback of "vtkRenderWindowInteractor"
and "vtkInteractorObserver and its subclasses" successfully worked,
something like:

renWinInteractor->AddObserver(vtkCommand::RightButtonPressEvent,
interactorCallBack);

is it the nature of the design or did I do anything wrong?  Please help and
thanks a lot!


Truly,


Phoenix

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111019/324017d1/attachment.htm>


More information about the vtkusers mailing list