/* VisAD Tutorial Copyright (C) 2000 Ugo Taddei */ package tutorial.s5; // Import needed classes import visad.*; import visad.java2d.DisplayImplJ2D; import java.rmi.RemoteException; import java.awt.*; import javax.swing.*; /** VisAD Tutorial example 5_01 A simple sine curve, but this time animated. Run program with java P5_01 * */ public class P5_01{ // Declare variables // The quantities to be displayed in x- and y-axes private RealType length, amplitude; // The function amplitude = f(length) // as ( length -> amplitude ) private FunctionType func_len_amp; // Our Data values for length are represented by the set private Set lengthSet; // The Data class FlatField, which will hold data. private FlatField amp_len_ff; // The DataReference from the data to display private DataReferenceImpl amp_len_ref; // The 2D display, and its the maps private DisplayImpl display; private ScalarMap lenXMap, ampYMap, ampRGBMap; public P5_01 (String[] args) throws RemoteException, VisADException { // Create the quantities length = RealType.getRealType("length", SI.meter, null); amplitude = RealType.getRealType("amplitude", SI.meter, null); // Create the function func_len_amp = new FunctionType(length,amplitude); // Create the domain (length) set int nSamples = 32; lengthSet = new Linear1DSet(length, -3.0, 3.0, nSamples); // Values for amplitude are in an array like float[ rangeDim ][ nSamples] float[][] ampVals = new float[1][nSamples]; // Get the lengthtime values in the domain set to help with the calculations // "flase" means we don't get a copy from the samples float[][] lenVals = lengthSet.getSamples( false ); // Create some amplitude values: for(int i=0;i