[vtkusers] vtkAssignAttribute for Java

Ed Stewart estewart at vni.com
Thu Jan 20 15:08:55 EST 2005


 
Greetings,

I'm having a bit of trouble getting vtkAssignAttribute working in Java.
I have a vtkPolyData object that I'd like to shade with a set of scalar
values. I've created a vtkDoubleArray to hold those values and then I'm
doing the following:

//sc is the vtkDoubleArray that has been filled up with scalar values
sc.SetName("foo");
vtkAssignAttribute aa = new vtkAssignAttribute();
aa.SetInput(surfPolyData);	//surfPolyData is my vtkPolyData object
to be shaded
aa.Assign("foo",0,0);		//enums are used for SCALARS and
POINTDATA
aa.Update();			//I don't think this is needed

//I then create a vtkLookupTable lut to hold the shading colors

vtkPolyDataNormals surfNormas = new vtkPolyDataNormals();
surfNormals.setInput(aa.GetPolyDataOutput());
vtkPolyDataMapper surfMapper = new vtkPolyDataMapper();
surfMapper.SetColorModeToMapScalars();
surfMapper.ScalarVisibilityOn();
surfMapper.SetInput(surfNormals.GetOutput());
surfMapper.SetScalarRange(0.0, 255.0);
surfMapper.SetLookupTable(lut);
vtkActor surfActor = new vtkActor();
surfActor.SetMapper(surfMapper);

The problem of course is that this doesn't change the surface at all. I
suspect the aa.Assign("foo",0,0) line is to blame as I don't see how it
can make the connection back to the vtkDataArray object that I've named
"foo".

Can anyone confirm that I am coding this correctly?

Thank you,
-ed



More information about the vtkusers mailing list