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.

Re: overlap MciDAS map file on a display?

Hi Helen-

Helen Yi wrote:

> I have a display in lat31-43 N)-lon(90 W -1 06W) domain , I like to
> overlap MciDAS map on my display and chop-off the map displayed
> outside my domain, that is, only show map information in my display
> domain (31-43N, 90W-106W).
> 
> I did the following  but the map shows beyond the display region (see
> the DISPLAY+MAP display at http://enso.larc.nasa.gov/~helen )
> 
> Is what I did wrong or I miss something?

As Mathias noted, you could use the setLatLonLimits method
of BaseMapAdapter, but this uses a crude algorithm to do the
clipping and must be called before you call the getData() method
of BMA.  A better solution is to use the clipping methods
in DataRendererJ*D.  Here is a snippet of code from one of
our classes that clips:

    /**
     * Enable clipping of data at the box edges
     * @param  clip  true to turn clipping on, otherwise off
     */
    public void enableClipping(boolean clip) {
       if (getDisplayMode() != MODE_2D) {
           DisplayRendererJ3D dr
               (DisplayRendererJ3D) getDisplay().getDisplayRenderer();
           try {
               dr.setClip(0, clip,  1.0f,  0.0f,  0.0f, -1.001f);
               dr.setClip(1, clip, -1.0f,  0.0f,  0.0f, -1.001f);
               dr.setClip(2, clip,  0.0f,  1.0f,  0.0f, -1.001f);
               dr.setClip(3, clip,  0.0f, -1.0f,  0.0f, -1.001f);
               // clipping on top and bottom of box - do not
               //dr.setClip(4, clip,  0.0f,  0.0f,  1.0f, -1.001f);
               //dr.setClip(5, clip,  0.0f,  0.0f, -1.0f, -1.001f);
           }
           catch (VisADException ve) {
               System.err.println("Couldn't set clipping " + ve);
           }
        } else {
           DisplayRendererJ2D dr2
               (DisplayRendererJ2D) getDisplay().getDisplayRenderer();
           if (clip) dr2.setClip(-1.0f, 1.0f, -1.0f, 1.0f);
        }
        clipping = clip;
    }

(getDisplay() is a method in this class that gets the VisAD
display in question).

Don
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************


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