Re: DisplayRealType


Bill Hibbard wrote:

> Sorry to say your can't do this. RealTypes and DisplayRealTypes are
> immutable (and for a good reason - tracking the events for all the
> consequences of a RealTyoe change would be prohibitively complex).
> You can deal with changing DisplayRealType bounds esily enough by a
> calculation of appropriate new arguments to ScalarMap.setRange().
> But if you want to change the CoordinateSystem then you need to
> create completely new DisplayRealTypes (with new unique String
> names), new DisplayTupleType, completely clear your Display, and
> rebuild your Display. By rebuilding your Display you are essentially
> tracking the event consequences of your DisplayRealType changes.

If you look at the ucar.unidata.view.geoloc.MapProjectionDisplay,
you will see that every time I switch projections, I have to
create a new DisplayRealTupleType (in the setDisplayTypes 
method).  I do this by creating a new DisplayRealType with
a name base and an appended incremented counter:

                new DisplayRealType(
                    "ProjectionLat" + instance,
                    true, -90.0, 90.0, 0.0,
                new DisplayRealType(
                    "ProjectionLon" + instance,
                    true, -180.0, 180.0, 0.0,
                new DisplayRealType(
                    "ProjectionAlt" + instance,
                    true, -1.0, 1.0, -1.0, null);
                new DisplayTupleType(
                    new DisplayRealType[] {

After that, you have to remap latitude to the new displayLatitudeType,
RealType.Longitude to the new displayLongitudeType and
(if 3D) RealType.Altitude to the new displayAltitudeType.  Note in
this class displayAltitudeType is really a passthrough to 
Display.ZAxis (bounds -1.0 to 1.0) and the coordinateSystem
just passes through the values directly.

Since DisplayRealTypes can't occur in more than one 
DisplayRealTupleType, this was all necessary.

Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307

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