public void adjustTransformation(BoundingBox bb,int viewWidth,int viewHeight){
  if (bb != null) {
    lonCorr=(float)Math.cos((bb.getLatMax() + bb.getLatMin()) / 360.0 * Math.PI);
    float scaleX=1f;
    float scaleY=1f;
    if (bb.getLonMax() > bb.getLonMin())     scaleX=viewWidth / ((bb.getLonMax() - bb.getLonMin()) * lonCorr);
    if (bb.getLatMax() > bb.getLatMin())     scaleY=viewHeight / (bb.getLatMax() - bb.getLatMin());
    dotsPerDeg=Math.max(scaleX,scaleY);
    originLon=bb.getLonMin();
    originLat=bb.getLatMax();
    originLon+=(bb.getLonMax() - lon(viewWidth)) / 2.0;
    originLat+=(bb.getLatMin() - lat(viewHeight)) / 2.0;
  }
 else {
    lonCorr=1.0f;
    dotsPerDeg=100;
    originLon=0;
    originLat=0;
  }
}

public void adjustTransformation ( BoundingBox bb , int viewWidth , int viewHeight ) { if ( bb != null ) { lonCorr = ( float ) Math . cos ( ( bb . getLatMax ( ) + bb . getLatMin ( ) ) / 360.0 * Math . PI ) ; float scaleX = 1f ; float scaleY = 1f ; if ( bb . getLonMax ( ) > bb . getLonMin ( ) ) scaleX = viewWidth / ( ( bb . getLonMax ( ) - bb . getLonMin ( ) ) * lonCorr ) ; if ( bb . getLatMax ( ) > bb . getLatMin ( ) ) scaleY = viewHeight / ( bb . getLatMax ( ) - bb . getLatMin ( ) ) ; dotsPerDeg = Math . max ( scaleX , scaleY ) ; originLon = bb . getLonMin ( ) ; originLat = bb . getLatMax ( ) ; originLon += ( bb . getLonMax ( ) - lon ( viewWidth ) ) / 2.0 ; originLat += ( bb . getLatMin ( ) - lat ( viewHeight ) ) / 2.0 ; } else { lonCorr = 1.0f ; dotsPerDeg = 100 ; originLon = 0 ; originLat = 0 ; } }
adjusts the transformation with respect to a given world coordinate bounding box .
