[Paraview] Controlling Render Views without Mouse

Nathan Jarus nmjxv3 at mst.edu
Tue May 29 01:31:22 EDT 2012


Have you posted on the paraview mailing list? This seems like a PV bug.

On Tue, May 29, 2012 at 12:23 AM, David Zemon <david.zemon at mst.edu> wrote:
> Hello,
>
> Overview
> I am attempting to control ParaView v3.14.1 with something other than a
> mouse and keyboard. I don't know how to do this - I've taken some wild
> guesses and bits 'n' pieces have started to work. I could really use some
> help from someone that knows the inner-workings though.
>
> What I'd Like to Happen
> I have an class, foo, with some events and callbacks of its own. Foo is not
> related to ParaView in any way other than foo needs to make ParaView do
> stuff as it sees fit. In the callbacks, I'd like to do things like zoom, pan
> and rotate. Eventually I'd like foo to be able add filters and such too, but
> that's a long way down the road.
>
> What I've Tried
> foo has 3 events similar to OnButtonDown, OnMouseMove, and OnButtonUp. I
> figure, why not just call these methods (within vtkPVInteractorStyle) from
> foo? This is what I've been trying.
> I have made foo a friend of vtkPVInteractorStyle. I've created a global
> pointer variable, g_pInteractorStyle, which points to vtkPVInteractorStyle.
> I've created a mutator and two integer variables - m_x and m_y - within foo
> to hold mouse coordinates. Any time that GetEventPosition()[0/1] is called,
> I save those values to local variables - x and y - and pass them into foo's
> mutator. This way, any time a real mouse is used, foo gets updated
> coordinates. This also now gives me starting points to pass into
> OnMouseMove.
> From foo I first call g_pInteractorStyle->OnButtonDown(3, 0, 0). Ideally,
> this will initiate zoom, which it seems to.
> Following that, I make a series of calls following the pattern:
> g_pInteractorStyle->Current->OnMouseMove(m_x, m_y + offset,
> g_pInteractorStyle->CurrentRenderer, g_pInteractorStyle->Interactor), where
> offset is some integer value from -49 to 49 and neither m_x or m_y change
> during the series of calls.
> Finally, I call g_pInteractorStyle->OnButtonup(3).
>
> I have also commented out one line each from OnButonDown and OnButtonUp:
> this->InvokeEvent(vtkCommand::[Start/End]InteractionEvent). With these two
> lines in place, OnButtonUp causes a crash. Without these lines in place
> (when they're commented out), ParaView acts just fine. I know this is NOT a
> good fix and I'm open to other suggestions, but it (this aspect) seems to be
> working at the moment.
>
> I've also tried looking into the QT libraries and moving the cursor via QT.
> Unfortunately, I've been unable to find the right cursor because nothing
> I've done has had any effect on the cursor I'm staring at (tried setPos()
> and setShape()).
>
> The Problem
> OnMouseMove() has caused problem after problem. In our current setup
> OnButtonDown(3, 0, 0) works great. OnMouseMove() kills paraview when it
> reaches vtkPVRenderView::Render() called from somewhere within
> vtkPVGenericRenderWindowInteractor. In a weak attempt to "fix" the problem,
> I tried commenting out this Render() call. Nothing too major seemed to break
> except that I'm blind as i try to zoom until I release the mouse button
> (tests were done using the mouse at first). In other words: Everything still
> working, but no rendering during zoom - only renders upon releasing the
> mouse. I now try it with foo, and it acts as though OnButtonUp(3) was never
> called - the whole foo routine finishes then I use the mouse and click
> somewhere to start a new interaction, and it zooms to wherever it should
> have zoomed when it finished foo's routines.
>
> So two options: I can either let it die every time it tries to render, or
> hold off rendering until I finish "moving the mouse" and then still be
> required to click the mouse somewhere when I'm finished.
>
> This is broken. And something tells me I'm going about this in a very wrong
> fashion. How should I be doing this?
>
> Thanks,
> David Zemon
> Computer


More information about the ParaView mailing list