public class Polygon<P extends Position> extends Geometry<P> implements Polygonal<P>, Complex<P,LinearRing<P>>
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(CoordinateReferenceSystem<P> crs) |
Polygon(LinearRing<P>... rings)
Creates a
Polygon with the specified array of exterior and interior boundaries. |
Polygon(PositionSequence<P> positionSequence,
CoordinateReferenceSystem<P> crs)
Creates a
Polygon with no holes, and having the specified PositionSequence as exterior boundary |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(GeometryVisitor<P> visitor)
Accepts a
GeometryVisitor. |
<Q extends Position> |
as(Class<Q> castToType) |
LinearRing<P>[] |
components()
Returns the components
|
Class<? extends Geometry> |
getComponentType()
Returns the
Class of which all constituent Geometrys are instances. |
int |
getDimension()
Returns the topological dimension of this instance.
|
LinearRing<P> |
getExteriorRing()
Returns the exterior boundary of this
Polygon. |
GeometryType |
getGeometryType()
Returns the type of this
Geometry. |
LinearRing<P> |
getInteriorRingN(int index)
Returns the specified interior ring.
|
int |
getNumGeometries()
Returns the number of constituent
Geometrys |
int |
getNumInteriorRing()
returns the number of interior boundaries.
|
Iterator<LinearRing<P>> |
iterator()
Returns an
Iterator over the boundaries of this Polygon. |
checkCast, equals, forceToCrs, forceToCrs, getBoundingBox, getCoordinateDimension, getCoordinateReferenceSystem, getCrs, getEnvelope, getNumPositions, getPositionClass, getPositionN, getPositions, getSRID, hashCode, hasM, hasZ, isEmpty, nestPositionSequences, toCrs, toString, writeReplaceclone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic Polygon(CoordinateReferenceSystem<P> crs)
public Polygon(PositionSequence<P> positionSequence, CoordinateReferenceSystem<P> crs)
Polygon with no holes, and having the specified PositionSequence as exterior boundarypositionSequence - the PositionSequence representing the exterior boundaryIllegalArgumentException - when the specified PositionSequence does not form a
LinearRing (i.e., is empty or not closed).public Polygon(LinearRing<P>... 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 PositionSequence does not form a
LinearRing (i.e., is empty or not closed).public LinearRing<P> getExteriorRing()
Polygon.LinearRing representing the exterior boundary of this Polygon.public int getNumInteriorRing()
public LinearRing<P> 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 int getDimension()
GeometryGeometries.getDimension in class Geometry<P extends Position>public GeometryType getGeometryType()
GeometryGeometry.getGeometryType in class Geometry<P extends Position>GeometryType of this instance.public Iterator<LinearRing<P>> 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<P extends Position>>Iterator over the boundaries of this Polygon.public void accept(GeometryVisitor<P> visitor)
GeometryGeometryVisitor.
If this Geometry instance is a GeometryCollection then it will pass the
visitor to its contained Geometries.
public int getNumGeometries()
ComplexGeometrysgetNumGeometries in interface Complex<P extends Position,LinearRing<P extends Position>>Geometryspublic Class<? extends Geometry> getComponentType()
ComplexClass of which all constituent Geometrys are instances.getComponentType in interface Complex<P extends Position,LinearRing<P extends Position>>Class of which all constituent Geometrys are instances.public LinearRing<P>[] components()
components in interface Complex<P extends Position,LinearRing<P extends Position>>Copyright © 2023 geolatte.org. All rights reserved.