[vtkusers] about vtkpicker

yhq at sjtu.edu.cn yhq at sjtu.edu.cn
Wed Mar 31 19:16:47 EST 2004


hello everybody:
    this is my problem.
    In a class derived from vtkInteractorStyle, the function
of OnLeftButtonDown  is wrote as following:
   void vtkRuler::OnLeftButtonDown()
  {
    vtkRenderWindowInteractor *rwi = this->Interactor;
    int x= rwi->GetEventPosition()[0];
    int y=rwi->GetEventPosition()[1];
    vtkPicker*pick=vtkPicker::New();
	pick->SetTolerance(0.1);
    pick->Pick(x,y,0.0,this->CurrentRenderer);
    vtkActorCollection *ac;
    vtkActor *anActor ;
    ac =  pick->GetActors();
    anActor = ac->GetNextItem() ; 
    while(anActor)
   {
      AfxMessageBox("this is a try in left button down !");
     anActor->SetPosition(pick->GetPickPosition());
	  this->findDistance();
      anActor=ac->GetNextItem(); 
	  
  } 
I find that it never runs into the while sentence. I think that there is  wrong with  the vtkpicker ,but I am not sure. I long for  some help from you about       vtkpicker.
    Thanks!                                  
              
    


 
  rwi->Render();
 
}
 


More information about the vtkusers mailing list