Re: ShapeSet

Hi Doug,

> I've always use an Integer1DSet for ShapeControl.setShapeSet() such that
> my Field range values are effectively indices into the
> VisADGeometryArray[] used for setShapes(), to minimize confusion if
> nothing else. 
> 
> I now need to represent an observation as a shape with multiple
> VisADGeometryArrays, i.e. a VisADGeometryArray[]. Instead of making a
> Field with the same domain values repeated and range values from 0 to n
> for each of the n GeometryArrays, I thought there ought to be a clever
> way to make use of the ShapeSet.
> 
> My Field has a single sample with a range value of 0. My ShapeSet is a
> Linear1DSet( 0.0, 0.0, n ). This works if n = 1, but I see nothing on
> the display when n > 1. More surprising, perhaps, I don't even see any
> Exceptions.
> 
> Should this approach work? If not, are there any other ideas? 

This approach won't work, and there is a better way. Most
subclasses of VisADGeometryArray (say VisADXArray) include
a static method:

  public static VisADXArray merge(VisADXArray[] arrays)

that allows you to merge multiple shapes into one. Pass
the merged shape to ShapeControl.setShapes() or setShape().

If you need to make complex shapes that merge different
subclasses of VisADGeometryArray, you can do it with
multiple ScalarMaps from your RealType to Display.Shape
(VisAD allows multiple identical ScalarMaps only for Shape).
See visad/examples/Test46.java for an example.

> Is there a case where it makes sense to use anything other than an
> Integer1DSet for the ShapeSet? It's an extra level of complexity in an
> already complex API for making shapes.

As Don says, you can use non-IntegerSets for non-integer
quantization of RealType values into shapes.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html


  • References:
  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: