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.

Controlling colors when displaying UnionSets

How can one control the display color rendered on the screen from a UnionSet? I have something like

   // construct river system
    Gridded2DSet[] river_system = {river};
    UnionSet rivers = new UnionSet(earth, river_system);

    // create a DataReference for river system
    final DataReference rivers_ref = new DataReferenceImpl("rivers");
    rivers_ref.setData(rivers);

    // create a Display
    DisplayImpl display = new DisplayImplJ2D("image display");

    // map earth coordinates to display coordinates

    ScalarMap longMap = new ScalarMap(RealType.Longitude, Display.XAxis);
    ScalarMap latMap = new ScalarMap(RealType.Latitude, Display.YAxis);
    display.addMap(longMap);
    display.addMap(latMap);

    // link the Display to rivers_ref
    display.addReference(rivers_ref);

When I have run this code in the past, the river system has been drawn in white: today, it draws in black. Since I had always intended to grab control of the colors anyway, this seems like a good time.

Normally, I would hunt for the control on the relevant ScalarMap, which I would expect to look something like

        ScalarMap map = new ScalarMap( tempType, Display.RGB);

However, there isn't any mapping of the display type here: just the definitions of the axis.

Which brings me to a deeper question: since the above code only defines mappings for the XAxis and YAxis, why does anything appear at all?

Thanks in advance,

        Edward


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