[vtkusers] vtkPicker and PickEvent

Darshan Pai vtk_darshan at yahoo.com
Thu Dec 15 22:41:18 EST 2005


Instead of connecting the Observer to the actor connect it to the vtkRenderer Object. This will ensure it only fires once.
  
  YOu can get the actors which the ray intersected, by using i guess  GetProp method. And when making ur Observer . try to use the  EndPickEvent instead of PickEvent unless u are specific abt wat u are  aiming for
  
  HTH
  
  Darshan

Mike Jackson <maillist at bluequartz.net> wrote:  I am trying to use the built in picker in renderer. I put the mouse  
over my scene and hit the "p"
  key and a red box shows up around my vtkActor which is really neat.  
Now how do I actually get any information from that? Looking through  
the docs I tried to implement a subclass of vtkCommand:

class PickListener : public vtkCommand
{
   public:
     ~PickListener();

   void Execute (vtkObject* caller, unsigned long eventId, void  
*callData);

   private:
      void *_document;  //Really a PFDocument object
};

And when I create each actor in the scene I add it there.

PickListener *pickEvent = new PickListener();
pickEvent->setDocument( (void *)self);
for (unsigned int i = 0; i < numRegions; ++i)
{
  // code above here...
   vtkActor *dataActor = vtkActor::New();
   dataActor->AddObserver(vtkCommand::PickEvent, pickEvent );
   // code below here
}

Now what happens is that for every "Pick" I get multiple calls to the  
Execute method, each call has a different "caller" associated with  
it. I figured this was because the "ray" was intersecting multiple  
actors. How do I sort out which actor was really "picked"?  
vtkRenderWindow gets it right?

---
Mike Jackson
mike _at_ bluequartz dot net


---
Mike Jackson
mike _at_ bluequartz dot net


_______________________________________________
This is the private VTK discussion list. 
Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20051215/e6111982/attachment.htm>


More information about the vtkusers mailing list