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
LinearRing
s will have the opposite orientation and appear as clockwise when viewed from the "top".
The rules that define valid Polygon
s are as follows
Polygon
s are topologically closed;Polygon
consists of a set of LinearRing
s 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 exteriorConstructor 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 . |
Class<? extends Geometry> |
getComponentType()
Returns the
Class of which all constituent Geometry s 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
Geometry s |
int |
getNumInteriorRing()
returns the number of interior boundaries.
|
Iterator<LinearRing<P>> |
iterator()
Returns an
Iterator over the boundaries of this Polygon . |
equals, forceToCrs, getCoordinateDimension, getCoordinateReferenceSystem, getCrs, getEnvelope, getNumPositions, getPositionClass, getPositionN, getPositions, getSRID, hashCode, isEmpty, nestPositionSequences, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public 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()
Geometry
Geometries
.getDimension
in class Geometry<P extends Position>
public GeometryType getGeometryType()
Geometry
Geometry
.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)
Geometry
GeometryVisitor
.
If this Geometry
instance is a GeometryCollection
then it will pass the
visitor to its contained Geometries
.
public int getNumGeometries()
Complex
Geometry
sgetNumGeometries
in interface Complex<P extends Position,LinearRing<P extends Position>>
Geometry
spublic Class<? extends Geometry> getComponentType()
Complex
Class
of which all constituent Geometry
s are instances.getComponentType
in interface Complex<P extends Position,LinearRing<P extends Position>>
Class
of which all constituent Geometry
s are instances.Copyright © 2015 geolatte.org. All rights reserved.