[vtkusers] mouse interaction with vtkImagePlaneWidget
Dean Inglis
dean.inglis at sympatico.ca
Tue Jul 7 07:38:45 EDT 2009
Hi Greg,
vtkImagePlaneWidget translates those events into start/end/interaction
events or start/end/reset/windowlevel events. You could try to add your
observer to
the renderer's/widget's interactor:
widget->GetInteractor()->AddObserver(
vtkCommand::LeftButtonPressEvent, my_command, priority );
where priority is set to 1. By default, the priority of classes
inherited from vtk3DWidget is 0.5, so setting your command with
a higher priority will work. Adding the event to the interactor
will receive all left button down clicks, not just those that
occur over the image plane widget.
Dean
Software Demos:
http://www.youtube.com/watch?v=iVmMdUc1gM8
http://www.youtube.com/watch?v=_zYNtHC9-0s
I'm trying to intercept mouse clicks on the vtkImagePlaneWidget, but I'm not
having much luck. I've created an observer and I've put some code in the
Execute function which should catch the mouse events.
Here is the code for creating the observer:
ObserverMousePicker *observeMousePick =
ObserverMousePicker::New(planeWidgetX, planeWidgetY, planeWidgetZ, points,
poly, polyMapper, polyActor, conn, ren1, vtkWindow);
planeWidgetX->AddObserver(vtkCommand::InteractionEvent,
observeMousePick);
Inside the observer, I try to check for particular mouse events, like
leftmousedown, leftmouseup, etc:
void ObserverMousePicker::Execute(vtkObject *caller, unsigned long event,
void*)
{
if ( event == vtkCommand::LeftButtonReleaseEvent )
{
/* do something */
The problem is that the mouse button events never reach my observer...
certain events work, like mousemove, but not mouse clicks, which seem to be
the events caught by the imageplanewidget itself. How can I catch these
mouse button events in my observer?
More information about the vtkusers
mailing list