Package org.geotools.coverage.util
Class IntersectUtils
- Object
-
- IntersectUtils
-
public class IntersectUtils extends Object
Performs some naive intersections on GeometryCollections, because JTS is not supporting them.- Author:
- Emanuele Tajariol (GeoSolutions)
-
-
Constructor Summary
Constructors Constructor Description IntersectUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Geometry
intersection(Geometry g1, Geometry g2)
Return the intersection of two Geometries.static boolean
intersects(Geometry g1, Geometry g2)
Tests whether the two geometries intersect.static Geometry
unrollGeometries(Geometry geometry)
Flatten all first-level (i.e. non recursively) bundles (GeometryCollections and MultiPolygons) into a GeometryCollection.
-
-
-
Method Detail
-
intersects
public static boolean intersects(Geometry g1, Geometry g2)
Tests whether the two geometries intersect.This method relies completely on
Geometry.intersects(Geometry)
but also tries to unroll GeometryCollections.- Returns:
- true if the two geometries intersect.
-
intersection
public static Geometry intersection(Geometry g1, Geometry g2)
Return the intersection of two Geometries.
This method relies completely onGeometry.intersection(Geometry)
but also tries to unroll GeometryCollections.- Returns:
- true if the two geometries intersect.
-
unrollGeometries
public static Geometry unrollGeometries(Geometry geometry) throws IllegalArgumentException
Flatten all first-level (i.e. non recursively) bundles (GeometryCollections and MultiPolygons) into a GeometryCollection.
Valid structures:- null -> null
- Polygon -> Polygon
- MultiPolygon -> GeometryCollection of Polygons
- GeometryCollection holding Polygons and MultiPolygons -> GeometryCollection of Polygons
- Throws:
IllegalArgumentException
- when encountering illegal Geometries; message is the Geometry class name.
-
-