Class PointQuadTree<T extends PointQuadTree.Item>


  • public class PointQuadTree<T extends PointQuadTree.Item>
    extends java.lang.Object
    A quad tree which tracks items with a Point geometry. See http://en.wikipedia.org/wiki/Quadtree for details on the data structure. This class is not thread safe.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  PointQuadTree.Item  
    • Constructor Summary

      Constructors 
      Constructor Description
      PointQuadTree​(double minX, double maxX, double minY, double maxY)
      Creates a new quad tree with specified bounds.
      PointQuadTree​(Bounds bounds)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(T item)
      Insert an item.
      void clear()
      Removes all points from the quadTree
      boolean remove​(T item)
      Remove the given item from the set.
      java.util.Collection<T> search​(Bounds searchBounds)
      Search for all items within a given bounds.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PointQuadTree

        public PointQuadTree​(double minX,
                             double maxX,
                             double minY,
                             double maxY)
        Creates a new quad tree with specified bounds.
        Parameters:
        minX -
        maxX -
        minY -
        maxY -
      • PointQuadTree

        public PointQuadTree​(Bounds bounds)
    • Method Detail

      • add

        public void add​(T item)
        Insert an item.
      • remove

        public boolean remove​(T item)
        Remove the given item from the set.
        Returns:
        whether the item was removed.
      • clear

        public void clear()
        Removes all points from the quadTree
      • search

        public java.util.Collection<T> search​(Bounds searchBounds)
        Search for all items within a given bounds.