/*
VisAD system for interactive analysis and visualization of numerical
data. Copyright (C) 1996 - 2017 Bill Hibbard, Curtis Rueden, Tom
Rink, Dave Glowacki, Steve Emmerson, Tom Whittaker, Don Murray, and
Tommy Jasmin.
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
*/
import java.awt.Component;
import java.rmi.RemoteException;
import visad.*;
import visad.java3d.DisplayImplJ3D;
import visad.util.SelectRangeWidget;
public class Test21
extends UISkeleton
{
private boolean texture;
public Test21() { }
public Test21(String[] args)
throws RemoteException, VisADException
{
super(args);
}
DisplayImpl[] setupServerDisplays()
throws RemoteException, VisADException
{
DisplayImpl[] dpys = new DisplayImpl[1];
dpys[0] = new DisplayImplJ3D("display", DisplayImplJ3D.APPLETFRAME);
return dpys;
}
public void initializeArgs() { texture = false; }
public int checkKeyword(String testName, int argc, String[] args)
{
texture = true;
return 1;
}
void setupServerData(LocalDisplay[] dpys)
throws RemoteException, VisADException
{
RealType[] types = {RealType.XAxis, RealType.YAxis};
RealTupleType earth_location = new RealTupleType(types);
RealType vis_radiance = RealType.getRealType("vis_radiance");
RealType ir_radiance = RealType.getRealType("ir_radiance");
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);
dpys[0].addMap(new ScalarMap(RealType.XAxis, Display.YAxis));
dpys[0].addMap(new ScalarMap(RealType.YAxis, Display.XAxis));
dpys[0].addMap(new ScalarMap(vis_radiance, Display.ZAxis));
dpys[0].addMap(new ScalarMap(vis_radiance, Display.Green));
dpys[0].addMap(new ConstantMap(0.5, Display.Blue));
dpys[0].addMap(new ConstantMap(0.5, Display.Red));
// dpys[0].addMap(new ConstantMap(0.25, Display.Alpha));
ScalarMap range1map = new ScalarMap(ir_radiance, Display.SelectRange);
dpys[0].addMap(range1map);
GraphicsModeControl mode = dpys[0].getGraphicsModeControl();
mode.setPointSize(2.0f);
mode.setPointMode(false);
mode.setMissingTransparent(true);
mode.setTextureEnable(texture);
DataReferenceImpl ref_imaget1 = new DataReferenceImpl("ref_imaget1");
ref_imaget1.setData(imaget1);
dpys[0].addReference(ref_imaget1, null);
}
String getFrameTitle() { return "VisAD select range slider"; }
Component getSpecialComponent(LocalDisplay[] dpys)
throws RemoteException, VisADException
{
ScalarMap range1map = (ScalarMap )dpys[0].getMapVector().lastElement();
return new SelectRangeWidget(range1map);
}
public String toString() { return " texture: SelectRange and SelectRangeWidget"; }
public static void main(String[] args)
throws RemoteException, VisADException
{
new Test21(args);
}
}