[vtkusers] Re: Picking in Win32/MFC

Nigel Nunn nNunn at ausport.gov.au
Mon Oct 30 11:48:08 EST 2000


Hi Chris and Peter, 
 
I worked through the problem of porting the pickCells.cxx 
example to the MFC framework.  The result was a very neat 
panel generation interface for constructing 3D models to 
feed to a panel-method solver. 
 
I will have some time beginning next week to re-do that 
pickCells.cxx translation.  Perhaps if I were to get a 
robust and clear MFC version of pickCells.cxx, we could 
make it available as an extended VC++ workspace: 
 
 "SamplePick.dsw"? 
 
More later, 
Nigel 
 
 
----- Chris Tsui [chris at traxtal.com] wrote ----- 
 
here's the question: 
 
how do I use the VTK pick functions (vtkCellPicker) to 
return the coordinate of the cell I click on the object? 
 
by left clicking on the screen, it would rotate the 
object, do I have to override this function in order 
to return the coordinate of the cell I pick?  
and how do I do that? 
 
the class function vtkMFCRenderView() under the class 
vtkMFCRenderView has several mouse event handler, I 
added some codes there for the case WM_LBUTTONDOWN..  
but seems that it has conflicts... 
 
Thanks for you help :) 
 
Chris 
 
 
--- [p.boettcher at anat.vetmed.uni-muenchen.de] wrote --- 
 
I try to implement vtkRenderWindowInteractor into a 
dialog-based MFC-Application. I don't use the 
Win32-Interactor! Unfortunately I don't find the right 
declaration for iren->SetEndPickMethod(????). 
In a DOS-based application I used:

static void PickCells(void *)

void main(void)
{
  vtkPointPicker *picker = vtkPointPicker::New();
    picker->SetTolerance(0.01);

  vtkRenderWindowInteractor *iren = 
        vtkRenderWindowInteractor::New();
    iren->SetRenderWindow(renWin);
    iren->SetPicker(picker);

  iren->SetEndPickMethod(PickCells,(void *)iren);
  iren->Start();
}

static void PickCells(void *arg)
{
  vtkRenderWindowInteractor *iren = 
           (vtkRenderWindowInteractor *)arg;
  vtkPointPicker *picker = 
           (vtkPointPicker *)iren->GetPicker();

  .... 
}
 
 
This works fine for DOS-based application, unfortunately 
the declaration isn't the same for windows-based applications? 
Any example code or suggestions, how to get this work? 
 
Peter Böttcher 
 
----------- end ----------- 




More information about the vtkusers mailing list