public boolean addExtent(GeoExtent extent){
  boolean ret=false;
  try {
    BoundingCircle bc=extent.getBoundingCircle();
    if (bc == null) {
      discarded.add(extent);
      return false;
    }
    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.add(extent);
    }
 else {
      all.add(extent);
      double latfactor=Geo.npdAtLat(clat);
      if (latfactor == 0) {
        polar.add(extent);
        ret=true;
      }
 else {
        double xd=(rnm + margin) / latfactor;
        if (xd >= 45) {
          polar.add(extent);
          ret=true;
        }
 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) {
              b=makeBucket(5);
              buckets[x]=b;
            }
            b.add(extent);
            ret=true;
          }
        }
      }
    }
  }
 catch (  Exception e) {
  }
  return ret;
}

public boolean addExtent ( GeoExtent extent ) { boolean ret = false ; try { BoundingCircle bc = extent . getBoundingCircle ( ) ; if ( bc == null ) { discarded . add ( extent ) ; return false ; } 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 . add ( extent ) ; } else { all . add ( extent ) ; double latfactor = Geo . npdAtLat ( clat ) ; if ( latfactor == 0 ) { polar . add ( extent ) ; ret = true ; } else { double xd = ( rnm + margin ) / latfactor ; if ( xd >= 45 ) { polar . add ( extent ) ; ret = true ; } 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 ) { b = makeBucket ( 5 ) ; buckets [ x ] = b ; } b . add ( extent ) ; ret = true ; } } } } } catch ( Exception e ) { } return ret ; }
method to call to add region object with boundingcircle to collection and organize it for later retrieval .
