Class GeoBaseDistanceShape

All Implemented Interfaces:
Bounded, GeoArea, GeoAreaShape, GeoBounds, GeoDistance, GeoDistanceShape, GeoMembershipShape, GeoOutsideDistance, GeoShape, Membership, PlanetObject, SerializableObject
Direct Known Subclasses:
GeoBaseCircle, GeoBasePath

public abstract class GeoBaseDistanceShape extends GeoBaseAreaShape implements GeoDistanceShape
Distance shapes have capabilities of both geohashing and distance computation (which also includes point membership determination).
  • Constructor Details

    • GeoBaseDistanceShape

      public GeoBaseDistanceShape(PlanetModel planetModel)
      Constructor.
      Parameters:
      planetModel - is the planet model to use.
  • Method Details

    • isWithin

      public boolean isWithin(Vector point)
      Description copied from interface: Membership
      Check if a point is within this shape.
      Specified by:
      isWithin in interface Membership
      Overrides:
      isWithin in class GeoBaseMembershipShape
      Parameters:
      point - is the point to check.
      Returns:
      true if the point is within this shape
    • computeDistance

      public double computeDistance(DistanceStyle distanceStyle, GeoPoint point)
      Description copied from interface: GeoDistance
      Compute this shape's internal "distance" to the GeoPoint. Implementations should clarify how this is computed when it's non-obvious. A return value of Double.POSITIVE_INFINITY should be returned for points outside of the shape.
      Specified by:
      computeDistance in interface GeoDistance
      Parameters:
      distanceStyle - is the distance style.
      point - is the point to compute the distance to.
      Returns:
      the distance.
    • computeDistance

      public double computeDistance(DistanceStyle distanceStyle, double x, double y, double z)
      Description copied from interface: GeoDistance
      Compute this shape's internal "distance" to the GeoPoint. Implementations should clarify how this is computed when it's non-obvious. A return value of Double.POSITIVE_INFINITY should be returned for points outside of the shape.
      Specified by:
      computeDistance in interface GeoDistance
      Parameters:
      distanceStyle - is the distance style.
      x - is the point's unit x coordinate (using U.S. convention).
      y - is the point's unit y coordinate (using U.S. convention).
      z - is the point's unit z coordinate (using U.S. convention).
      Returns:
      the distance.
    • distance

      protected abstract double distance(DistanceStyle distanceStyle, double x, double y, double z)
      Called by a computeDistance method if X/Y/Z is within this shape.
    • computeDeltaDistance

      public double computeDeltaDistance(DistanceStyle distanceStyle, GeoPoint point)
      Description copied from interface: GeoDistance
      Compute the shape's delta distance given a point. This is defined as the distance that someone traveling the "length" of the shape would have to go out of their way to include the point. For some shapes, e.g. paths, this makes perfect sense. For other shapes, e.g. circles, the "length" of the shape is zero, and the delta is computed as the distance from the center to the point and back. A return value of Double.POSITIVE_INFINITY should be returned for points outside of the shape.
      Specified by:
      computeDeltaDistance in interface GeoDistance
      Parameters:
      distanceStyle - is the distance style.
      point - is the point to compute the distance to.
      Returns:
      the distance.
    • computeDeltaDistance

      public double computeDeltaDistance(DistanceStyle distanceStyle, double x, double y, double z)
      Description copied from interface: GeoDistance
      Compute the shape's delta distance given a point. This is defined as the distance that someone traveling the "length" of the shape would have to go out of their way to include the point. For some shapes, e.g. paths, this makes perfect sense. For other shapes, e.g. circles, the "length" of the shape is zero, and the delta is computed as the distance from the center to the point and back. A return value of Double.POSITIVE_INFINITY should be returned for points outside of the shape.
      Specified by:
      computeDeltaDistance in interface GeoDistance
      Parameters:
      distanceStyle - is the distance style.
      x - is the point's unit x coordinate (using U.S. convention).
      y - is the point's unit y coordinate (using U.S. convention).
      z - is the point's unit z coordinate (using U.S. convention).
      Returns:
      the distance.
    • deltaDistance

      protected double deltaDistance(DistanceStyle distanceStyle, double x, double y, double z)
      Called by a computeDeltaDistance method if X/Y/Z is within this shape.
    • getDistanceBounds

      public void getDistanceBounds(Bounds bounds, DistanceStyle distanceStyle, double distanceValue)
      Description copied from interface: GeoDistanceShape
      Compute a bound based on a provided distance measure. This method takes an input distance and distance metric and provides bounds on the shape if reduced to match that distance. The method is allowed to return bounds that are larger than the distance would indicate, but never smaller.
      Specified by:
      getDistanceBounds in interface GeoDistanceShape
      Parameters:
      bounds - is the bounds object to update.
      distanceStyle - describes the type of distance metric provided.
      distanceValue - is the distance metric to use. It is presumed that the distance metric was produced with the same distance style as is provided to this method.
    • distanceBounds

      protected abstract void distanceBounds(Bounds bounds, DistanceStyle distanceStyle, double distanceValue)
      Called by a getDistanceBounds method if distanceValue is not Double.POSITIVE_INFINITY.