[vtkusers] Question about vtkInteractorStyleUser

Elvis Stansvik elvis.stansvik at orexplore.com
Thu Feb 25 05:13:54 EST 2016


2016-02-25 11:02 GMT+01:00 Elvis Stansvik <elvis.stansvik at orexplore.com>:

> Hi,
>
> I found this old thread about vtkInteractorStyleUser:
>
>     http://www.vtk.org/pipermail/vtkusers/2010-September/062584.html
>
> In it, David Gobbi explained:
>
> > The vtkInteractorStyleUser is still the correct way to write a fully
> > customized vtkInteractorStyle in the wrapper languages.  It isn't the
> > only option, i.e. you can add observers to the other interactor
> > styles, but it is different from the rest because it doesn't define
> > any "default" interaction of its own.
>
> Is this still true?
>
> In my case, I have a large, roughly cylindrical volume (tomography of a
> drill core), where the camera should only ever see the cylinder from the
> side, with the line of sight perpendicular to the center line of the core.
> Rotation of the camera should also be limited to rotation around the center
> line of the core (z axis), with no possibility of roll, and I think I want
> to support this rotation only through a Qt slider, not by mouse interaction
> in the VTK window. Movement of the camera (and focal point) up and down the
> core should be through a Qt scrollbar. The last camera operation I want to
> support is zooming, and just like with rotation, I'd like this to be done
> through a Qt slider.
>
> Apart from that, I only want to selectively add certain interactions in
> the VTK window, to allow the user to annotate the core visually by adding
> markers of various kinds through mouse clicks and click-drags.
>
> It's because the set of interactions I want to support in the VTK window
> are so few, and quite specialized, I was looking at vtkInteractorStyleUser.
> Does it seems reasonable to use this interactor style in my case, or are
> there other approaches I should consider?
>
> The only example I can find of vtkInteractorStyleUser usage is this C++
> example:
>
>
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/InteractorStyleUser
>
> But it seems this example just sets the vtkInteractorStyleUser on the
> interactor, not really making use of it (e.g. overriding its virtual On*
> methods)? Instead it adds observers to the interactor itself. Or is setting
> a vtkInteractorStyleUser on the interactor a prerequisite to be able to
> observe those events in this way?
>
> Thankful for any advice / clarifications on how vtkInteractorStyleUser is
> meant to be used.
>

An additional question: As a test, I just tried setting a
vtkInteractorStyleUser as the style my vtkGenericRenderWindowInteractor
(I'm using the QVTKRenderWindowInteractor from Python), instead of the
vtkInteractorStyleImage I was using before (I'm mapping a slice of the core
with a vtkImageResliceMapper), and with the vtkInteractorStyleUser set, the
window does not render anything when I call Render() and Start() the
interactor.

Is this to be expected when using the vtkInteractorStyleUser? The
interactor shouldn't affect rendering, should it? How can I get back
rendering when using vtkInteractorStyleUser?

Elvis


> Cheers,
> Elvis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160225/a93f6403/attachment.html>


More information about the vtkusers mailing list