public static void test2() { com.esri.core.geometry.MultiPoint multipoint = new com.esri.core.geometry.MultiPoint (); for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { multipoint.add(i, j); } } com.esri.core.geometry.Envelope2D extent = new com.esri.core.geometry.Envelope2D( ); multipoint.queryEnvelope2D(extent); com.esri.core.geometry.MultiPointImpl multipointImpl = (com.esri.core.geometry.MultiPointImpl )multipoint._getImpl(); com.esri.core.geometry.QuadTree quadtree = buildQuadTree_(multipointImpl); com.esri.core.geometry.QuadTree.QuadTreeIterator qtIter = quadtree.getIterator(); NUnit.Framework.Assert.IsTrue(qtIter.next() == -1); int count = 0; qtIter.resetIterator(extent, 0.0); while (qtIter.next() != -1) { count++; } NUnit.Framework.Assert.IsTrue(count == 10000); }
internal static com.esri.core.geometry.QuadTree buildQuadTree_(com.esri.core.geometry.MultiPointImpl multipointImpl) { com.esri.core.geometry.Envelope2D extent = new com.esri.core.geometry.Envelope2D( ); multipointImpl.queryEnvelope2D(extent); com.esri.core.geometry.QuadTree quadTree = new com.esri.core.geometry.QuadTree(extent , 8); com.esri.core.geometry.Envelope2D boundingbox = new com.esri.core.geometry.Envelope2D (); com.esri.core.geometry.Point2D pt; for (int i = 0; i < multipointImpl.getPointCount(); i++) { pt = multipointImpl.getXY(i); boundingbox.setCoords(pt.x, pt.y, pt.x, pt.y); quadTree.insert(i, boundingbox, -1); } return(quadTree); }