Re: a class to make VisAD shapes

Hi Maohai,

> i have written a class to define a few shapes in visad.
> currently the supported shapes are:
>  DOT (a pixel), STAR3 (three-point skeletal star), STAR4
>  or CROSS, STAR5 (five-point), OPEN_TRIANGLE,
>  SOLID_TRIANGLE, OPEN_SQUARE, SOLID_SQUARE,
>  OPEN_CIRCLE (actually a decagon).
>
>
> A test class, TestP.java, is adapted from Test46.java
>
> The classes are attached. Maybe someone will find
> this useful.

Great. Thanks.

> A problem I find is that I wrote a class for solid decagon
> using VisADQuadArray.java as a template:
>
> package herschel.spire.qla.plot;
> import visad.VisADGeometryArray;
>
> public class VisAD10Array extends VisADGeometryArray {
>     public Object clone() {
>  VisAD10Array array = new VisAD10Array();
>  copy(array);
>  return array;
>     }
> }
>
>
> But I get this complaint at runtime:
> visad.VisADError: VisADCanvasJ2D.render: bad array class
>         at visad.java2d.VisADCanvasJ2D.render(VisADCanvasJ2D.java:1098)
>         at visad.java2d.VisADCanvasJ2D.render(VisADCanvasJ2D.java:577)
>
> apparently adding new shapes of this kind needs extra
> work on the renderer side. Does VisAD provide a
> way to make arbitrary solid shapes easily (i.e. only
> define the look of it)?

By far the easiest way to handle this is to decompose your
decagon into triangles, and use a VisADTriangleArray.

Cheers,
Bill


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