[vtkusers] vtkPropPicker... the problem does not go away...

Anja Ende anja.ende at googlemail.com
Thu Oct 5 03:29:00 EDT 2006


Hi all,

Ok, tried all sorts of pickers in the vtk framework but nothing really picks
2D actors.

The examples and the archives do not really have anything on 2D picking.

If anyone has had any success in picking 2D actors when there is more than
one 2D actor on the scene, please share! I am pretty desperate here.

Here is what I have tried... I would be really grateful if someone takes a
look at it and comments on what else I could ry here...

Repeating message here:

So, I am basically having trouble picking 2D actors using vtkPropPicker.
What is happening is I have set the location of the 2D actor at a position
on the screen using:

m_actor->SetPosition(x, y);

but I can only pick it at coordinates (0, 0) through to width and height of
the image.

It looks like I am not the only one who had this problem. While searching, I
came upon a person with the same problem. The thread is located at:

http://public.kitware.com/pipermail/vtkusers/2004-October/077010.html

It does not have any responses. There was another thread by the same author
that mentions that this problem only happens when the vtkActor2D has a
vtkImageMapper associated with it.

This is what my code looks like:

The actor is setup in the following way:

m_mapper = vtkImageMapper::New();
m_mapper->SetInput(myImage->GetOutput());

m_actor = vtkActor2D::New();
m_actor->SetMapper(m_mapper);

// The position is set using
m_actor->SetPosition(x, y);

I can see the image at the correct position on the screen.

Now the picking is done as follows:

// Interaction coordinate
int x = this->Interactor->GetEventPosition()[0];
int y = this->Interactor->GetEventPosition()[1];
this->FindPokedRenderer(x, y);

if (this->CurrentRenderer == NULL)
    return;

// Create the picker
vtkPropPicker * picker = vtkPropPicker::New();

if (picker->PickProp(x, y, this->CurrentRenderer))
{
    // The correct prop is only picked when x, y is around 0, 0
    vtkProp * prop = picker->GetViewProp();
}
picker->Delete();

I had counted on this working correctly... Is this not possible at all?
should I keep track of all my objects myself???

Cheers,
Anja
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061005/98ade641/attachment.htm>


More information about the vtkusers mailing list