Class SpatialRTree<T,​NT>

    • Field Detail

      • splitterContext

        protected SplitterContext<T> splitterContext
        a container for the splitter functions to use, quadratic or R*Tree
      • rtree

        protected RTree<T> rtree
        the RTree to use. Add/Remove methods may change this to a new immutable RTree reference
      • boundingRectangleCollector

        protected BoundingRectangleCollector<T> boundingRectangleCollector
        gathers the bounding rectangles of the elements managed by the RTree. Node or Edge shapes
      • reinsert

        protected boolean reinsert
    • Constructor Detail

      • SpatialRTree

        protected SpatialRTree​(LayoutModel<NT> layoutModel,
                               SplitterContext<T> splitterContext,
                               boolean reinsert)
        create a new instance with the a LayoutModel and a style of splitter to use
        Parameters:
        layoutModel -
        splitterContext -
    • Method Detail

      • isReinsert

        public boolean isReinsert()
      • setReinsert

        public void setReinsert​(boolean reinsert)
      • collectGrids

        protected abstract List<Shape> collectGrids​(List<Shape> list,
                                                    RTree<T> tree)
        gather the RTree nodes into a list for display as Paintables
        Parameters:
        list -
        tree -
        Returns:
      • getLayoutArea

        public Rectangle2D getLayoutArea()
        Specified by:
        getLayoutArea in interface Spatial<T,​NT>
        Returns:
        the 2 dimensional area of interest for this class
      • setBounds

        public void setBounds​(Rectangle2D bounds)
        Specified by:
        setBounds in interface Spatial<T,​NT>
        Parameters:
        bounds - the new bounds for the data struture
      • getGrid

        public List<Shape> getGrid()
        Specified by:
        getGrid in interface Spatial<T,​NT>
        Returns:
        a geometic representation of the spatial structure
      • clear

        public void clear()
        Description copied from interface: Spatial
        destroy the current spatial structure
        Specified by:
        clear in interface Spatial<T,​NT>
      • getContainingLeafs

        public Set<LeafNode<T>> getContainingLeafs​(double x,
                                                   double y)
        Specified by:
        getContainingLeafs in interface Spatial<T,​NT>
        Parameters:
        x - a point to search in the spatial structure
        y - a point to search in the spatial structure
        Returns:
        a collection of the RTree LeafVertices that would contain the passed point
      • getContainingLeafs

        public Set<LeafNode<T>> getContainingLeafs​(Point2D p)
        Specified by:
        getContainingLeafs in interface Spatial<T,​NT>
        Parameters:
        p - a point to search in the spatial structure
        Returns:
        all leaf nodes that contain the passed point
      • getContainingLeaf

        public LeafNode<T> getContainingLeaf​(Object element)
        Specified by:
        getContainingLeaf in interface Spatial<T,​NT>
        Parameters:
        element - element to search for
        Returns:
        the leaf node that currently contains the element (not a spatial search)
      • recalculate

        protected void recalculate​(Collection<T> elements)
      • bulkInsert

        protected void bulkInsert​(Collection<T> elements)