public class GeometryRTree implements IGeometryCache

Implementation of an arbitrary-dimension RTree. Based on R-Trees: A Dynamic Index Structure for Spatial Searching (Antonn Guttmann, 1984) This class is not thread-safe. Fields mHasEdits

protected boolean mHasEdits mPath

protected File mPath Constructors GeometryRTree

public GeometryRTree(int maxEntries, int minEntries, SeedPicker seedPicker)

Creates a new RTree.

  • maxEntries – maximum number of entries per node
  • minEntries – minimum number of entries per node (except for the root node) GeometryRTree

public GeometryRTree(int maxEntries, int minEntries) GeometryRTree

public GeometryRTree()

Builds a new RTree using default parameters: maximum 50 entries per node minimum 2 entries per node Methods addItem

public IGeometryCacheItem addItem(long id, GeoEnvelope envelope) changeId

public void changeId(long oldFeatureId, long newFeatureId) clear

public void clear()

Empties the RTree getAll

public synchronized List<IGeometryCacheItem> getAll() getAll

protected void getAll(Node n, LinkedList<IGeometryCacheItem> results) getItem

public IGeometryCacheItem getItem(long featureId) getItem

public IGeometryCacheItem getItem(long featureId, Node n) getMaxEntries

public int getMaxEntries()
Returns:the maximum number of entries per node getMinEntries

public int getMinEntries()
Returns:the minimum number of entries per node for all nodes except the root. insert

public IGeometryCacheItem insert(long featureId, GeoEnvelope envelope)

Inserts the given entry into the RTree, associated with the given rectangle.

  • featureId – a feature identificator
  • envelope – an envelope isItemExist

public boolean isItemExist(long featureId) isItemExist

public boolean isItemExist(long featureId, Node n) load

public void load(File path) removeItem

public IGeometryCacheItem removeItem(long featureId)

Deletes the entry associated with the given rectangle from the RTree

  • featureId – the feature id to delete

true if the entry was deleted from the RTree. save

public synchronized void save(File path) size

public int size()
Returns:the number of items in this tree.