6.3.1.3.19. GeometryRTree

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.

6.3.1.3.19.1. Fields

6.3.1.3.19.1.1. mHasEdits

protected boolean mHasEdits

6.3.1.3.19.1.2. mPath

protected File mPath

6.3.1.3.19.2. Constructors

6.3.1.3.19.2.1. GeometryRTree

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

Creates a new RTree.

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

6.3.1.3.19.2.2. GeometryRTree

public GeometryRTree(int maxEntries, int minEntries)

6.3.1.3.19.2.3. GeometryRTree

public GeometryRTree()

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

6.3.1.3.19.3. Methods

6.3.1.3.19.3.1. addItem

public IGeometryCacheItem addItem(long id, GeoEnvelope envelope)

6.3.1.3.19.3.2. changeId

public void changeId(long oldFeatureId, long newFeatureId)

6.3.1.3.19.3.3. clear

public void clear()

Empties the RTree

6.3.1.3.19.3.4. getAll

public synchronized List<IGeometryCacheItem> getAll()

6.3.1.3.19.3.5. getAll

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

6.3.1.3.19.3.6. getItem

public IGeometryCacheItem getItem(long featureId)

6.3.1.3.19.3.7. getItem

public IGeometryCacheItem getItem(long featureId, Node n)

6.3.1.3.19.3.8. getMaxEntries

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

6.3.1.3.19.3.9. getMinEntries

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

6.3.1.3.19.3.10. insert

public IGeometryCacheItem insert(long featureId, GeoEnvelope envelope)

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

Parameters:
  • featureId – a feature identificator
  • envelope – an envelope

6.3.1.3.19.3.11. isItemExist

public boolean isItemExist(long featureId)

6.3.1.3.19.3.12. isItemExist

public boolean isItemExist(long featureId, Node n)

6.3.1.3.19.3.13. load

public void load(File path)

6.3.1.3.19.3.14. removeItem

public IGeometryCacheItem removeItem(long featureId)

Deletes the entry associated with the given rectangle from the RTree

Parameters:
  • featureId – the feature id to delete
Returns:

true if the entry was deleted from the RTree.

6.3.1.3.19.3.15. save

public synchronized void save(File path)

6.3.1.3.19.3.17. size

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