intersection method
Computes a Geometry
representing the point-set which is
common to both this Geometry
and the other
Geometry.
The intersection of two geometries of different dimension produces a result geometry of dimension less than or equal to the minimum dimension of the input geometries. The result geometry may be a heterogeneous {@link GeometryCollection}. If the result is empty, it is an atomic geometry with the dimension of the lowest input dimension.
Intersection of {@link GeometryCollection}s is supported only for homogeneous collection types.
Non-empty heterogeneous {@link GeometryCollection} arguments are not supported.
@param other the Geometry
with which to compute the intersection
@return a Geometry representing the point-set common to the two Geometry
s
@throws TopologyException if a robustness error occurs
@throws IllegalArgumentException if the argument is a non-empty heterogeneous GeometryCollection
Implementation
Geometry intersection(Geometry other) {
throw UnimplementedError("Not implemented yet"); // TODO
// /**
// * TODO: MD - add optimization for P-A case using Point-In-Polygon
// */
// // special case: if one input is empty ==> empty
// if (this.isEmpty() || other.isEmpty())
// return OverlayOp.createEmptyResult(OverlayOp.INTERSECTION, this, other, factory);
//
// // compute for GCs
// // (An inefficient algorithm, but will work)
// // TODO: improve efficiency of computation for GCs
// if (this.isGeometryCollection()) {
// final Geometry g2 = other;
// return GeometryCollectionMapper.map(
// (GeometryCollection) this,
// new GeometryMapper.MapOp() {
// Geometry map(Geometry g) {
// return g.intersection(g2);
// }
// });
// }
//
// // No longer needed since GCs are handled by previous code
// //checkNotGeometryCollection(this);
// //checkNotGeometryCollection(other);
// return SnapIfNeededOverlayOp.overlayOp(this, other, OverlayOp.INTERSECTION);
}