org.apache.lucene.spatial3d.geom

## Class GeoBaseDistanceShape

- java.lang.Object
- - org.apache.lucene.spatial3d.geom.BasePlanetObject
  - - org.apache.lucene.spatial3d.geom.GeoBaseShape
    - - org.apache.lucene.spatial3d.geom.GeoBaseMembershipShape
      - - org.apache.lucene.spatial3d.geom.GeoBaseDistanceShape

- All Implemented Interfaces:
    Bounded, GeoArea, GeoAreaShape, GeoDistance, GeoDistanceShape, GeoMembershipShape, GeoOutsideDistance, GeoShape, Membership, PlanetObject, SerializableObject

      public abstract class GeoBaseDistanceShape
      extends GeoBaseMembershipShape
      implements GeoDistanceShape

  Distance shapes have capabilities of both geohashing and distance computation (which also includes point membership determination).
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static int` | `ALL_INSIDE` All edgepoints inside shape
    `protected static int` | `NONE_INSIDE` No edgepoints inside shape
    `protected static int` | `SOME_INSIDE` Some edgepoints inside shape

    - ### Fields inherited from class org.apache.lucene.spatial3d.geom.BasePlanetObject

      `planetModel`

    - ### Fields inherited from interface org.apache.lucene.spatial3d.geom.GeoArea

      `CONTAINS, DISJOINT, OVERLAPS, WITHIN`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GeoBaseDistanceShape(PlanetModel planetModel)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `computeDeltaDistance(DistanceStyle distanceStyle, double x, double y, double z)` Compute the shape's delta distance given a point.
    `double` | `computeDeltaDistance(DistanceStyle distanceStyle, GeoPoint point)` Compute the shape's delta distance given a point.
    `double` | `computeDistance(DistanceStyle distanceStyle, double x, double y, double z)` Compute this shape's internal "distance" to the GeoPoint.
    `double` | `computeDistance(DistanceStyle distanceStyle, GeoPoint point)` Compute this shape's internal "distance" to the GeoPoint.
    `protected double` | `deltaDistance(DistanceStyle distanceStyle, double x, double y, double z)` Called by a `computeDeltaDistance` method if X/Y/Z is within this shape.
    `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.
    `protected abstract void` | `distanceBounds(Bounds bounds, DistanceStyle distanceStyle, double distanceValue)` Called by a `getDistanceBounds` method if distanceValue is not Double.POSITIVE_INFINITY.
    `void` | `getDistanceBounds(Bounds bounds, DistanceStyle distanceStyle, double distanceValue)` Compute a bound based on a provided distance measure.
    `int` | `getRelationship(GeoShape geoShape)` Find the spatial relationship between a shape and the current geo area.
    `protected int` | `isGeoAreaShapeInsideShape(GeoShape geoshape)` Determine the relationship between the GeoAreaShape's edgepoints and the provided shape.
    `protected int` | `isShapeInsideGeoAreaShape(GeoShape geoShape)` Determine the relationship between the GeoAreShape and the shape's edgepoints.
    `boolean` | `isWithin(Vector point)` Check if a point is within this shape.

    - ### Methods inherited from class org.apache.lucene.spatial3d.geom.GeoBaseMembershipShape

      `computeOutsideDistance, computeOutsideDistance, outsideDistance`

    - ### Methods inherited from class org.apache.lucene.spatial3d.geom.GeoBaseShape

      `getBounds`

    - ### Methods inherited from class org.apache.lucene.spatial3d.geom.BasePlanetObject

      `equals, getPlanetModel, hashCode, write`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.lucene.spatial3d.geom.GeoAreaShape

      `intersects`

    - ### Methods inherited from interface org.apache.lucene.spatial3d.geom.GeoShape

      `getEdgePoints, intersects`

    - ### Methods inherited from interface org.apache.lucene.spatial3d.geom.Bounded

      `getBounds`

    - ### Methods inherited from interface org.apache.lucene.spatial3d.geom.PlanetObject

      `getPlanetModel`

    - ### Methods inherited from interface org.apache.lucene.spatial3d.geom.SerializableObject

      `readBitSet, readBoolean, readByteArray, readClass, readDouble, readHeterogeneousArray, readHomogeneousArray, readInt, readLong, readObject, readObject, readObject, readObject, readPlanetObject, readPointArray, readPolygonArray, readString, write, writeBitSet, writeBoolean, writeByteArray, writeClass, writeDouble, writeHeterogeneousArray, writeHeterogeneousArray, writeHomogeneousArray, writeHomogeneousArray, writeInt, writeLong, writeObject, writePlanetObject, writePointArray, writePointArray, writePolygonArray, writePolygonArray, writeString`

    - ### Methods inherited from interface org.apache.lucene.spatial3d.geom.GeoOutsideDistance

      `computeOutsideDistance, computeOutsideDistance`

    - ### Methods inherited from interface org.apache.lucene.spatial3d.geom.Membership

      `isWithin`

    - ### Methods inherited from interface org.apache.lucene.spatial3d.geom.GeoArea

      `getRelationship`

- - ### Field Detail

    - #### ALL_INSIDE

          protected static final int ALL_INSIDE

      All edgepoints inside shape
      See Also:
        Constant Field Values

    - #### SOME_INSIDE

          protected static final int SOME_INSIDE

      Some edgepoints inside shape
      See Also:
        Constant Field Values

    - #### NONE_INSIDE

          protected static final int NONE_INSIDE

      No edgepoints inside shape
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### GeoBaseDistanceShape

          public GeoBaseDistanceShape(PlanetModel planetModel)

      Constructor.
      Parameters:
        `planetModel` - is the planet model to use.

  - ### Method Detail

    - #### 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.

    - #### isShapeInsideGeoAreaShape

          protected int isShapeInsideGeoAreaShape(GeoShape geoShape)

      Determine the relationship between the GeoAreShape and the shape's edgepoints.
      Parameters:
        `geoShape` - is the shape.
      Returns:
        the relationship.

    - #### isGeoAreaShapeInsideShape

          protected int isGeoAreaShapeInsideShape(GeoShape geoshape)

      Determine the relationship between the GeoAreaShape's edgepoints and the provided shape.
      Parameters:
        `geoshape` - is the shape.
      Returns:
        the relationship.

    - #### getRelationship

          public int getRelationship(GeoShape geoShape)

      Description copied from interface: `GeoArea`
      Find the spatial relationship between a shape and the current geo area. Note: return value is how the GeoShape relates to the GeoArea, not the other way around. For example, if this GeoArea is entirely within the shape, then CONTAINS should be returned. If the shape is entirely enclosed by this GeoArea, then WITHIN should be returned. It is permissible to return OVERLAPS instead of WITHIN if the shape intersects with the area at even a single point. So, a circle inscribed in a rectangle could return either OVERLAPS or WITHIN, depending on implementation. It is not permissible to return CONTAINS or DISJOINT in this circumstance, however. Similarly, it is permissible to return OVERLAPS instead of CONTAINS under conditions where the shape consists of multiple independent overlapping subshapes, and the area overlaps one of the subshapes. It is not permissible to return WITHIN or DISJOINT in this circumstance, however.
      Specified by:
        `getRelationship` in interface `GeoArea`
      Parameters:
        `geoShape` - is the shape to consider.
      Returns:
        the relationship, from the perspective of the shape.

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.