public interface Geometry extends Cloneable, Comparable<Object>, Serializable, DataTypeProxy
GeometryCollections would be useful,
GeometryCollections are not supported as arguments to binary
predicates or the relate
method.
Point, LineString, or
Polygon will be returned if the result contains a single
element; otherwise, a MultiPoint, MultiLineString,
or MultiPolygon will be returned. If the result is
heterogeneous a GeometryCollection will be returned.
Because it is not clear at this time what semantics for set-theoretic
methods involving GeometryCollections would be useful,
GeometryCollections
are not supported as arguments to the set-theoretic methods.
Geometry.
The SFS does not specify an unambiguous representation of a given point set
returned from a spatial analysis method. One goal of JTS is to make this
specification precise and unambiguous. JTS uses a canonical form for
Geometrys returned from overlay methods. The canonical
form is a Geometry which is simple and noded:
isSimple.
LineStrings. It
means that all intersection points on LineStrings will be
present as endpoints of LineStrings in the result.
Geometry
s. These new points arise from intersections between line segments in the
edges of the input Geometrys. In the general case it is not
possible to represent constructed points exactly. This is due to the geometryFactory
that the coordinates of an intersection point may contain twice as many bits
of precision as the coordinates of the input line segments. In order to
represent these constructed points explicitly, JTS must truncate them to fit
the PrecisionModel. Unfortunately, truncating coordinates moves them slightly. Line segments which would not be coincident in the exact result may become coincident in the truncated representation. This in turn leads to "topology collapses" -- situations where a computed element has a lower dimension than it would in the exact result.
When JTS detects topology collapses during the computation of spatial analysis methods, it will throw an exception. If possible the exception will report the location of the collapse.
equals(2,Geometry) method.
This implements a comparison based on exact, structural pointwise
equality.
The equals(Object) is a synonym for this method,
to provide structural equality semantics for
use in Java collections.
It is important to note that structural pointwise equality
is easily affected by things like
ring order and component order. In many situations
it will be desirable to normalize geometries before
comparing them (using the #norm()
or normalize() methods).
equalsNorm(Geometry) is provided
as a convenience method to compute equality over
normalized geometries, but it is expensive to use.
Finally, equalsExact(Geometry, double)
allows using a tolerance value for point comparison.
equalsTopo(Geometry) method.
It implements the SFS definition of point-set equality
defined in terms of the DE-9IM matrix.
To support the SFS naming convention, the method
equals(Geometry) is also provided as a synonym.
However, due to the potential for confusion with equals(Object)
its use is discouraged.
Since equals(Object) and hashCode() are overridden,
Geometries can be used effectively in Java collections.
| Modifier and Type | Field and Description |
|---|---|
static int |
M |
static List<String> |
sortedGeometryTypes |
static int |
X
Standard ordinate index values
|
static int |
Y |
static int |
Z |
| Modifier and Type | Method and Description |
|---|---|
<V extends Geometry> |
appendVertex(Point newPoint,
int... geometryId) |
Geometry |
buffer(double distance)
Computes a buffer area around this geometry having the given width.
|
Geometry |
buffer(double distance,
int quadrantSegments)
Computes a buffer area around this geometry having the given width and with
a specified accuracy of approximation for circular arcs.
|
Geometry |
buffer(double distance,
int quadrantSegments,
int endCapStyle)
Computes a buffer area around this geometry having the given
width and with a specified accuracy of approximation for circular arcs,
and using a specified end cap style.
|
Geometry |
clone()
Creates and returns a full copy of this
Geometry object
(including all coordinates contained by it). |
int |
compareTo(Object other)
Returns whether this
Geometry is greater than, equal to,
or less than another Geometry. |
int |
compareToSameClass(Geometry geometry) |
boolean |
contains(Geometry geometry)
Tests whether this geometry contains the
argument geometry.
|
boolean |
containsProperly(Geometry geometry) |
<V extends Geometry> |
convert(GeometryFactory geometryFactory)
Convert the geometry to the requried geometry factory.
|
<V extends Geometry> |
convert(GeometryFactory geometryFactory,
int axisCount) |
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.
|
boolean |
coveredBy(Geometry geometry)
Tests whether this geometry is covered by the
argument geometry.
|
boolean |
covers(Geometry geometry)
Tests whether this geometry covers the
argument geometry.
|
boolean |
crosses(Geometry geometry)
Tests whether this geometry crosses the
argument geometry.
|
<V extends Geometry> |
deleteVertex(int... vertexId) |
Geometry |
difference(Geometry geometry)
Computes a
Geometry representing the closure of the point-set
of the points contained in this Geometry that are not contained in
the other Geometry. |
boolean |
disjoint(Geometry geometry)
Tests whether this geometry is disjoint from the argument geometry.
|
double |
distance(Geometry geometry)
Returns the minimum distance between this
Geometry
and another Geometry. |
boolean |
equal(Point a,
Point b,
double tolerance) |
boolean |
equals(Geometry geometry)
Tests whether this geometry is
topologically equal to the argument geometry.
|
boolean |
equals(int axisCount,
Geometry geometry) |
boolean |
equals(Object other)
Tests whether this geometry is structurally and numerically equal
to a given
Object. |
boolean |
equalsExact(Geometry other) |
boolean |
equalsExact(Geometry other,
double tolerance)
Returns true if the two
Geometrys are exactly equal,
up to a specified distance tolerance. |
boolean |
equalsNorm(Geometry geometry)
Tests whether two geometries are exactly equal
in their normalized forms.
|
boolean |
equalsTopo(Geometry geometry)
Tests whether this geometry is topologically equal to the argument geometry
as defined by the SFS
equals predicate. |
Iterable<Geometry> |
geometries() |
double |
getArea()
Returns the area of this
Geometry. |
int |
getAxisCount() |
Geometry |
getBoundary()
Returns the boundary, or an empty geometry of appropriate dimension
if this
Geometry is empty. |
int |
getBoundaryDimension()
Returns the dimension of this
Geometrys inherent boundary. |
BoundingBox |
getBoundingBox()
Gets an
BoundingBoxDoubleGf containing
the minimum and maximum x and y values in this Geometry. |
Point |
getCentroid()
Computes the centroid of this
Geometry. |
int |
getClassSortIndex() |
CoordinateSystem |
getCoordinateSystem() |
int |
getDimension()
Returns the dimension of this geometry.
|
Geometry |
getEnvelope()
Gets a Geometry representing the envelope (bounding box) of
this
Geometry. |
<V extends Geometry> |
getGeometries() |
<V extends Geometry> |
getGeometries(Class<V> geometryClass) |
<V extends Geometry> |
getGeometry(int partIndex)
Returns an element
Geometry from a GeometryCollection
(or this, if the geometry is not a collection). |
<V extends Geometry> |
getGeometryComponents(Class<V> geometryClass)
Differs from
getGeometries(Class) in that it will return matching Polygon.rings() |
int |
getGeometryCount()
Returns the number of
Geometrys in a GeometryCollection
(or 1, if the geometry is not a collection). |
GeometryFactory |
getGeometryFactory()
Gets the geometryFactory which contains the context in which this geometry was created.
|
String |
getGeometryType()
Returns the name of this Geometry's actual class.
|
Point |
getInteriorPoint()
Computes an interior point of this
Geometry. |
double |
getLength()
Returns the length of this
Geometry. |
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()). |
int |
getSrid()
Returns the ID of the Spatial Reference System used by the
Geometry. |
Vertex |
getToVertex(int... vertexId)
Get the
Vertex at the specified vertexId starting at the end of the geometry (see Vertex.getVertexId()). |
Object |
getUserData()
Gets the user data object for this geometry, if any.
|
Vertex |
getVertex(int... vertexId)
Get the
Vertex at the specified vertexId (see Vertex.getVertexId()). |
int |
getVertexCount()
Returns the count of this
Geometrys vertices. |
int |
hashCode()
Gets a hash code for the Geometry.
|
boolean |
hasInvalidXyCoordinates() |
<V extends Geometry> |
insertVertex(Point newPoint,
int... vertexId) |
Geometry |
intersection(Geometry other)
Computes a
Geometry representing the point-set which is
common to both this Geometry and the other Geometry. |
boolean |
intersects(BoundingBox boundingBox) |
boolean |
intersects(Geometry geometry)
Tests whether this geometry intersects the argument geometry.
|
boolean |
isEmpty()
Tests whether the set of points covered by this
Geometry is
empty. |
boolean |
isRectangle() |
boolean |
isSimple()
Tests whether this
Geometry is simple. |
boolean |
isValid()
Tests whether this
Geometry
is topologically valid, according to the OGC SFS specification. |
boolean |
isWithinDistance(Geometry geom,
double distance)
Tests whether the distance from this
Geometry
to another is less than or equal to a specified value. |
Geometry |
move(double... deltas) |
<V extends Geometry> |
moveVertex(Point newPoint,
int... vertexId) |
Geometry |
normalize()
Converts this
Geometry to normal form (or
canonical form ). |
boolean |
overlaps(Geometry geometry)
Tests whether this geometry overlaps the
specified geometry.
|
Geometry |
prepare() |
IntersectionMatrix |
relate(Geometry geometry)
Returns the DE-9IM
IntersectionMatrix for the two Geometrys. |
boolean |
relate(Geometry g,
String intersectionPattern)
Tests whether the elements in the DE-9IM
IntersectionMatrix for the two Geometrys match the elements in intersectionPattern. |
Geometry |
reverse()
Computes a new geometry which has all component coordinate sequences
in reverse order (opposite orientation) to this one.
|
Reader<Segment> |
segments() |
void |
setUserData(Object userData)
A simple scheme for applications to add their own custom data to a Geometry.
|
Geometry |
symDifference(Geometry other)
Computes a
Geometry which are not
contained in the other Geometry,
with the points in the other Geometry not contained in this
Geometry. |
<G extends Geometry> |
toClockwise() |
<G extends Geometry> |
toCounterClockwise() |
boolean |
touches(Geometry geometry)
Tests whether this geometry touches the
argument geometry.
|
String |
toWkt()
Returns the Extended Well-known Text representation of this
Geometry. |
Geometry |
union()
Computes the union of all the elements of this geometry.
|
Geometry |
union(Geometry other)
Computes a
Geometry representing the point-set
which is contained in both this
Geometry and the other Geometry. |
Reader<Vertex> |
vertices()
|
boolean |
within(Geometry geometry)
Tests whether this geometry is within the
specified geometry.
|
getDataTypestatic final int X
static final int Y
static final int Z
static final int M
Geometry buffer(double distance)
abs(distance).
Mathematically-exact buffer area boundaries can contain circular arcs.
To represent these arcs using linear geometry they must be approximated with line segments.
The buffer geometry is constructed using 8 segments per quadrant to approximate
the circular arcs.
The end cap style is CAP_ROUND.
The buffer operation always returns a polygonal result. The negative or
zero-distance buffer of lines and points is always an empty Polygon.
This is also the result for the buffers of degenerate (zero-area) polygons.
distance - the width of the buffer (may be positive, negative or 0)TopologyException - if a robustness error occursbuffer(double, int),
buffer(double, int, int)Geometry buffer(double distance, int quadrantSegments)
Mathematically-exact buffer area boundaries can contain circular arcs.
To represent these arcs
using linear geometry they must be approximated with line segments. The
quadrantSegments argument allows controlling the accuracy of
the approximation by specifying the number of line segments used to
represent a quadrant of a circle
The buffer operation always returns a polygonal result. The negative or
zero-distance buffer of lines and points is always an empty Polygon.
This is also the result for the buffers of degenerate (zero-area) polygons.
distance - the width of the buffer (may be positive, negative or 0)quadrantSegments - the number of line segments used to represent a quadrant of a
circleTopologyException - if a robustness error occursbuffer(double),
buffer(double, int, int)Geometry buffer(double distance, int quadrantSegments, int endCapStyle)
Mathematically-exact buffer area boundaries can contain circular arcs.
To represent these arcs using linear geometry they must be approximated with line segments.
The quadrantSegments argument allows controlling the
accuracy of the approximation
by specifying the number of line segments used to represent a quadrant of a circle
The end cap style specifies the buffer geometry that will be created at the ends of linestrings. The styles provided are:
Buffer.CAP_ROUND - (default) a semi-circle
Buffer.CAP_BUTT - a straight line perpendicular to the end segment
Buffer.CAP_SQUARE - a half-square
The buffer operation always returns a polygonal result. The negative or
zero-distance buffer of lines and points is always an empty Polygon.
This is also the result for the buffers of degenerate (zero-area) polygons.
distance - the width of the buffer (may be positive, negative or 0)quadrantSegments - the number of line segments used to represent a quadrant of a circleendCapStyle - the end cap style to useTopologyException - if a robustness error occursbuffer(double),
buffer(double, int),
BufferGeometry clone()
Geometry object
(including all coordinates contained by it).
Subclasses are responsible for overriding this method and copying
their internal data. Overrides should call this method first.int compareTo(Object other)
Geometry is greater than, equal to,
or less than another Geometry. If their classes are different, they are compared using the following ordering:
Geometrys have the same class, their first
elements are compared. If those are the same, the second elements are
compared, etc.compareTo in interface Comparable<Object>other - a Geometry with which to compare this Geometryo, as
defined in "Normal Form For Geometry" in the JTS Technical
Specificationsint compareToSameClass(Geometry geometry)
boolean contains(Geometry geometry)
The contains predicate has the following equivalent definitions:
[T*****FF*]
g.within(this) = true
contains is the converse of within(com.revolsys.jts.geom.Geometry) )
B.contains(A) = false.
(As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.)
For a predicate with similar behaviour but avoiding
this subtle limitation, see covers(com.revolsys.jts.geom.Geometry).g - the Geometry with which to compare this Geometrytrue if this Geometry contains gwithin(com.revolsys.jts.geom.Geometry),
covers(com.revolsys.jts.geom.Geometry)boolean containsProperly(Geometry geometry)
<V extends Geometry> V convert(GeometryFactory geometryFactory)
geometryFactory - The geometry factory to convert the geometry to.<V extends Geometry> V convert(GeometryFactory geometryFactory, int axisCount)
Geometry convexHull()
Polygon 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 |
Geometry'
s points<V extends Geometry> V copy(GeometryFactory geometryFactory)
geometryFactory - The geometry factory to convert the geometry to.boolean coveredBy(Geometry geometry)
The coveredBy predicate has the following equivalent definitions:
[T*F**F***]
[*TF**F***]
[**FT*F***]
[**F*TF***]
g.covers(this) = true
coveredBy is the converse of covers(com.revolsys.jts.geom.Geometry))
false.
This predicate is similar to within(com.revolsys.jts.geom.Geometry),
but is more inclusive (i.e. returns true for more cases).
g - the Geometry with which to compare this Geometrytrue if this Geometry is covered by gwithin(com.revolsys.jts.geom.Geometry),
covers(com.revolsys.jts.geom.Geometry)boolean covers(Geometry geometry)
The covers predicate has the following equivalent definitions:
[T*****FF*]
[*T****FF*]
[***T**FF*]
[****T*FF*]
g.coveredBy(this) = true
covers is the converse of coveredBy(com.revolsys.jts.geom.Geometry))
false.
This predicate is similar to contains(com.revolsys.jts.geom.Geometry),
but is more inclusive (i.e. returns true for more cases).
In particular, unlike contains it does not distinguish between
points in the boundary and in the interior of geometries.
For most situations, covers should be used in preference to contains.
As an added benefit, covers is more amenable to optimization,
and hence should be more performant.
g - the Geometry with which to compare this Geometrytrue if this Geometry covers gcontains(com.revolsys.jts.geom.Geometry),
coveredBy(com.revolsys.jts.geom.Geometry)boolean crosses(Geometry geometry)
The crosses predicate has the following equivalent definitions:
[T*T******] (for P/L, P/A, and L/A situations)
[T*****T**] (for L/P, A/P, and A/L situations)
[0********] (for L/L situations)
false.
The SFS defined this predicate only for P/L, P/A, L/L, and L/A situations. In order to make the relation symmetric, JTS extends the definition to apply to L/P, A/P and A/L situations as well.
g - the Geometry with which to compare this Geometrytrue if the two Geometrys cross.<V extends Geometry> V deleteVertex(int... vertexId)
Geometry difference(Geometry geometry)
Geometry representing the closure of the point-set
of the points contained in this Geometry that are not contained in
the other Geometry.
If the result is empty, it is an atomic geometry with the dimension of the left-hand input.
Non-empty GeometryCollection arguments are not supported.
other - the Geometry with which to compute the
differenceGeometry with
otherTopologyException - if a robustness error occursIllegalArgumentException - if either input is a non-empty GeometryCollectionboolean disjoint(Geometry geometry)
The disjoint predicate has the following equivalent definitions:
[FF*FF****]
! g.intersects(this) = true
disjoint is the inverse of intersects)
g - the Geometry with which to compare this Geometrytrue if the two Geometrys are
disjointintersects(com.revolsys.jts.geom.BoundingBox)double distance(Geometry geometry)
Geometry
and another Geometry.g - the Geometry from which to compute the distanceIllegalArgumentException - if g is nullboolean equals(Geometry geometry)
This method is included for backward compatibility reasons.
It has been superseded by the equalsTopo(Geometry) method,
which has been named to clearly denote its functionality.
This method should NOT be confused with the method
equals(Object), which implements
an exact equality comparison.
g - the Geometry with which to compare this GeometryGeometrys are topologically equalequalsTopo(Geometry)boolean equals(int axisCount,
Geometry geometry)
boolean equals(Object other)
Object.
If the argument Object is not a Geometry,
the result is false.
Otherwise, the result is computed using
equals(2,Geometry).
This method is provided to fulfill the Java contract
for value-based object equality.
In conjunction with hashCode()
it provides semantics which are most useful
for using
Geometrys as keys and values in Java collections.
Note that to produce the expected result the input geometries should be in normal form. It is the caller's responsibility to perform this where required (using Geometry#norm() or {@link #normalize()} as appropriate).
equals in class Objectother - the Object to compareequals(2,Geometry),
hashCode(),
#norm(),
normalize()boolean equalsExact(Geometry other)
boolean equalsExact(Geometry other, double tolerance)
Geometrys 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 normalize() them first.
other - 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.equals(2,Geometry),
normalize(),
#norm()boolean equalsNorm(Geometry geometry)
equals(2,Geometry).
This method is relatively expensive to compute. For maximum performance, the client should instead perform normalization on the individual geometries at an appropriate point during processing.
g - a Geometryboolean equalsTopo(Geometry geometry)
equals predicate.
The SFS equals predicate has the following equivalent definitions:
T*F**FFF*
T*F **F FF*
equals(2,Geometry).g - the Geometry with which to compare this Geometrytrue if the two Geometrys are topologically equalequals(2,Geometry)double getArea()
Geometry.
Areal Geometries have a non-zero area.
They override this function to compute the area.
Others return 0.0int getAxisCount()
Geometry getBoundary()
Geometry is empty.
(In the case of zero-dimensional geometries, '
an empty GeometryCollection is returned.)
For a discussion of this function, see the OpenGIS Simple
Features Specification. As stated in SFS Section 2.1.13.1, "the boundary
of a Geometry is a set of Geometries of the next lower dimension."Geometryint getBoundaryDimension()
Geometrys inherent boundary.Dimension.FALSE if the boundary is the empty geometry.BoundingBox getBoundingBox()
BoundingBoxDoubleGf containing
the minimum and maximum x and y values in this Geometry.
If the geometry is empty, an empty BoundingBoxDoubleGf
is returned.
The returned object is a copy of the one maintained internally, to avoid aliasing issues. For best performance, clients which access this envelope frequently should cache the return value.
Geometry.Point getCentroid()
Geometry.
The centroid
is equal to the centroid of the set of component Geometries of highest
dimension (since the lower-dimension geometries contribute zero
"weight" to the centroid).
The centroid of an empty geometry is POINT EMPTY.
Point which is the centroid of this Geometryint getClassSortIndex()
CoordinateSystem getCoordinateSystem()
int getDimension()
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).
Geometry getEnvelope()
Geometry.
If this Geometry is:
Point.
Point.
LineString
Polygon whose vertices are (minx miny, maxx miny,
maxx maxy, minx maxy, minx miny).
GeometryFactory#toLineString(BoundingBoxDoubleGf)<V extends Geometry> V getGeometry(int partIndex)
Geometry from a GeometryCollection
(or this, if the geometry is not a collection).partIndex - the index of the geometry element<V extends Geometry> List<V> getGeometryComponents(Class<V> geometryClass)
getGeometries(Class) in that it will return matching Polygon.rings()geometryClass - int getGeometryCount()
Geometrys in a GeometryCollection
(or 1, if the geometry is not a collection).GeometryFactory getGeometryFactory()
String getGeometryType()
Geometrys actual classPoint getInteriorPoint()
Geometry.
An interior point is guaranteed to lie in the interior of the Geometry,
if it possible to calculate such a point exactly. Otherwise,
the point may lie on the boundary of the geometry.
The interior point of an empty geometry is POINT EMPTY.
Point which is in the interior of this Geometrydouble getLength()
Geometry.
Linear geometries return their length.
Areal geometries return their perimeter.
They override this function to compute the area.
Others return 0.0Point getPoint()
Geometry
(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.Coordinates which is a vertex of this Geometry.Point getPointWithin()
Segment getSegment(int... segmentId)
Get the Segment at the specified vertexId (see Segment.getSegmentId()).
vertexId - The id of the vertex.int getSrid()
Geometry.
JTS supports Spatial Reference System information in the simple way
defined in the SFS. A Spatial Reference System ID (SRID) is present in
each Geometry object. Geometry provides basic
accessor operations for this field, but no others. The SRID is represented
as an integer.
Geometry
is defined.Vertex getToVertex(int... vertexId)
Get the Vertex at the specified vertexId starting at the end of the geometry (see Vertex.getVertexId()).
vertexId - The id of the vertex.Object getUserData()
null if none setVertex getVertex(int... vertexId)
Get the Vertex at the specified vertexId (see Vertex.getVertexId()).
vertexId - The id of the vertex.int getVertexCount()
Geometrys vertices. The Geometry
s contained by composite Geometrys must be
Geometry's; that is, they must implement getNumPointsGeometryint hashCode()
boolean hasInvalidXyCoordinates()
Geometry intersection(Geometry other)
Geometry representing the point-set which is
common to both this Geometry and the other Geometry.
The intersection of two geometries of different dimension produces a result
geometry of dimension less than or equal to the minimum dimension of the input
geometries.
The result geometry may be a heterogenous GeometryCollection.
If the result is empty, it is an atomic geometry
with the dimension of the lowest input dimension.
Intersection of GeometryCollections is supported
only for homogeneous collection types.
Non-empty heterogeneous GeometryCollection arguments are not supported.
other - the Geometry with which to compute the intersectionGeometrysTopologyException - if a robustness error occursIllegalArgumentException - if the argument is a non-empty heterogeneous GeometryCollectionboolean intersects(BoundingBox boundingBox)
boolean intersects(Geometry geometry)
The intersects predicate has the following equivalent definitions:
[T********]
[*T*******]
[***T*****]
[****T****]
! g.disjoint(this) = true
intersects is the inverse of disjoint)
g - the Geometry with which to compare this Geometrytrue if the two Geometrys intersectdisjoint(com.revolsys.jts.geom.Geometry)boolean isEmpty()
Geometry is
empty.true if this Geometry does not cover any pointsboolean isRectangle()
boolean isSimple()
Geometry is simple.
The SFS definition of simplicity
follows the general rule that a Geometry is simple if it has no points of
self-tangency, self-intersection or other anomalous points.
Simplicity is defined for each Geometry subclass as follows:
isSimple
tests for this condition and reports false if it is not met.
(This is a looser test than checking for validity).
Geometrys are always simple.
true if this Geometry is simpleisValid()boolean isValid()
Geometry
is topologically valid, according to the OGC SFS specification.
For validity rules see the Javadoc for the specific Geometry subclass.
true if this Geometry is validIsValidOpboolean isWithinDistance(Geometry geom, double distance)
Geometry
to another is less than or equal to a specified value.geom - the Geometry to check the distance todistance - the distance value to comparetrue if the geometries are less than distance apart.Geometry move(double... deltas)
Geometry normalize()
Geometry 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()boolean overlaps(Geometry geometry)
The overlaps predicate has the following equivalent definitions:
[T*T***T**] (for two points or two surfaces)
or [1*T***T**] (for two curves)
false.
This predicate is symmetric.g - the Geometry with which to compare this Geometrytrue if the two Geometrys overlap.Geometry prepare()
IntersectionMatrix relate(Geometry geometry)
IntersectionMatrix for the two Geometrys.g - the Geometry with which to compare this GeometryIntersectionMatrix describing the intersections of the interiors,
boundaries and exteriors of the two Geometrysboolean relate(Geometry g, String intersectionPattern)
IntersectionMatrix for the two Geometrys match the elements in intersectionPattern.
The pattern is a 9-character string, with symbols drawn from the following set:
g - the Geometry with which to compare
this GeometryintersectionPattern - the pattern against which to check the
intersection matrix for the two Geometrystrue if the DE-9IM intersection
matrix for the two Geometrys match intersectionPatternIntersectionMatrixGeometry reverse()
void setUserData(Object userData)
Note that user data objects are not present in geometries created by construction methods.
userData - an object, the semantics for which are defined by the
application using this GeometryGeometry symDifference(Geometry other)
Geometry which are not
contained in the other Geometry,
with the points in the other Geometry not contained in this
Geometry.
If the result is empty, it is an atomic geometry
with the dimension of the highest input dimension.
Non-empty GeometryCollection arguments are not supported.
other - the Geometry with which to compute the symmetric
differenceGeometry
with otherTopologyException - if a robustness error occursIllegalArgumentException - if either input is a non-empty GeometryCollection<G extends Geometry> G toClockwise()
<G extends Geometry> G toCounterClockwise()
boolean touches(Geometry geometry)
The touches predicate has the following equivalent definitions:
[FT*******]
[F**T*****]
[F***T****]
false,
since points have only interiors.
This predicate is symmetric.g - the Geometry with which to compare this Geometrytrue if the two Geometrys touch;
Returns false if both Geometrys are pointsString toWkt()
Returns the Extended Well-known Text representation of this Geometry.
For a definition of the Well-known Text format, see the OpenGIS Simple
Features Specification.
GeometryGeometry union()
This method supports
GeometryCollections
(which the other overlay operations currently do not).
The result obeys the following contract:
LineStrings has the effect of fully noding
and dissolving the linework.
Polygons always
returns a Polygonal geometry (unlike union(Geometry),
which may return geometries of lower dimension if a topology collapse occurred).
TopologyException - if a robustness error occursUnaryUnionOpGeometry union(Geometry other)
Geometry representing the point-set
which is contained in both this
Geometry and the other Geometry.
The union of two geometries of different dimension produces a result
geometry of dimension equal to the maximum dimension of the input
geometries.
The result geometry may be a heterogenous
GeometryCollection.
If the result is empty, it is an atomic geometry
with the dimension of the highest input dimension.
Unioning LineStrings has the effect of
noding and dissolving the input linework. In this context
"noding" means that there will be a node or endpoint in the result for
every endpoint or line segment crossing in the input. "Dissolving" means
that any duplicate (i.e. coincident) line segments or portions of line
segments will be reduced to a single line segment in the result.
If merged linework is required, the LineMerger
class can be used.
Non-empty GeometryCollection arguments are not supported.
other - the Geometry with which to compute the unionGeometry and the
points of otherTopologyException - if a robustness error occursIllegalArgumentException - if either input is a non-empty GeometryCollectionLineMergerReader<Vertex> vertices()
Get 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.
boolean within(Geometry geometry)
The within predicate has the following equivalent definitions:
[T*F**F***]
g.contains(this) = true
within is the converse of contains(com.revolsys.jts.geom.Geometry))
A.within(B) = false
(As a concrete example, take A to be a LineString which lies in the boundary of a Polygon B.)
For a predicate with similar behaviour but avoiding
this subtle limitation, see coveredBy(com.revolsys.jts.geom.Geometry).g - the Geometry with which to compare this Geometrytrue if this Geometry is within
gcontains(com.revolsys.jts.geom.Geometry),
coveredBy(com.revolsys.jts.geom.Geometry)Copyright © 2015 Revolution Systems Inc.. All rights reserved.