public void adjustTransformation(double minXW,double minYW,double maxXW,double maxYW){
  double scaleX=1f;
  double scaleY=1f;
  if (maxXW > minXW)   scaleX=(getWidth() - borderLeft - borderRight) / (maxXW - minXW);
  if (maxYW > minYW)   scaleY=(getHeight() - borderTop - borderBottom) / (maxYW - minYW);
  offsetX=-minXW;
  offsetY=-minYW;
  scale=Math.min(scaleX,scaleY);
}

public void adjustTransformation ( double minXW , double minYW , double maxXW , double maxYW ) { double scaleX = 1f ; double scaleY = 1f ; if ( maxXW > minXW ) scaleX = ( getWidth ( ) - borderLeft - borderRight ) / ( maxXW - minXW ) ; if ( maxYW > minYW ) scaleY = ( getHeight ( ) - borderTop - borderBottom ) / ( maxYW - minYW ) ; offsetX = - minXW ; offsetY = - minYW ; scale = Math . min ( scaleX , scaleY ) ; }
specifies a bounding box in world coordinates . the resulting transformation is able to display everything within this bounding box without scrolling .
