cdm/src/main/java/ucar/unidata/geoloc/ProjectionImpl.java
public ProjectionRect latLonToProjBB(LatLonRect latlonRect) {
    if (isLatLon) {
      LatLonProjection llp = (LatLonProjection) this;
      llp.setCenterLon(latlonRect.getCenterLon()); // LOOK side effect BAD !!
    }

    ProjectionPointImpl w1 = new ProjectionPointImpl();
    ProjectionPointImpl w2 = new ProjectionPointImpl();

    LatLonPoint ll = latlonRect.getLowerLeftPoint();
    LatLonPoint ur = latlonRect.getUpperRightPoint();
    latLonToProj(ll, w1);
    latLonToProj(ur, w2);

    //if (!isLatLon && crossSeam(w1, w2)) {
    //  log.warn("CROSS SEAM failure=" + w1 + " " + w2+" for "+this, new Throwable());
    //}

    // make bounding box out of those two corners
    ProjectionRect world = new ProjectionRect(w1.getX(), w1.getY(), w2.getX(), w2.getY());

    LatLonPointImpl la = new LatLonPointImpl();
    LatLonPointImpl lb = new LatLonPointImpl();

    // now extend if needed to the other two corners
    la.setLatitude(ur.getLatitude());
    la.setLongitude(ll.getLongitude());
    latLonToProj(la, w1);
    world.add(w1);

    lb.setLatitude(ll.getLatitude());
    lb.setLongitude(ur.getLongitude());
    latLonToProj(lb, w2);
    world.add(w2);

    return world;
  }
public ProjectionRect latLonToProjBB(LatLonRect latlonRect) {
    if (isLatLon) {
      LatLonProjection llp = (LatLonProjection) this;
      llp.setCenterLon(latlonRect.getCenterLon()); // LOOK side effect BAD !!
    }

    ProjectionPointImpl w1 = new ProjectionPointImpl();
    ProjectionPointImpl w2 = new ProjectionPointImpl();

    LatLonPoint ll = latlonRect.getLowerLeftPoint();
    LatLonPoint ur = latlonRect.getUpperRightPoint();
    latLonToProj(ll, w1);
    latLonToProj(ur, w2);

    //if (!isLatLon && crossSeam(w1, w2)) {
    //  log.warn("CROSS SEAM failure=" + w1 + " " + w2+" for "+this, new Throwable());
    //}

    // make bounding box out of those two corners
    ProjectionRect world = new ProjectionRect(w1.getX(), w1.getY(), w2.getX(), w2.getY());

    LatLonPointImpl la = new LatLonPointImpl();
    LatLonPointImpl lb = new LatLonPointImpl();

    // now extend if needed to the other two corners
    la.setLatitude(ur.getLatitude());
    la.setLongitude(ll.getLongitude());
    latLonToProj(la, w1);
    world.add(w1);

    lb.setLatitude(ll.getLatitude());
    lb.setLongitude(ur.getLongitude());
    latLonToProj(lb, w2);
    world.add(w2);

    return world;
  }
public ProjectionRect latLonToProjBB ( LatLonRect latlonRect ) { if ( isLatLon ) { LatLonProjection llp = ( LatLonProjection ) this ; llp . setCenterLon ( latlonRect . getCenterLon ( ) ) ; // LOOK side effect BAD !!
 } ProjectionPointImpl w1 = new ProjectionPointImpl ( ) ; ProjectionPointImpl w2 = new ProjectionPointImpl ( ) ; LatLonPoint ll = latlonRect . getLowerLeftPoint ( ) ; LatLonPoint ur = latlonRect . getUpperRightPoint ( ) ; latLonToProj ( ll , w1 ) ; latLonToProj ( ur , w2 ) ; //if (!isLatLon && crossSeam(w1, w2)) {
 //  log.warn("CROSS SEAM failure=" + w1 + " " + w2+" for "+this, new Throwable());
 //}
 // make bounding box out of those two corners
 ProjectionRect world = new ProjectionRect ( w1 . getX ( ) , w1 . getY ( ) , w2 . getX ( ) , w2 . getY ( ) ) ; LatLonPointImpl la = new LatLonPointImpl ( ) ; LatLonPointImpl lb = new LatLonPointImpl ( ) ; // now extend if needed to the other two corners
 la . setLatitude ( ur . getLatitude ( ) ) ; la . setLongitude ( ll . getLongitude ( ) ) ; latLonToProj ( la , w1 ) ; world . add ( w1 ) ; lb . setLatitude ( ll . getLatitude ( ) ) ; lb . setLongitude ( ur . getLongitude ( ) ) ; latLonToProj ( lb , w2 ) ; world . add ( w2 ) ; return world ; }
Convert a lat/lon bounding box to a world coordinate bounding box,
by finding the minimum enclosing box.
Handles lat/lon points that do not intersect the projection panel.

@param latlonRect input lat,lon bounding box
@return minimum enclosing box in world coordinates, or null if no part of the LatLonRect intersects the projection plane
Convert a lat / lon bounding box to a world coordinate bounding box by finding the minimum enclosing box . Handles lat / lon points that do not intersect the projection panel .