public synchronized OMGraphicList prepare(){
  if (spatialIndexes == null || spatialIndexes.isEmpty()) {
    logger.fine(getName() + ": spatialIndexes is empty!");
    return new OMGraphicList();
  }
  Projection projection=getProjection();
  if (projection == null) {
    logger.fine(getName() + ": prepare called with null projection");
    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 masterList=new OMGraphicList();
  OMGraphicList list=null;
  if (ProjMath.isCrossingDateline(ulLon,lrLon,projection.getScale())) {
    if (logger.isLoggable(Level.FINE)) {
      logger.fine(getName() + ": Dateline is on screen");
    }
    double ymin=Math.min(ulLat,lrLat);
    double ymax=Math.max(ulLat,lrLat);
    Iterator<SpatialIndexHandler> sii=spatialIndexes.iterator();
    while (sii.hasNext()) {
      SpatialIndexHandler sih=(SpatialIndexHandler)sii.next();
      if (!sih.enabled)       continue;
      try {
        list=sih.getGraphics(ulLon,ymin,180.0d,ymax,list,projection);
        list=sih.getGraphics(-180.0d,ymin,lrLon,ymax,list,projection);
      }
 catch (      java.io.IOException ex) {
        ex.printStackTrace();
      }
catch (      FormatException fe) {
        fe.printStackTrace();
      }
      masterList.add(list);
    }
  }
 else {
    double xmin=(double)Math.min(ulLon,lrLon);
    double xmax=(double)Math.max(ulLon,lrLon);
    double ymin=(double)Math.min(ulLat,lrLat);
    double ymax=(double)Math.max(ulLat,lrLat);
    Iterator<SpatialIndexHandler> sii=spatialIndexes.iterator();
    while (sii.hasNext()) {
      SpatialIndexHandler sih=(SpatialIndexHandler)sii.next();
      if (!sih.enabled)       continue;
      if (logger.isLoggable(Level.FINE)) {
        logger.fine(getName() + ": Getting graphics from " + sih.prettyName+ " spatial index");
      }
      try {
        list=sih.getGraphics(xmin,ymin,xmax,ymax,list,projection);
      }
 catch (      java.io.IOException ex) {
        ex.printStackTrace();
      }
catch (      FormatException fe) {
        fe.printStackTrace();
      }
      masterList.add(list);
    }
  }
  return masterList;
}

public synchronized OMGraphicList prepare ( ) { if ( spatialIndexes == null || spatialIndexes . isEmpty ( ) ) { logger . fine ( getName ( ) + ": spatialIndexes is empty!" ) ; return new OMGraphicList ( ) ; } Projection projection = getProjection ( ) ; if ( projection == null ) { logger . fine ( getName ( ) + ": prepare called with null projection" ) ; 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 masterList = new OMGraphicList ( ) ; OMGraphicList list = null ; if ( ProjMath . isCrossingDateline ( ulLon , lrLon , projection . getScale ( ) ) ) { if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( getName ( ) + ": Dateline is on screen" ) ; } double ymin = Math . min ( ulLat , lrLat ) ; double ymax = Math . max ( ulLat , lrLat ) ; Iterator < SpatialIndexHandler > sii = spatialIndexes . iterator ( ) ; while ( sii . hasNext ( ) ) { SpatialIndexHandler sih = ( SpatialIndexHandler ) sii . next ( ) ; if ( ! sih . enabled ) continue ; try { list = sih . getGraphics ( ulLon , ymin , 180.0d , ymax , list , projection ) ; list = sih . getGraphics ( - 180.0d , ymin , lrLon , ymax , list , projection ) ; } catch ( java . io . IOException ex ) { ex . printStackTrace ( ) ; } catch ( FormatException fe ) { fe . printStackTrace ( ) ; } masterList . add ( list ) ; } } else { double xmin = ( double ) Math . min ( ulLon , lrLon ) ; double xmax = ( double ) Math . max ( ulLon , lrLon ) ; double ymin = ( double ) Math . min ( ulLat , lrLat ) ; double ymax = ( double ) Math . max ( ulLat , lrLat ) ; Iterator < SpatialIndexHandler > sii = spatialIndexes . iterator ( ) ; while ( sii . hasNext ( ) ) { SpatialIndexHandler sih = ( SpatialIndexHandler ) sii . next ( ) ; if ( ! sih . enabled ) continue ; if ( logger . isLoggable ( Level . FINE ) ) { logger . fine ( getName ( ) + ": Getting graphics from " + sih . prettyName + " spatial index" ) ; } try { list = sih . getGraphics ( xmin , ymin , xmax , ymax , list , projection ) ; } catch ( java . io . IOException ex ) { ex . printStackTrace ( ) ; } catch ( FormatException fe ) { fe . printStackTrace ( ) ; } masterList . add ( list ) ; } } return masterList ; }
creates an omgraphiclist containing graphics from all spatialindex objects and shapefiles .
