Tuple vs. FieldImpl displays


I was doing some work with DEM data and was trying to show
two 7.5 minute DEM's for Mt. Rainer (east side, west side)
to create a more complete view.

We are using the geotransform package for UTM->lat/lon conversion
and my FlatField for each DEM looks like:

(UTM_easting, UTM_northing) -> (Altitude)

I create a UTMCoordinateSystem for each section which may
be different since they could lie in different UTM zones.
I then create a RealTupleType of (UTM_easting, UTM_northing)
and pass in the CS on the constructor.  I use this RTT
as the MathType of my domain set.

My first thought was to create a FieldImpl of:

(index) -> ((UTM_easting, UTM_northing) -> (Altitude))

and the samples of the FieldImpl would just be each of
the DEM FlatFields.  However, I thought I would run into
an error if I created the FunctionType with the MathTYpe
of one of the FlatFields and then tried to call setSample
on the FieldImpl, because the MathType of the other FlatField
would not be the same since it had a different CoordinateSystem.
(I've since found this isn't a problem and have other ways
to work around it.)

So, my initial solution was to create a Tuple of the two
FlatFields and then use that as the Data object for my
DataReference.  When I did this, I ended up with only one
of the FlatFields being rendered (the second in the Tuple).

So, I tried to do this with a FieldImpl instead and found
that it worked (RealTupleTypes must be equal even if they
don't have the same CS?) and when I used the FieldImpl,
I got both halves of Mt. Rainier to show up.  Thinking
this was some problem with my CS, I removed that from
the equation and found that this happens in any case.

I've attached a small test program that shows the behavior.
Is this a bug or a feature?

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

import visad.*;
import visad.java3d.*;
import javax.swing.*;
import java.awt.event.*;

class TupleTest extends JFrame {

   FieldImpl fi = null;
   Tuple t = null;
   DataReference ref;

   public static void main (String[] args) throws Exception {
      TupleTest ttest = new TupleTest();

   public TupleTest() throws Exception {

      super("Test of Tuples vs. Fields");
      addWindowListener(new WindowAdapter() {
          public void windowClosing(WindowEvent ev) {
      RealType easting = RealType.getRealType("UTM_Easting", CommonUnit.meter);
      RealType northing = 
          RealType.getRealType("UTM_Northing", CommonUnit.meter);
      RealTupleType rt = new RealTupleType(easting, northing);
      DisplayImpl display = new DisplayImplJ3D("display");
      display.addMap(new ScalarMap(northing, Display.YAxis));
      display.addMap(new ScalarMap(easting, Display.XAxis));
      display.addMap(new ScalarMap(RealType.Altitude, Display.ZAxis));
      display.addMap(new ScalarMap(RealType.Altitude, Display.RGB));
      ref = new DataReferenceImpl("ref");
      FunctionType ft = new FunctionType(rt, RealType.Altitude);
      FlatField ff1 = FlatField.makeField1(ft, 0., 100., 101, 0., 100., 101);
      FlatField ff2 = FlatField.makeField1(ft, 101., 200., 100, 0., 100., 101);
      RealType index = RealType.getRealType("index");
      fi = new FieldImpl(new FunctionType(index, ff1.getType()), new 
Integer1DSet(index, 2));
      Data[] d = new Data[] {ff1, ff2};
      fi.setSamples(d, false);
      t = new Tuple(d);
      JPanel p = new JPanel();
      JButton tupleB = new JButton("Load Tuple");
      tupleB.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
             try {
             } catch (Exception ex) {}
      JButton fieldB = new JButton("Load Field");
      fieldB.addActionListener(new ActionListener() {
          public void actionPerformed(ActionEvent e) {
             try {
             } catch (Exception ex) {}
      getContentPane().add("South", p);