public synchronized OMGraphicList prepare(){
  Projection projection=getProjection();
  boolean DEBUG_FINE=logger.isLoggable(Level.FINE);
  if (projection == null) {
    if (DEBUG_FINE) {
      logger.fine(getName() + ": prepare called with null projection");
    }
    return new OMGraphicList();
  }
  if (spatialIndex == null) {
    if (DEBUG_FINE) {
      logger.fine(getName() + ": spatialIndex is null!");
    }
    OMGraphicList list=getList();
    if (list != null) {
      list.generate(projection,true);
      return list;
    }
 else {
      return new OMGraphicList();
    }
  }
  Point2D ul=projection.getUpperLeft();
  Point2D lr=projection.getLowerRight();
  double ulLat=ul.getY();
  double ulLon=ul.getX();
  double lrLat=lr.getY();
  double lrLon=lr.getX();
  OMGraphicList list=new OMGraphicList();
  if (ProjMath.isCrossingDateline(ulLon,lrLon,projection.getScale())) {
    if (DEBUG_FINE) {
      logger.fine("ShapeLayer.computeGraphics(): Dateline is on screen");
    }
    double ymin=Math.min(ulLat,lrLat);
    double ymax=Math.max(ulLat,lrLat);
    try {
      list=spatialIndex.getOMGraphics(ulLon,ymin,180.0d,ymax,list,drawingAttributes,projection,coordTransform);
      list=spatialIndex.getOMGraphics(-180.0d,ymin,lrLon,ymax,list,drawingAttributes,projection,coordTransform);
    }
 catch (    InterruptedIOException iioe) {
      list=null;
    }
catch (    IOException ex) {
      if (DEBUG_FINE) {
        ex.printStackTrace();
      }
    }
catch (    FormatException fe) {
      if (DEBUG_FINE) {
        fe.printStackTrace();
      }
    }
catch (    NullPointerException npe) {
      if (DEBUG_FINE) {
        npe.printStackTrace();
      }
    }
  }
 else {
    double xmin=Math.min(ulLon,lrLon);
    double xmax=Math.max(ulLon,lrLon);
    double ymin=Math.min(ulLat,lrLat);
    double ymax=Math.max(ulLat,lrLat);
    try {
      list=spatialIndex.getOMGraphics(xmin,ymin,xmax,ymax,list,drawingAttributes,projection,coordTransform);
    }
 catch (    InterruptedIOException iioe) {
      list=null;
    }
catch (    java.io.IOException ex) {
      if (DEBUG_FINE) {
        ex.printStackTrace();
      }
    }
catch (    FormatException fe) {
      if (DEBUG_FINE) {
        fe.printStackTrace();
      }
    }
catch (    NullPointerException npe) {
      if (DEBUG_FINE) {
        npe.printStackTrace();
      }
    }
  }
  return list;
}

public synchronized OMGraphicList prepare ( ) { Projection projection = getProjection ( ) ; boolean DEBUG_FINE = logger . isLoggable ( Level . FINE ) ; if ( projection == null ) { if ( DEBUG_FINE ) { logger . fine ( getName ( ) + ": prepare called with null projection" ) ; } return new OMGraphicList ( ) ; } if ( spatialIndex == null ) { if ( DEBUG_FINE ) { logger . fine ( getName ( ) + ": spatialIndex is null!" ) ; } OMGraphicList list = getList ( ) ; if ( list != null ) { list . generate ( projection , true ) ; return list ; } else { return new OMGraphicList ( ) ; } } Point2D ul = projection . getUpperLeft ( ) ; Point2D lr = projection . getLowerRight ( ) ; double ulLat = ul . getY ( ) ; double ulLon = ul . getX ( ) ; double lrLat = lr . getY ( ) ; double lrLon = lr . getX ( ) ; OMGraphicList list = new OMGraphicList ( ) ; if ( ProjMath . isCrossingDateline ( ulLon , lrLon , projection . getScale ( ) ) ) { if ( DEBUG_FINE ) { logger . fine ( "ShapeLayer.computeGraphics(): Dateline is on screen" ) ; } double ymin = Math . min ( ulLat , lrLat ) ; double ymax = Math . max ( ulLat , lrLat ) ; try { list = spatialIndex . getOMGraphics ( ulLon , ymin , 180.0d , ymax , list , drawingAttributes , projection , coordTransform ) ; list = spatialIndex . getOMGraphics ( - 180.0d , ymin , lrLon , ymax , list , drawingAttributes , projection , coordTransform ) ; } catch ( InterruptedIOException iioe ) { list = null ; } catch ( IOException ex ) { if ( DEBUG_FINE ) { ex . printStackTrace ( ) ; } } catch ( FormatException fe ) { if ( DEBUG_FINE ) { fe . printStackTrace ( ) ; } } catch ( NullPointerException npe ) { if ( DEBUG_FINE ) { npe . printStackTrace ( ) ; } } } else { double xmin = Math . min ( ulLon , lrLon ) ; double xmax = Math . max ( ulLon , lrLon ) ; double ymin = Math . min ( ulLat , lrLat ) ; double ymax = Math . max ( ulLat , lrLat ) ; try { list = spatialIndex . getOMGraphics ( xmin , ymin , xmax , ymax , list , drawingAttributes , projection , coordTransform ) ; } catch ( InterruptedIOException iioe ) { list = null ; } catch ( java . io . IOException ex ) { if ( DEBUG_FINE ) { ex . printStackTrace ( ) ; } } catch ( FormatException fe ) { if ( DEBUG_FINE ) { fe . printStackTrace ( ) ; } } catch ( NullPointerException npe ) { if ( DEBUG_FINE ) { npe . printStackTrace ( ) ; } } } return list ; }
create the omgraphics using the shape file and spatialindex .
