public class Polygon extends Geometry implements Iterable<LinearRing>
Polygon.
The exterior boundary LinearRing defines the "top" of the surface which is the side of the surface
from which the exterior boundary appears to traverse the boundary in a counter clockwise direction. The interior
LinearRings will have the opposite orientation and appear as clockwise when viewed from the "top".
The rules that define valid Polygons are as follows
Polygons are topologically closed;Polygon consists of a set of LinearRings that make up its
exterior and interior boundaries;Polygon may
intersect at a Point but only as a tangentPolygon may not have cut lines, spikes or punctures;Polygon is a connected point set; Polygon with 1 or more holes is not connected. Each hole defines a
connected component of the exterior| Constructor and Description |
|---|
Polygon(LinearRing[] rings)
Creates a
Polygon with the specified array of exterior and interior boundaries. |
Polygon(PointSequence pointSequence)
Creates a
Polygon with no holes, and having the specified PointSequence as exterior boundary |
Polygon(PointSequence pointSequence,
GeometryOperations ops)
Creates a
Polygon with no holes, and having the specified PointSequence as exterior boundary |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(GeometryVisitor visitor)
Accepts a
GeometryVisitor. |
static Polygon |
createEmpty()
Creates an empty
Polygon. |
double |
getArea()
Returns the area of this
Polygon as measured in the CoordinateReferenceSystem of this
Polygon. |
MultiLineString |
getBoundary()
Returns the boundary of this
Geometry. |
Point |
getCentroid()
Returns the mathematical centroid for this
Polygon. |
int |
getDimension()
Returns the topological dimension of this instance.
|
LinearRing |
getExteriorRing()
Returns the exterior boundary of this
Polygon. |
GeometryType |
getGeometryType()
Returns the type of this
Geometry. |
LinearRing |
getInteriorRingN(int index)
Returns the specified interior ring.
|
int |
getNumInteriorRing()
returns the number of interior boundaries.
|
Point |
getPointOnSurface()
Returns a
Point that is guaranteed to lie on this Polygon. |
PointCollection |
getPoints()
Returns the
PointCollection that is associated with this instance |
Iterator<LinearRing> |
iterator()
Returns an
Iterator over the boundaries of this Polygon. |
asBinary, asText, buffer, collectPointSets, contains, convexHull, crosses, difference, disjoint, distance, equals, getCoordinateDimension, getCrsId, getCrsId, getDimensionalFlag, getEnvelope, getGeometryOperations, getGeometryOperations, getNumPoints, getPointN, getSRID, hashCode, intersection, intersects, is3D, isEmpty, isMeasured, isSimple, locateAlong, locateBetween, overlaps, relate, symDifference, toString, touches, union, withinclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic Polygon(PointSequence pointSequence, GeometryOperations ops)
Polygon with no holes, and having the specified PointSequence as exterior boundarypointSequence - the PointSequence representing the exterior boundaryops - the GeometryOperatoins implementation for the constructed PolygonIllegalArgumentException - when the specified PointSequence does not form a
LinearRing (i.e., is empty or not closed).public Polygon(PointSequence pointSequence)
Polygon with no holes, and having the specified PointSequence as exterior boundarypointSequence - the PointSequence representing the exterior boundaryIllegalArgumentException - when the specified PointSequence does not form a
LinearRing (i.e., is empty or not closed).public Polygon(LinearRing[] rings)
Polygon with the specified array of exterior and interior boundaries.rings - the array of the Polygon's boundaries: the first element is the exterior boundary, all subsequent rings represent
interior boundaries.IllegalArgumentException - when the specified PointSequence does not form a
LinearRing (i.e., is empty or not closed).public static Polygon createEmpty()
Polygon.Polygon.public PointCollection getPoints()
GeometryPointCollection that is associated with this instancepublic LinearRing getExteriorRing()
Polygon.LinearRing representing the exterior boundary of this Polygon.public int getNumInteriorRing()
public LinearRing getInteriorRingN(int index)
index - the (zero-based) position of the interior boundary in the list of interior boundaries.LinearRing at the position specified by the parameter index.public double getArea()
Polygon as measured in the CoordinateReferenceSystem of this
Polygon.Polygon.public Point getCentroid()
Polygon.
The result is not guaranteed to be on this surface.
Point for this Polygonpublic Point getPointOnSurface()
Point that is guaranteed to lie on this Polygon.Point on this Polygonpublic int getDimension()
GeometryGeometries.getDimension in class Geometrypublic GeometryType getGeometryType()
GeometryGeometry.getGeometryType in class GeometryGeometryType of this instance.public MultiLineString getBoundary()
GeometryGeometry.getBoundary in class Geometrypublic Iterator<LinearRing> iterator()
Iterator over the boundaries of this Polygon.
The boundaries are returned in order, with the first element being the exterior boundary.
iterator in interface Iterable<LinearRing>public void accept(GeometryVisitor visitor)
GeometryGeometryVisitor.
If this Geometry instance is a GeometryCollection then it will pass the
visitor to its contained Geometries.
Copyright © 2015 geolatte.org. All rights reserved.