deegree 2.5 (2011/06/29 09:44 build-8-official)

org.deegree.io.rtree
Class RTree

java.lang.Object
  extended by org.deegree.io.rtree.RTree
All Implemented Interfaces:
java.io.Serializable

public class RTree
extends java.lang.Object
implements java.io.Serializable


Implementation of a R-Tree after the algorithms of Antonio Guttman. With nearest neighbour search after algorithm of Cheung & Fu

Version:
$Revision: 12519 $, $Date: 2008-06-25 11:37:30 +0200 (Mi, 25 Jun 2008) $
Author:
Wolfgang Baer - WBaer@gmx.de, last edited by: $Author: aschmitz $
See Also:
Serialized Form

Constructor Summary
RTree(int dimension, int maxLoad)
          Creates an empty R-Tree with a memory-mapped pagefile (MemoryPageFile) and an empty root node
RTree(int dimension, int maxLoad, java.lang.String fileName)
          Creates an empty R-Tree with a persistent pagefile (PersistentPageFile) and an empty root node.
RTree(java.lang.String fileName)
          Creates an R-Tree from an EXISTING persistent pagefile (PersistentPageFile).
 
Method Summary
 void close()
          Closes the rtree.
 java.lang.Object[] contains(HyperBoundingBox box)
          Searches all entries in the R-Tree whose HyperBoundingBoxes contain the given.
 boolean delete(HyperBoundingBox box)
          Deletes all entries from the R-Tree with given HyperBoundingBox
 boolean delete(HyperBoundingBox box, int objID)
          Deletes an entry from the RTree.
 java.lang.Object[] find(HyperBoundingBox box)
          Retrieves all entries with the given HyperBoundingBox.
 boolean insert(java.lang.Object obj, HyperBoundingBox box)
          Inserts the given Object associated with the given HyperBoundingBox object into the R-Tree.
 java.lang.Object[] intersects(HyperBoundingBox box)
          Searches all entries in the R-Tree whose HyperBoundingBoxes intersect with the given.
 double[] nearestNeighbour(HyperPoint point)
          Queries the nearest neighbour to given search HyperPoint
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RTree

public RTree(int dimension,
             int maxLoad)
      throws RTreeException
Creates an empty R-Tree with a memory-mapped pagefile (MemoryPageFile) and an empty root node

Parameters:
dimension - - dimension of the data to store
maxLoad - - maximum load of a node
Throws:
RTreeException

RTree

public RTree(int dimension,
             int maxLoad,
             java.lang.String fileName)
      throws RTreeException
Creates an empty R-Tree with a persistent pagefile (PersistentPageFile) and an empty root node.

Parameters:
dimension - - dimension of the data to store
maxLoad - - maximum load of a node
fileName - - name of the rtree file
Throws:
RTreeException

RTree

public RTree(java.lang.String fileName)
      throws RTreeException
Creates an R-Tree from an EXISTING persistent pagefile (PersistentPageFile).

Parameters:
fileName - - name of the existing rtree file
Throws:
RTreeException
Method Detail

intersects

public java.lang.Object[] intersects(HyperBoundingBox box)
                              throws RTreeException
Searches all entries in the R-Tree whose HyperBoundingBoxes intersect with the given.

Parameters:
box - - given test HyperBoundingBox
Returns:
Object[] - Array with retrieved Objects
Throws:
RTreeException

contains

public java.lang.Object[] contains(HyperBoundingBox box)
                            throws RTreeException
Searches all entries in the R-Tree whose HyperBoundingBoxes contain the given.

Parameters:
box - - given test HyperBoundingBox
Returns:
Object[] - Array with retrieved Objects
Throws:
RTreeException

insert

public boolean insert(java.lang.Object obj,
                      HyperBoundingBox box)
               throws RTreeException
Inserts the given Object associated with the given HyperBoundingBox object into the R-Tree.

Parameters:
obj - - Object to insert
box - - associated HyperBoundingBox
Returns:
boolean - true if successfull
Throws:
RTreeException

nearestNeighbour

public double[] nearestNeighbour(HyperPoint point)
                          throws RTreeException
Queries the nearest neighbour to given search HyperPoint

Parameters:
point - - search point
Returns:
double[] - Place 0 = Distance, Place 1 = data number (must be cast to int)
Throws:
RTreeException

close

public void close()
           throws RTreeException
Closes the rtree.

Throws:
RTreeException - - if an error occures.

delete

public boolean delete(HyperBoundingBox box,
                      int objID)
               throws RTreeException
Deletes an entry from the RTree.

Parameters:
box - - HyperBoundingBox of the entry to deleted
objID - - Integer value of Object-ID to be deleted
Returns:
boolean - true if successfull
Throws:
RTreeException

delete

public boolean delete(HyperBoundingBox box)
               throws RTreeException
Deletes all entries from the R-Tree with given HyperBoundingBox

Parameters:
box - - HyperBoundingBox
Returns:
boolean - true if successfull
Throws:
RTreeException

find

public java.lang.Object[] find(HyperBoundingBox box)
                        throws RTreeException
Retrieves all entries with the given HyperBoundingBox.

Parameters:
box - - HyperBoundingBox
Returns:
Object[] - array with retrieved objects
Throws:
RTreeException

deegree 2.5 (2011/06/29 09:44 build-8-official)

an open source project founded by lat/lon, Bonn, Germany.
For more information visit: http://www.deegree.org