deegree 2.1 (2007/11/08 09:57 build-328-official)

org.deegree.io.quadtree
Class DBQuadtreeManager

java.lang.Object
  extended by org.deegree.io.quadtree.DBQuadtreeManager
Direct Known Subclasses:
DBQuadtreeManagerWithNumberId

public class DBQuadtreeManager
extends Object

Access control to a quadtree for managing spatial indizes stored in a usual database.

Version:
$Revision: 7786 $, $Date: 2007-07-19 09:37:19 +0200 (Do, 19 Jul 2007) $
Author:
Andreas Poth, last edited by: $Author: apoth $

Field Summary
protected  String backend
           
protected  String column
           
protected  Envelope envelope
           
protected  String indexName
           
protected  JDBCConnection jdbc
           
protected  int maxDepth
           
protected  String owner
           
protected  Quadtree qt
           
protected  String table
           
 
Constructor Summary
DBQuadtreeManager(JDBCConnection jdbc, String table, String column, String owner)
          initializes a QuadtreeManager to access an alread existing Quadtree
DBQuadtreeManager(JDBCConnection jdbc, String indexName, String table, String column, String owner, int maxDepth)
           
DBQuadtreeManager(String driver, String logon, String user, String password, String encoding, String table, String column, String owner)
          initializes a QuadtreeManager to access an alread existing Quadtree
DBQuadtreeManager(String driver, String logon, String user, String password, String encoding, String indexName, String table, String column, String owner, int maxDepth)
           
 
Method Summary
 void appendShape(String fileName)
          appends the features of a shape to an existing datatable and inserts references into the assigned quadtree table.
protected  void checkForBackend()
           
protected  void createDataTable(String fileName)
          creates table the shape data shall be stored
protected  void createIndexTable(String indexTable)
          creates a table that will store the nodes assigned to a specific quadtree index.
protected  String getDatabaseType(int dataTypeCode)
          returns the type name for a generic type code as used by SQLServer
 Quadtree getQuadtree()
          returns the current Quadtree
 void importShape(String fileName)
          imports a shape into the database and builds a quadtree on it
protected  int initQuadtree(String fileName)
          initializes a new Quadtree by adding a row into table TAB_QUADTREE and into TAB_QTNODE (-> root node)
protected  void initRootNode(String fileName)
          initializes the root node of the quadtree
 void insertIndexMetadata(int fk_indexTree)
           
protected  Quadtree loadQuadtree()
          loads an already existing quadtree
 void setRootEnvelope(Envelope envelope)
          before importing a shape a user may set an envelope for the quadtree to bee created that is different from the one of the shape by calling this method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jdbc

protected JDBCConnection jdbc

table

protected String table

column

protected String column

owner

protected String owner

indexName

protected String indexName

maxDepth

protected int maxDepth

qt

protected Quadtree qt

envelope

protected Envelope envelope

backend

protected String backend
Constructor Detail

DBQuadtreeManager

public DBQuadtreeManager(JDBCConnection jdbc,
                         String indexName,
                         String table,
                         String column,
                         String owner,
                         int maxDepth)
Parameters:
jdbc - database connection info
indexName - this name will be used to create the table that stores the nodes of a specific quadtree
table - name of table the index shall be created for
column - name of column the index shall be created for
owner - owner of the table (optional, database user will be used if set to null )
maxDepth - max depth of the generated quadtree (default = 6 if a value < 2 will be passed)

DBQuadtreeManager

public DBQuadtreeManager(String driver,
                         String logon,
                         String user,
                         String password,
                         String encoding,
                         String indexName,
                         String table,
                         String column,
                         String owner,
                         int maxDepth)
Parameters:
driver - database connection driver
logon - database connection logon
user - database user
password - database user's password
encoding - character encoding to be used (if possible)
indexName - this name will be used to create the table that stores the nodes of a specific quadtree
table - name of table the index shall be created for
column - name of column the index shall be created for
owner - owner of the table (optional, database user will be used if set to null )
maxDepth - max depth of the generated quadtree (default = 6 if a value < 2 will be passed)

DBQuadtreeManager

public DBQuadtreeManager(JDBCConnection jdbc,
                         String table,
                         String column,
                         String owner)
initializes a QuadtreeManager to access an alread existing Quadtree

Parameters:
jdbc - database connection info
table - name of table the index shall be created for
column - name of column the index shall be created for
owner - owner of the table (optional, database user will be used if set to null )

DBQuadtreeManager

public DBQuadtreeManager(String driver,
                         String logon,
                         String user,
                         String password,
                         String encoding,
                         String table,
                         String column,
                         String owner)
initializes a QuadtreeManager to access an alread existing Quadtree

Parameters:
driver - database connection driver
logon - database connection logon
user - database user
password - database user's password
encoding - character encoding to be used (if possible)
table - name of table the index shall be created for
column - name of column the index shall be created for
owner - owner of the table (optional, database user will be used if set to null )
Method Detail

checkForBackend

protected void checkForBackend()

getQuadtree

public Quadtree getQuadtree()
                     throws IndexException
returns the current Quadtree

Returns:
the current Quadtree
Throws:
IndexException

loadQuadtree

protected Quadtree loadQuadtree()
                         throws IndexException
loads an already existing quadtree

Returns:
Throws:
IndexException

initRootNode

protected void initRootNode(String fileName)
                     throws IndexException,
                            IOException
initializes the root node of the quadtree

Parameters:
fileName -
Throws:
IndexException
IOException

setRootEnvelope

public void setRootEnvelope(Envelope envelope)
before importing a shape a user may set an envelope for the quadtree to bee created that is different from the one of the shape by calling this method. Notice: calling this method does not have any effect when calling

Parameters:
envelope -
See Also:
method.

initQuadtree

protected int initQuadtree(String fileName)
                    throws IndexException,
                           IOException
initializes a new Quadtree by adding a row into table TAB_QUADTREE and into TAB_QTNODE (-> root node)

Parameters:
fileName -
Returns:
Throws:
IndexException
IOException

insertIndexMetadata

public void insertIndexMetadata(int fk_indexTree)
                         throws IndexException
Parameters:
fk_indexTree -
Throws:
IndexException

createDataTable

protected void createDataTable(String fileName)
                        throws IndexException,
                               IOException
creates table the shape data shall be stored

Parameters:
fileName -
Throws:
IndexException
IOException

getDatabaseType

protected String getDatabaseType(int dataTypeCode)
                          throws IndexException
returns the type name for a generic type code as used by SQLServer

Parameters:
dataTypeCode -
Returns:
the type name for a generic type code as used by SQLServer
Throws:
IndexException

importShape

public void importShape(String fileName)
                 throws Exception,
                        IOException
imports a shape into the database and builds a quadtree on it

Parameters:
fileName -
Throws:
Exception
IOException

appendShape

public void appendShape(String fileName)
                 throws Exception,
                        IOException
appends the features of a shape to an existing datatable and inserts references into the assigned quadtree table.

you have to consider that the quadtree is just valid for a defined area. if the features to append exceeds this area the quadtree has to be rebuilded.

Parameters:
fileName -
Throws:
Exception
IOException

createIndexTable

protected void createIndexTable(String indexTable)
creates a table that will store the nodes assigned to a specific quadtree index.

Parameters:
indexTable -

deegree 2.1 (2007/11/08 09:57 build-328-official)

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