public class Polygon extends Geometry
PolygonType
.
This is a planar surface in a two-dimensional XY-plane, represented by one exterior boundary and 0 or more interior
boundaries.Modifier and Type | Class and Description |
---|---|
static class |
Polygon.Builder
Provides a DSL to build a polygon.
|
Constructor and Description |
---|
Polygon(Point p1,
Point p2,
Point p3,
Point... pn)
Creates a polygon instance from a series of 3 or more points.
|
Modifier and Type | Method and Description |
---|---|
static Polygon.Builder |
builder()
Returns a polygon builder.
|
static Polygon |
fromGeoJson(String source)
Creates a polygon from its JSON representation.
|
static Polygon |
fromWellKnownBinary(ByteBuffer source)
Creates a polygon from its
Well-known Binary (WKB)
representation.
|
static Polygon |
fromWellKnownText(String source)
Creates a polygon from its Well-known Text (WKT)
representation.
|
List<Point> |
getExteriorRing()
Returns the external ring of the polygon.
|
List<List<Point>> |
getInteriorRings()
Returns the internal rings of the polygon, i.e.
|
asGeoJson, asWellKnownBinary, asWellKnownText, contains, equals, hashCode, toString
public static Polygon fromWellKnownText(String source)
source
- the Well-known Text representation to parse.InvalidTypeException
- if the string does not contain a valid Well-known Text representation.public static Polygon fromWellKnownBinary(ByteBuffer source)
source
- the Well-known Binary representation to parse.InvalidTypeException
- if the provided ByteBuffer
does not contain a valid Well-known Binary
representation.public static Polygon fromGeoJson(String source)
source
- the JSON representation to parse.InvalidTypeException
- if the string does not contain a valid JSON representation.public List<Point> getExteriorRing()
public List<List<Point>> getInteriorRings()
public static Polygon.Builder builder()