org.apache.lucene.spatial3d.geom

## Class GeoCompositePolygon

- java.lang.Object
- - org.apache.lucene.spatial3d.geom.BasePlanetObject
  - - org.apache.lucene.spatial3d.geom.GeoBaseCompositeShape<T>
    - - org.apache.lucene.spatial3d.geom.GeoCompositePolygon

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

      public class GeoCompositePolygon
      extends GeoBaseCompositeShape<T>
      implements GeoPolygon

  GeoCompositePolygon is a specific implementation of GeoCompositeAreaShape, which implements GeoPolygon explicitly.
  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.GeoBaseCompositeShape

      `shapes`

    - ### 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
    `GeoCompositePolygon(PlanetModel planetModel)` Constructor.
    `GeoCompositePolygon(PlanetModel planetModel, InputStream inputStream)` Constructor for deserialization.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `computeOutsideDistance(DistanceStyle distanceStyle, double x, double y, double z)` Compute this shape's distance to the GeoPoint.
    `double` | `computeOutsideDistance(DistanceStyle distanceStyle, GeoPoint point)` Compute this shape's distance to the GeoPoint.
    `boolean` | `equals(Object o)`
    `int` | `getRelationship(GeoShape geoShape)` Find the spatial relationship between a shape and the current geo area.
    `boolean` | `intersects(GeoShape geoShape)` Assess whether a shape intersects with any of the edges of this shape.
    `protected int` | `isGeoAreaShapeInsideShape(GeoShape geoshape)` Determine the relationship between the GeoAreShape's edgepoints and the provided shape.
    `protected int` | `isShapeInsideGeoAreaShape(GeoShape geoShape)` Determine the relationship between the GeoAreShape and the shape's edgepoints.
    `String` | `toString()`

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

      `addShape, getBounds, getEdgePoints, getShape, hashCode, intersects, isWithin, isWithin, size, write`

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

      `getPlanetModel`

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

      `clone, finalize, getClass, notify, notifyAll, 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, 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

    - #### GeoCompositePolygon

          public GeoCompositePolygon(PlanetModel planetModel)

      Constructor.

    - #### GeoCompositePolygon

          public GeoCompositePolygon(PlanetModel planetModel,
                                     InputStream inputStream)
                              throws IOException

      Constructor for deserialization.
      Parameters:
        `planetModel` - is the planet model.
        `inputStream` - is the input stream.
      Throws:
        `IOException`

  - ### Method Detail

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `GeoBaseCompositeShape<GeoPolygon>`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### intersects

          public boolean intersects(GeoShape geoShape)

      Description copied from interface: `GeoAreaShape`
      Assess whether a shape intersects with any of the edges of this shape. Note well that this method must return false if the shape contains or is disjoint with the given shape. It is permissible to return true if the shape is within the specified shape, if it is difficult to compute intersection with edges.
      Specified by:
        `intersects` in interface `GeoAreaShape`
      Parameters:
        `geoShape` - is the shape to assess for intersection with this shape's edges.
      Returns:
        true if there's such an intersection, false if not.

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

    - #### 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 GeoAreShape's edgepoints and the provided shape.
      Parameters:
        `geoshape` - is the shape.
      Returns:
        the relationship.

    - #### computeOutsideDistance

          public double computeOutsideDistance(DistanceStyle distanceStyle,
                                               GeoPoint point)

      Description copied from interface: `GeoOutsideDistance`
      Compute this shape's distance to the GeoPoint. A return value of 0.0 should be returned for points inside of the shape.
      Specified by:
        `computeOutsideDistance` in interface `GeoOutsideDistance`
      Parameters:
        `distanceStyle` - is the distance style.
        `point` - is the point to compute the distance to.
      Returns:
        the distance.

    - #### computeOutsideDistance

          public double computeOutsideDistance(DistanceStyle distanceStyle,
                                               double x,
                                               double y,
                                               double z)

      Description copied from interface: `GeoOutsideDistance`
      Compute this shape's distance to the GeoPoint. A return value of 0.0 should be returned for points inside of the shape.
      Specified by:
        `computeOutsideDistance` in interface `GeoOutsideDistance`
      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.

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