Gridded2DSet

Hi Bill and others,

due to your suggestion I tried to use Gridded2DSet.
I am not sure if I am using it correctly:

public void makeSurface() {

        eastValues = RealType.getRealType("eastValues");
        northValues = RealType.getRealType("northValues");
        heightValues = RealType.getRealType("heightValues");
        
        try {
            domain_tuple = new RealTupleType(northValues,eastValues);
            // Create a FunctionType (domain_tuple -> range_tuple);
            func_en_h = new FunctionType(domain_tuple, heightValues);
            
            // in this case not rectangular
            // numsamples = linecounter
            domain_set = new
Gridded2DDoubleSet(domain_tuple,coords,east.length); 

            // Get the Set samples to facilitate the calculations
            //float[][] set_samples = domain_set.getSamples( true );
            
            // We create another array, with the same number of elements
of
            // altitude and temperature, but organized as 
            float[][] flat_samples = new float[1][height.length]; 
            
            for (int n=0;n<height.length;n++) {
                flat_samples[0][n]=height[n];
            }

            // Create a FlatField  
            // Use FlatField(FunctionType type, Set domain_set)    
            vals_ff = new FlatField( func_en_h, domain_set);
            
            // ...and put the values above into it
            // Note the argument false, meaning that the array won't be
copied 
            vals_ff.setSamples( flat_samples , false ); 

            // Create Display and its maps    
            // A 2D display    
            display = new DisplayImplJ3D("display1");    
            
            // Create the ScalarMaps: latitude to XAxis, longitude to
YAxis and
            // altitude to RGB and temperature to IsoContour
            // Use ScalarMap(ScalarType scalar, DisplayRealType
display_scalar) 
            eastMap = new ScalarMap( eastValues, Display.YAxis );
            northMap = new ScalarMap( northValues, Display.XAxis );    
            heightMap = new ScalarMap(heightValues,Display.ZAxis);

            eastMap.setRange(-1.0, 1.0);
            northMap.setRange(-1.0, 1.0);
            heightMap.setRange(-1.0, 1.0);

            
            // Add maps to display
            display.addMap( eastMap );
            display.addMap( northMap );    
            display.addMap( heightMap );

            // Create a data reference and set the FlatField as our data 
            data_ref = new DataReferenceImpl("data_ref");
            data_ref.setData( vals_ff );
            renderer = new DefaultRendererJ3D();
            
            // Add reference to display
            display.addReferences(renderer,data_ref);
            display.addDisplayListener(listener);

            // Create application window and add display to window
            /*
            JFrame jframe = new JFrame("VisAD Fenster");
            jframe.getContentPane().add(display.getComponent());        
            // Set window size and make it visible
            jframe.setSize(300, 300);
            jframe.setVisible(true);        
            */
            // Change [Mon May 28 15:23:31 2001]hilbring:
        }
        catch (VisADException ve) {
            System.out.println("VisADException");
            System.out.println(ve.getMessage());
        }       
        catch (RemoteException re) {
            System.out.println("RemoteExcpetion");
            System.out.println(re.getMessage());
        }
    }

This codes results in an NullpointerException, which I can not find in my
code:

Loading DGM ...
lc 25
hl 25
nCols 9 nRows 5
GIS3DService: DGM loaded successfully!
java.lang.NullPointerException
        at visad.Unit.convertTuple(Unit.java:65)
        at
visad.ShadowFunctionOrSetType.doTransform(ShadowFunctionOrSetType.jav
a:1146)
        at
visad.java3d.ShadowFunctionOrSetTypeJ3D.doTransform(ShadowFunctionOrS
etTypeJ3D.java:101)
        at
visad.java3d.DefaultRendererJ3D.doTransform(DefaultRendererJ3D.java:9
8)
        at visad.java3d.RendererJ3D.doAction(RendererJ3D.java:185)
        at visad.DisplayImpl.doAction(DisplayImpl.java:1006)
        at visad.ActionImpl.run(ActionImpl.java:225)
        at visad.util.ThreadPool$ThreadMinnow.run(ThreadPool.java:86)


Thanks for your help in advance

Desiree

oooooooooooooooooooooooooooooooooooooooooooooooo
Desiree Hilbring

Institut fuer Photogrammetrie und Fernerkundung  
Universitaet Karlsruhe, Germany
email: hilbring@xxxxxxxxxxxxxxxxxxxx             
# 0721 6083676                                   
oooooooooooooooooooooooooooooooooooooooooooooooo



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