public final class GeometryOperations extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_RESOLUTION
The default buffer resolution (12).
|
| Modifier and Type | Method and Description |
|---|---|
static Area |
area(IGeometry geom,
ComputationType model)
Returns the area of the geometry.
|
static IFeatureGeometry |
buffer(IGeometry g,
Offset distance)
Returns a geometry consisting of all the points within the
distance of this geometry. |
static IFeatureGeometry |
buffer(IGeometry g,
Offset distance,
int resolution)
Returns a geometry consisting of all the points within the
distance of the given geometry. |
static ClosestPoints |
closestPoints(IGeometry first,
IGeometry second)
Returns the closest points between the two geometries.
|
static ClosestPoints |
closestPoints(IGeometry first,
IGeometry second,
ComputationType model)
Returns the closest points between the two geometries.
|
static IFeatureGeometry |
convexHull(IGeometry g)
Forms the convex hull of the geometry.
|
static boolean |
disjoint(IGeometry first,
IGeometry second)
Tests if two objects satisfy the 'DISJOINT' criteria, as defined in OGC Simple Feature Specification
This test can return true for any combination of geometry objects.
|
static Length |
distance(IGeometry first,
IGeometry second)
Returns the minimum distance between the two geometries.
|
static Length |
distance(IGeometry first,
IGeometry second,
ComputationType model)
Returns the minimum distance between the two geometries.
|
static Length |
distanceToEdge(IGeometry first,
IGeometry second,
ComputationType model)
Returns the minimum distance between the two geometries.
|
static IFeatureGeometry |
intersection(IGeometry first,
IGeometry second)
Returns the geometry consisting of direct positions that lie in both specified geometries.
|
static boolean |
intersects(Envelope env,
IGeometry second)
Returns true if there is any direct position in common between the two
geometries.
|
static boolean |
intersects(IGeometry first,
IGeometry second)
Returns true if there is any direct position in common between the two
geometries.
|
static Length |
length(IGeometry geom,
ComputationType model)
Computes the length of a geometry.
|
static boolean |
overlaps(IGeometry first,
IGeometry second)
Tests if two objects satisfy the 'OVERLAPS' criteria, as defined in OGC Simple Feature Specification
This test can return true for P/P, A/A, and L/L combinations; otherwise it returns false.
|
static Length |
perimeter(IGeometry geom,
ComputationType model)
Returns the total perimeter of the geometry.
|
static IFeatureGeometry |
union(IGeometry first,
IGeometry second)
Computes the set-union of the two geometries.
|
static IFeatureGeometry |
union(Iterable<? extends IGeometry> geomList)
Computes the set-union of the list of geometries.
|
static boolean |
within(IGeometry first,
IGeometry second)
The first geometry is within the second if the intersection of the
two is the first geometry, and the intersections of their interiors is
non-empty.
|
public static final int DEFAULT_BUFFER_RESOLUTION
public static Area area(IGeometry geom, ComputationType model)
geom - the input geometry.model - the computation model (may be null, in which case the default
for the coordinate system is used).InvalidComputationTypeException - if the ComputationType is inappropriate for the coordinate system.public static IFeatureGeometry buffer(IGeometry g, Offset distance, int resolution)
distance of the given geometry. A positive distance results in
a larger geometry. A negative distance shrinks polygons, and causes
points and curves to disappear. A distance of 0 is legal.g - the geometry to buffer.distance - the amount to enlarge or shrink the geometry by.resolution - the resolution specifies how many straight-line
segments are used in approximating a circle. For example, with
a resolution of 8, the buffer of a point will be an octagon.
Buffers with larger resolution values take more
time and space to compute.
A positive buffer of a point will always have at least three straight-lines,
even if the resolution is zero, one, or two. Curves and polygons have
no minimum resolution value.
Implementations may in the future return curved sections
instead of straight-line approximations, ignoring this
parameter.UnsupportedGeometryOperationException - if the resulting geometry is
discovered to extend beyond the coordinate system (thrown on a best-effort basis).public static IFeatureGeometry buffer(IGeometry g, Offset distance)
distance of this geometry.
Equivalent to
buffer(g, distance, resolution)
with a default value for resolution.g - the geometry to buffer.distance - the amount to enlarge or shrink the geometry by.public static IFeatureGeometry convexHull(IGeometry g)
g - the input geometry.public static Length distance(IGeometry first, IGeometry second, ComputationType model)
first - first geometry to be used.second - second geometry to be used.model - the preferred computational model for computing the distance. If null,
a default computational model is used.InvalidGeometryException - if either object is empty.InvalidComputationTypeException - if the ComputationType is inappropriate for the coordinate system.public static Length distanceToEdge(IGeometry first, IGeometry second, ComputationType model)
GeometryOperations.distance(IGeometry, IGeometry, ComputationType),
this method will return a distance when one geometry is contained within the other instead of returning zero.
Zero can still be returned when geometry edges (or points) overlap.
It is an error for either geometry to be empty.first - first geometry to be used.second - second geometry to be used.model - the preferred computational model for computing the distance. If null,
a default computational model is used.InvalidGeometryException - if either object is empty.InvalidComputationTypeException - if the ComputationType is inappropriate for the coordinate system.public static ClosestPoints closestPoints(IGeometry first, IGeometry second)
Distance is always non-negative (objects which overlap are distance zero
from each other. In which case a shared point will be returned). This is identical to
closestPoints(first, second, model)
using a default computational model.
first - first geometry to be used.second - second geometry to be used.InvalidGeometryException - if either object is empty.public static ClosestPoints closestPoints(IGeometry first, IGeometry second, ComputationType model)
first - first geometry to be used.second - second geometry to be used.model - the preferred computational model for computing the distance. If null,
a default computational model is used.InvalidGeometryException - if either object is empty.InvalidComputationTypeException - if the ComputationType is inappropriate for the coordinate system.public static Length distance(IGeometry first, IGeometry second)
distance(a, b, model)
using a default computational model.
It is an error for either geometry to be empty.first - first geometry to be used.second - second geometry to be used.InvalidGeometryException - if either object is empty.public static IFeatureGeometry intersection(IGeometry first, IGeometry second)
This is set-intersection.first - first geometry to be used.second - second geometry to be used.InvalidGeometryException - if either object is empty.public static Length length(IGeometry geom, ComputationType model)
geom - the input geometry.model - the preferred computational model.UnsupportedGeometryOperationException - if the geometry contains an object with area (polygon, ellipse, etc.).InvalidComputationTypeException - if the ComputationType is inappropriate for the coordinate system.public static Length perimeter(IGeometry geom, ComputationType model)
geom - the input geometry.model - the computation model (may be null, in which case the default
for the coordinate system is used).InvalidComputationTypeException - if the ComputationType is inappropriate for the coordinate system.UnsupportedGeometryOperationException - if called on a LegacyText geometry.public static IFeatureGeometry union(IGeometry first, IGeometry second)
first - first geometry to be used.second - second geometry to be used.public static IFeatureGeometry union(Iterable<? extends IGeometry> geomList)
geomList - a list of geometries to be used.public static boolean disjoint(IGeometry first, IGeometry second)
!intersects(first,second)first - first geometry to be used.second - second geometry to be used.public static boolean intersects(IGeometry first, IGeometry second)
first - first geometry to be used.second - second geometry to be used.public static boolean overlaps(IGeometry first, IGeometry second)
first - first geometry to be used.second - second geometry to be used.public static boolean intersects(Envelope env, IGeometry second)
env - first geometry to be used specified as an Envelope.second - second geometry to be used.public static boolean within(IGeometry first, IGeometry second)
first - first geometry to be used.second - second geometry to be used.