Re: Alternative DataRenderer in FancySSCell

  • To: Mathias Stümpert <atzes@xxxxxx>
  • Subject: Re: Alternative DataRenderer in FancySSCell
  • From: Curtis Rueden <curtis@xxxxxxxxxxxxx>
  • Date: Thu, 31 May 2001 10:26:13 -0500
Hi Mathias,

I wrote a small program to test the problem, but I was unable to
duplicate the error you are getting.  If you can send me a self-
contained version of your source code, so that I can duplicate
the error, I'll look into it further.  In case you're curious,
I've included the BasicSSCell.addReference() test program below
(it simply creates two datasets and adds them to a FancySSCell
using two separate DataReferences).

-Curtis

At 23:49 5/30/01, you wrote:
>Hi Curtis,
>
>To your first question, yes I call the setData() before adding the
>DataReferenceImpls to the display.
>To ensure that the error is not caused by my method, I changed my program to
>use a DisplayImplJ3D instead of the SSCell. It figures out that with the
>pure DisplayImplJ3D there are no problems. I can add all kinds of
>DataReferenceImpls in every combination to the DisplayImpl with my method.
>
>Thanks for your help, Mathias
>
>
>> Hi Mathias,
>>
>> My first question is, did you do DataReferenceImpl.setData() before adding
>> the DataReferenceImpls to the display?  If not, it would explain the "Data
>> is null" errors you are getting.  If you did call setData() first,
>however,
>> then it's probably a bug in BasicSSCell, and I'll look into it.
>>
>> -Curtis

------------------------
//
// SSDataRefTest.java
//

import java.awt.event.*;
import javax.swing.*;
import visad.*;
import visad.ss.FancySSCell;

public class SSDataRefTest {

  public static void main(String[] args) throws Exception {
    FancySSCell cell = new FancySSCell("Cell");
    cell.setDimension(FancySSCell.JAVA3D_3D);
    cell.setAutoDetect(false);
    JFrame frame = new JFrame("SSDataRefTest");
    JPanel p = new JPanel();
    frame.setContentPane(p);
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    p.add(cell);

    RealType[] types = {RealType.Latitude, RealType.Longitude};
    RealTupleType earth_location = new RealTupleType(types);
    RealType vis_radiance = new RealType("vis_radiance", null, null);
    RealType ir_radiance = new RealType("ir_radiance", null, null);
    RealType[] types2 = {vis_radiance, ir_radiance};
    RealTupleType radiance = new RealTupleType(types2);
    FunctionType image_tuple = new FunctionType(earth_location, radiance);

    int size = 64;
    FlatField imaget1 = FlatField.makeField(image_tuple, size, false);

    RealType c_radiance = new RealType("c_radiance", null, null);
    FunctionType image2_tuple = new FunctionType(earth_location, c_radiance);

    FlatField imaget2 = FlatField.makeField(image2_tuple, size, false);

    ScalarMap[] maps = {
      new ScalarMap(RealType.Latitude, Display.YAxis),
      new ScalarMap(RealType.Longitude, Display.XAxis),
      new ScalarMap(vis_radiance, Display.ZAxis),
      new ScalarMap(vis_radiance, Display.Green),
      new ScalarMap(c_radiance, Display.RGB)
    };
    cell.setMaps(maps);

    DataReferenceImpl ref1 = new DataReferenceImpl("ref1");
    ref1.setData(imaget1);
    ConstantMap[] cmaps = {
      new ConstantMap(0.5, Display.Blue),
      new ConstantMap(0.5, Display.Red)
    };
    cell.addReference(ref1, cmaps);

    DataReferenceImpl ref2 = new DataReferenceImpl("ref2");
    ref2.setData(imaget2);
    cell.addReference(ref2);

    frame.addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent e) { System.exit(0); }
    });
    frame.setSize(300, 300);
    frame.show();
  }

}


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