<div><div class="gmail_quote">On Thu, Apr 22, 2010 at 1:10 PM, da <span dir="ltr"><<a href="mailto:remywendy@gmail.com">remywendy@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
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.<div><br></div><div>I've tried using a vtkInteractorStyleImage as vtkContextView's interactor style, with no success.</div>
<div><br></div><div><div><font face="tahoma, sans-serif"><font color="#666666">contextView->GetScene()->SetInteractorStyle(</font></font></div><div><span style="white-space:pre"><font face="tahoma, sans-serif"><font color="#666666">                </font></font></span><font face="tahoma, sans-serif"><font color="#666666">vtkSmartPointer<vtkInteractorStyleImage>::New());</font></font></div>
<div><font face="tahoma, sans-serif"><font color="#666666"><br></font></font></div><div><div><font face="tahoma, sans-serif"><font color="#666666">vtkSmartPointer<QVTKInteractor> renderWindowInteractor = vtkSmartPointer<QVTKInteractor>::New();</font></font></div>
<div><font face="tahoma, sans-serif"><font color="#666666">renderWindowInteractor->SetRenderWindow(contextView->GetRenderWindow());</font></font></div><div><font face="tahoma, sans-serif"><font color="#666666">renderWindowInteractor->Initialize();</font></font></div>
</div><div><font face="tahoma, sans-serif"><font color="#666666">renderWindowInteractor->SetInteractorStyle(vtkSmartPointer<vtkInteractorStyleImage>::New());</font></font></div>
<div><br></div><div><br></div><div> Is there a proper way to set up zoom / pan functionality in these vtkContextViews?</div></div>
<br></blockquote>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.<div>
<br></div><div>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.</div>
<div><br></div><div>I will see if I can add a wiki page discussing this in more detail now that the API has settled down.</div><div><br></div><div>Thanks,</div><div><br></div><div>Marcus</div></div></div>