[vtkusers] vtkImplicitPlaneWidget + Java.
Shyam Prakash
ramakrishna.prakash at quest-global.com
Fri Nov 7 05:52:23 EST 2003
If adding observer is what you are looking for, then
Suppose you want to invoke the method updatePlanePosition() which is in
the class PlaneWidgetObserver then
PlaneWidgetObserver planeObserver = new PlaneWidgetObserver();
pw.AddObserver("AnyEvent", planeObserver,"updatePlanePosition");
You can replace "AnyEvent" with the suitable event to meet your needs
--Shyam
-----Original Message-----
From: Said.El_Kasmi at sophia.inria.fr
[mailto:Said.El_Kasmi at sophia.inria.fr]
Sent: Friday, November 07, 2003 3:58 PM
To: Shyam Prakash
Subject: Re: [vtkusers] vtkImplicitPlaneWidget + Java.
Shyam Prakash wrote:
>
> Can you be more clear on your requirement?
In fact, i want attach an Observer ( pw.AddObserver(...); ) Have a look
on vtkImplictPlaneWidget.py for more details :-(
>
> --Shyam
>
> -----Original Message-----
> From: vtkusers-admin at vtk.org [mailto:vtkusers-admin at vtk.org] On Behalf
> Of Said.
> Sent: Friday, November 07, 2003 3:39 PM
> To: vtkusers
> Subject: [vtkusers] vtkImplicitPlaneWidget + Java.
>
> Hi all,
>
> In this java class I'm testing how to use vtkImplicitPlaneWidget
class.
> I attached to this mail the output view of the following code.
>
> I need some help to add suport for user intercation: I mean, when the
> user replace the plane in the vtkImplicitPlaneWidget, the application
> should the new cut plane and show it. I'm browsing vtk examples but I
> didn't find any java one.
>
> Thanks.
>
> /*
> * Created on Nov 6, 2003
> */
> package caiman.vizu.vtk;
> import javax.swing.JFrame;
>
> import vtk.vtkActor;
> import vtk.vtkCanvas;
> import vtk.vtkCutter;
> import vtk.vtkDataSet;
> import vtk.vtkDataSetMapper;
> import vtk.vtkDataSetReader;
> import vtk.vtkImplicitPlaneWidget;
> import vtk.vtkPlane;
> import vtk.vtkPolyData;
> import vtk.vtkPolyDataMapper;
>
> public class TestPlaneWidget extends JFrame{
>
> static {
> System.loadLibrary("vtkCommonJava");
> System.loadLibrary("vtkFilteringJava");
> System.loadLibrary("vtkIOJava");
> System.loadLibrary("vtkImagingJava");
> System.loadLibrary("vtkGraphicsJava");
> System.loadLibrary("vtkRenderingJava");
> System.loadLibrary("vtkHybridJava");
> }
>
>
> private vtkDataSet data;
> private vtkDataSetReader dsr;
> private vtkCanvas renWin;
> private vtkImplicitPlaneWidget pw;
> private vtkPlane plane;
> private vtkCutter cutter;
> private vtkActor actor;
> private vtkPolyDataMapper mapper;
>
> public TestPlaneWidget() {
> dsr = new vtkDataSetReader();
> dsr.SetFileName("Cube.vtk");
> data = dsr.GetOutput();
>
> vtkDataSetMapper dmapper = new vtkDataSetMapper();
> dmapper.SetInput(data);
> vtkActor dactor = new vtkActor();
> dactor.SetMapper(dmapper);
>
>
> plane = new vtkPlane();
> renWin = new vtkCanvas();
>
> pw = new vtkImplicitPlaneWidget();
> pw.SetOrigin(data.GetCenter());
> pw.SetInteractor(renWin.getIren());
> pw.SetInput(data);
> pw.NormalToZAxisOn();
> pw.On();
> pw.GetPlane(plane);
> vtkPolyData pdata = new vtkPolyData();
> pw.GetPolyData(pdata);
>
>
>
> cutter = new vtkCutter();
> cutter.SetInput(data);
> cutter.SetCutFunction(plane);
>
> mapper = new vtkPolyDataMapper();
> mapper.SetInput(cutter.GetOutput());
> actor = new vtkActor();
> actor.SetMapper(mapper);
>
> renWin.GetRenderer().AddActor(actor);
> //renWin.GetRenderer().AddActor(dactor);
>
>
> this.getContentPane().add(renWin);
> this.setVisible(true);
> }
>
> public static void main(String[] args) {
> new TestPlaneWidget();
> }
>
> }
--
Said.
--------------------------------------------------------------------
Said EL KASMI.
INRIA - Projet CAIMAN. 2004, Route des Lucioles - BP 93
06902 Sophia Antipolis Cedex (France)- Tel: 04 92 38 79 07
Email: Said.El_kasmi at sophia.inria.fr
More information about the vtkusers
mailing list