Search in sources :

Example 26 with BoundingBoxDoubleXY

use of com.revolsys.geometry.model.impl.BoundingBoxDoubleXY in project com.revolsys.open by revolsys.

the class SpatialIndexTester method doTest.

private void doTest(final SpatialIndex<BoundingBox> index, final double queryEnvelopeExtent, final List<BoundingBox> sourceData) {
    int extraMatchCount = 0;
    int expectedMatchCount = 0;
    int actualMatchCount = 0;
    int queryCount = 0;
    for (int x = 0; x < CELL_EXTENT * CELLS_PER_GRID_SIDE; x += queryEnvelopeExtent) {
        for (int y = 0; y < CELL_EXTENT * CELLS_PER_GRID_SIDE; y += queryEnvelopeExtent) {
            final BoundingBox queryEnvelope = new BoundingBoxDoubleXY(x, y, x + queryEnvelopeExtent, y + queryEnvelopeExtent);
            final List<BoundingBox> expectedMatches = intersectingEnvelopes(queryEnvelope, sourceData);
            final List<BoundingBox> actualMatches = index.getItems(queryEnvelope);
            // expected value
            if (expectedMatches.size() > actualMatches.size()) {
                this.isSuccess = false;
            }
            extraMatchCount += actualMatches.size() - expectedMatches.size();
            expectedMatchCount += expectedMatches.size();
            actualMatchCount += actualMatches.size();
            compare(expectedMatches, actualMatches);
            queryCount++;
        }
    }
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox) BoundingBoxDoubleXY(com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)

Aggregations

BoundingBoxDoubleXY (com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)26 BoundingBox (com.revolsys.geometry.model.BoundingBox)18 ArrayList (java.util.ArrayList)7 List (java.util.List)6 Point (com.revolsys.geometry.model.Point)5 Geometry (com.revolsys.geometry.model.Geometry)4 StrTree (com.revolsys.geometry.index.strtree.StrTree)3 KdNode (com.revolsys.geometry.index.kdtree.KdNode)2 KdTree (com.revolsys.geometry.index.kdtree.KdTree)2 LineString (com.revolsys.geometry.model.LineString)2 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)2 Iterator (java.util.Iterator)2 Lists (com.revolsys.collection.list.Lists)1 MapEx (com.revolsys.collection.map.MapEx)1 ScaledIntegerTriangulatedIrregularNetwork (com.revolsys.elevation.tin.compactbinary.ScaledIntegerTriangulatedIrregularNetwork)1 AsciiTin (com.revolsys.elevation.tin.tin.AsciiTin)1 RayCrossingCounter (com.revolsys.geometry.algorithm.RayCrossingCounter)1 Area (com.revolsys.geometry.cs.Area)1 Authority (com.revolsys.geometry.cs.Authority)1 ParameterValueString (com.revolsys.geometry.cs.ParameterValueString)1