Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

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


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690