NamedWriteable
, Writeable
, ToXContent
, ToXContentObject
public class PolygonBuilder extends ShapeBuilder<org.locationtech.spatial4j.shape.jts.JtsGeometry,PolygonBuilder>
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.Edge, ShapeBuilder.Orientation
ToXContent.DelegatingMapParams, ToXContent.MapParams, ToXContent.Params
Writeable.Reader<V>, Writeable.Writer<V>
Modifier and Type | Field | Description |
---|---|---|
static GeoShapeType |
TYPE |
AUTO_INDEX_JTS_GEOMETRY, AUTO_VALIDATE_JTS_GEOMETRY, coordinates, DATELINE, FACTORY, INTERSECTION_ORDER, LOGGER, MULTI_POLYGON_MAY_OVERLAP, SPATIAL_CONTEXT, wrapdateline, ZERO_ZERO
EMPTY_PARAMS
Constructor | 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 | Description |
---|---|---|
org.locationtech.spatial4j.shape.jts.JtsGeometry |
build() |
Create a new Shape from this builder.
|
org.locationtech.jts.geom.Geometry |
buildGeometry(org.locationtech.jts.geom.GeometryFactory factory,
boolean fixDateline) |
|
PolygonBuilder |
close() |
Close the shell of the polygon
|
protected java.lang.StringBuilder |
contentToWKT() |
|
org.locationtech.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 org.locationtech.jts.geom.LinearRing |
linearRing(org.locationtech.jts.geom.GeometryFactory factory,
java.util.List<org.locationtech.jts.geom.Coordinate> coordinates) |
|
protected static org.locationtech.jts.geom.MultiPolygon |
multipolygon(org.locationtech.jts.geom.GeometryFactory factory,
org.locationtech.jts.geom.Coordinate[][][] polygons) |
Create a Multipolygon from a set of coordinates.
|
int |
numDimensions() |
tracks number of dimensions for this shape
|
ShapeBuilder.Orientation |
orientation() |
|
protected static org.locationtech.jts.geom.Polygon |
polygon(org.locationtech.jts.geom.GeometryFactory factory,
org.locationtech.jts.geom.Coordinate[][] polygon) |
|
LineStringBuilder |
shell() |
|
org.locationtech.jts.geom.Polygon |
toPolygon() |
|
protected org.locationtech.jts.geom.Polygon |
toPolygon(org.locationtech.jts.geom.GeometryFactory factory) |
|
XContentBuilder |
toXContent(XContentBuilder builder,
ToXContent.Params params) |
|
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.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
coordinate, coordinate, coordinateListToWKT, coordinates, coordinates, coordinates, coordinatesToXcontent, debugEnabled, getWriteableName, intersection, intersections, jtsGeometry, parse, readFromStream, shift, toString, toWKT, toXContent, writeCoordinateTo
isFragment
public static final 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.IOException
public void writeTo(StreamOutput out) throws java.io.IOException
Writeable
writeTo
in interface Writeable
writeTo
in class ShapeBuilder<org.locationtech.spatial4j.shape.jts.JtsGeometry,PolygonBuilder>
java.io.IOException
public 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 org.locationtech.jts.geom.Coordinate[][][] coordinates()
public org.locationtech.spatial4j.shape.jts.JtsGeometry build()
ShapeBuilder
build
in class ShapeBuilder<org.locationtech.spatial4j.shape.jts.JtsGeometry,PolygonBuilder>
Shape
defined by the builderprotected XContentBuilder coordinatesArray(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOException
public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws java.io.IOException
java.io.IOException
public org.locationtech.jts.geom.Geometry buildGeometry(org.locationtech.jts.geom.GeometryFactory factory, boolean fixDateline)
public org.locationtech.jts.geom.Polygon toPolygon()
protected org.locationtech.jts.geom.Polygon toPolygon(org.locationtech.jts.geom.GeometryFactory factory)
protected static org.locationtech.jts.geom.LinearRing linearRing(org.locationtech.jts.geom.GeometryFactory factory, java.util.List<org.locationtech.jts.geom.Coordinate> coordinates)
public GeoShapeType type()
ShapeBuilder
type
in class ShapeBuilder<org.locationtech.spatial4j.shape.jts.JtsGeometry,PolygonBuilder>
public int numDimensions()
ShapeBuilder
numDimensions
in class ShapeBuilder<org.locationtech.spatial4j.shape.jts.JtsGeometry,PolygonBuilder>
protected static org.locationtech.jts.geom.Polygon polygon(org.locationtech.jts.geom.GeometryFactory factory, org.locationtech.jts.geom.Coordinate[][] polygon)
protected static org.locationtech.jts.geom.MultiPolygon multipolygon(org.locationtech.jts.geom.GeometryFactory factory, org.locationtech.jts.geom.Coordinate[][][] polygons)
factory
- GeometryFactory
to usepolygons
- definition of polygonsprotected java.lang.StringBuilder contentToWKT()
contentToWKT
in class ShapeBuilder<org.locationtech.spatial4j.shape.jts.JtsGeometry,PolygonBuilder>
public int hashCode()
hashCode
in class ShapeBuilder<org.locationtech.spatial4j.shape.jts.JtsGeometry,PolygonBuilder>
public boolean equals(java.lang.Object obj)
equals
in class ShapeBuilder<org.locationtech.spatial4j.shape.jts.JtsGeometry,PolygonBuilder>