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.
>From: Paul Gifford <pgg@xxxxxxxxxxxxx> >Organization: NOAA/NGDC >Keywords: 200010271635.e9RGZK409722 Hi Paul- > - I use setScalarName() to get nice descriptions along the axes. >However, when I examine the values by holding down both left and right >buttons, the not-nice "internal" name is displayed in the upper left of >the display. Is there any way to get the nice description up there >instead? The best bet is to not use the in-display printouts, but to turn that off and use your own custom widgets to display values. See comments below. >- I would like to zoom in on the display. I know I can shift-left drag >but what I had in mind is drawing a box over the display and having the >display zoom to the selection (changing the ranges). Anyone have any >starting suggestions on this? Hopefully the ideas won't involve >Test27...no matter how I run that test (different JDKs, in or out of >devel environment) it brings certain death to my machine and I have to >hit the reset button... While it's not in core VisAD, Unidata has developed some classes that do this to some degree. Basically, I created zoom and translate methods in a wrapper class for a VisAD display. Zoom and translate look like: /** * Zoom in on the display * * @param factor zoom factor * ( > 1 = zoom in, 1 > zoom > 0 = zoom out). using * 2.0 and .5 seems to work well. */ public void zoom(double factor) { double[] currentMatrix = projControl.getMatrix(); double[] scaleMatrix mouseBehavior.make_matrix( 0.0, 0.0, 0.0, factor, 0.0, 0.0, 0.0); scaleMatrix mouseBehavior.multiply_matrix( scaleMatrix, currentMatrix); try { projControl.setMatrix(scaleMatrix); } catch (Exception e) { e.printStackTrace(); } } /** * Translate (X,Y position) of the display * * @param xFactor X translation factor * @param yFactor Y translation factor */ public void translate(double xFactor, double yFactor) { double[] currentMatrix = projControl.getMatrix(); double[] translateMatrix mouseBehavior.make_translate(xFactor, yFactor); translateMatrix mouseBehavior.multiply_matrix( translateMatrix, currentMatrix); try { projControl.setMatrix(translateMatrix); } catch (Exception e) { e.printStackTrace(); } } You can see this code in action if you download the metapps.jar, and auxdata.jar file from the Unidata page: http://www.unidata.ucar.edu/community/committees/metapps/SoftwareDownload.html and run: java -cp metapps.jar;auxdata.jar;visad.jar ucar.unidata.view.geoloc.MapProjectionDisplay Zooming can be accomplished by drawing a rubberband box with the right mouse button (manipulation button). Panning is done is the standard VisAD way. The code to figure out how much to pan and zoom based on the rubber band box is ugly, but is basically what's done in visad.MouseHelper. This example also has a readout of lat,lon points as you drag MB2 around which addresses your first request. Source code for these classes is available on the same download page above. It is licensed under the LGPL (same as VisAD) and is freely available. Don ************************************************************* Don Murray UCAR Unidata Program dmurray@xxxxxxxxxxxxxxxx P.O. Box 3000 (303) 497-8628 Boulder, CO 80307 ************************************************************* Unidata WWW Server http://www.unidata.ucar.edu/ McIDAS Demonstration Machine http://mcdemo.unidata.ucar.edu/ *************************************************************
visad
archives: