Re: DisplayRealType

Hi Luke,

> I am instantiating a DisplayRealType and get the message:
>
> visad.VisADError: Action.run: visad.TypeException: DisplayRealType: name
> already used
>             at visad.ActionImpl.run(ActionImpl.java, Compiled Code)
>             at visad.util.ThreadPool$ThreadMinnow.run(ThreadPool.java,
> Compiled Code)
>
> I am calling it everytime I redefine the area of the world I want to
> display.
>
>   displayLatitudeType
>         new DisplayRealType(
>             "ProjectionLat",
>             true, -90.0, 270.0, 0.0,
>             CommonUnit.degree);
>
>
> I remember a while back, I had this problem with RealType and was told to
> use
>
> RealType.getRealType("Index"), which would either construct it, or if its
> already constructed
> then just return it.   Is there something like that for DisplayRealType.   I
> tried DisplayRealType.getRealType, but I need DisplayRealType returned and
> it returns RealType.  If I try to typecast it, I get a casting error.
>
> When I varied the name (first arg) passed to DisplayRealType, then I got the
> error:
>
> visad.DisplayException: DisplayTupleType: DisplayRealType already part of a
> DisplayTupleType
>             at
> crrel_view.MapDisplay2D.loadZoomedShapeFile(MapDisplay2D.java:229)
>             at crrel_view.MapDisplay2D$1.doAction(MapDisplay2D.java:190)
>             at visad.ActionImpl.run(ActionImpl.java, Compiled Code)
>             at visad.util.ThreadPool$ThreadMinnow.run(ThreadPool.java,
> Compiled Code)
>
> everytime I redefine the area of the world I want to display.
>
>     displayTupleType
>         new DisplayTupleType(
>             new DisplayRealType[] {
>                 displayLatitudeType,
>                 displayLongitudeType,
>                 displayAltitudeType},
>                 coordinateSystem);

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.

Good luck,
Bill


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