public class PolygonBuilder extends ShapeBuilder
PolygonBuilder implements the groundwork to create polygons. This contains
Methods to wrap polygons at the dateline and building shapes from the data held by the
builder.ShapeBuilder.CoordinateNode, ShapeBuilder.Edge, ShapeBuilder.GeoShapeType, ShapeBuilder.OrientationWriteable.Reader<V>, Writeable.Writer<V>ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params| Modifier and Type | Field and Description |
|---|---|
static ShapeBuilder.GeoShapeType |
TYPE |
AUTO_INDEX_JTS_GEOMETRY, AUTO_VALIDATE_JTS_GEOMETRY, DATELINE, FACTORY, FIELD_COORDINATES, FIELD_GEOMETRIES, FIELD_ORIENTATION, FIELD_TYPE, INTERSECTION_ORDER, LOGGER, MULTI_POLYGON_MAY_OVERLAP, SPATIAL_CONTEXT, wrapdateline, ZERO_ZEROEMPTY_PARAMS| Constructor and Description |
|---|
PolygonBuilder(CoordinatesBuilder coordinates) |
PolygonBuilder(CoordinatesBuilder coordinates,
ShapeBuilder.Orientation orientation) |
PolygonBuilder(LineStringBuilder lineString,
ShapeBuilder.Orientation orientation) |
PolygonBuilder(LineStringBuilder lineString,
ShapeBuilder.Orientation orientation,
boolean coerce) |
PolygonBuilder(StreamInput in)
Read from a stream.
|
| Modifier and Type | Method and Description |
|---|---|
org.locationtech.spatial4j.shape.Shape |
build()
Create a new Shape from this builder.
|
com.vividsolutions.jts.geom.Geometry |
buildGeometry(com.vividsolutions.jts.geom.GeometryFactory factory,
boolean fixDateline) |
PolygonBuilder |
close()
Close the shell of the polygon
|
com.vividsolutions.jts.geom.Coordinate[][][] |
coordinates()
The coordinates setup by the builder will be assembled to a polygon.
|
protected XContentBuilder |
coordinatesArray(XContentBuilder builder,
ToXContent.Params params) |
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
PolygonBuilder |
hole(LineStringBuilder hole)
Add a new hole to the polygon
|
PolygonBuilder |
hole(LineStringBuilder hole,
boolean coerce)
Add a new hole to the polygon
|
java.util.List<LineStringBuilder> |
holes() |
protected static com.vividsolutions.jts.geom.LinearRing |
linearRing(com.vividsolutions.jts.geom.GeometryFactory factory,
java.util.List<com.vividsolutions.jts.geom.Coordinate> coordinates) |
protected static com.vividsolutions.jts.geom.MultiPolygon |
multipolygon(com.vividsolutions.jts.geom.GeometryFactory factory,
com.vividsolutions.jts.geom.Coordinate[][][] polygons)
Create a Multipolygon from a set of coordinates.
|
ShapeBuilder.Orientation |
orientation() |
protected static com.vividsolutions.jts.geom.Polygon |
polygon(com.vividsolutions.jts.geom.GeometryFactory factory,
com.vividsolutions.jts.geom.Coordinate[][] polygon) |
LineStringBuilder |
shell() |
com.vividsolutions.jts.geom.Polygon |
toPolygon() |
protected com.vividsolutions.jts.geom.Polygon |
toPolygon(com.vividsolutions.jts.geom.GeometryFactory factory) |
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
ShapeBuilder.GeoShapeType |
type()
get the shapes type
|
protected void |
validateHole(LineStringBuilder shell,
LineStringBuilder hole)
Validates only 1 vertex is tangential (shared) between the interior and exterior of a polygon
|
void |
writeTo(StreamOutput out)
Write this into the StreamOutput.
|
debugEnabled, getWriteableName, intersection, intersections, jtsGeometry, parse, parse, readFromStream, shift, toXContent, writeCoordinateTobuildAsBytes, buildAsBytes, toString, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitisFragmentpublic static final ShapeBuilder.GeoShapeType TYPE
public PolygonBuilder(LineStringBuilder lineString, ShapeBuilder.Orientation orientation, boolean coerce)
public PolygonBuilder(LineStringBuilder lineString, ShapeBuilder.Orientation orientation)
public PolygonBuilder(CoordinatesBuilder coordinates, ShapeBuilder.Orientation orientation)
public PolygonBuilder(CoordinatesBuilder coordinates)
public PolygonBuilder(StreamInput in) throws java.io.IOException
java.io.IOExceptionpublic void writeTo(StreamOutput out) throws java.io.IOException
Writeablejava.io.IOExceptionpublic ShapeBuilder.Orientation orientation()
public PolygonBuilder hole(LineStringBuilder hole)
hole - linear ring defining the holepublic PolygonBuilder hole(LineStringBuilder hole, boolean coerce)
hole - linear ring defining the holecoerce - if set to true, it will try to close the hole by adding starting point as end pointpublic java.util.List<LineStringBuilder> holes()
public LineStringBuilder shell()
public PolygonBuilder close()
protected void validateHole(LineStringBuilder shell, LineStringBuilder hole)
public com.vividsolutions.jts.geom.Coordinate[][][] coordinates()
public org.locationtech.spatial4j.shape.Shape build()
ShapeBuilderbuild in class ShapeBuilderShape defined by the builderprotected XContentBuilder coordinatesArray(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOExceptionpublic XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOExceptionpublic com.vividsolutions.jts.geom.Geometry buildGeometry(com.vividsolutions.jts.geom.GeometryFactory factory,
boolean fixDateline)
public com.vividsolutions.jts.geom.Polygon toPolygon()
protected com.vividsolutions.jts.geom.Polygon toPolygon(com.vividsolutions.jts.geom.GeometryFactory factory)
protected static com.vividsolutions.jts.geom.LinearRing linearRing(com.vividsolutions.jts.geom.GeometryFactory factory,
java.util.List<com.vividsolutions.jts.geom.Coordinate> coordinates)
public ShapeBuilder.GeoShapeType type()
ShapeBuildertype in class ShapeBuilderprotected static com.vividsolutions.jts.geom.Polygon polygon(com.vividsolutions.jts.geom.GeometryFactory factory,
com.vividsolutions.jts.geom.Coordinate[][] polygon)
protected static com.vividsolutions.jts.geom.MultiPolygon multipolygon(com.vividsolutions.jts.geom.GeometryFactory factory,
com.vividsolutions.jts.geom.Coordinate[][][] polygons)
factory - GeometryFactory to usepolygons - definition of polygonspublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object