Class GenericRTree<T>

    • Constructor Detail

      • GenericRTree

        public GenericRTree(int minNodes,
                            int maxNodes)
        This constructor creates a GenericRTree. The specified minimal and maximal number of childs per node is internally used for the implementing RTree.
        Parameters:
        minNodes - the minimum number of childs per node.
        maxNodes - the maximum number of childs per node.
      • GenericRTree

        public GenericRTree()
        default constructor that initializes the underlying tree to have at least 1 and at most 10 childs per node.
    • Method Detail

      • add

        public void add(Rectangle r,
                        T thing)
        Description copied from interface: GenericSpatialIndex
        Add thing to this index with place-occupation specified by r.
        Specified by:
        add in interface  GenericSpatialIndex<T>
        Parameters:
        r - the element's bounding box
        thing - the element to add.
      • delete

        public boolean delete(Rectangle r,
                              T thing)
        Description copied from interface: GenericSpatialIndex
        Remove element thing from spatial index. The associated rectangle r has to be provided.
        Specified by:
        delete in interface  GenericSpatialIndex<T>
        Parameters:
        r - the element's bounding box.
        thing - the element to remove.
        Returns:
        whether deletion has been successful.
      • contains

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

        public Set<T> contains(Rectangle r)
        Description copied from interface: GenericSpatialIndex
        Acquire a set of all elements contained in the given rectangle r.
        Specified by:
        contains in interface  GenericSpatialIndex<T>
        Parameters:
        r - the rectangle to query for contained elements.
        Returns:
        the set of all elements contained in r.
      • intersects

        public void intersects(Rectangle r,
                               TObjectProcedure<T> procedure)
        Description copied from interface: GenericSpatialIndex
        Calls procedure on each element that intersects the given rectangle r.
        Specified by:
        intersects in interface  GenericSpatialIndex<T>
        Parameters:
        r - the rectangle to query for intersecting elements.
        procedure - the procedure to call on each element.
      • intersects

        public Set<T> intersects(Rectangle r)
        Description copied from interface: GenericSpatialIndex
        Acquire a set of all elements intersecting the given rectangle r.
        Specified by:
        intersects in interface  GenericSpatialIndex<T>
        Parameters:
        r - the rectangle to query for intersecting elements.
        Returns:
        the set of all elements intersecting r.
      • intersectionsAsList

        public List<T> intersectionsAsList(Rectangle r)
        Description copied from interface: GenericSpatialIndex
        Acquire a list of all elements intersecting the given rectangle r.
        Specified by:
        intersectionsAsList in interface  GenericSpatialIndex<T>
        Parameters:
        r - the rectangle to query for intersecting elements.
        Returns:
        the list of all element intersectin r
      • nearest

        public void nearest(Point p,
                            TObjectProcedure<T> procedure,
                            float distance)
        Description copied from interface: GenericSpatialIndex
        Execute procedure on all elements that are in less or equal distance of p than distance.
        Specified by:
        nearest in interface  GenericSpatialIndex<T>
        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

        public Set<T> nearest(Point p,
                              float distance)
        Description copied from interface: GenericSpatialIndex
        Acquire a set of all elements that are in less or equal distance of p than distance.
        Specified by:
        nearest in interface  GenericSpatialIndex<T>
        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

        public int size()
        Description copied from interface: GenericSpatialIndex
        Returns the number of entries in this index.
        Specified by:
        size in interface  GenericSpatialIndex<T>
        Returns:
        the number of elements.
      • getBounds

        public Rectangle getBounds()
        Returns:
        the bounds of the contained elements.