[vtkusers] How to set zoom functionality in vtkChartXY / vtkContextView?

Marcus D. Hanwell marcus.hanwell at kitware.com
Fri Apr 23 10:42:29 EDT 2010


On Thu, Apr 22, 2010 at 1:10 PM, da <remywendy at gmail.com> wrote:

> I'm having trouble setting up a zoom functionality into my vtkContextView.
> Currently, I create vtkContextView, and put its vtkRenderWindow into a
> QVTKWidget so it shows up on my GUI.
>
> I've tried using a vtkInteractorStyleImage as vtkContextView's interactor
> style, with no success.
>
> contextView->GetScene()->SetInteractorStyle(
> vtkSmartPointer<vtkInteractorStyleImage>::New());
>
> vtkSmartPointer<QVTKInteractor> renderWindowInteractor =
> vtkSmartPointer<QVTKInteractor>::New();
> renderWindowInteractor->SetRenderWindow(contextView->GetRenderWindow());
> renderWindowInteractor->Initialize();
>
> renderWindowInteractor->SetInteractorStyle(vtkSmartPointer<vtkInteractorStyleImage>::New());
>
>
>  Is there a proper way to set up zoom / pan functionality in these
> vtkContextViews?
>
> If you take a look at the source to TestPCPlot.cxx (the parallel coordinate
VTK test), this can be used with interaction. The file is in
VTK/Charts/Testing/Cxx/TestPCPlot.cxx, it optionally calls
'view->GetInteractor()->Start();' if the test is run with the -I switch.

The line plot test (VTK/Charts/Testing/Cxx/TestLinePlot.cxx), also does
something very similar. I should clean the tests up so that they do not use
the VTK_CREATE macro (although I still prefer a more concise syntax), but
they should both serve as good examples of how to set up a context view with
an interactive chart.

I will see if I can add a wiki page discussing this in more detail now that
the API has settled down.

Thanks,

Marcus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100423/af385510/attachment.htm>


More information about the vtkusers mailing list