[vtkusers] vtkPicker in Java

Brian Henz bjhenz at hotmail.com
Thu Jul 26 10:17:00 EDT 2001


I have had some varying success with vtkCellPicker in Java.  Use the 
MouseMotionListener to keep track of the current position of the mouse.


class MouseTracker implements MouseMotionListener {
  public void mouseMoved(MouseEvent e){
    //  sharedrenpanel is the vtkPanel
    guiLocationX = e.getX();
    guiLocationY = sharedrenpanel.getHeight() - e.getY();
  }
}

// Then to get the Pick information start here and call
//   functions as needed such as GetCellId, ...
Integer x = new Integer(guiLocationX);
Integer y = new Integer(guiLocationY);

// sharedren is the vtkRenderer for the vtkPanel
myPicker.Pick(x.doubleValue(), y.doubleValue(), 0.0, sharedren);
int myCell = myPicker.GetCellId();

>From: Jingyi Jin <jinjingyi at yahoo.com>
>To: "vtkusers at public.kitware.com" <vtkusers at public.kitware.com>
>Subject: [vtkusers] vtkPicker in Java
>Date: Wed, 25 Jul 2001 15:39:25 -0700 (PDT)
>
>Hi,
>
>I was wondering if any of you had experience in
>developing programs using vtkPicker in Java. I tried
>to follow the example pickCells.cxx, but at some point
>I didn't know how to translate the code.
>
>For example, Java uses vtkPanel to handle all the
>mouse events, neither vtkRenderWindow nor
>vtkRenderWindowInteractor has been used to render
>objects and get the mouse interaction, but the
>vtkPicker is set to the vtkRenderWindowInteractor. How
>should I adapt my code so that I can use vtkPicker in
>vtkPanel?
>
>I would greatly appretiate if any of you can send me
>example codes for this.
>
>Thank you for your attention. Have a good day.
>
>Jingyi
>
>__________________________________________________
>Do You Yahoo!?
>Make international calls for as low as $.04/minute with Yahoo! Messenger
>http://phonecard.yahoo.com/
>
>_______________________________________________
>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://public.kitware.com/mailman/listinfo/vtkusers


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp





More information about the vtkusers mailing list