[vtkusers] vtkCellPickers and vtkPointPickers in a vtkPanel

William E Lucarell welucarell at equityeng.com
Fri Apr 4 10:50:31 EDT 2008


Amy,

I'm using it in a Java Swing application with Swing controls (JLabels,
JSliders, etc).  I have a JPanel window in my form and I put a vtkPanel in
the JPanel. I don't want to mix Swing and AWT components.

- Bill

-----Original Message-----
From: Amy Squillacote [mailto:ahs at cfdrc.com] 
Sent: Friday, April 04, 2008 10:24 AM
To: William E Lucarell
Cc: 'VTK_question'
Subject: Re: [vtkusers] vtkCellPickers and vtkPointPickers in a vtkPanel

Hi Bill,

In vtkCanvas, there are methods for taking java mouse events and passing 
the appropriate information to the render window interactor. (See the 
public mouse* methods that take a MouseEvent parameter.) These methods, 
in addition to a render window interactor, are what makes it possible to 
do things like picking, interacting with 3D widgets, etc. These methods 
are not in vtkPanel.

Is there a particular reason you need to use a vtkPanel and not its 
vtkCanvas subclass?

- Amy

William E Lucarell wrote:
> -->
>
> I have a vtkPolyData mesh with scalar data and a 
> vtkBandedPolyDataContourFilter. I am trying to use pickers to get the 
> scalar data at a point. It works with a vtkCanvas, but *not with a 
> vtkPanel*. Here is the code I use in the addWindowSetObserver method 
> to make the picker work. I want it to work with a vtkPointPicker and 
> with a vtkPanel. The problem is that vtkPanels do not have a getIren() 
> method like the vtkCanvas.
>
> // Delay creation and setup of picker till the VTK window is ready
>
> renWin.addWindowSetObserver(new Observer() {
>
> public void update(Observable o, Object arg) {
>
> // Create a cell picker.
>
> picker = new vtkCellPicker();
>
> // Now at the end of the pick event call the above function.
>
> picker.AddObserver("EndPickEvent", AnnotatePick.this, "annotatePick");
>
> renWin.getIren().SetPicker(picker);
>
> // Initially pick the cell at this location.
>
> picker.Pick(85, 126, 0, renWin.GetRenderer());
>
> }
>
> });
>
> I tried creating a vtkRenderWindowInteractor and setting the render 
> window to renWin.GetRenderWindow(). However, the picker doesn't work 
> when I do this; it only works with the vtkCanvas. Is there any way you 
> can implement pickers with the vtkPanel, or can it only be done with a 
> vtkCanvas?
>
> Thanks in advance!
>
> */Bill Lucarell/*
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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
>   

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805




More information about the vtkusers mailing list