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: 23009 $, $Date: 2010-03-11 15:37:56 +0100 (Thu, 11 Mar 2010) $
Author:
Rutger Bezema, last edited by: $Author: aschmitz $

Constructor Summary
SpatialIndex()
           
 
Method Summary
abstract  void clear()
          Removes all objects from this spatial index.
abstract  boolean insert(float[] envelope, T object)
          Add the given object to the spatial index using the given boundingbox
abstract  void insertBulk(List<Pair<float[],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(float[] 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(float[] 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<float[],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(float[] 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.


Copyright © 2011. All Rights Reserved.