[vtkusers] Have cameras/interactors synchronized between two QVTKWidgets
Georg Ziegler
gziegler at mail.tuwien.ac.at
Wed Feb 9 07:25:50 EST 2011
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
More information about the vtkusers
mailing list