org.geotools.caching.spatialindex
Interface SpatialIndex

All Known Implementing Classes:
AbstractSpatialIndex, GridSpatialIndex

public interface SpatialIndex

A generic contract for spatial indexes, such as quadtrees or r-trees. Provides methods to insert, delete and query the index. Note that implementations may be n-dimensional.

Author:
Marios Hadjieleftheriou, marioh@cs.ucr.edu

Field Summary
static double EPSILON
          This constant is used to check if two doubles are nearly equal.
static java.lang.String INDEX_TYPE_PROPERTY
           
 
Method Summary
 void clear()
          Empty the index.
 void containmentQuery(Shape query, Visitor v)
          Traverse index to match data such as : query.contains(Data.getShape())
 void flush()
          Cause pending write operations to happen immediately.
 java.util.Properties getIndexProperties()
           
 Statistics getStatistics()
           
 void initializeFromStorage(Storage storage)
          Initializes the spatial index from a storage instance.
 void insertData(java.lang.Object data, Shape shape)
          Insert new data in the index.
 void intersectionQuery(Shape query, Visitor v)
          Traverse index to match data such as : query.intersects(Data.getShape())
 boolean isIndexValid()
          Implementations may always return true.
 void nearestNeighborQuery(int k, Shape query, Visitor v)
           
 void nearestNeighborQuery(int k, Shape query, Visitor v, NearestNeighborComparator nnc)
           
 void pointLocationQuery(Point query, Visitor v)
          Traverse index to match data having query falling inside its shape, ie : Data.getShape().contains(query)
 

Field Detail

INDEX_TYPE_PROPERTY

static final java.lang.String INDEX_TYPE_PROPERTY
See Also:
Constant Field Values

EPSILON

static final double EPSILON
This constant is used to check if two doubles are nearly equal. Copied from original code by Marios Hadjieleftheriou.

See Also:
Constant Field Values
Method Detail

clear

void clear()
           throws java.lang.IllegalStateException
Empty the index.

Throws:
java.lang.IllegalStateException

insertData

void insertData(java.lang.Object data,
                Shape shape)
Insert new data in the index.

Parameters:
data - to insert
a - n-dims shape

containmentQuery

void containmentQuery(Shape query,
                      Visitor v)
Traverse index to match data such as : query.contains(Data.getShape())

Parameters:
query, - a n-dims shape
visitor - implementing visit() callback method

intersectionQuery

void intersectionQuery(Shape query,
                       Visitor v)
Traverse index to match data such as : query.intersects(Data.getShape())

Parameters:
query, - a n-dims shape
visitor - implementing visit() callback method

pointLocationQuery

void pointLocationQuery(Point query,
                        Visitor v)
Traverse index to match data having query falling inside its shape, ie : Data.getShape().contains(query)

Parameters:
query, - a n-dims point
visitor - implementing visit() callback method

nearestNeighborQuery

void nearestNeighborQuery(int k,
                          Shape query,
                          Visitor v,
                          NearestNeighborComparator nnc)
Parameters:
k -
query -
v -
nnc -

nearestNeighborQuery

void nearestNeighborQuery(int k,
                          Shape query,
                          Visitor v)
Parameters:
k -
query -
v -

getIndexProperties

java.util.Properties getIndexProperties()
Returns:

isIndexValid

boolean isIndexValid()
Implementations may always return true.

Returns:
true if index is valid. TODO: define what is a valid index.

getStatistics

Statistics getStatistics()
Returns:
statistics about the index.

flush

void flush()
Cause pending write operations to happen immediately. Use this method to persist the index before disposal.


initializeFromStorage

void initializeFromStorage(Storage storage)
Initializes the spatial index from a storage instance.

This allows caches to be saved to storage and reused.

Parameters:
storage -


Copyright © 1996-2010 Geotools. All Rights Reserved.