Interface GenericSpatialIndex<T>

  • Type Parameters:
    T - the type of the elements to be saved in this index.
    All Known Implementing Classes:
    GenericRTree


    public interface GenericSpatialIndex<T>
    An interface to a spatial index that stores generic values that occupy a rectangular area.
    • Method Summary

      Modifier and Type Method and Description
      void add(Rectangle r, T thing)
      Add thing to this index with place-occupation specified by r.
      Set<T> contains(Rectangle r)
      Acquire a set of all elements contained in the given rectangle r.
      void contains(Rectangle r, TObjectProcedure<T> procedure)
      Calls procedure on each element that is contained in the given rectangle r.
      boolean delete(Rectangle r, T thing)
      Remove element thing from spatial index.
      List<T> intersectionsAsList(Rectangle r)
      Acquire a list of all elements intersecting the given rectangle r.
      Set<T> intersects(Rectangle r)
      Acquire a set of all elements intersecting the given rectangle r.
      void intersects(Rectangle r, TObjectProcedure<T> procedure)
      Calls procedure on each element that intersects the given rectangle r.
      Set<T> nearest(Point p, float distance)
      Acquire a set of all elements that are in less or equal distance of p than distance.
      void nearest(Point p, TObjectProcedure<T> procedure, float distance)
      Execute procedure on all elements that are in less or equal distance of p than distance.
      int size()
      Returns the number of entries in this index.
    • Method Detail

      • add

        void add(Rectangle r,
                 T thing)
        Add thing to this index with place-occupation specified by r.
        Parameters:
        r - the element's bounding box
        thing - the element to add.
      • contains

        void contains(Rectangle r,
                      TObjectProcedure<T> procedure)
        Calls procedure on each element that is contained in the given rectangle r.
        Parameters:
        r - the rectangle to query for contained elements.
        procedure - the procedure to call on each element.
      • contains

        Set<T> contains(Rectangle r)
        Acquire a set of all elements contained in the given rectangle r.
        Parameters:
        r - the rectangle to query for contained elements.
        Returns:
        the set of all elements contained in r.
      • delete

        boolean delete(Rectangle r,
                       T thing)
        Remove element thing from spatial index. The associated rectangle r has to be provided.
        Parameters:
        r - the element's bounding box.
        thing - the element to remove.
        Returns:
        whether deletion has been successful.
      • intersects

        void intersects(Rectangle r,
                        TObjectProcedure<T> procedure)
        Calls procedure on each element that intersects the given rectangle r.
        Parameters:
        r - the rectangle to query for intersecting elements.
        procedure - the procedure to call on each element.
      • intersects

        Set<T> intersects(Rectangle r)
        Acquire a set of all elements intersecting the given rectangle r.
        Parameters:
        r - the rectangle to query for intersecting elements.
        Returns:
        the set of all elements intersecting r.
      • intersectionsAsList

        List<T> intersectionsAsList(Rectangle r)
        Acquire a list of all elements intersecting the given rectangle r.
        Parameters:
        r - the rectangle to query for intersecting elements.
        Returns:
        the list of all element intersectin r
      • nearest

        void nearest(Point p,
                     TObjectProcedure<T> procedure,
                     float distance)
        Execute procedure on all elements that are in less or equal distance of p than distance.
        Parameters:
        p - the point from where to measure distance.
        procedure - the procedure to call on each element.
        distance - the maximum distance from p of elements.
      • nearest

        Set<T> nearest(Point p,
                       float distance)
        Acquire a set of all elements that are in less or equal distance of p than distance.
        Parameters:
        p - the point from where to measure distance.
        distance - the maximum distance from p of elements.
        Returns:
        the set all elements found in less distance than distance.
      • size

        int size()
        Returns the number of entries in this index.
        Returns:
        the number of elements.