LatLonPoint ul = projection.getUpperLeft(); LatLonPoint lr = projection.getLowerRight(); float ulLat = ul.getLatitude(); float ulLon = ul.getLongitude(); float lrLat = lr.getLatitude(); float lrLon = lr.getLongitude();
if (projection == null) {      Debug.message("basic", "MultiShapeLayer|" + getName() + ": prepare called with null projection"); return new OMGraphicList(); }
    public OMGraphicList prepare() {	if (spatialIndexes == null || spatialIndexes.size() == 0) {	    Debug.message("shape", "MultiShapeLayer: spatialIndexes is empty!");	    return new OMGraphicList();	}	Projection projection = getProjection();	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 masterList = new OMGraphicList();	OMGraphicList list = null;	SpatialIndexHandler sih;	Iterator sii;	// 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("MultiShapeLayer.computeGraphics(): Dateline is on screen");	    }	    	    double ymin = (double) Math.min(ulLat, lrLat);	    double ymax = (double) Math.max(ulLat, lrLat);	    	    sii = spatialIndexes.iterator();	    while (sii.hasNext()) {		sih = (SpatialIndexHandler)sii.next();		if (!sih.enabled) continue;				try {		    list = sih.getGraphics(ulLon, ymin, 180.0d, ymax, list);		    list = sih.getGraphics(-180.0d, ymin, lrLon, ymax, list);		} 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);	    sii = spatialIndexes.iterator();	    while (sii.hasNext()) {		sih = (SpatialIndexHandler)sii.next();		if (!sih.enabled) continue;		if (Debug.debugging("shape")) {		    Debug.output("  Getting graphics from " + sih.prettyName + " spatial index");		}		try {		    list = sih.getGraphics(xmin, ymin, xmax, ymax, list);		} catch (java.io.IOException ex) {		    ex.printStackTrace();		} catch (FormatException fe) {		    fe.printStackTrace();		}		masterList.add(list);	    }	}	if (masterList != null) {	    masterList.generate(projection, true);//all new graphics	}	return masterList;    }