In general, a view can have multiple data sources (representations), and it is the representations that emit SelectionChangedEvent with a vtkSelection attached. vtkView and subclasses only forward these SelectionChangedEvents with no attached selection. So you can do the following:<div>
<br></div><div>vtkGraphLayoutView* view = vtkGraphLayoutView::New();</div><div>vtkDataRepresentation* rep = view->AddRepresentationFromInput(graph);</div><div>rep->AddObserver(vtkCommand::SelectionChangedEvent, your_callback);</div>
<div><br></div><div>In your_callback, cast the third argument (the void*) to a vtkSelection*.</div><div><br></div><div>Jeff<br><br><div class="gmail_quote">On Tue, Jul 6, 2010 at 12:55 AM, ross hennessy <span dir="ltr"><<a href="mailto:roscoh@gmail.com">roscoh@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
I'm using vtk 5.6 with python, and I have a question about how I<br>
should achieve something which I can't find examples for. I have a<br>
vtkGraphLayoutView which I've registered a callback to for the<br>
SelectionChangedEvent. This is working in the sense that I've checked<br>
that it gets called when interacting with the window. However when I<br>
go to provide an implementation for this function I would like to<br>
calculate/retrieve the selected data (verticies or edges) which have<br>
been selected. This is obviously being calculated in the pipeline as<br>
the selected data is colored differently. However I can't seem to find<br>
the correct method to achieve this. Can somebody please help me out<br>
with the general method of doing this?<br>
<br>
Thanks, Ross<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br>
</div>