if (projection == null) { return new OMGraphicList(); }
if (projection == null) { Debug.message("basic", "ShapeLayer|" + getName() + ": prepare called with null projection"); return new OMGraphicList(); }
    public OMGraphicList prepare() {	if (spatialIndex == null) {	    Debug.message("shape", "ShapeLayer: spatialIndex is null!");	    return new OMGraphicList();	}	Projection projection = getProjection();	if (projection == null) {	    return new OMGraphicList();	}	LatLonPoint ul = projection.getUpperLeft();	LatLonPoint lr = projection.getLowerRight();	float ulLat = ul.getLatitude();	float ulLon = ul.getLongitude();	float lrLat = lr.getLatitude();	float lrLon = lr.getLongitude();	OMGraphicList list = null;	// check for dateline anomaly on the screen.  we check for	// ulLon >= lrLon, but we need to be careful of the check for	// equality because of floating point arguments...	if ((ulLon > lrLon) ||		MoreMath.approximately_equal(ulLon, lrLon, .001f))	{	    if (Debug.debugging("shape")) {		Debug.output("ShapeLayer.computeGraphics(): Dateline is on screen");	    }	    double ymin = (double) Math.min(ulLat, lrLat);	    double ymax = (double) Math.max(ulLat, lrLat);	    try {		ESRIRecord records1[] = spatialIndex.locateRecords(		    ulLon, ymin, 180.0d, ymax);		ESRIRecord records2[] = spatialIndex.locateRecords(		    -180.0d, ymin, lrLon, ymax);		int nRecords1 = records1.length;		int nRecords2 = records2.length;  		list = new OMGraphicList(nRecords1+nRecords2);		for (int i = 0; i < nRecords1; i++) {		    records1[i].addOMGraphics(list, drawingAttributes);		}		for (int i = 0; i < nRecords2; i++) {		    records2[i].addOMGraphics(list, drawingAttributes);		}	    } catch (java.io.IOException ex) {		ex.printStackTrace();	    } catch (FormatException fe) {		fe.printStackTrace();	    }	} 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);	    try {		ESRIRecord records[] = spatialIndex.locateRecords(		    xmin, ymin, xmax, ymax);		int nRecords = records.length;  		list = new OMGraphicList(nRecords);		for (int i = 0; i < nRecords; i++) {		    records[i].addOMGraphics(list, drawingAttributes);		}	    } catch (java.io.IOException ex) {		ex.printStackTrace();	    } catch (FormatException fe) {		fe.printStackTrace();	    }	}	if (list != null) {	    list.generate(projection, true);//all new graphics	}	return list;    }