GeoPolygonFactory (Lucene 10.5.1 spatial3d API)
Description: declaration: package: org.apache.lucene.spatial3d.geom, class: GeoPolygonFactory

Package org.apache.lucene.spatial3d.geom

# Class GeoPolygonFactory

java.lang.Object
org.apache.lucene.spatial3d.geom.GeoPolygonFactory

public class GeoPolygonFactory extends Object
Class which constructs a GeoMembershipShape representing an arbitrary polygon.

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `GeoPolygonFactory.PolygonDescription`
  Use this class to specify a polygon with associated holes.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static GeoPolygon`
  `makeGeoConcavePolygon(PlanetModel planetModel, List<GeoPoint> pointList)`
  Create a GeoConcavePolygon using the specified points.
  `static GeoPolygon`
  `makeGeoConcavePolygon(PlanetModel planetModel, List<GeoPoint> pointList, List<GeoPolygon> holes)`
  Create a GeoConcavePolygon using the specified points and holes.
  `static GeoPolygon`
  `makeGeoConvexPolygon(PlanetModel planetModel, List<GeoPoint> pointList)`
  Create a GeoConvexPolygon using the specified points.
  `static GeoPolygon`
  `makeGeoConvexPolygon(PlanetModel planetModel, List<GeoPoint> pointList, List<GeoPolygon> holes)`
  Create a GeoConvexPolygon using the specified points and holes.
  `static GeoPolygon`
  `makeGeoPolygon(PlanetModel planetModel, List<GeoPoint> pointList)`
  Create a GeoPolygon using the specified points and holes, using order to determine siding of the polygon.
  `static GeoPolygon`
  `makeGeoPolygon(PlanetModel planetModel, List<GeoPoint> pointList, List<GeoPolygon> holes)`
  Create a GeoPolygon using the specified points and holes, using order to determine siding of the polygon.
  `static GeoPolygon`
  `makeGeoPolygon(PlanetModel planetModel, List<GeoPoint> pointList, List<GeoPolygon> holes, double leniencyValue)`
  Create a GeoPolygon using the specified points and holes, using order to determine siding of the polygon.
  `static GeoPolygon`
  `makeGeoPolygon(PlanetModel planetModel, GeoPolygonFactory.PolygonDescription description)`
  Create a GeoPolygon using the specified points and holes, using order to determine siding of the polygon.
  `static GeoPolygon`
  `makeGeoPolygon(PlanetModel planetModel, GeoPolygonFactory.PolygonDescription description, double leniencyValue)`
  Create a GeoPolygon using the specified points and holes, using order to determine siding of the polygon.
  `static GeoPolygon`
  `makeLargeGeoPolygon(PlanetModel planetModel, List<GeoPolygonFactory.PolygonDescription> shapesList)`
  Create a large GeoPolygon.

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

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

- ## Method Details

  - ### makeGeoConcavePolygon

    public static GeoPolygon makeGeoConcavePolygon(PlanetModel planetModel, List<GeoPoint> pointList)
    Create a GeoConcavePolygon using the specified points. The polygon must have a maximum extent larger than PI. The siding of the polygon is chosen so that any adjacent point to a segment provides an exterior measurement and therefore, the polygon is a truly concave polygon. Note that this method should only be used when there is certainty that we are dealing with a concave polygon, e.g. the polygon has been serialized. If there is not such certainty, please refer to @`makeGeoPolygon(PlanetModel, List)`.
    Parameters:
      `pointList` - is a list of the GeoPoints to build an arbitrary polygon out of.
    Returns:
      a GeoPolygon corresponding to what was specified.

  - ### makeGeoConvexPolygon

    public static GeoPolygon makeGeoConvexPolygon(PlanetModel planetModel, List<GeoPoint> pointList)
    Create a GeoConvexPolygon using the specified points. The polygon must have a maximum extent no larger than PI. The siding of the polygon is chosen so that any adjacent point to a segment provides an interior measurement and therefore the polygon is a truly convex polygon. Note that this method should only be used when there is certainty that we are dealing with a convex polygon, e.g. the polygon has been serialized. If there is not such certainty, please refer to @`makeGeoPolygon(PlanetModel, List)`.
    Parameters:
      `pointList` - is a list of the GeoPoints to build an arbitrary polygon out of.
    Returns:
      a GeoPolygon corresponding to what was specified.

  - ### makeGeoConcavePolygon

    public static GeoPolygon makeGeoConcavePolygon(PlanetModel planetModel, List<GeoPoint> pointList, List<GeoPolygon> holes)
    Create a GeoConcavePolygon using the specified points and holes. The polygon must have a maximum extent larger than PI. The siding of the polygon is chosen so that any adjacent point to a segment provides an exterior measurement and therefore the polygon is a truly concave polygon. Note that this method should only be used when there is certainty that we are dealing with a concave polygon, e.g. the polygon has been serialized. If there is not such certainty, please refer to `makeGeoPolygon(PlanetModel, List, List)`.
    Parameters:
      `pointList` - is a list of the GeoPoints to build an arbitrary polygon out of.
      `holes` - is a list of polygons representing "holes" in the outside polygon. Holes describe the area outside each hole as being "in set". Null == none.
    Returns:
      a GeoPolygon corresponding to what was specified.

  - ### makeGeoConvexPolygon

    public static GeoPolygon makeGeoConvexPolygon(PlanetModel planetModel, List<GeoPoint> pointList, List<GeoPolygon> holes)
    Create a GeoConvexPolygon using the specified points and holes. The polygon must have a maximum extent no larger than PI. The siding of the polygon is chosen so that any adjacent point to a segment provides an interior measurement and therefore the polygon is a truly convex polygon. Note that this method should only be used when there is certainty that we are dealing with a convex polygon, e.g. the polygon has been serialized. If there is not such certainty, please refer to `makeGeoPolygon(PlanetModel, List, List)`.
    Parameters:
      `pointList` - is a list of the GeoPoints to build an arbitrary polygon out of.
      `holes` - is a list of polygons representing "holes" in the outside polygon. Holes describe the area outside each hole as being "in set". Null == none.
    Returns:
      a GeoPolygon corresponding to what was specified.

  - ### makeGeoPolygon

    public static GeoPolygon makeGeoPolygon(PlanetModel planetModel, GeoPolygonFactory.PolygonDescription description)
    Create a GeoPolygon using the specified points and holes, using order to determine siding of the polygon. Much like ESRI, this method uses clockwise to indicate the space on the same side of the shape as being inside, and counter-clockwise to indicate the space on the opposite side as being inside.
    Parameters:
      `description` - describes the polygon and its associated holes. If points go clockwise from a given pole, then that pole should be within the polygon. If points go counter-clockwise, then that pole should be outside the polygon.
    Returns:
      a GeoPolygon corresponding to what was specified, or null if a valid polygon cannot be generated from this input.

  - ### makeGeoPolygon

    public static GeoPolygon makeGeoPolygon(PlanetModel planetModel, GeoPolygonFactory.PolygonDescription description, double leniencyValue)
    Create a GeoPolygon using the specified points and holes, using order to determine siding of the polygon. Much like ESRI, this method uses clockwise to indicate the space on the same side of the shape as being inside, and counter-clockwise to indicate the space on the opposite side as being inside.
    Parameters:
      `description` - describes the polygon and its associated holes. If points go clockwise from a given pole, then that pole should be within the polygon. If points go counter-clockwise, then that pole should be outside the polygon.
      `leniencyValue` - is the maximum distance (in units) that a point can be from the plane and still be considered as belonging to the plane. Any value greater than zero may cause some of the provided points that are in fact outside the strict definition of co-planarity, but are within this distance, to be discarded for the purposes of creating a "safe" polygon.
    Returns:
      a GeoPolygon corresponding to what was specified, or null if a valid polygon cannot be generated from this input.

  - ### makeGeoPolygon

    public static GeoPolygon makeGeoPolygon(PlanetModel planetModel, List<GeoPoint> pointList)
    Create a GeoPolygon using the specified points and holes, using order to determine siding of the polygon. Much like ESRI, this method uses clockwise to indicate the space on the same side of the shape as being inside, and counter-clockwise to indicate the space on the opposite side as being inside.
    Parameters:
      `pointList` - is a list of the GeoPoints to build an arbitrary polygon out of. If points go clockwise from a given pole, then that pole should be within the polygon. If points go counter-clockwise, then that pole should be outside the polygon.
    Returns:
      a GeoPolygon corresponding to what was specified.

  - ### makeGeoPolygon

    public static GeoPolygon makeGeoPolygon(PlanetModel planetModel, List<GeoPoint> pointList, List<GeoPolygon> holes)
    Create a GeoPolygon using the specified points and holes, using order to determine siding of the polygon. Much like ESRI, this method uses clockwise to indicate the space on the same side of the shape as being inside, and counter-clockwise to indicate the space on the opposite side as being inside.
    Parameters:
      `pointList` - is a list of the GeoPoints to build an arbitrary polygon out of. If points go clockwise from a given pole, then that pole should be within the polygon. If points go counter-clockwise, then that pole should be outside the polygon.
      `holes` - is a list of polygons representing "holes" in the outside polygon. Holes describe the area outside each hole as being "in set". Null == none.
    Returns:
      a GeoPolygon corresponding to what was specified, or null if a valid polygon cannot be generated from this input.

  - ### makeGeoPolygon

    public static GeoPolygon makeGeoPolygon(PlanetModel planetModel, List<GeoPoint> pointList, List<GeoPolygon> holes, double leniencyValue)
    Create a GeoPolygon using the specified points and holes, using order to determine siding of the polygon. Much like ESRI, this method uses clockwise to indicate the space on the same side of the shape as being inside, and counter-clockwise to indicate the space on the opposite side as being inside.
    Parameters:
      `pointList` - is a list of the GeoPoints to build an arbitrary polygon out of. If points go clockwise from a given pole, then that pole should be within the polygon. If points go counter-clockwise, then that pole should be outside the polygon.
      `holes` - is a list of polygons representing "holes" in the outside polygon. Holes describe the area outside each hole as being "in set". Null == none.
      `leniencyValue` - is the maximum distance (in units) that a point can be from the plane and still be considered as belonging to the plane. Any value greater than zero may cause some of the provided points that are in fact outside the strict definition of co-planarity, but are within this distance, to be discarded for the purposes of creating a "safe" polygon.
    Returns:
      a GeoPolygon corresponding to what was specified, or null if a valid polygon cannot be generated from this input.

  - ### makeLargeGeoPolygon

    public static GeoPolygon makeLargeGeoPolygon(PlanetModel planetModel, List<GeoPolygonFactory.PolygonDescription> shapesList)
    Create a large GeoPolygon. This is one which has more than 100 sides and/or may have resolution problems with very closely spaced points, which often occurs when the polygon was constructed to approximate curves. No tiling is done, and intersections and membership are optimized for having large numbers of sides.

    This method does very little checking for legality. It expects the incoming shapes to not intersect each other. The shapes can be disjoint or nested. If the shapes listed are nested, then we are describing holes. There is no limit to the depth of holes. However, if a shape is nested within another it must be explicitly described as being a child of the other shape.

    Membership in any given shape is described by the clockwise/counterclockwise direction of the points. The clockwise direction indicates that a point inside is "in-set", while a counter-clockwise direction implies that a point inside is "out-of-set".

    Parameters:
      `planetModel` - is the planet model.
      `shapesList` - is the list of polygons we should be making.
    Returns:
      the GeoPolygon, or null if it cannot be constructed.