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

org.deegree.io.quadtree
Class DBQuadtree<T>

java.lang.Object
  extended by org.deegree.io.quadtree.DBQuadtree<T>
Type Parameters:
T - the datatype to be used as id
All Implemented Interfaces:
Quadtree<T>

public class DBQuadtree<T>
extends java.lang.Object
implements Quadtree<T>

Since:
2.0
Version:
$Revision: 18195 $, 1.0. $Revision: 18195 $, $Date: 2009-06-18 17:55:39 +0200 (Do, 18 Jun 2009) $
Author:
Andreas Poth, last edited by: $Author: mschneider $

Nested Class Summary
static class DBQuadtree.SupportedVersions
          The SupportedVersions supported by this quatree
 
Constructor Summary
DBQuadtree(int id, java.lang.String indexName, JDBCConnection jdbc)
          initializes a quadtree already existing in a database.
DBQuadtree(int id, java.lang.String indexName, JDBCConnection jdbc, double accuracyX, double accuracyY, java.lang.String version)
          initializes a quadtree already existing in a database
DBQuadtree(int id, java.lang.String indexName, JDBCConnection jdbc, java.lang.String version)
          Creates a Database with given version.
 
Method Summary
(package private)  void addToCache(DBNode<T> node)
           
 void deleteItem(T item)
          deletes an item from a quadtree
 void deleteRange(Envelope envelope)
          deletes all references of items whose envelope intersects with the passed one (
 int getDepth()
           
(package private)  DBNode<T> getFromCache(java.lang.String id)
           
 Envelope getRootBoundingBox()
          returns the bounding box covered by the quadtrees root node
 void insert(T item, Envelope envelope)
          inserts a new item into a quadtree
 void insert(T item, Point point)
          inserts a new item into the quadtree
 java.util.List<T> query(Envelope envelope)
          returns a List containing all items whose envelope intersects with the passed one
 boolean releaseConnection()
           
(package private)  DBNode<T> removeFromCache(DBNode<T> node)
           
 void update(T item, Envelope newBBox)
          updates the envelope of an item
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBQuadtree

public DBQuadtree(int id,
                  java.lang.String indexName,
                  JDBCConnection jdbc,
                  java.lang.String version)
           throws IndexException
Creates a Database with given version.

Parameters:
id - of the table which contains the features.
indexName - this name will be used to create the table that stores the nodes of a specific quadtree
jdbc - description of database connection
version - of the quadtree, which is usefull for the determination of the layout, if null then the version is assumed to be unknown and the old layout is used.
Throws:
IndexException

DBQuadtree

public DBQuadtree(int id,
                  java.lang.String indexName,
                  JDBCConnection jdbc)
           throws IndexException
initializes a quadtree already existing in a database. New items will have a slightly larger bbox with 0.0001 added to each boundary, this is usefull for point geometries.

Parameters:
id - of the table which contains the features.
indexName - this name will be used to create the table that stores the nodes of a specific quadtree
jdbc - description of database connection
Throws:
IndexException - if the quadtree node with 'id' could not be read from the database.

DBQuadtree

public DBQuadtree(int id,
                  java.lang.String indexName,
                  JDBCConnection jdbc,
                  double accuracyX,
                  double accuracyY,
                  java.lang.String version)
           throws IndexException
initializes a quadtree already existing in a database

Parameters:
id - of the table which contains the features.
indexName - this name will be used to create the table that stores the nodes of a specific quadtree
jdbc - description of database connection
accuracyX -
accuracyY -
version - of the quadtree, which is usefull for the determination of the layout, if null then the version is assumed to be "1.0.0" (the first version) and the old layout is used.
Throws:
IndexException - if the quadtree node with 'id' could not be read from the database.
Method Detail

getFromCache

DBNode<T> getFromCache(java.lang.String id)
Parameters:
id -
Returns:
node

addToCache

void addToCache(DBNode<T> node)
Parameters:
node -

removeFromCache

DBNode<T> removeFromCache(DBNode<T> node)
Parameters:
node -

insert

public void insert(T item,
                   Envelope envelope)
            throws IndexException
inserts a new item into a quadtree

Specified by:
insert in interface Quadtree<T>
Parameters:
item -
envelope -
Throws:
IndexException

insert

public void insert(T item,
                   Point point)
            throws IndexException
Description copied from interface: Quadtree
inserts a new item into the quadtree

Specified by:
insert in interface Quadtree<T>
Parameters:
item -
point -
Throws:
IndexException

query

public java.util.List<T> query(Envelope envelope)
                        throws IndexException
Description copied from interface: Quadtree
returns a List containing all items whose envelope intersects with the passed one

Specified by:
query in interface Quadtree<T>
Parameters:
envelope -
Returns:
list a items intersecting with the passed envelope
Throws:
IndexException

deleteItem

public void deleteItem(T item)
                throws IndexException
deletes an item from a quadtree

Specified by:
deleteItem in interface Quadtree<T>
Parameters:
item -
Throws:
IndexException - if the rootnode cannot be loaded, or the given item does not exist.

update

public void update(T item,
                   Envelope newBBox)
            throws IndexException
updates the envelope of an item

Specified by:
update in interface Quadtree<T>
Parameters:
item -
newBBox -
Throws:
IndexException - if the rootnode cannot be loaded, or the given item does not exist.

deleteRange

public void deleteRange(Envelope envelope)
Description copied from interface: Quadtree
deletes all references of items whose envelope intersects with the passed one (

Specified by:
deleteRange in interface Quadtree<T>
See Also:
)

getDepth

public int getDepth()
Specified by:
getDepth in interface Quadtree<T>
Returns:
depth of a quadtree

releaseConnection

public boolean releaseConnection()
Returns:
true if the db connection could be released to the pool, false otherwise.

getRootBoundingBox

public Envelope getRootBoundingBox()
                            throws IndexException
Description copied from interface: Quadtree
returns the bounding box covered by the quadtrees root node

Specified by:
getRootBoundingBox in interface Quadtree<T>
Returns:
envelope of a quadtree's root node
Throws:
IndexException

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