20000802: Scales

>From: Bill Hibbard <hibbard@xxxxxxxxxxxxxxxxx>
>Organization: SSEC
>Keywords: 200008021348.e72DmDT22328

Hi All-

>> We would like to extend VisAD, in order to change axes'depiction, like havin
> g a label for each graduation.
>> We thought of extending the ScalarMap class, in order to overide the method 
> makeScale that builds scales.
>> But most attributs and methods are private or have package privacy, we can't
>  then inherit it in another package.
>> Is there another way to modify axis depiction, or can some attributs of the 
> ScalarMap class become protected?
>> thanks
>I have just modified ScalarMap.java in the source on the VisAD
>ftp server, to declare the makeScale() method as public.  Please
>let me know if there are any other methods that you need public.
>Another way to draw custom scales is to construct data objects
>(probably just Real or RealTuple) with a RealType mapped to
>Display.Shape, then to draw your custom scale as a VisADLineArray
>passed to the corresponding ShapeControl.setShape().  Note something
>like this is done in visad/bom/TrackManipulation.java.

Louise's question is timely as I was just contemplating how to make
custom scales in VisAD.  This question comes up frequently on the VisAD
list, and the reply has never really been satisfactory (create a 
VisADLineArray, use ShapeControl).

I was looking into this the other day and think that VisAD needs a
higher level (than VisADLineArray) Scale component which can be used to
create custom scales. Looking at the makeScale method in ScalarMap,
it seems like that logic could be encapsulated and enhanced in a new
class and have makeScale enhanced to pass a Scale object to the display
renderer. I have not tried this yet, but I thought the properties of a
Scale should be:

    Color               - color of the scale
    Font                - font used (Bill, can this be done now that 
                                     you've added font support to TextControl?)
    Major Tick Spacing  - Tick mark spacing used for major Ticks
    Minor Ticks Spacing - Tick mark spacing used for minor ticks
    Tick Mark visibility - whether ticks are visible or not
    Tick Labels         - which ticks are labeled
    Min/Max values      - min/max of values
    (The five above are like what a JSlider has for settable properties)
    Label               - Axis label
    Position            - X, Y or X axis
    Ordinal position    - position on the axis (first, second, third, etc)
    CoordinateSystem    - CS used to convert values to linear positions on the
                          scale.  For example, if you wanted to have a logP
                          axis, you would provide the CS to create the position
                          of the non-linear spacing of the pressure values on
                          the axis

Are there others?  Internally, the actual scale would be a VisADLineArray
akin to what makeScale creates now.  I'm not sure when I'd get around
to this, but if anyone else wants to run with this and contribute
it to the cause, be my guest.  Like I said, I just started looking at
this, so haven't thought it through to much.  Additional input would
be appreciated.  I think this would be a valuable enhancement to 
VisAD given the number of times this question has come up and would
make the scale creation more object oriented (and easier to deal with).

Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
Unidata WWW Server               http://www.unidata.ucar.edu/
McIDAS Demonstration Machine  http://mcdemo.unidata.ucar.edu/