[vtkusers] How to identify picked objects in a scene?

Cory Quammen cquammen at cs.unc.edu
Sun Mar 9 15:26:43 EDT 2008


On Sun, Mar 9, 2008 at 1:15 PM,  <stoeltze at isg.cs.uni-magdeburg.de> wrote:

>  I have a scene consisting of a couple of actors which have all been
>  created based on vtkPolyData. I am able to pick those actors and to
>  retrieve a pointer to the associated vtkPolyData.

I'm confused. The above paragraph makes it sound like you are able to
associate a picked actor with the vtkPolyData it represents, but the
paragraph below suggests you can't. Which is the case?

>  My problem is probably very simple to solve but I got stuck. How do I
>  determine which Actor, i.e. which vtkPolyData, has been picked? I would
>  like to assign something like a unique identifier to my vtkPolyDatas and
>  then, retrieve this identifier from the picked one. The following actions
>  shall be carried out then dependent on the ID of the picked one.

>From your actor, you can call GetMapper(), and from the mapper that is
returned, you can call GetInput(). This should return the vtkPolyData
represented by the actor in the form of a vtkDataSet, so you may have
to cast the returned pointer to a vtkPolyData pointer, depending on
your needs..

Hope that helps,
Cory

-- 
Cory Quammen
Department of Computer Science
University of North Carolina at Chapel Hill
http://www.cs.unc.edu/~cquammen



More information about the vtkusers mailing list