public abstract class AbstractPolygon extends AbstractGeometry implements Polygon
LinearRings.
The boundary rings of the polygon may have any orientation.
Polygons are closed, simple geometries by definition.
The polygon model conforms to the assertions specified in the OpenGIS Simple Features Specification for SQL.
A Polygon is topologically valid if and only if:
| Constructor and Description |
|---|
AbstractPolygon() |
| Modifier and Type | Method and Description |
|---|---|
<V extends Geometry> |
appendVertex(Point newPoint,
int... geometryId) |
AbstractPolygon |
clone()
Creates and returns a full copy of this
Polygon object. |
int |
compareToSameClass(Geometry geometry)
Returns whether this
Geometry is greater than, equal to,
or less than another Geometry having the same class. |
protected BoundingBox |
computeBoundingBox()
Returns the minimum and maximum x and y values in this
Geometry
, or a null BoundingBoxDoubleGf if this Geometry is empty. |
Geometry |
convexHull()
Computes the smallest convex
Polygon that contains all the
points in the Geometry. |
<V extends Geometry> |
copy(GeometryFactory geometryFactory)
Create a copy of the geometry io the requried geometry factory.
|
<V extends Geometry> |
deleteVertex(int... vertexId) |
protected boolean |
doEquals(int axisCount,
Geometry geometry) |
boolean |
equalsExact(Geometry other,
double tolerance)
Returns true if the two
Geometrys are exactly equal,
up to a specified distance tolerance. |
double |
getArea()
Returns the area of this
Polygon |
Geometry |
getBoundary()
Computes the boundary of this geometry
|
int |
getBoundaryDimension()
Returns the dimension of this
Geometrys inherent boundary. |
DataType |
getDataType() |
int |
getDimension()
Returns the dimension of this geometry.
|
LinearRing |
getExteriorRing() |
<V extends Geometry> |
getGeometryComponents(Class<V> geometryClass)
Differs from
Geometry.getGeometries(Class) in that it will return matching Polygon.rings() |
GeometryFactory |
getGeometryFactory()
Gets the geometryFactory which contains the context in which this geometry was created.
|
LinearRing |
getInteriorRing(int ringIndex) |
double |
getLength()
Returns the perimeter of this
Polygon |
int |
getNumInteriorRing() |
Point |
getPoint()
Returns a vertex of this
Geometry
(usually, but not necessarily, the first one). |
Point |
getPointWithin() |
Segment |
getSegment(int... segmentId)
Get the
Segment at the specified vertexId (see Segment.getSegmentId()). |
Vertex |
getToVertex(int... vertexId)
Get the
Vertex at the specified vertexId starting at the end of the geometry (see Vertex.getVertexId()). |
Vertex |
getVertex(int... vertexId)
Get the
Vertex at the specified vertexId (see Vertex.getVertexId()). |
int |
getVertexCount()
Returns the count of this
Geometrys vertices. |
Iterable<LinearRing> |
holes() |
<V extends Geometry> |
insertVertex(Point newPoint,
int... vertexId) |
boolean |
intersects(BoundingBox boundingBox) |
boolean |
isEmpty()
Tests whether the set of points covered by this
Geometry is
empty. |
protected boolean |
isEquivalentClass(Geometry other)
Returns whether the two
Geometrys are equal, from the point
of view of the equalsExact method. |
boolean |
isRectangle() |
static int |
minCoordinateIndex(LinearRing ring)
Returns the minimum coordinate, using the usual lexicographic comparison.
|
Polygon |
move(double... deltas) |
<V extends Geometry> |
moveVertex(Point newPoint,
int... vertexId) |
Polygon |
normalize()
Converts this
Geometry to normal form (or
canonical form ). |
Polygon |
prepare()
Deprecated.
|
Polygon |
reverse()
Computes a new geometry which has all component coordinate sequences
in reverse order (opposite orientation) to this one.
|
Iterable<LinearRing> |
rings() |
static LinearRing |
scroll(LinearRing ring,
int index)
Shifts the positions of the coordinates until
firstCoordinate
is first. |
Reader<Segment> |
segments() |
<G extends Geometry> |
toClockwise() |
<G extends Geometry> |
toCounterClockwise() |
Reader<Vertex> |
vertices()
|
buffer, buffer, buffer, checkNotGeometryCollection, compare, compareTo, contains, containsProperly, convert, convert, coveredBy, covers, createVertexId, crosses, difference, disjoint, distance, envelopeCovers, envelopesIntersect, equal, equals, equals, equals, equalsExact, equalsNorm, equalsTopo, geometries, getAxisCount, getBoundingBox, getCentroid, getClassSortIndex, getCoordinateSystem, getEnvelope, getGeometries, getGeometries, getGeometry, getGeometryCount, getGeometryType, getInteriorPoint, getNonZeroGeometryFactory, getSrid, getUserData, getVertexIndex, hashCode, hasInvalidXyCoordinates, hasNonEmptyElements, hasNullElements, intersection, intersects, isAnyTargetComponentInTest, isGeometryCollection, isSimple, isValid, isWithinDistance, overlaps, relate, relate, setUserData, setVertexIndex, symDifference, toString, touches, toWkt, union, union, withinfinalize, getClass, notify, notifyAll, wait, wait, waitgetRing, getRingCount, getRingsbuffer, buffer, buffer, compareTo, contains, containsProperly, convert, convert, coveredBy, covers, crosses, difference, disjoint, distance, equal, equals, equals, equals, equalsExact, equalsNorm, equalsTopo, geometries, getAxisCount, getBoundingBox, getCentroid, getClassSortIndex, getCoordinateSystem, getEnvelope, getGeometries, getGeometries, getGeometry, getGeometryCount, getGeometryType, getInteriorPoint, getSrid, getUserData, hashCode, hasInvalidXyCoordinates, intersection, intersects, isSimple, isValid, isWithinDistance, overlaps, relate, relate, setUserData, symDifference, touches, toWkt, union, union, withingetBoundingBoxpublic static int minCoordinateIndex(LinearRing ring)
coordinates - the array to searchcompareToPoint.compareTo(Object)public static LinearRing scroll(LinearRing ring, int index)
firstCoordinate
is first.coordinates - the array to rearrangefirstCoordinate - the coordinate to make firstpublic <V extends Geometry> V appendVertex(Point newPoint, int... geometryId)
appendVertex in interface Geometrypublic AbstractPolygon clone()
Polygon object.
(including all coordinates contained by it).public int compareToSameClass(Geometry geometry)
AbstractGeometryGeometry is greater than, equal to,
or less than another Geometry having the same class.compareToSameClass in interface GeometrycompareToSameClass in class AbstractGeometrygeometry - a Geometry having the same class as this Geometryo, as
defined in "Normal Form For Geometry" in the JTS Technical
Specificationsprotected BoundingBox computeBoundingBox()
AbstractGeometryGeometry
, or a null BoundingBoxDoubleGf if this Geometry is empty.
Unlike getEnvelopeInternal, this method calculates the BoundingBoxDoubleGf
each time it is called; getEnvelopeInternal caches the result
of this method.computeBoundingBox in class AbstractGeometryGeometrys bounding box; if the Geometry
is empty, BoundingBoxDoubleGf#isNull will return truepublic Geometry convexHull()
AbstractGeometryPolygon that contains all the
points in the Geometry. This obviously applies only to Geometry
s which contain 3 or more points; the results for degenerate cases are
specified as follows:
Number of Points in argument Geometry |
Geometry class of result |
|---|---|
| 0 | empty GeometryCollection |
| 1 | Point |
| 2 | LineString |
| 3 or more | Polygon |
convexHull in interface GeometryconvexHull in class AbstractGeometryGeometry'
s pointspublic <V extends Geometry> V copy(GeometryFactory geometryFactory)
Geometrypublic <V extends Geometry> V deleteVertex(int... vertexId)
deleteVertex in interface Geometryprotected boolean doEquals(int axisCount,
Geometry geometry)
doEquals in class AbstractGeometrypublic boolean equalsExact(Geometry other, double tolerance)
AbstractGeometryGeometrys are exactly equal,
up to a specified distance tolerance.
Two Geometries are exactly equal within a distance tolerance
if and only if:
GeometryFactory, the SRID,
or the userData fields.
To properly test equality between different geometries,
it is usually necessary to AbstractGeometry.normalize() them first.
equalsExact in interface GeometryequalsExact in class AbstractGeometryother - the Geometry with which to compare this Geometrytolerance - distance at or below which two Coordinates
are considered equaltrue if this and the other Geometry
have identical structure and point values, up to the distance tolerance.AbstractGeometry.equals(2,Geometry),
AbstractGeometry.normalize(),
#norm()public double getArea()
PolygongetArea in interface GeometrygetArea in class AbstractGeometrypublic Geometry getBoundary()
getBoundary in interface GeometrygetBoundary in class AbstractGeometryGeometry.getBoundary()public int getBoundaryDimension()
AbstractGeometryGeometrys inherent boundary.getBoundaryDimension in interface GeometrygetBoundaryDimension in class AbstractGeometryDimension.FALSE if the boundary is the empty geometry.public DataType getDataType()
getDataType in interface DataTypeProxygetDataType in class AbstractGeometrypublic int getDimension()
AbstractGeometry
Note that this is a different concept to the dimension of
the vertex Coordinatess.
The geometry dimension can never be greater than the coordinate dimension.
For example, a 0-dimensional geometry (e.g. a Point)
may have a coordinate dimension of 3 (X,Y,Z).
getDimension in interface GeometrygetDimension in class AbstractGeometrypublic LinearRing getExteriorRing()
getExteriorRing in interface Polygonpublic <V extends Geometry> List<V> getGeometryComponents(Class<V> geometryClass)
GeometryGeometry.getGeometries(Class) in that it will return matching Polygon.rings()getGeometryComponents in interface GeometrygetGeometryComponents in class AbstractGeometrypublic GeometryFactory getGeometryFactory()
GeometrygetGeometryFactory in interface GeometrygetGeometryFactory in class AbstractGeometrypublic LinearRing getInteriorRing(int ringIndex)
getInteriorRing in interface Polygonpublic double getLength()
PolygongetLength in interface GeometrygetLength in class AbstractGeometrypublic int getNumInteriorRing()
getNumInteriorRing in interface Polygonpublic Point getPoint()
AbstractGeometryGeometry
(usually, but not necessarily, the first one).
The returned coordinate should not be assumed
to be an actual Point object used in
the internal representation.getPoint in interface GeometrygetPoint in class AbstractGeometryCoordinates which is a vertex of this Geometry.public Point getPointWithin()
getPointWithin in interface Geometrypublic Segment getSegment(int... segmentId)
GeometryGet the Segment at the specified vertexId (see Segment.getSegmentId()).
getSegment in interface Geometrypublic Vertex getToVertex(int... vertexId)
GeometryGet the Vertex at the specified vertexId starting at the end of the geometry (see Vertex.getVertexId()).
getToVertex in interface GeometryvertexId - The id of the vertex.public Vertex getVertex(int... vertexId)
GeometryGet the Vertex at the specified vertexId (see Vertex.getVertexId()).
public int getVertexCount()
GeometryGeometrys vertices. The Geometry
s contained by composite Geometrys must be
Geometry's; that is, they must implement getNumPointsgetVertexCount in interface GeometryGeometrypublic Iterable<LinearRing> holes()
public <V extends Geometry> V insertVertex(Point newPoint, int... vertexId)
insertVertex in interface Geometrypublic boolean intersects(BoundingBox boundingBox)
intersects in interface Geometrypublic boolean isEmpty()
AbstractGeometryGeometry is
empty.isEmpty in interface GeometryisEmpty in class AbstractGeometrytrue if this Geometry does not cover any pointsprotected boolean isEquivalentClass(Geometry other)
AbstractGeometryGeometrys are equal, from the point
of view of the equalsExact method. Called by equalsExact
. In general, two Geometry classes are considered to be
"equivalent" only if they are the same class. An exception is LineString
, which is considered to be equivalent to its subclasses.isEquivalentClass in class AbstractGeometryother - the Geometry with which to compare this Geometry
for equalitytrue if the classes of the two Geometry
s are considered to be equal by the equalsExact method.public boolean isRectangle()
isRectangle in interface GeometryisRectangle in class AbstractGeometrypublic Polygon move(double... deltas)
public <V extends Geometry> V moveVertex(Point newPoint, int... vertexId)
moveVertex in interface Geometrypublic Polygon normalize()
AbstractGeometryGeometry to normal form (or
canonical form ). Normal form is a unique representation for Geometry
s. It can be used to test whether two Geometrys are equal
in a way that is independent of the ordering of the coordinates within
them. Normal form equality is a stronger condition than topological
equality, but weaker than pointwise equality. The definitions for normal
form use the standard lexicographical ordering for coordinates. "Sorted in
order of coordinates" means the obvious extension of this ordering to
sequences of coordinates.normalize in interface Geometrynormalize in interface Polygonnormalize in class AbstractGeometryAbstractGeometry.normalize()@Deprecated public Polygon prepare()
public Polygon reverse()
AbstractGeometrypublic Iterable<LinearRing> rings()
public <G extends Geometry> G toClockwise()
toClockwise in interface GeometrytoClockwise in class AbstractGeometrypublic <G extends Geometry> G toCounterClockwise()
toCounterClockwise in interface GeometrytoCounterClockwise in class AbstractGeometrypublic Reader<Vertex> vertices()
GeometryGet an Iterable that iterates over the Vertex of the geometry. For memory
efficiency the Vertex returned is the same instance for each call to next
on the iterator. If the vertex is required to track the previous vertex then the
Vertex.clone() method must be called to get a copy of the vertex.
The Iterable.iterator() method always returns the same Iterator instance.
Therefore that method should not be called more than once.
Copyright © 2015 Revolution Systems Inc.. All rights reserved.