Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
Hi Stu: On Fri, 17 Aug 2001, Stu Wier wrote: > Tom, > > > I might be naive, but I'd use a CellImpl to listen for changes in your > > sliceFF (or the user interface), and then inside its doAction() > > method, I'd get the data from sliceFF and make slide2D, as you described > > ...including a setData into the DataReference you're using for > > the 2D display. Does that make sense? > Thanks for the help. I have not used Cell or doAction at all, so > I will learn about it and look into it and tell you how it works. > Take a look at Test00.java. Also, here's a small example I put together for ABoM training: // import needed classes import visad.*; import visad.java2d.DisplayImplJ2D; import visad.java2d.DirectManipulationRendererJ2D; import java.rmi.RemoteException; import java.awt.*; import java.awt.event.*; import javax.swing.*; public class Dot { // type 'java Dot' to run this application public static void main(String args[]) throws VisADException, RemoteException { final RealType x = new RealType("x"); final RealType y = new RealType("y"); Real[] coord = new Real[] {new Real(x,.7), new Real(y,-.3)}; RealTuple coord_tuple = new RealTuple(coord); DisplayImpl disp = new DisplayImplJ2D("display"); ScalarMap sx = new ScalarMap(x, Display.XAxis); sx.setRange(-1.0, 1.0); disp.addMap(sx); ScalarMap sy = new ScalarMap(y, Display.YAxis); sy.setRange(-1.0, 1.0); disp.addMap(sy); DataReferenceImpl ref_coord_tuple = new DataReferenceImpl("ref_c_t"); ref_coord_tuple.setData(coord_tuple); GraphicsModeControl gmc = disp.getGraphicsModeControl(); gmc.setPointSize(5.f); gmc.setPointMode(true); // for simple dipslay, use //disp.addReference(ref_coord_tuple); // ...or...for interactive display, use disp.addReferences(new DirectManipulationRendererJ2D(), ref_coord_tuple); // to list out the values at the cursor final DisplayRenderer dr = disp.getDisplayRenderer(); CellImpl cell = new CellImpl() { public void doAction() throws VisADException { double xcoord = dr.getDirectAxisValue(x); double ycoord = dr.getDirectAxisValue(y); System.out.println("x,y ="+xcoord+" "+ycoord); } }; cell.addReference(ref_coord_tuple); // end of list out values addition... JFrame frame = new JFrame("Dot Application"); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) {System.exit(0);} }); // create JPanel in JFrame JPanel panel = new JPanel(); frame.getContentPane().add(disp.getComponent()); // set size of JFrame and make it visible frame.setSize(300, 300); frame.setVisible(true); } } And a similar example in the Jython tutorial: http://www.ssec.wisc.edu/~tomw/visadtutor/t7example.html (actually this will give you the flavor even if you're using that "other" J language...) Have a good weekend! tom -- Tom Whittaker (tomw@xxxxxxxxxxxxx) University of Wisconsin-Madison Space Science and Engineering Center Phone/Voicemail: 608/262-2759 Fax: 608/263-6738
visad
archives: