org.geotools.index.quadtree
Class QuadTree

java.lang.Object
  extended byorg.geotools.index.quadtree.QuadTree

public class QuadTree
extends java.lang.Object

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 Summary
QuadTree(int numShapes, com.vividsolutions.jts.geom.Envelope maxBounds)
          Constructor.
QuadTree(int numShapes, int maxDepth)
          Constructor.
QuadTree(int numShapes, int maxDepth, com.vividsolutions.jts.geom.Envelope maxBounds)
          Constructor.
 
Method Summary
 void close()
          Closes this QuadTree after use...
 int getMaxDepth()
           
 int getNumShapes()
           
 Node getRoot()
           
 void insert(int recno, com.vividsolutions.jts.geom.Envelope bounds)
          Inserts a shape record id in the quadtree
 java.util.List search(com.vividsolutions.jts.geom.Envelope bounds)
           
 void setMaxDepth(int maxDepth)
           
 void setNumShapes(int numShapes)
           
 void setRoot(Node root)
           
 boolean trim()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuadTree

public QuadTree(int numShapes,
                com.vividsolutions.jts.geom.Envelope maxBounds)
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,
                com.vividsolutions.jts.geom.Envelope maxBounds)
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)
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,
                   com.vividsolutions.jts.geom.Envelope bounds)
            throws StoreException
Inserts a shape record id in the quadtree

Parameters:
recno - The record number
bounds - The bounding box
Throws:
StoreException

search

public java.util.List search(com.vividsolutions.jts.geom.Envelope bounds)
                      throws StoreException
Parameters:
bounds -
Returns:
A List of Integer
Throws:
StoreException

close

public void close()
           throws StoreException
Closes this QuadTree after use...

Throws:
StoreException

trim

public boolean trim()
             throws StoreException
Returns:
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.


Copyright © GeoTools. All Rights Reserved.