@UML(identifier="GM_Object", specification=ISO_19107) public interface Geometry extends TransfiniteSet
Geometry
supports interfaces common to all
geographically referenced geometric objects. Geometry
instances are sets of direct
positions in a particular coordinate reference system. A Geometry
can be regarded as an
infinite set of points that satisfies the set operation interfaces for a set of direct positions,
TransfiniteSet<DirectPosition>
.Modifier and Type  Method and Description 

Geometry 
clone()
Returns a clone of this geometry with deep copy semantic.

double 
distance(Geometry geometry)
Returns the distance between this
Geometry and another Geometry . 
Boundary 
getBoundary()
Returns a finite set of
Geometry s containing all of the direct positions on the
boundary of this Geometry . 
Geometry 
getBuffer(double distance)
Returns a
Geometry containing all points whose distance from this Geometry is
less than or equal to the distance passed as a parameter. 
DirectPosition 
getCentroid()
Returns the mathematical centroid for this
Geometry . 
Complex 
getClosure()
Returns a finite set of
Geometry s containing all of the points on the boundary of
this Geometry and this object (the union of the object and its boundary). 
Geometry 
getConvexHull()
Returns a
Geometry that represents the convex hull of this Geometry . 
int 
getCoordinateDimension()
Returns the dimension of the coordinates that define this
Geometry , which must be the
same as the coordinate dimension of the coordinate reference system for this Geometry . 
CoordinateReferenceSystem 
getCoordinateReferenceSystem()
Returns the coordinate reference system used in direct position
coordinates.

int 
getDimension(DirectPosition point)
Returns the inherent dimension of this
Geometry , which shall be less than or equal to
the coordinate dimension. 
Envelope 
getEnvelope()
Returns the minimum bounding box for this
Geometry . 
Set<? extends Complex> 
getMaximalComplex()
Returns the set of maximal complexes within which this
Geometry is contained. 
Geometry 
getMbRegion()
Returns a region in the coordinate reference system that contains this
Geometry . 
Precision 
getPrecision()
Returns the precision model used to guide the accuracy of topology operations.

DirectPosition 
getRepresentativePoint()
Returns a point value that is guaranteed to be on this
Geometry . 
boolean 
isCycle()
Returns
true if this Geometry has an empty boundary after topological
simplification (removal of overlaps between components in nonstructured aggregates, such as
subclasses of Aggregate ). 
boolean 
isMutable()
Returns
false if this geometry is immutable. 
boolean 
isSimple()
Returns
true if this Geometry has no interior point of selfintersection or
selftangency. 
Geometry 
toImmutable()
Returns an immutable copy of this geometry.

Geometry 
transform(CoordinateReferenceSystem newCRS)
Returns a new
Geometry that is the coordinate transformation of this Geometry
into the passed coordinate reference system within the accuracy of the transformation. 
Geometry 
transform(CoordinateReferenceSystem newCRS,
MathTransform transform)
Returns a new
Geometry that is the coordinate transformation of this Geometry
into the passed coordinate reference system, using the specified transform. 
contains, contains, difference, equals, intersection, intersects, symmetricDifference, union
@UML(identifier="CRS", obligation=MANDATORY, specification=ISO_19107) CoordinateReferenceSystem getCoordinateReferenceSystem()
null
, then this Geometry
uses the coordinate reference system
from another Geometry
in which it is contained.
The most common example where the coordinate reference system is null
is the
elements and subcomplexes of a maximal complex. The complex can carry the coordinate reference system for
all primitive elements and for all
Complex
subcomplexes.
This association is only navigable from Geometry
to coordinate reference system. This means that the coordinate
reference system objects in a data set do not keep a list of Geometry
s that use them.
getCoordinateDimension()
Precision getPrecision()
@UML(identifier="mbRegion", obligation=MANDATORY, specification=ISO_19107) Geometry getMbRegion()
Geometry
. The
default shall be to return an instance of an appropriate Geometry
subclass that
represents the same spatial set returned from getEnvelope()
. The most common use of
mbRegion
will be to support indexing methods that use extents other than minimum
bounding rectangles (MBR or envelopes). This does not restrict the returned Geometry
from being a nonvector geometric representation, although those types are not defined within
this specification.getEnvelope()
,
getBoundary()
@UML(identifier="representativePoint", obligation=MANDATORY, specification=ISO_19107) DirectPosition getRepresentativePoint()
Geometry
. The default logic
may be to use the direct position of the point returned by getCentroid()
if that point is on the object. Another use of representative point may be for
the placement of labels in systems based on graphic presentation.getCentroid()
@UML(identifier="boundary", obligation=MANDATORY, specification=ISO_19107) Boundary getBoundary()
Geometry
s containing all of the direct positions on the
boundary of this Geometry
. These object collections shall have further internal
structure where appropriate. The finite set of Geometry
s returned shall be in the
same coordinate reference system as this Geometry
. If the Geometry
is in a
complex, then the boundary Geometry
s returned shall be in the
same complex. If the Geometry
is not in any complex, then the boundary Geometry
s returned may have been constructed in response
to the operation. The elements of a boundary shall be smaller in dimension than the original
element.getMbRegion()
,
getClosure()
,
getBuffer(double)
,
#getDistance
@UML(identifier="closure", obligation=MANDATORY, specification=ISO_19107) Complex getClosure()
Geometry
s containing all of the points on the boundary of
this Geometry
and this object (the union of the object and its boundary). These
object collections shall have further internal structure where appropriate. The finite set of
Geometry
s returned shall be in the same coordinate reference system as this Geometry
. If the Geometry
is in a complex, then the boundary
Geometry
s returned shall be in the same complex. If the Geometry
is not in any complex, then the boundary Geometry
s
returned may have been constructed in response to the operation.getBoundary()
@UML(identifier="isSimple", obligation=MANDATORY, specification=ISO_19107) boolean isSimple()
true
if this Geometry
has no interior point of selfintersection or
selftangency. In mathematical formalisms, this means that every point in the interior of the
object must have a metric neighborhood whose intersection with the object is isomorphic to an
nsphere, where n is the dimension of this Geometry
.
Since most coordinate geometries are represented, either directly or indirectly by
functions from regions in Euclidean space of their topological dimension, the easiest test
for simplicity to require that a function exist that is onetoone and bicontinuous
(continuous in both directions). Such a function is a topological isomorphism. This test does
not work for "closed" objects (that is, objects for which isCycle()
returns true
).
true
if this object has no interior point of selfintersection or
selftangency.isCycle()
@UML(identifier="isCycle", obligation=MANDATORY, specification=ISO_19107) boolean isCycle()
true
if this Geometry
has an empty boundary after topological
simplification (removal of overlaps between components in nonstructured aggregates, such as
subclasses of Aggregate
). This condition is
alternatively referred to as being "closed" as in a "closed curve." This creates some
confusion since there are two distinct and incompatible definitions for the word "closed".
The use of the word cycle is rarer (generally restricted to the field of algebraic topology),
but leads to less confusion. Essentially, an object is a cycle if it is isomorphic to a
geometric object that is the boundary of a region in some Euclidean space. Thus a curve is a
cycle if it is isomorphic to a circle (has the same start and end point). A surface is a
cycle if it isomorphic to the surface of a sphere, or some torus. A solid, with finite size,
in a space of dimension 3 is never a cycle.true
if this Geometry
has an empty boundary after topological
simplification.isSimple()
@UML(identifier="distance", obligation=MANDATORY, specification=ISO_19107) double distance(Geometry geometry)
Geometry
and another Geometry
. This
distance is defined to be the greatest lower bound of the set of distances between all pairs
of points that include one each from each of the two Geometry
s. A "distance" value
shall be a positive number associated to a distance unit such as meter or standard foot. If
necessary, the second geometric object shall be transformed into the same coordinate
reference system as the first before the distance is calculated.
If the geometric objects overlap, or touch, then their distance apart shall be zero. Some current implementations use a "negative" distance for such cases, but the approach is neither consistent between implementations, nor theoretically viable.
NOTE: The role of the reference system in distance calculations is important. Generally, there are at least three types of distances that may be defined between points (and therefore between geometric objects): map distance, geodesic distance, and terrain distance.
geometry
 The other object.getBoundary()
,
getBuffer(double)
,
CoordinateSystem.getAxis(int)
@UML(identifier="dimension", obligation=MANDATORY, specification=ISO_19107) int getDimension(DirectPosition point)
Geometry
, which shall be less than or equal to
the coordinate dimension. The dimension of a collection
of geometric objects shall be the largest dimension of any of its pieces. Points are
0dimensional, curves are 1dimensional, surfaces are 2dimensional, and solids are
3dimensional. Locally, the dimension of a geometric object at a point is the dimension of a
local neighborhood of the point  that is the dimension of any coordinate neighborhood of the
point. Dimension is unambiguously defined only for direct
positions interior to this Geometry
. If the passed direct
position is null
, then the operation shall return the largest possible dimension for
any direct position in this Geometry
.point
 The point where to evaluate the dimension, or null
.getCoordinateDimension()
@UML(identifier="coordinateDimension", obligation=MANDATORY, specification=ISO_19107) int getCoordinateDimension()
Geometry
, which must be the
same as the coordinate dimension of the coordinate reference system for this Geometry
.getDimension(org.opengis.geometry.DirectPosition)
,
getCoordinateReferenceSystem()
@UML(identifier="maximalComplex", obligation=MANDATORY, specification=ISO_19107) Set<? extends Complex> getMaximalComplex()
Geometry
is contained. As a
set of primitives, a complex may be contained as a set in another larger
complex, referred to as a "super complex" of the original. A complex is maximal if there is no such larger super complex.Geometry
is contained.@UML(identifier="transform", obligation=MANDATORY, specification=ISO_19107) Geometry transform(CoordinateReferenceSystem newCRS) throws TransformException
Geometry
that is the coordinate transformation of this Geometry
into the passed coordinate reference system within the accuracy of the transformation.newCRS
 The new coordinate reference system.Geometry
.TransformException
 if the transformation failed.@Extension Geometry transform(CoordinateReferenceSystem newCRS, MathTransform transform) throws TransformException
Geometry
that is the coordinate transformation of this Geometry
into the passed coordinate reference system, using the specified transform. It is the user
responsability to ensure that the supplied transform is appropriate for this geometry.newCRS
 The new coordinate reference system.transform
 The transform from the existing coordinate reference system to the new
coordinate reference system.Geometry
.TransformException
 if the transformation failed.@UML(identifier="envelope", obligation=MANDATORY, specification=ISO_19107) Envelope getEnvelope()
Geometry
. This shall be the coordinate
region spanning the minimum and maximum value for each ordinate taken on by direct positions in this Geometry
. The simplest representation for an
envelope consists of two direct positions, the first one
containing all the minimums for each ordinate, and second one containing all the maximums.
However, there are cases for which these two positions would be outside the domain of
validity of the object's coordinate reference system.getMbRegion()
@UML(identifier="centroid", obligation=MANDATORY, specification=ISO_19107) DirectPosition getCentroid()
Geometry
. The result is not guaranteed to
be on the object. For heterogeneous collections of primitives, the centroid only takes into
account those of the largest dimension. For example, when calculating the centroid of
surfaces, an average is taken weighted by area. Since curves have no area they do not
contribute to the average.getRepresentativePoint()
@UML(identifier="convexHull", obligation=MANDATORY, specification=ISO_19107) Geometry getConvexHull()
Geometry
that represents the convex hull of this Geometry
.
Convexity requires the use of "lines" or "curves of shortest length" and the use of different
coordinate systems may result in different versions of the convex hull of an object. Each
implementation shall decide on an appropriate solution to this ambiguity. For two reasonable
coordinate systems, a convex hull of an object in one will be very closely approximated by
the transformed image of the convex hull of the same object in the other.@UML(identifier="buffer", obligation=MANDATORY, specification=ISO_19107) Geometry getBuffer(double distance)
Geometry
containing all points whose distance from this Geometry
is
less than or equal to the distance passed as a parameter. The Geometry
returned is in
the same reference system as this original Geometry
. The dimension of the returned
Geometry
is normally the same as the coordinate dimension  a collection of
surfaces in 2D space and a collection of
solids in 3D space, but this may be
application defined.distance
 The distance.Geometry
is less
than or equal to the specified distance.getBoundary()
,
#getDistance
,
CoordinateSystem.getAxis(int)
@Extension boolean isMutable()
false
if this geometry is immutable. Immutable geometries are guarantee to
never change their state, neither directly (through a change in this object) or indirectly
(through a change in an other object this geometry depends upon). Immutable geometries avoid
the need for cloning them. More specifically:
If false
, then this geometry is immutable. It is guarantee that
a call to any setFoo(...)
method will throws an UnmodifiableGeometryException
(that said, immutable geometries are
necessarily unmodifiable. The converse is not true, see next point below).
This geometry will never change its state, and there is no need for cloning it.
If true
, then this geometry is mutable. Note that
mutable geometry is not synonymous of modifiable geometry.
The nuance lays in whatever the geometry may changes its state directly (as of user
request) or indirectly:
This geometry may be modifiable, in which case invoking setFoo(...)
methods is legal and will not throws exception.
This geometry may still unmodifiable. User is not allowed to
modify it himself and invoking any setFoo(...)
method will throws an
UnmodifiableGeometryException
. However, the implementation may change the
geometry itself (for example a timevarying geometry).
true
if this geometry is mutable.@Extension Geometry toImmutable()
isMutable()
value of false. Moreover, as per the contract of isMutable()
, its
values will never change. Any attempts to change the values of the returned object will
result in a UnmodifiableGeometryException
.
Implementors are free to return this
if this object is already immutable.
Geometry clone() throws CloneNotSupportedException
Special cases:
If this geometry is immutable (isMutable() == false
), then
there is no need for cloning this object. This method may return this
or
returns a modifiable copy of this object, at implementation choice.
If a deep copy semantic is not possible at a reasonable cost (for example for some
database backend), then this method throws a CloneNotSupportedException
.
If a deep cloning is possible for all case (i.e. if this method never throws CloneNotSupportedException
), then the implementation should implements the Cloneable
interface.
CloneNotSupportedException
 if this object do not support clone. This exception is
never throws if this object implements Cloneable
.Cloneable
,
isMutable()
Copyright © 1996–2019 Geotools. All rights reserved.