p.s., Re: Help with ProjectionControl

John, clearly from your code you'd like a systematic solution.
To figure out why outputWidth and outputHeight are giving you
the wrong aspect, you'll just have to trace through everything:
1. Are these values really the size of the window?
2. Is the VisAD box the size you'd expect?
3. Is the VisAD box truly square, on your system, with no call
to setAspectCartesian()?

Good luck, Bill

On Wed, 18 Aug 2004, Bill Hibbard wrote:

> Hi John,
>
> This is a messy problem easiest handled by trial and error.
> Based on your fdr1.png image, it looks like you need to make
> a small adjustment to the values you are passing
> to setAspectCartesian(), to make the box a little wider.
>
> Good luck,
> Bill
>
> On Tue, 17 Aug 2004, John C Cartwright wrote:
>
> > Hello All,
> >
> > I'm having some trouble creating the images that I need and would
> > greatly appreciate a little direction.
> >
> > My objective is to render an image where the data completely fills the
> > image - no borders, axes, etc.
> >
> > I have attempted to do this with the ProjectionControl#setMatrix to
> > "zoom-in" so that the data display area fills the image.  Problem with
> > this approach is that the matrix values that I'm using are empirically
> > determined and when the desired out image aspect ratio changes, I no
> > longer get the desired results.
> >
> > Is there a (better) way to avoid getting the background? Or is there a
> > way that I can calculate the matrix values based on desired image size?
> >
> > listed below is the pertinent section of code. Attached are two images:
> > the first with the setMatrix() call enabled, the second without.
> >
> > Thanks for your help!
> >
> >
> > -- john
> >
> >
> >                  // zoom to get rid of black border
> >                  ProjectionControl pc = display.getProjectionControl();
> >                  double[] matrix = pc.getMatrix();
> >
> >                  // this number is empirically derived
> >                  double[] mult = display.make_matrix(0.0, 0.0, 0.0,
> > 1.515, 0.0, 0.0, 0.0);
> >                  pc.setMatrix(display.multiply_matrix(mult, matrix));
> >
> >                  //set aspect ratio based on image size. Assumes
> > geographic envelope
> >                  //has already been adjusted to accomodate the ratio
> >                  double[] aspect = new double[2];  //width,height
> >                  if (outputWidth > outputHeight) {
> >                     aspect[0] = outputWidth / outputHeight;
> >                     aspect[1] = 1.0;
> >                  } else {
> >                     aspect[0] = 1;
> >                     aspect[1] = outputHeight / outputWidth;
> >                  }
> >                  log.debug("aspect set to: "+aspect[0]+","+aspect[1]);
> >                  pc.setAspectCartesian(aspect);
> >              }
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > ====================================================
> > John Cartwright
> > Associate Scientist
> > Geospatial Data Services Group
> > CIRES, National Geophysical Data Center/NOAA
> > (303) 497-6284
> > John.C.Cartwright@xxxxxxxx
> > ====================================================
> >
> >
>
>