20001027: Display stuff

>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

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 

>- 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
                 0.0, 0.0, 0.0, factor, 0.0, 0.0, 0.0);
                 scaleMatrix, currentMatrix);
        try {
        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, currentMatrix);
        try {
        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:


and run:

java -cp metapps.jar;auxdata.jar;visad.jar 

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 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/

  • 2000 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: