Class QuadTree

  • All Implemented Interfaces:
    Closeable, AutoCloseable

    public class QuadTree
    extends Object
    implements Closeable
    Java porting of mapserver quadtree implementation.

    Note that this implementation is not thread safe, so don't share the same instance across two or more threads.

    TODO: example of typical use...

    Author:
    Tommaso Nolli
    • Constructor Detail

      • QuadTree

        public QuadTree​(int numShapes,
                        Envelope maxBounds,
                        IndexFile file)
        Constructor. The maxDepth will be calculated.
        Parameters:
        numShapes - The total number of shapes to index
        maxBounds - The bounds of all geometries to be indexed
      • QuadTree

        public QuadTree​(int numShapes,
                        int maxDepth,
                        Envelope maxBounds,
                        IndexFile file)
        Constructor.
        Parameters:
        numShapes - The total number of shapes to index
        maxDepth - The max depth of the index, must be <= 65535
        maxBounds - The bounds of all geometries to be indexed
      • QuadTree

        public QuadTree​(int numShapes,
                        int maxDepth,
                        IndexFile file)
        Constructor. WARNING: using this constructor, you have to manually set the root
        Parameters:
        numShapes - The total number of shapes to index
        maxDepth - The max depth of the index, must be <= 65535
    • Method Detail

      • insert

        public void insert​(int recno,
                           Envelope bounds)
                    throws StoreException
        Inserts a shape record id in the quadtree
        Parameters:
        recno - The record number
        bounds - The bounding box
        Throws:
        StoreException
      • getMaxDepth

        public int getMaxDepth()
        Returns:
        Returns the maxDepth.
      • setMaxDepth

        public void setMaxDepth​(int maxDepth)
        Parameters:
        maxDepth - The maxDepth to set.
      • getNumShapes

        public int getNumShapes()
        Returns:
        Returns the numShapes.
      • setNumShapes

        public void setNumShapes​(int numShapes)
        Parameters:
        numShapes - The numShapes to set.
      • getRoot

        public Node getRoot()
        Returns:
        Returns the root.
      • setRoot

        public void setRoot​(Node root)
        Parameters:
        root - The root to set.
      • registerIterator

        public void registerIterator​(Iterator<Data> object)
      • getIndexfile

        public IndexFile getIndexfile()