NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Ko Ko, You message to the list bounced because it was too long (>40000 chars). It looked like the problem was a bunch of appended HTML. Probably some NT craziness. However, I am repeating your message because you found a bug in visad.bom.ShadowBarbRealTupleTypeJ3D, which I have fixed. You can get the fix at: ftp://www.ssec.wisc.edu/pub/visad-2.0/ShadowBarbRealTupleTypeJ3D.java Also, you might want to change: z_map.setRange(0.0,0.1); to something like: z_map.setRange(-1.0,1.0); Hopefully I will update the general source distribution pretty soon. CHeers, Bill Here's your message: Hello Visaders When I tried to stack up the flatfields on top of each other, they appeared on the same Z-Plane instead of appearing on different values of Z.I would appreciate if someone help to solve this problem. Ko Ko _____________________________________________________ import visad.*; import visad.util.*; import visad.data.mcidas.*; import visad.bom.BarbRendererJ3D; import visad.java2d.*; import visad.java3d.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.rmi.*; import javax.swing.border.*; import java.util.*; public class WindStacks { DisplayImpl display; final int numOfBarbSet = 2; ConstantMap [] red = new ConstantMap[4]; ConstantMap[] blue = new ConstantMap[4]; FunctionType timeBarb = null; Gridded2DSet latlonSet = null; float [][] data = null; float [][] latlon = { {-40.5f, -40.5f, -43.1f, -43.1f}, {145.5f, 148.4f, 145.5f, 148.4f} }; float[][] uvSet1 = { {-20.0f, 5.0f, -20.0f, 15.0f}, { 10.0f, 7.89f, 10.0f, -5.0f} }; float[][] uvSet2 = { {20.0f, -5.0f, 20.0f, -15.0f}, { 10.0f, 7.89f, 10.0f, -5.0f} }; public WindStacks() throws Exception { display = new DisplayImplJ3D("display"); display.getDisplayRenderer().setBackgroundColor(1.0f, 1.0f, 1.0f); DisplayRenderer dr = display.getDisplayRenderer(); dr.setCursorColor(0.0f,0.0f,0.0f); DataReferenceImpl ref = new DataReferenceImpl("image"); RealType [] time = {RealType.Time}; RealTupleType time_type = new RealTupleType(time); RealType uType = new RealType("U", CommonUnit.meterPerSecond, null); RealType vType = new RealType("V", CommonUnit.meterPerSecond, null); EarthVectorType uvType = new EarthVectorType(uType, vType); RealTupleType latlonType = new RealTupleType(RealType.Latitude, RealType.Longitude); FunctionType ftype = new FunctionType(latlonType, uvType); FunctionType timeBarb = new FunctionType(time_type,ftype); FlatField [] winds = new FlatField[numOfBarbSet]; red[0] = new ConstantMap(0.0, Display.Blue); red[1] = new ConstantMap(1.0, Display.Red); red[2] = new ConstantMap(0.0, Display.Green); red[3] = new ConstantMap(1.5, Display.LineWidth ); blue[0] = new ConstantMap(1.0, Display.Blue); blue[1] = new ConstantMap(0.0, Display.Red); blue[2] = new ConstantMap(0.0, Display.Green); blue[3] = new ConstantMap(2.0, Display.LineWidth ); for (int k=0; k<numOfBarbSet; k++) { latlonSet = null; latlonSet = new Gridded2DSet(latlonType, latlon, 4); winds[k] = new FlatField(ftype, latlonSet); if(k==0) winds[k].setSamples(uvSet1); else if(k==1) winds[k].setSamples(uvSet2); } Linear1DSet time_set = new Linear1DSet(time_type, 0.0, (double) (numOfBarbSet - 1.0), numOfBarbSet); FieldImpl barb_stacks = new FieldImpl(timeBarb,time_set); for(int x=0;x<numOfBarbSet;x++) barb_stacks.setSample(x,winds[x]); ref.setData(barb_stacks); ScalarMap latMap = new ScalarMap(RealType.Latitude, Display.YAxis); ScalarMap lonMap = new ScalarMap(RealType.Longitude, Display.XAxis); ScalarMap z_map = new ScalarMap(RealType.Time, Display.ZAxis); display.addMap(latMap); display.addMap(lonMap); display.addMap(z_map); latMap.setRange(-45, -39); lonMap.setRange(144, 150); z_map.setRange(0.0,0.1); ScalarMap uMap = new ScalarMap(uType,Display.Flow1X); ScalarMap vMap = new ScalarMap(vType,Display.Flow1Y); display.addMap(uMap); display.addMap(vMap); uMap.setRange(-1.0, 1.0); vMap.setRange(-1.0, 1.0); FlowControl fc = (FlowControl) vMap.getControl(); fc.setFlowScale(0.05f); BaseMapAdapter bma = new BaseMapAdapter("OUTLSUPW"); bma.setLatLonLimits(-48.0f,-9.0f,105.0f,165.0f); DataReference maplines_ref = new DataReferenceImpl("MapLines"); maplines_ref.setData(bma.getData() ); display.addReference( maplines_ref, blue); display.addReferences(new BarbRendererJ3D(),ref, red); System.out.println("Starting to render display"); JFrame frame = new JFrame("Wind Test"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); // create JPanel in JFrame JPanel main = new JPanel(); //main.setLayout(new BorderLayout()); frame.getContentPane().add(main); main.setLayout(new BoxLayout(main, BoxLayout.X_AXIS)); main.add(display.getComponent()); // frame.getContentPane().add(display.getComponent()); frame.pack(); frame.setVisible(true); } public static void main(String[] args) throws Exception { WindStacks tl = new WindStacks(); } } ---------------------------------------------------------- Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI 53706 hibbard@xxxxxxxxxxxxxxxxx 608-263-4427 fax: 608-263-6738 http://www.ssec.wisc.edu/~billh/vis.html
visad
archives: