That didn&#39;t seem to work either.&nbsp; I&#39;m trying to view a xy plot.<br><br>Justin<br><br><div class="gmail_quote">On Mon, Feb 23, 2009 at 1:05 PM, Clinton Stimpson <span dir="ltr">&lt;<a href="mailto:clinton@elemtech.com">clinton@elemtech.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Maybe you&#39;re just missing a<br>
renderer-&gt;ResetCamera();<br>
<br>
If you&#39;re just viewing an image, have a look at the image viewer example in VTK/Examples/GUI/Qt/ImageViewer<br>
<br>
Clint<br>
<br>
Justin Giles wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
Ok, I added a style to my interactor in the following way:<br>
<br>
//code<br>
 &nbsp; &nbsp;vtkRenderWindow *renderWindow = vtkRenderWindow::New();<br>
 &nbsp; &nbsp;renderWindow-&gt;SetSize(550, 450);<br>
 &nbsp; &nbsp;renderWindow-&gt;AddRenderer(renderer);<br>
 &nbsp; &nbsp;vtkRenderWindowInteractor* inter = QVTKInteractor::New();<br>
 &nbsp; &nbsp;renderWindow-&gt;SetInteractor(inter);<br>
 &nbsp; &nbsp;vtkInteractorStyleImage* interstyle = vtkInteractorStyleImage::New();<br>
 &nbsp; &nbsp;inter-&gt;SetInteractorStyle(interstyle);<br>
 &nbsp; &nbsp;view-&gt;SetRenderWindow(renderWindow);<br>
//end code<br>
<br>
(where view = QVTKWidget)<br>
<br>
And, I still get the same results. &nbsp;Instead of a nice plot, I just get a blank white screen. &nbsp;Thoughts? &nbsp;Am I doing something wrong?<br>
<br>
Thanks,<br>
<br>
Justin<br>
<br></div><div><div></div><div class="Wj3C7c">
On Mon, Feb 23, 2009 at 11:20 AM, Clinton Stimpson &lt;<a href="mailto:clinton@elemtech.com" target="_blank">clinton@elemtech.com</a> &lt;mailto:<a href="mailto:clinton@elemtech.com" target="_blank">clinton@elemtech.com</a>&gt;&gt; wrote:<br>

<br>
<br>
 &nbsp; &nbsp;Interaction is handled by the interactor style classes.<br>
 &nbsp; &nbsp;<a href="http://www.vtk.org/doc/nightly/html/classvtkInteractorStyle.html" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkInteractorStyle.html</a><br>
<br>
 &nbsp; &nbsp;You can use an existing style, or make your own and give it to the<br>
 &nbsp; &nbsp;interactor.<br>
<br>
 &nbsp; &nbsp;Clint<br>
<br>
 &nbsp; &nbsp;Justin Giles wrote:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;I am able to create a 2d plot using a QVTKWidget, however I am<br>
 &nbsp; &nbsp; &nbsp; &nbsp;unable to interact with that plot. &nbsp;I pretty much new to VTK,<br>
 &nbsp; &nbsp; &nbsp; &nbsp;so I am kind of at a loss as to how to connect the vtk<br>
 &nbsp; &nbsp; &nbsp; &nbsp;interactors and Qt. &nbsp;I have poked around a bit and noticed a<br>
 &nbsp; &nbsp; &nbsp; &nbsp;QVTKInteractor class, but anything I do with that results in<br>
 &nbsp; &nbsp; &nbsp; &nbsp;my 2d plot going away to be replaced with a blank white area.<br>
 &nbsp; &nbsp; &nbsp; &nbsp; Below is the code that I am using. &nbsp;Just as a note, this is<br>
 &nbsp; &nbsp; &nbsp; &nbsp;being done in a class that extends a QMainWindow.<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;//snippet//<br>
<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; view = new QVTKWidget;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setCentralWidget(view);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int DIM = 500;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkDataArray *dataArray1 =<br>
 &nbsp; &nbsp; &nbsp; &nbsp;vtkDataArray::CreateDataArray(VTK_FLOAT);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dataArray1-&gt;SetNumberOfTuples(DIM);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkDataArray *dataArray2 =<br>
 &nbsp; &nbsp; &nbsp; &nbsp;vtkDataArray::CreateDataArray(VTK_FLOAT);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dataArray2-&gt;SetNumberOfTuples(DIM);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int t;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for (t = 0; t &lt; DIM; t++)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float x = t;<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; float y = vtkMath::Random(0.0f,1.0f);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dataArray1-&gt;SetTuple(t, &amp;x);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dataArray2-&gt;SetTuple(t, &amp;y);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkFieldData *fieldData = vtkFieldData::New();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fieldData-&gt;AllocateArrays(2);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fieldData-&gt;AddArray(dataArray1);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fieldData-&gt;AddArray(dataArray2);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkDataObject *dataObject = vtkDataObject::New();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dataObject-&gt;SetFieldData(fieldData);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkXYPlotActor *plot = vtkXYPlotActor::New();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;AddDataObjectInput(dataObject);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;SetTitle(&quot;Plot&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;SetXTitle(&quot;X-Axis&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;SetYTitle(&quot;Y-Axis&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;SetXValuesToValue();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;SetWidth(0.9);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;SetHeight(0.9);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;SetPosition(0.05, 0.05);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;LegendOn();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;PickableOff();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;PlotCurvePointsOn();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;PlotCurveLinesOff();<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;SetDataObjectXComponent(0, 0);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;SetDataObjectYComponent(0, 1);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;SetPlotColor(0, 1.0, 0.0, 0.0);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; plot-&gt;SetPlotLabel(0, &quot;My Label&quot;);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //plot-&gt;GetProperty()-&gt;SetColor(0.0, 0.0, 0.0);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkRenderer *renderer = vtkRenderer::New();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; renderer-&gt;SetBackground(0, 0, 0);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; renderer-&gt;AddActor2D(plot);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vtkRenderWindow *renderWindow = vtkRenderWindow::New();<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; renderWindow-&gt;SetSize(550, 450);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; renderWindow-&gt;AddRenderer(renderer);<br>
 &nbsp; &nbsp; &nbsp; &nbsp;// &nbsp; &nbsp;vtkRenderWindowInteractor* inter = QVTKInteractor::New();<br>
 &nbsp; &nbsp; &nbsp; &nbsp;// &nbsp; &nbsp;renderWindow-&gt;SetInteractor(inter);<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; view-&gt;SetRenderWindow(renderWindow);<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;//end-snippet//<br>
 &nbsp; &nbsp; &nbsp; &nbsp;------------------------------------------------------------------------<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;_______________________________________________<br></div></div>
 &nbsp; &nbsp; &nbsp; &nbsp;Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> &lt;<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>&gt;<div class="Ih2E3d"><br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Visit other Kitware open-source projects at<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Please keep messages on-topic and check the VTK FAQ at:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp;Follow this link to subscribe/unsubscribe:<br>
 &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
 &nbsp; &nbsp; &nbsp; &nbsp; <br>
<br>
<br>
</div></blockquote>
<br>
</blockquote></div><br>