NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: Axis labeling and axis interaction

Hi Henner,

>         hi again and thanks for your answer bill , ...
>         but i have to ask again.
> 
>         >There are a couple of ways to create custom axis labels:
> 
>         >1. Extend visad.java3d.DefaultDisplayRendererJ3D, and override its
>         >createSceneGraph() method to create your labels as part of your
>         >"box".
> 
>         hm, sorry, but i have absolutely no idea how to do this. i already
> took a look at the source code, but it didn't really help me. ok, i would
> call super.createSceneGraph() in my subclass before doing something, but...

In this approach, you would create a new class like:

  public class MyDisplayRenderer extends DefaultDisplayRendererJ3D {


  public BranchGroup createSceneGraph(View v, TransformGroup vpt,
                                      VisADCanvasJ3D c) {

    . . .
    LineArray box_geometry = new LineArray(my_number_of_vertices,
                                           LineArray.COORDINATES);
    box_geometry.setCoordinates(0, my_box_verts);
    . . .
  }
}

where the code is identical to the code from DefaultDisplayRendererJ3D
except you construct your own my_box_verts.  I recommend instead the
second approach:

>         >2. Create your labels as VisADLineArrays and put them in
>         >ShapeControls for some RealType mapped to Display.Shape.  There's
>         >an example in visad/bom/TrackManipulation.java.
>         >
>         >In a DisplayImplJ3D the "box" spans X, Y and Z coordinates from
> -1.0
>         >to 1.0.  You can use the visad.PlotText.render_label() method to
>         >help you draw text for your labels.
> 
>         yes, i think i understood this, it's the creation you mentioned in
> point one -isn't it?
>         but how dow create them "as part of my box"? i also don't know what
> realtype i should use for mapping.
>         i tried the one i already mapped to the xaxis, but the labels where
> plotted at the position of the data, of course. also a dummy realtype
> doesn't really work, because they always seem to be plotted with a fixed y
> value, so they don't stay on the x-axis when the plot is zoomed.

You will either need to encode the proper X, Y and Z offsets into the
geometry of the VisADLineArrays, or use a RealTuple with RealTypes
mapped to XAxis, YAXis and ZAxis, plus a RealType mapped to Shape.

What you are asking to do is a bit complex.  I recommend spending
some time studying existing programs that use Shape, such as
visad/bom/TrackManipulation.java, visad/examples/Test47.java
and visad/rabin/Rain.java.

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


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