[vtkusers] vtkCellPickers and vtkPointPickers in a vtkPanel

William E Lucarell welucarell at equityeng.com
Fri Apr 4 11:17:12 EDT 2008


N/M I got the cell and point pickers to work with the vtkCanvas embedded in
a swing component. It's just funny getting used to moving the mesh with the
mouse on the canvas. I wonder if you can customize movement of such objects
to make it user-friendly for others. I can get used to it but I'd like
others to be able to use my tool.

Thanks for all the help!

-----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