Ejemplo n.º 1
0
 public void visit(FloatRectangle region, IQuadTreeElementsVisitor<E> visitor) {
   region = bounds.intersection(region);
   if (region.isEmpty()) return;
   if (isLeaf()) {
     if (bounds.equals(region))
       for (FloatPoint location : contents.keySet())
         visitor.visit(this, location, contents.get(location));
     else
       for (FloatPoint location : contents.keySet())
         if (region.contains(location)) visitor.visit(this, location, contents.get(location));
   } else {
     for (QuadTree<E> quadrant : quadrants) quadrant.visit(region, visitor);
   }
 }
Ejemplo n.º 2
0
 public void visit(FloatRectangle region, IQuadTreeVisitor<E> visitor) {
   if (!region.intersects(bounds)) return;
   if (visitor.visit(this)) {
     if (!isLeaf()) {
       for (QuadTree<E> quadrant : quadrants) quadrant.visit(region, visitor);
     }
   }
 }