[vtkusers] Pick points and cells at one time ?

Patric Weis Patric.Weis at Mycrona.de
Wed Jun 2 03:17:43 EDT 2004


Hi Ingo,

Here is a proposal that works fine for me:

1.
To be able to rapidly pick world coordinates on 3D and 2D actors I use
vtkPropPicker as default picker for my interactor:

...
vtkPropPicker *pPropPicker = vtkPropPicker::New();
vtkCallbackCommand *PickCallBackCommand = vtkCallbackCommand::New();
PickCallBackCommand->SetCallback(MyVtkView::PickCallBack);
pPropPicker->AddObserver(vtkCommand::EndPickEvent, PickCallBackCommand);
MyVtkInteractor->SetPicker(pPropPicker);
...

2.
When picking occurs, in my callback function I then pick again
with new pickers to get the ids of the picked cell or point:

vtkPropPicker *pPicker = (vtkPropPicker *) MyVtkInteractor->GetPicker();
...
vtkCellPicker *pCellPicker = vtkCellPicker::New();
pCellPicker->Pick(pPicker->GetSelectionPoint(), MyVtkRenderer);
vtkIdType lCellId = pCellPicker->GetCellId();
...
vtkPointPicker *pPointPicker = vtkPointPicker::New();
pPointPicker->Pick(pPicker->GetSelectionPoint(), MyVtkRenderer);
vtkIdType lPointId = pPointPicker->GetCellId();
...

Maybe this helps.


- Patric Weis
   MYCRONA


de Boer Ingo schrieb am 01.06.2004 15:22:
> Hi,
> 
> I have a vtkPolyData object and I want to allow picking
> points and cells at the same time. The function
> vtkRenderWindowInteractor::SetPicker(vtkAbstractPicker *)
> allows only one picker. So, do I have to write my own
> picker ? Is there any solution, yet ?
> 
> greets
>   Ingo
> 
> 
> ---
> Dr.-Ing. Ingo H. de Boer
> 
> Polytec GmbH
> Polytec-Platz 1-7, 76337 Waldbronn, Germany
> phone: ++49 7243 604 106
> fax  : ++49 7243 604 255
>  
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 



More information about the vtkusers mailing list