public boolean removeExtent(GeoExtent region){
  boolean ret=false;
  BoundingCircle bc=region.getBoundingCircle();
  if (bc == null) {
    return discarded.remove(region);
  }
  Geo center=bc.getCenter();
  double clon=center.getLongitude();
  double clat=center.getLatitude();
  double rnm=Geo.nm(bc.getRadius());
  if ((clat == 90.0 && clon == -180.0) || rnm >= 90 * 60) {
    discarded.remove(region);
  }
 else {
    all.remove(region);
    double latfactor=Geo.npdAtLat(clat);
    if (latfactor == 0) {
      ret=ret || polar.remove(region);
    }
 else {
      double xd=(rnm + margin) / latfactor;
      if (xd >= 45) {
        ret=ret || polar.remove(region);
      }
 else {
        double[] lons=normalizeLons(new double[]{clon - xd,clon + xd});
        int lb=bucketFor(lons[0]);
        int rb=bucketFor(lons[1]);
        if (rb < lb)         rb+=nbuckets;
        for (int i=lb; i <= rb; i++) {
          int x=i % nbuckets;
          Collection b=buckets[x];
          if (b != null) {
            ret=ret || b.remove(region);
            if (b.isEmpty()) {
              buckets[x]=null;
            }
          }
        }
      }
    }
  }
  return ret;
}

public boolean removeExtent ( GeoExtent region ) { boolean ret = false ; BoundingCircle bc = region . getBoundingCircle ( ) ; if ( bc == null ) { return discarded . remove ( region ) ; } Geo center = bc . getCenter ( ) ; double clon = center . getLongitude ( ) ; double clat = center . getLatitude ( ) ; double rnm = Geo . nm ( bc . getRadius ( ) ) ; if ( ( clat == 90.0 && clon == - 180.0 ) || rnm >= 90 * 60 ) { discarded . remove ( region ) ; } else { all . remove ( region ) ; double latfactor = Geo . npdAtLat ( clat ) ; if ( latfactor == 0 ) { ret = ret || polar . remove ( region ) ; } else { double xd = ( rnm + margin ) / latfactor ; if ( xd >= 45 ) { ret = ret || polar . remove ( region ) ; } else { double [ ] lons = normalizeLons ( new double [ ] { clon - xd , clon + xd } ) ; int lb = bucketFor ( lons [ 0 ] ) ; int rb = bucketFor ( lons [ 1 ] ) ; if ( rb < lb ) rb += nbuckets ; for ( int i = lb ; i <= rb ; i ++ ) { int x = i % nbuckets ; Collection b = buckets [ x ] ; if ( b != null ) { ret = ret || b . remove ( region ) ; if ( b . isEmpty ( ) ) { buckets [ x ] = null ; } } } } } } return ret ; }
method to call to remove a region from the index .
