Now that I have finally understood the Affine Transform operations
applied to the graphics2D object inside VisadCanvasJ2D, I can see that
if you do this
w = display's width
h = display's height
ProjectionControl pc = display.getProjectionControl();
double ax, ay;
if( w > h ) {
ax = (float)w / h;
ay = 1;
} else {
ay = (float)h / w;
ax = 1;
}
pc.setAspect( new double[] { ax * 0.5/0.33, ay * 0.5/0.33 } );
then the 'box' (display real type values -1 -> 1 ) will fill the display
component entirely, at least in the simple cases I have tested. There
may well be data-related times when this does not hold.
It appears to work since the idea is to get the final AT scaling and
translation both to 0.5 of the width (and height). The translation is
already set to 0.5, we just need the scale factor from above, which when
concatted to the 0.33 scaling AT in the canvas, results in a scale of
0.5 * width. Then x = -1 in visad coords maps to pixel 0, and 1 maps to
display width, so the box fills the display (??)
I thought this worth sharing, as I have seen requests for it in the past
on the mailing list
Stuart
==============================================================================
To unsubscribe visad, visit:
http://www.unidata.ucar.edu/mailing-list-delete-form.html
==============================================================================