[vtkusers] Calculating selection data using python wrappers

Jeff Baumes jeff.baumes at kitware.com
Tue Jul 6 09:44:30 EDT 2010


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:

vtkGraphLayoutView* view = vtkGraphLayoutView::New();
vtkDataRepresentation* rep = view->AddRepresentationFromInput(graph);
rep->AddObserver(vtkCommand::SelectionChangedEvent, your_callback);

In your_callback, cast the third argument (the void*) to a vtkSelection*.

Jeff

On Tue, Jul 6, 2010 at 12:55 AM, ross hennessy <roscoh at gmail.com> wrote:

> Hi,
>
> I'm using vtk 5.6 with python, and I have a question about how I
> should achieve something which I can't find examples for. I have a
> vtkGraphLayoutView which I've registered a callback to for the
> SelectionChangedEvent. This is working in the sense that I've checked
> that it gets called when interacting with the window. However when I
> go to provide an implementation for this function I would like to
> calculate/retrieve the selected data (verticies or edges) which have
> been selected. This is obviously being calculated in the pipeline as
> the selected data is colored differently. However I can't seem to find
> the correct method to achieve this. Can somebody please help me out
> with the general method of doing this?
>
> Thanks, Ross
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100706/dbebdd97/attachment.htm>


More information about the vtkusers mailing list