[vtkusers] Have cameras/interactors synchronized between two QVTKWidgets

Hong Yi hongyi at renci.org
Wed Feb 9 12:08:37 EST 2011


Many thanks for the helpful information. I will try to set up observer to listen to vtkCommand::ModifiedEvent to synchronize two cameras.

Thanks again,

Hong

-----Original Message-----
From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On Behalf Of Georg Ziegler
Sent: Wednesday, February 09, 2011 7:26 AM
To: vtkusers at vtk.org
Subject: Re: [vtkusers] Have cameras/interactors synchronized between two QVTKWidgets

Hi!
I didn't use QVTKWidget, but KWWidgets, but I guess it works similar.
First, figure out if you control the camera or the actor with your interactor.

Then you can try to set the ActiveCamera of the two windows. Where
vtkRenderer1/2 are the renderers of the specific windows.
vtkRenderer1->SetActiveCamera(vtkRenderer2->GetActiveCamera());
This should work, but is not the best way to do the job.

The better solution (as I was told on this list) is to use
vtkCamera->ShallowCopy();
and then issue Render() calls.

This did the trick for me. Btw I listen for vtkCommand::ModifiedEvent's.

Hope that helps.



Am 08.02.2011 17:41, schrieb Hong Yi:
> Hello,
>
> I have two QVTKWidget windows and try to add an option to have these 
> two windows synchronized when interacting with either window such as 
> zooming, rotating, etc. I know each QVTKWidget has its own interactor. 
> I am thinking perhaps I could make these two QVTKWidgets share the 
> same interactor style. So I tried to get Interactor Style out of one 
> QVTKWidget window and set it to the other QVTKwidget window interactor 
> style, but it does not work. Another way I can think of is to add 
> observer and write my own callback to one window to force camera of 
> the other window in sync with it. Before embarking on doing it, I am 
> asking the list to see whether anybody has suggestions on the simple 
> and best way to achieve this.
>
> Thanks for any suggestions and pointers,
>
> Hong
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: 
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers



More information about the vtkusers mailing list