Class SnappingPointIndex


  • public class SnappingPointIndex
    extends java.lang.Object
    An index providing fast creation and lookup of snap points.
    Author:
    mdavis
    • Constructor Summary

      Constructors 
      Constructor Description
      SnappingPointIndex​(double snapTolerance)
      Creates a snap point index using a specified distance tolerance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int depth()
      Computes the depth of the index tree.
      double getTolerance()
      Gets the snapping tolerance value for the index.
      Coordinate snap​(Coordinate p)
      Snaps a coordinate to an existing snap point, if it is within the snap tolerance distance.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SnappingPointIndex

        public SnappingPointIndex​(double snapTolerance)
        Creates a snap point index using a specified distance tolerance.
        Parameters:
        snapTolerance - points are snapped if within this distance
    • Method Detail

      • snap

        public Coordinate snap​(Coordinate p)
        Snaps a coordinate to an existing snap point, if it is within the snap tolerance distance. Otherwise adds the coordinate to the snap point index.
        Parameters:
        p - the point to snap
        Returns:
        the point it snapped to, or the input point
      • getTolerance

        public double getTolerance()
        Gets the snapping tolerance value for the index.
        Returns:
        the snapping tolerance value
      • depth

        public int depth()
        Computes the depth of the index tree.
        Returns:
        the depth of the index tree