|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.caching.spatialindex.AbstractSpatialIndex
public abstract class AbstractSpatialIndex
This is a base class for implementing spatial indexes. It provides common routines useful for every type of indexes.
Field Summary | |
---|---|
static int |
ContainmentQuery
|
protected int |
dimension
Indexes can be n-dimensional, but queries and data should be consistent with regards to dimensions. |
protected Region |
infiniteRegion
|
static int |
IntersectionQuery
|
protected NodeIdentifier |
root
The node at the root of index. |
protected Node |
rootNode
|
protected SpatialIndexStatistics |
stats
|
protected Storage |
store
|
Fields inherited from interface org.geotools.caching.spatialindex.SpatialIndex |
---|
EPSILON, INDEX_TYPE_PROPERTY |
Constructor Summary | |
---|---|
AbstractSpatialIndex()
|
Method Summary | |
---|---|
void |
containmentQuery(Shape query,
Visitor v)
Traverse index to match data such as : query.contains(Data.getShape()) |
protected void |
deleteNode(NodeIdentifier id)
|
void |
flush()
Cause pending write operations to happen immediately. |
Statistics |
getStatistics()
|
Storage |
getStorage()
|
protected abstract void |
insertData(NodeIdentifier n,
java.lang.Object data,
Shape shape)
Insert new data into target node. |
void |
insertData(java.lang.Object data,
Shape shape)
Inserts data into the spatial index. |
protected abstract void |
insertDataOutOfBounds(java.lang.Object data,
Shape shape)
Insert new data with shape not contained in the current index. |
void |
intersectionQuery(Shape query,
Visitor v)
Traverse index to match data such as : query.intersects(Data.getShape()) |
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) |
protected void |
rangeQuery(int type,
Shape query,
Visitor v)
Common algorithm used by both intersection and containment queries. |
protected Node |
readNode(NodeIdentifier id)
|
protected abstract void |
visitData(Node n,
Visitor v,
Shape query,
int type)
Visit data associated with a node using given visitor. |
protected void |
writeNode(Node node)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.geotools.caching.spatialindex.SpatialIndex |
---|
clear, getIndexProperties, initializeFromStorage, isIndexValid |
Field Detail |
---|
public static final int ContainmentQuery
public static final int IntersectionQuery
protected NodeIdentifier root
protected Node rootNode
protected Storage store
protected int dimension
protected Region infiniteRegion
protected SpatialIndexStatistics stats
Constructor Detail |
---|
public AbstractSpatialIndex()
Method Detail |
---|
public Storage getStorage()
public void intersectionQuery(Shape query, Visitor v)
SpatialIndex
query.intersects(Data.getShape())
intersectionQuery
in interface SpatialIndex
public void containmentQuery(Shape query, Visitor v)
SpatialIndex
query.contains(Data.getShape())
containmentQuery
in interface SpatialIndex
public void pointLocationQuery(Point query, Visitor v)
SpatialIndex
Data.getShape().contains(query)
pointLocationQuery
in interface SpatialIndex
protected void rangeQuery(int type, Shape query, Visitor v)
type
- query
- v
- protected abstract void visitData(Node n, Visitor v, Shape query, int type)
node
- to visitvisitor
- for callbackquery
- type
- of query, either containement or intersection (@see AbstractSpatialIndex)public void nearestNeighborQuery(int k, Shape query, Visitor v, NearestNeighborComparator nnc)
nearestNeighborQuery
in interface SpatialIndex
public void nearestNeighborQuery(int k, Shape query, Visitor v)
nearestNeighborQuery
in interface SpatialIndex
public void insertData(java.lang.Object data, Shape shape)
Items with the same "data" and "shape" will be considered equal and only one copy of them will be added to the cache.
insertData
in interface SpatialIndex
data
- to insertshape
- associated with dataid
- the id of the dataprotected abstract void insertData(NodeIdentifier n, java.lang.Object data, Shape shape)
node.getShape().contains(shape)
So this must be checked before calling this method.
node
- where to insert datadata
- shape
- of dataid
- of dataprotected abstract void insertDataOutOfBounds(java.lang.Object data, Shape shape)
data
- shape
- id
- public Statistics getStatistics()
getStatistics
in interface SpatialIndex
protected Node readNode(NodeIdentifier id)
protected void writeNode(Node node)
protected void deleteNode(NodeIdentifier id)
public void flush()
SpatialIndex
flush
in interface SpatialIndex
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |