org.geolatte.geom.ProjectedGeometryOperations Maven / Gradle / Ivy
Show all versions of geolatte-geom Show documentation
/*
* This file is part of the GeoLatte project.
*
* GeoLatte is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GeoLatte is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with GeoLatte. If not, see .
*
* Copyright (C) 2010 - 2011 and Ownership of code is shared by:
* Qmino bvba - Romeinsestraat 18 - 3001 Heverlee (http://www.qmino.com)
* Geovise bvba - Generaal Eisenhowerlei 9 - 2140 Antwerpen (http://www.geovise.com)
*/
package org.geolatte.geom;
/**
* Defines standard operations on {@code Geometry}s with projected coordinate systems.
*
* The semantics of the operations is as specified in
* Simple Feature Access - Part 1: common architecture
*
*
* @author Karel Maesen, Geovise BVBA
*/
public interface ProjectedGeometryOperations {
/**
* Default implementation of this interface
*/
public final ProjectedGeometryOperations Default = new JTSGeometryOperations();
/**
* Tests the simplicity of the specified Geometry
.
*
* @param geometry the Geometry
to test for simplicity.
* @return True iff the specified Geometry
is simple.
*/
boolean isSimple(final Geometry
geometry);
/**
* Calculates the boundary of the specified Geometry
.
*
* @param geometry the Geometry
for which to calculate the boundary.
* @return a Geometry
representing the boundary of the specified Geometry
.
*/
Geometry
boundary(final Geometry
geometry);
/**
* Creates a Geometry
with the positions of the input Geometry
in reverse order.
*
* @param geometry the Geometry
to reverse
* @return a Geometry
with the same positions as the specified input Geometry
but in reverse order
*/
> G reverse (final G geometry);
/**
* Checks if the specified Geometry
s intersect.
*
* @param geometry the first Geometry
operand of the intersection test
* @param other the second Geometry
operand of the intersection test
* @return true iff the specified Geometry
s spatially intersect
*/
boolean intersects(final Geometry
geometry, final Geometry
other);
/**
* Checks if the specified Geometry
s touch.
*
* @param geometry the first Geometry
operand of the touch test
* @param other the second Geometry
operand of the touch test
* @return true iff the specified Geometry
s spatially touch
*/
boolean touches(final Geometry
geometry, final Geometry
other);
/**
* Checks if the specified Geometry
s cross.
*
* @param geometry the first Geometry
operand of the cross test
* @param other the second Geometry
operand of the cross test
* @return true iff the specified Geometry
s spatially cross
*/
boolean crosses(final Geometry
geometry, final Geometry
other);
/**
* Checks if the first specified Geometry
spatially
* contains the second.
*
* @param geometry the first Geometry
operand of the containment test
* @param other the second Geometry
operand of the containment test
* @return true iff the first specified Geometry
spatially contains the second
*/
boolean contains(final Geometry
geometry, final Geometry
other);
/**
* Checks if the specified Geometry
s overlap.
*
* @param geometry the first Geometry
operand of the overlap test
* @param other the second Geometry
operand of the overlap test
* @return true iff the specified Geometry
s spatially overlap
*/
boolean overlaps(final Geometry
geometry, final Geometry
other);
/**
* Checks if the specified Geometry
s are spatially related by testing
* for intersections between the interior, boundary and exterior of the two geometric objects as specified by
* the values in the intersection pattern matrix. This returns false if all the tested intersections are empty except
* exterior (this) intersect exterior (another).
*
* @param geometry the first Geometry
operand of the relates test
* @param other the second Geometry
operand of the relates test
* @param matrix the intersection pattern matrix
* @return true iff this instance intersects the specifed other Geometry
*/
boolean relates(final Geometry
geometry, final Geometry
other, final String matrix);
/**
* Calculates the shortest distance between any two points in the two Geometry
s in the
* coordinate reference system of this Geometry
. Only the X/Y-coordinates are used in the distance
* calculation; M- and Z-coordinates are ignored.
*
* @param geometry the first Geometry
* @param other the second Geometry
* @return the shortest distance between the two specified Geometries
*/
double distance(final Geometry
geometry, final Geometry
other);
/**
* Calculates a Geometry
that represents all points whose distance from the specified
* Geometry
is less than or equal the specified distance.
*
*
Calculations are in the CoordinateReferenceSystem
of this
* Geometry
.
* Z- or M-coordinates are ignored in the buffering operation; and the result will always be a 2D geometry.
*
* @param geometry the Geometry
for which to calculate the buffer
* @param distance the buffer distance
* @return a 2D Geometry
representing the buffer of the specified Geometry
with the specified distance.
*/
Geometry
buffer(final Geometry
geometry, final double distance);
/**
* Calculates the convex hull of the specified Geometry
.
*
* @param geometry the Geometry
for which to calculate the convex hull.
* @return the convex hull for the specified Geometry
.
*/
Geometry
convexHull(final Geometry
geometry);
/**
* Calculates the point set intersection of the specified Geometry
s.
*
* @param geometry the first Geometry
* @param other the second Geometry
* @return a Geometry
representing the point set intersection between the two specified Geometries
*/
Geometry
intersection(final Geometry
geometry, final Geometry
other);
/**
* Calculates the point set union of the specified Geometry
s.
*
* @param geometry the first Geometry
* @param other the second Geometry
* @return a Geometry
representing the point set union between the two specified Geometries
*/
Geometry
union(final Geometry
geometry, final Geometry
other);
/**
* Calculates the point set difference of the specified Geometry
s.
*
* @param geometry the first Geometry
* @param other the second Geometry
* @return a Geometry
representing the point set difference between the two specified Geometries
*/
Geometry
difference(final Geometry
geometry, final Geometry
other);
/**
* Calculates the point set symmetric difference of the specified Geometry
s.
*
* @param geometry the first Geometry
* @param other the second Geometry
* @return a Geometry
representing the point set symmetric difference between the two specified Geometries
*/
Geometry
symmetricDifference(final Geometry
geometry, final Geometry
other);
/**
* Calculates the length of the specified {@code Geometry}.
*
* @param geometry the Geometry
* @return the length of the specified Geometry
*/
& Linear
> double length(final G geometry);
/**
* Calculates the area of the specified {@code Geometry}.
*
* @param geometry the Geometry
* @return the area of the specified Geometry
*/
& Polygonal
> double area(final G geometry);
/**
* Calculates a centroid for the specified {@code Geometry}.
*
* @param geometry the Geometry
* @param Polygonal Geometry
* @return the centroid of the specified Geometry as a {@code Point}
*/
& Polygonal
> Point
centroid(final G geometry);
}