Class VertexSequencePackedRtree

java.lang.Object
org.locationtech.jts.index.VertexSequencePackedRtree

public class VertexSequencePackedRtree extends Object
A semi-static spatial index for points which occur in a spatially-coherent sequence. In particular, this is suitable for indexing the vertices of a
invalid reference
LineString
or
invalid reference
Polygon
ring.

The index is constructed in a batch fashion on a given sequence of coordinates. Coordinates can be removed via the remove(int) method.

Note that this index queries only the individual points of the input coordinate sequence, not any line segments which might be lie between them.

The input coordinate array is read-only, and is not changed when vertices are removed.

Author:
Martin Davis
  • Constructor Details

    • VertexSequencePackedRtree

      public VertexSequencePackedRtree(Coordinate[] pts)
      Creates a new tree over the given sequence of coordinates. The sequence should be spatially coherent to provide query performance.
      Parameters:
      pts - a sequence of points
  • Method Details

    • getBounds

      public Envelope[] getBounds()
    • query

      public int[] query(Envelope queryEnv)
      Queries the index to find all items which intersect an extent. The query result is a list of the indices of input coordinates which intersect the extent.
      Parameters:
      queryEnv - the query extent
      Returns:
      an array of the indices of the input coordinates
    • remove

      public void remove(int index)
      Removes the input item at the given index from the spatial index. This does not change the underlying coordinate array.
      Parameters:
      index - the index of the item in the input