[Fwd: Re: question on DisplayRendering]

John F Moses wrote:
> 
> Hello Folks,
> how can i set the default display size and still use the VisAD 2D
> implementation?  i'd like to set it at 360 by 180 (i,e, to depict a
> rectangular latlon grid rather than a square).
> 
> i'm having a little trouble understanding whether i can reference the
> setPreferredSize method in DisplayPanelJ2D.  is this possible?
> 

If you just use 'setSize(width, height)' the window size will change,
but the VisAD "box" will still be square.  In order to change the aspect
ratio of the box, you need to do what jmet.ShowNCEPModel does (this is
the 3D version).  

   private double[] pcMatrix;
....
   DisplayImpl di = new DisplayImplJ3D("display1");
   pc = di.getProjectionControl();

   // make the cube 95% the size of the window...for 'snapping' to
original 
   // remove perspective (vanishing point)
   pcMatrix = pc.getMatrix();
   pcMatrix[0] = .95;
   pcMatrix[5] = .95;
   pcMatrix[10] = .95;
   pc.setMatrix(pcMatrix);
....
      Dimension dim = ng.getDimension(); // returns #columns & # rows
....
      double aspect = ng.getAspect(); // returns aspect ratio of
row-to-column spacing
      aspect = aspect * ( (double)dim.width/(double)dim.height) ;
      if (aspect >= 1.0) {
        pcMatrix[0] = .95;
        pcMatrix[5] = .95/aspect;
      } else {
        pcMatrix[0] = .95 * aspect;
        pcMatrix[5] = .95;
      }

      pc.setMatrix(pcMatrix);

(I think these are all the parts -- it's been a while).

Hope that helps.

tom

-- 
Tom Whittaker (tomw@xxxxxxxxxxxxx)
University of Wisconsin-Madison
Space Science and Engineering Center
Phone/VoiceMail: 608/262-2759
Fax: 608/262-5974