|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.caching.spatialindex.AbstractSpatialIndex
org.geotools.caching.grid.spatialindex.GridSpatialIndex
public class GridSpatialIndex
A grid implementation of SpatialIndex. A grid is a regular division of space, and is implemented as a very simple tree. It has two levels, a top level consisting of one root node, and a bottom level of nodes of the same size forming a grid. Data is either inserted at the top level or at the bottom level, and may be inserted more than once, if data intersects more than one node. If data's shape is too big, it is inserted at the top level. For the grid to be efficient, data should evenly distributed in size and in space, and grid size should twice the mean size of data's shape.
Field Summary | |
---|---|
static java.lang.String |
GRID_CAPACITY_PROPERTY
|
static java.lang.String |
GRID_SIZE_PROPERTY
|
protected int |
gridsize
|
protected int |
MAX_INSERTION
|
protected Region |
mbr
|
static java.lang.String |
ROOT_MBR_MAXX_PROPERTY
|
static java.lang.String |
ROOT_MBR_MAXY_PROPERTY
|
static java.lang.String |
ROOT_MBR_MINX_PROPERTY
|
static java.lang.String |
ROOT_MBR_MINY_PROPERTY
|
Fields inherited from class org.geotools.caching.spatialindex.AbstractSpatialIndex |
---|
ContainmentQuery, dimension, infiniteRegion, IntersectionQuery, root, rootNode, stats, store |
Fields inherited from interface org.geotools.caching.spatialindex.SpatialIndex |
---|
EPSILON, INDEX_TYPE_PROPERTY |
Constructor Summary | |
---|---|
protected |
GridSpatialIndex()
|
|
GridSpatialIndex(Region mbr,
int gridsize,
Storage store,
int capacity)
Constructor. |
Method Summary | |
---|---|
void |
clear()
Empty the index. |
static SpatialIndex |
createInstance(java.util.Properties pset)
|
void |
dispose()
|
void |
evict(NodeIdentifier node)
must deal with synchronization outside this method. |
java.util.List<NodeIdentifier>[] |
findMissingTiles(Region search)
Searches the index for missing tiles Returns both the "valid" tiles and the "invalid" tiles |
NodeIdentifier |
findUniqueInstance(NodeIdentifier id)
|
boolean |
getDoRecordAccess()
|
EvictionPolicy |
getEvictionPolicy()
|
int |
getEvictions()
|
java.util.Properties |
getIndexProperties()
|
GridRootNode |
getRootNode()
|
GridSpatialIndexStatistics |
getStatistics()
|
void |
initializeFromStorage(Storage storage)
Initializes the spatial index from a storage instance. |
protected void |
insertData(NodeIdentifier n,
java.lang.Object data,
Shape shape)
Insert new data into target node. |
void |
insertData(java.lang.Object data,
Shape shape)
This function assumes that you have a lock on the necessary nodes. |
protected void |
insertDataOutOfBounds(java.lang.Object data,
Shape shape)
Insert new data with shape not contained in the current index. |
boolean |
isIndexValid()
Implementations may always return true. |
protected void |
rangeQuery(int type,
Shape query,
Visitor v)
Common algorithm used by both intersection and containment queries. |
Node |
readNode(NodeIdentifier id)
|
void |
setDoRecordAccess(boolean b)
|
protected void |
visitData(Node n,
Visitor v,
Shape query,
int type)
Visit data associated with a node using given visitor. |
void |
writeNode(Node node)
Assumes you have a write lock on the node you are writing. |
Methods inherited from class org.geotools.caching.spatialindex.AbstractSpatialIndex |
---|
containmentQuery, deleteNode, flush, getStorage, intersectionQuery, nearestNeighborQuery, nearestNeighborQuery, pointLocationQuery |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String GRID_SIZE_PROPERTY
public static final java.lang.String GRID_CAPACITY_PROPERTY
public static final java.lang.String ROOT_MBR_MINX_PROPERTY
public static final java.lang.String ROOT_MBR_MINY_PROPERTY
public static final java.lang.String ROOT_MBR_MAXX_PROPERTY
public static final java.lang.String ROOT_MBR_MAXY_PROPERTY
protected int MAX_INSERTION
protected int gridsize
protected Region mbr
Constructor Detail |
---|
public GridSpatialIndex(Region mbr, int gridsize, Storage store, int capacity)
mbr
and with at least capacity
nodes.
mbr
- capacity
- - the number of tiles in the indexstore
- - the backend index storageprotected GridSpatialIndex()
Method Detail |
---|
public static SpatialIndex createInstance(java.util.Properties pset)
public GridRootNode getRootNode()
public void dispose()
protected void visitData(Node n, Visitor v, Shape query, int type)
AbstractSpatialIndex
visitData
in class AbstractSpatialIndex
type
- of query, either containement or intersection (@see AbstractSpatialIndex)public void clear() throws java.lang.IllegalStateException
SpatialIndex
clear
in interface SpatialIndex
java.lang.IllegalStateException
public java.util.Properties getIndexProperties()
getIndexProperties
in interface SpatialIndex
protected void insertData(NodeIdentifier n, java.lang.Object data, Shape shape)
AbstractSpatialIndex
node.getShape().contains(shape)
So this must be checked before calling this method.
insertData
in class AbstractSpatialIndex
shape
- of dataprotected void insertDataOutOfBounds(java.lang.Object data, Shape shape)
AbstractSpatialIndex
insertDataOutOfBounds
in class AbstractSpatialIndex
public boolean isIndexValid()
SpatialIndex
isIndexValid
in interface SpatialIndex
public NodeIdentifier findUniqueInstance(NodeIdentifier id)
public void initializeFromStorage(Storage storage)
SpatialIndex
This allows caches to be saved to storage and reused.
initializeFromStorage
in interface SpatialIndex
protected void rangeQuery(int type, Shape query, Visitor v)
rangeQuery
in class AbstractSpatialIndex
type
- query
- v
- public java.util.List<NodeIdentifier>[] findMissingTiles(Region search)
search
- must be within the mbr of the index
public int getEvictions()
public EvictionPolicy getEvictionPolicy()
public void evict(NodeIdentifier node)
evict
in interface EvictableTree
public Node readNode(NodeIdentifier id)
readNode
in class AbstractSpatialIndex
public GridSpatialIndexStatistics getStatistics()
getStatistics
in interface SpatialIndex
getStatistics
in class AbstractSpatialIndex
public void writeNode(Node node)
writeNode
in class AbstractSpatialIndex
public boolean getDoRecordAccess()
public void setDoRecordAccess(boolean b)
public void insertData(java.lang.Object data, Shape shape)
insertData
in interface SpatialIndex
insertData
in class AbstractSpatialIndex
data
- to insertshape
- associated with data
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |