Search in sources :

Example 11 with Point

use of com.github.davidmoten.rtree2.geometry.Point in project rtree2 by davidmoten.

the class RTreeTest method testBulkLoadingEntryCount.

@Test
public void testBulkLoadingEntryCount() {
    List<Entry<Integer, Geometry>> entries = new ArrayList<Entry<Integer, Geometry>>(10000);
    for (int i = 1; i <= 10000; i++) {
        Point point = nextPoint();
        // System.out.println("point(" + point.x() + "," + point.y() +
        // "),");
        entries.add(new EntryDefault<Integer, Geometry>(i, point));
    }
    RTree<Integer, Geometry> tree = RTree.create(entries);
    int entrySize = Observable.from(tree.entries()).count().toBlocking().single();
    System.out.println("entry count: " + entrySize);
    assertEquals(entrySize, entries.size());
}
Also used : Geometry(com.github.davidmoten.rtree2.geometry.Geometry) HasGeometry(com.github.davidmoten.rtree2.geometry.HasGeometry) ArrayList(java.util.ArrayList) Point(com.github.davidmoten.rtree2.geometry.Point) Geometries.point(com.github.davidmoten.rtree2.geometry.Geometries.point) Point(com.github.davidmoten.rtree2.geometry.Point) Test(org.junit.Test)

Aggregations

Point (com.github.davidmoten.rtree2.geometry.Point)11 Test (org.junit.Test)7 Geometries.point (com.github.davidmoten.rtree2.geometry.Geometries.point)6 Rectangle (com.github.davidmoten.rtree2.geometry.Rectangle)6 Geometry (com.github.davidmoten.rtree2.geometry.Geometry)4 HasGeometry (com.github.davidmoten.rtree2.geometry.HasGeometry)4 HashSet (java.util.HashSet)3 Position (com.github.davidmoten.grumpy.core.Position)2 ArrayList (java.util.ArrayList)2 Geometries (com.github.davidmoten.rtree2.geometry.Geometries)1 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1 StandardCharsets (java.nio.charset.StandardCharsets)1 DecimalFormat (java.text.DecimalFormat)1 List (java.util.List)1 GZIPInputStream (java.util.zip.GZIPInputStream)1 Stream (org.davidmoten.kool.Stream)1