[vtkusers] vtkPropPicker and 2D actors again

Anja Ende anja.ende at googlemail.com
Wed Oct 4 05:50:00 EDT 2006


Hi all,

Posted this over the last couple of days but did not get any response nor
did I have any luck trying this on my side. So, here it goes again:

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 cursor 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 am having tons of problem with this and a lot depends on this working
correctly. If you have any ideas or suggestions, no matter how wild, please
share!

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


More information about the vtkusers mailing list