/* VisAD Tutorial Copyright (C) 2000 Ugo Taddei */ package tutorial.s5; // Import needed classes import visad.*; import visad.util.*; import visad.java2d.DisplayImplJ2D; import visad.java3d.DisplayImplJ3D; import java.rmi.RemoteException; import java.awt.*; import javax.swing.*; import java.util.Calendar; import java.util.GregorianCalendar; /** VisAD Tutorial example 5_07 Like example 5_06, but with a VisADSlider and a SelectValue map An animated surface with MathType ( time -> (( longitude, latitude ) -> ( altitude, temperature ) ) ) Run program with java P5_07 * */ public class P5_07{ // Declare variables // The RealTypes private RealType time, longitude, latitude; private RealType altitude, temperature; // The function // (( longitude, latitude ) -> ( altitude, temperature ) ) private FunctionType func_latlon_at; // The function // ( time -> ( ( longitude, latitude ) -> ( altitude, temperature ) ) ) private FunctionType func_t_latlon; // Our Data values for longitude, latitude are represented by the set private Set latlonSet; // Time values are given by the set by the set private Set timeSet; // The FlatField private FlatField latlon_at_ff; // A FieldImpl private FieldImpl timeField; // The DataReference from the data to display private DataReferenceImpl data_ref; // The 2D display, and its the maps private DisplayImpl display; private ScalarMap timeAnimMap, timeZMap, selValMap; private ScalarMap lonXMap, latYMap, altiZMap, temperRGBMap; // The VisADSlider private VisADSlider vSlider; //private AnimationWidget animWid; public P5_07 (String[] args) throws RemoteException, VisADException { // Create the quantities altitude = RealType.getRealType("altitude", SI.meter, null); temperature = RealType.getRealType("temperature", SI.kelvin, null); // The RealTypes above form a tuple RealTupleType altitemp = new RealTupleType(altitude, temperature); // The RealTypes for the 2D domain longitude = RealType.getRealType("longitude", SI.meter, null); latitude = RealType.getRealType("latitude", SI.meter, null); // The RealTypes above form a tuple RealTupleType latlon = new RealTupleType(longitude, latitude); time = RealType.getRealTypeByName("Time"); // Create the functions func_latlon_at = new FunctionType(latlon, altitemp); func_t_latlon = new FunctionType(time, func_latlon_at ); // Create the sets: one for lat, lon and the other for time int NCOLS = 50; int NROWS = NCOLS; // the domain set is now 2D latlonSet = new Linear2DSet(latlon, -Math.PI, Math.PI, NROWS, -Math.PI, Math.PI, NCOLS); // Time set int tSamples = 12; double startValue = 10.0; timeSet = new Linear1DSet(time, startValue, startValue + tSamples, tSamples); // Values for altitude and temperature will go into: double[][] flat_samples = new double[2][NCOLS * NROWS]; // Get the longitude and latitude values in the domain set to help with the calculations // "false" means we don't get a copy from the samples float[][] set_samples = latlonSet.getSamples( false ); // Create a FlatField latlon_at_ff = new FlatField( func_latlon_at, latlonSet); // ...and a FieldImpl timeField = new FieldImpl( func_t_latlon, timeSet); // loop for all time steps for(int t=0;t