StandardGISTreeSet extends AbstractGISTreeSet<P, GISTreeSetNode<P>> implements GISTreeSetNodeFactory<P, GISTreeSetNode<P>> { @Override public final boolean add(P elt) { return GISTreeSetUtil.addInside(this, getTree().getRoot(), elt, this); } StandardGISTreeSet();  StandardGISTreeSet(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds);  StandardGISTreeSet(double boundsX, double boundsY, double boundsWidth, double boundsHeight); @Override final boolean add(P elt); @Override void setNodeFactory(GISTreeSetNodeFactory<P, GISTreeSetNode<P>> factory); @Override @Pure GISTreeSetNodeFactory<P, GISTreeSetNode<P>> getNodeFactory(); @Override @Pure GISTreeSetNode<P> newRootNode(P element); @Override @Pure GISTreeSetNode<P> newRootNode(P element, double boundsX, double boundsY, double boundsWidth, double boundsHeight); @Override @Pure GISTreeSetNode<P> newNode(IcosepQuadTreeZone zone, double boundsX, double boundsY,
			double boundsWidth, double boundsHeight);  }
@Test public void testAddAll() { this.reference.clear(); this.reference.add(new MapPoint(1000,1000)); this.reference.add(new MapPoint(0,0)); this.reference.add(new MapPoint(501,801)); this.reference.add(new MapPoint(500,800)); this.reference.add(new MapPoint(502,802)); this.reference.add(new MapPoint(100,800)); this.reference.add(new MapPoint(800,0)); List<Point2d> transformed = new ArrayList<>(); for (final GISPrimitive it : this.reference) { transformed.add(((MapPoint)it).getPoint()); } Rectangle2d bounds = new Rectangle2d(); bounds.setFromPointCloud(transformed); StandardGISTreeSet<GISPrimitive> test = new StandardGISTreeSet<>(bounds); assertTrue(test.addAll(this.reference)); for(GISPrimitive p : test) { assertTrue(this.reference.remove(p)); } assertTrue(this.reference.isEmpty()); }
@Test public void testAddE() { StandardGISTreeSet<GISPrimitive> test = new StandardGISTreeSet<>(this.worldBounds); assertTrue(test.addAll(this.reference)); assertEpsilonEquals(this.reference.size(), test.size()); String msg; Random rnd = new Random(); int testCount = rnd.nextInt(5)+1; for(int i=0; i<testCount; ++i) { msg = "test "+(i+1)+"/"+testCount; getLogger().info(msg+"..."); double x = this.worldBounds.getMinX() + rnd.nextDouble() * this.worldBounds.getWidth(); double y = this.worldBounds.getMinY() + rnd.nextDouble() * this.worldBounds.getHeight(); GISPrimitive newElement = new MapPoint(x,y); assertTrue(this.reference.add(newElement), msg); assertTrue(test.add(newElement), msg); assertEquals(this.reference.size(), test.size(), msg); assertTrue(test.slowContains(newElement), msg); assertEpsilonEquals(this.reference.toArray(),test.toArray(), msg); getLogger().info("done"); } }