[OpenMap Users] [PATCH] MultiShapeLayer.java

From: <MNewcomb@tacintel.com>
Date: Fri May 14 2004 - 15:55:14 EDT

Using MultiShapeLayer caused error when Views->Go Over
Data->'multi-shape-layer'.

- spatialIndexes is a collection of SpatialIndexHandler objects not
SpatialIndex objects (caused ClassCastException)
- box was always null (caused "can't move map over data" when
ClassCastException was fixed)

'cvs diff -u' was returning some weird stuff... So, here is the method to
patch:

Previous method:

***************************************
    public DataBounds getDataBounds() {
        DataBounds box = null;

        ESRIBoundingBox bounds = new ESRIBoundingBox();
        Iterator sii = spatialIndexes.iterator();
        while (sii.hasNext()) {
            SpatialIndex si = (SpatialIndex)sii.next();
            if (si != null) {
                ESRIBoundingBox boundingBox = spatialIndex.getBounds();
                if (bounds != null) {
                    bounds.addBounds(boundingBox);
                }
            }
        }
        return box;
    }
***************************************

New method:

***************************************
    public DataBounds getDataBounds() {
        ESRIBoundingBox bounds = new ESRIBoundingBox();
        Iterator sii = spatialIndexes.iterator();
        while (sii.hasNext()) {
            SpatialIndexHandler sih = (SpatialIndexHandler)sii.next();
            if (sih != null && sih.spatialIndex != null) {
                ESRIBoundingBox boundingBox = sih.spatialIndex.getBounds();
                if (bounds != null) {
                    bounds.addBounds(boundingBox);
                }
            }
        }
        return new DataBounds(bounds.min.x, bounds.min.y,
                              bounds.max.x, bounds.max.y);
    }
***************************************

Michael

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri May 14 15:56:07 2004

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT