//
// Swells.java
//
/*
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
/**
* Swells class for setting up display of swells
*/
package visad.bom;
import visad.*;
import visad.java3d.*;
import java.awt.event.*;
import javax.swing.*;
import java.rmi.RemoteException;
public class Swells extends Exception {
private static final int NDIRS = 721;
private static final int NHEIGHTS = 51;
// size scale for shapes
private static final float SIZE = 0.05f;
private static WindPolarCoordinateSystem wcs = null;
// four points of a zero-degree arrow in polar coordinates
private static float[][] arrow_zero =
{{0.0f, 0.0f, 7.0f, -7.0f}, {0.9f*SIZE, 1.9f*SIZE, 1.6f*SIZE, 1.6f*SIZE}};
/** set up ScalarMaps from swellDir and swellHeight to Display.Shape
in display; swellDir default Unit must be degree and swellHeight
default Unit must be meter */
public static void setupSwellDisplay(RealType swellDir, RealType swellHeight,
DisplayImpl display) throws VisADException, RemoteException {
if (wcs == null) wcs = new WindPolarCoordinateSystem();
if (!CommonUnit.degree.equals(swellDir.getDefaultUnit())) {
throw new UnitException("swellDir Unit must be degree");
}
if (!CommonUnit.meter.equals(swellHeight.getDefaultUnit())) {
throw new UnitException("swellHeight Unit must be meter");
}
// construct dir_set and dir_shapes
Linear1DSet dir_set = new Linear1DSet(swellDir, -360.0, 360.0, NDIRS);
float[][] dirs = dir_set.getSamples();
VisADGeometryArray[] dir_shapes = new VisADGeometryArray[NDIRS];
for (int i=0; i
Ads help maintain this website.