deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

org.deegree.commons.index
Class SpatialIndex<T>

java.lang.Object
  extended by org.deegree.commons.index.SpatialIndex<T>
Type Parameters:
T - the type returned by the query
Direct Known Subclasses:
QTree, RTree

public abstract class SpatialIndex<T>
extends Object

The SpatialIndex defines basic methods for the adding, removing and querying of a spatial index.

Version:
$Revision: 19860 $, $Date: 2009-09-30 11:10:18 +0200 (Mi, 30 Sep 2009) $
Author:
Rutger Bezema, last edited by: $Author: rbezema $

Constructor Summary
SpatialIndex()
           
 
Method Summary
abstract  void clear()
          Removes all objects from this spatial index.
static float[] createEnvelope(Envelope validDomain)
          Creates float array out of an envelope (Geometry).
abstract  boolean insert(Envelope envelope, T object)
          Add the given object to the spatial index using the given boundingbox
abstract  void insertBulk(List<Pair<Envelope,T>> listOfObjects)
          Create the spatial index from the given list of envelope, objects tuples.
protected  boolean intersects(float[] box1, float[] box2, int maxOffset)
          Test if two envelopes intersect, bbox must be defined as float[4]=min[0],min[1];max[0],max[1]
abstract  Collection<T> query(Envelope envelope)
          Query the spatial index with the given envelope and return all objects which intersect with the given boundingbox.
abstract  boolean remove(T object)
          Removes the given object from this spatial index, using the objects' equals method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpatialIndex

public SpatialIndex()
Method Detail

query

public abstract Collection<T> query(Envelope envelope)
Query the spatial index with the given envelope and return all objects which intersect with the given boundingbox.

Parameters:
envelope - to intersect
Returns:
the list of intersecting objects.

insertBulk

public abstract void insertBulk(List<Pair<Envelope,T>> listOfObjects)
Create the spatial index from the given list of envelope, objects tuples.

Parameters:
listOfObjects - to be inserted into the spatial index.

clear

public abstract void clear()
Removes all objects from this spatial index.


insert

public abstract boolean insert(Envelope envelope,
                               T object)
Add the given object to the spatial index using the given boundingbox

Parameters:
envelope - of the object
object - to insert
Returns:
true if the object could be inserted.
Throws:
UnsupportedOperationException - if the implementation does not support inserting single objects

remove

public abstract boolean remove(T object)
Removes the given object from this spatial index, using the objects' equals method.

Parameters:
object - to be removed
Returns:
true if the removal was successful, false otherwise
Throws:
UnsupportedOperationException - if the implementation does not support removal of objects

intersects

protected boolean intersects(float[] box1,
                             float[] box2,
                             int maxOffset)
Test if two envelopes intersect, bbox must be defined as float[4]=min[0],min[1];max[0],max[1]

Parameters:
box1 - the first envelope
box2 - the second envelope
maxOffset - the offset within the bbox where the max point starts.
Returns:
true if the given boxes intersects with each other.

createEnvelope

public static final float[] createEnvelope(Envelope validDomain)
Creates float array out of an envelope (Geometry).

Parameters:
validDomain -
Returns:
a float[] representation of the given envelope

deegree-core-3.0-pre-nightly (2010/03/05 00:01) - official

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

]]>