Package org.geolatte.geom
Class JTSGeometryOperations
- java.lang.Object
-
- org.geolatte.geom.JTSGeometryOperations
-
- All Implemented Interfaces:
ProjectedGeometryOperations
public class JTSGeometryOperations extends Object implements ProjectedGeometryOperations
An implementation ofProjectedGeometryOperationsthat delegates to the corresponding JTS operations.- Author:
- Karel Maesen, Geovise BVBA creation-date: 5/3/11
-
-
Field Summary
-
Fields inherited from interface org.geolatte.geom.ProjectedGeometryOperations
Default
-
-
Constructor Summary
Constructors Constructor Description JTSGeometryOperations()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <P extends C2D,G extends Geometry<P> & Polygonal<P>>
doublearea(G geometry)Calculates the area of the specifiedGeometry.<P extends C2D>
Geometry<P>boundary(Geometry<P> geometry)Calculates the boundary of the specifiedGeometry.<P extends C2D>
Geometry<P>buffer(Geometry<P> geometry, double distance)Calculates aGeometrythat represents all points whose distance from the specifiedGeometryis less than or equal the specified distance.<P extends C2D,G extends Geometry<P> & Polygonal<P>>
Point<P>centroid(G geometry)Calculates a centroid for the specifiedGeometry.<P extends C2D>
booleancontains(Geometry<P> geometry, Geometry<P> other)Checks if the first specifiedGeometryspatially contains the second.<P extends C2D>
Geometry<P>convexHull(Geometry<P> geometry)Calculates the convex hull of the specifiedGeometry.<P extends C2D>
booleancrosses(Geometry<P> geometry, Geometry<P> other)Checks if the specifiedGeometrys cross.<P extends C2D>
Geometry<P>difference(Geometry<P> geometry, Geometry<P> other)Calculates the point set difference of the specifiedGeometrys.<P extends C2D>
doubledistance(Geometry<P> geometry, Geometry<P> other)Calculates the shortest distance between any two points in the twoGeometrys in the coordinate reference system of thisGeometry.<P extends C2D>
Geometry<P>intersection(Geometry<P> geometry, Geometry<P> other)Calculates the point set intersection of the specifiedGeometrys.<P extends C2D>
booleanintersects(Geometry<P> geometry, Geometry<P> other)Checks if the specifiedGeometrys intersect.<P extends C2D>
booleanisSimple(Geometry<P> geometry)Tests the simplicity of the specifiedGeometry.<P extends C2D,G extends Geometry<P> & Linear<P>>
doublelength(G geometry)Calculates the length of the specifiedGeometry.<P extends C2D>
booleanoverlaps(Geometry<P> geometry, Geometry<P> other)Checks if the specifiedGeometrys overlap.<P extends C2D>
booleanrelates(Geometry<P> geometry, Geometry<P> other, String matrix)Checks if the specifiedGeometrys 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.<P extends C2D,G extends Geometry<P>>
Greverse(G geometry)Creates aGeometryhaving as coordinates the coordinates of the inputGeometryin reverse order.<P extends C2D>
Geometry<P>symmetricDifference(Geometry<P> geometry, Geometry<P> other)Calculates the point set symmetric difference of the specifiedGeometrys.<P extends C2D>
booleantouches(Geometry<P> geometry, Geometry<P> other)Checks if the specifiedGeometrys touch.<P extends C2D>
Geometry<P>union(Geometry<P> geometry, Geometry<P> other)Calculates the point set union of the specifiedGeometrys.
-
-
-
Method Detail
-
isSimple
public <P extends C2D> boolean isSimple(Geometry<P> geometry)
Description copied from interface:ProjectedGeometryOperationsTests the simplicity of the specifiedGeometry.- Specified by:
isSimplein interfaceProjectedGeometryOperations- Parameters:
geometry- theGeometryto test for simplicity.- Returns:
- True iff the specified
Geometryis simple.
-
boundary
public <P extends C2D> Geometry<P> boundary(Geometry<P> geometry)
Description copied from interface:ProjectedGeometryOperationsCalculates the boundary of the specifiedGeometry.- Specified by:
boundaryin interfaceProjectedGeometryOperations- Parameters:
geometry- theGeometryfor which to calculate the boundary.- Returns:
- a
Geometryrepresenting the boundary of the specifiedGeometry.
-
reverse
public <P extends C2D,G extends Geometry<P>> G reverse(G geometry)
Creates aGeometryhaving as coordinates the coordinates of the inputGeometryin reverse order.- Specified by:
reversein interfaceProjectedGeometryOperations- Parameters:
geometry- theGeometryto reverse- Returns:
- a
Geometrywith the same coordinates as the specified inputGeometrybut in reverse order
-
intersects
public <P extends C2D> boolean intersects(Geometry<P> geometry, Geometry<P> other)
Description copied from interface:ProjectedGeometryOperationsChecks if the specifiedGeometrys intersect.- Specified by:
intersectsin interfaceProjectedGeometryOperations- Parameters:
geometry- the firstGeometryoperand of the intersection testother- the secondGeometryoperand of the intersection test- Returns:
- true iff the specified
Geometrys spatially intersect
-
touches
public <P extends C2D> boolean touches(Geometry<P> geometry, Geometry<P> other)
Description copied from interface:ProjectedGeometryOperationsChecks if the specifiedGeometrys touch.- Specified by:
touchesin interfaceProjectedGeometryOperations- Parameters:
geometry- the firstGeometryoperand of the touch testother- the secondGeometryoperand of the touch test- Returns:
- true iff the specified
Geometrys spatially touch
-
crosses
public <P extends C2D> boolean crosses(Geometry<P> geometry, Geometry<P> other)
Description copied from interface:ProjectedGeometryOperationsChecks if the specifiedGeometrys cross.- Specified by:
crossesin interfaceProjectedGeometryOperations- Parameters:
geometry- the firstGeometryoperand of the cross testother- the secondGeometryoperand of the cross test- Returns:
- true iff the specified
Geometrys spatially cross
-
contains
public <P extends C2D> boolean contains(Geometry<P> geometry, Geometry<P> other)
Description copied from interface:ProjectedGeometryOperationsChecks if the first specifiedGeometryspatially contains the second.- Specified by:
containsin interfaceProjectedGeometryOperations- Parameters:
geometry- the firstGeometryoperand of the containment testother- the secondGeometryoperand of the containment test- Returns:
- true iff the first specified
Geometryspatially contains the second
-
overlaps
public <P extends C2D> boolean overlaps(Geometry<P> geometry, Geometry<P> other)
Description copied from interface:ProjectedGeometryOperationsChecks if the specifiedGeometrys overlap.- Specified by:
overlapsin interfaceProjectedGeometryOperations- Parameters:
geometry- the firstGeometryoperand of the overlap testother- the secondGeometryoperand of the overlap test- Returns:
- true iff the specified
Geometrys spatially overlap
-
relates
public <P extends C2D> boolean relates(Geometry<P> geometry, Geometry<P> other, String matrix)
Description copied from interface:ProjectedGeometryOperationsChecks if the specifiedGeometrys 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).- Specified by:
relatesin interfaceProjectedGeometryOperations- Parameters:
geometry- the firstGeometryoperand of the relates testother- the secondGeometryoperand of the relates testmatrix- the intersection pattern matrix- Returns:
- true iff this instance intersects the specifed other
Geometry
-
distance
public <P extends C2D> double distance(Geometry<P> geometry, Geometry<P> other)
Description copied from interface:ProjectedGeometryOperationsCalculates the shortest distance between any two points in the twoGeometrys in the coordinate reference system of thisGeometry. Only the X/Y-coordinates are used in the distance calculation; M- and Z-coordinates are ignored.- Specified by:
distancein interfaceProjectedGeometryOperations- Parameters:
geometry- the firstGeometryother- the secondGeometry- Returns:
- the shortest distance between the two specified
Geometries
-
buffer
public <P extends C2D> Geometry<P> buffer(Geometry<P> geometry, double distance)
Description copied from interface:ProjectedGeometryOperationsCalculates aGeometrythat represents all points whose distance from the specifiedGeometryis less than or equal the specified distance.Calculations are in the
CoordinateReferenceSystemof thisGeometry.Z- or M-coordinates are ignored in the buffering operation; and the result will always be a 2D geometry.
- Specified by:
bufferin interfaceProjectedGeometryOperations- Parameters:
geometry- theGeometryfor which to calculate the bufferdistance- the buffer distance- Returns:
- a 2D
Geometryrepresenting the buffer of the specifiedGeometrywith the specified distance.
-
convexHull
public <P extends C2D> Geometry<P> convexHull(Geometry<P> geometry)
Description copied from interface:ProjectedGeometryOperationsCalculates the convex hull of the specifiedGeometry.- Specified by:
convexHullin interfaceProjectedGeometryOperations- Parameters:
geometry- theGeometryfor which to calculate the convex hull.- Returns:
- the convex hull for the specified
Geometry.
-
intersection
public <P extends C2D> Geometry<P> intersection(Geometry<P> geometry, Geometry<P> other)
Description copied from interface:ProjectedGeometryOperationsCalculates the point set intersection of the specifiedGeometrys.- Specified by:
intersectionin interfaceProjectedGeometryOperations- Parameters:
geometry- the firstGeometryother- the secondGeometry- Returns:
- a
Geometryrepresenting the point set intersection between the two specifiedGeometries
-
union
public <P extends C2D> Geometry<P> union(Geometry<P> geometry, Geometry<P> other)
Description copied from interface:ProjectedGeometryOperationsCalculates the point set union of the specifiedGeometrys.- Specified by:
unionin interfaceProjectedGeometryOperations- Parameters:
geometry- the firstGeometryother- the secondGeometry- Returns:
- a
Geometryrepresenting the point set union between the two specifiedGeometries
-
difference
public <P extends C2D> Geometry<P> difference(Geometry<P> geometry, Geometry<P> other)
Description copied from interface:ProjectedGeometryOperationsCalculates the point set difference of the specifiedGeometrys.- Specified by:
differencein interfaceProjectedGeometryOperations- Parameters:
geometry- the firstGeometryother- the secondGeometry- Returns:
- a
Geometryrepresenting the point set difference between the two specifiedGeometries
-
symmetricDifference
public <P extends C2D> Geometry<P> symmetricDifference(Geometry<P> geometry, Geometry<P> other)
Description copied from interface:ProjectedGeometryOperationsCalculates the point set symmetric difference of the specifiedGeometrys.- Specified by:
symmetricDifferencein interfaceProjectedGeometryOperations- Parameters:
geometry- the firstGeometryother- the secondGeometry- Returns:
- a
Geometryrepresenting the point set symmetric difference between the two specifiedGeometries
-
length
public <P extends C2D,G extends Geometry<P> & Linear<P>> double length(G geometry)
Description copied from interface:ProjectedGeometryOperationsCalculates the length of the specifiedGeometry.- Specified by:
lengthin interfaceProjectedGeometryOperations- Parameters:
geometry- the Geometry- Returns:
- the length of the specified Geometry
-
area
public <P extends C2D,G extends Geometry<P> & Polygonal<P>> double area(G geometry)
Description copied from interface:ProjectedGeometryOperationsCalculates the area of the specifiedGeometry.- Specified by:
areain interfaceProjectedGeometryOperations- Parameters:
geometry- the Geometry- Returns:
- the area of the specified Geometry
-
centroid
public <P extends C2D,G extends Geometry<P> & Polygonal<P>> Point<P> centroid(G geometry)
Description copied from interface:ProjectedGeometryOperationsCalculates a centroid for the specifiedGeometry.- Specified by:
centroidin interfaceProjectedGeometryOperationsG- Polygonal Geometry- Parameters:
geometry- the Geometry- Returns:
- the centroid of the specified Geometry as a
Point
-
-