/// <summary> /// Computes the set-theoretic intersection of two <c>Geometry</c>s, using enhanced precision. /// </summary> /// <param name="geom0">The first Geometry.</param> /// <param name="geom1">The second Geometry.</param> /// <returns>The Geometry representing the set-theoretic intersection of the input Geometries.</returns> public static IGeometry Intersection(IGeometry geom0, IGeometry geom1) { ApplicationException originalEx; try { IGeometry result = geom0.Intersection(geom1); return result; } catch (ApplicationException ex) { originalEx = ex; } /* * If we are here, the original op encountered a precision problem * (or some other problem). Retry the operation with * enhanced precision to see if it succeeds */ try { CommonBitsOp cbo = new CommonBitsOp(true); IGeometry resultEp = cbo.Intersection(geom0, geom1); // check that result is a valid point after the reshift to orginal precision if (!resultEp.IsValid) throw originalEx; return resultEp; } catch (ApplicationException) { throw originalEx; } }
/// <summary> /// Computes the set-theoretic union of two <c>Geometry</c>s, using enhanced precision. /// </summary> /// <param name="geom0">The first Geometry.</param> /// <param name="geom1">The second Geometry.</param> /// <returns>The Geometry representing the set-theoretic union of the input Geometries.</returns> public static IGeometry Union(IGeometry geom0, IGeometry geom1) { ApplicationException originalEx; try { IGeometry result = geom0.Union(geom1); return(result); } catch (ApplicationException ex) { originalEx = ex; } /* * If we are here, the original op encountered a precision problem * (or some other problem). Retry the operation with * enhanced precision to see if it succeeds */ try { CommonBitsOp cbo = new CommonBitsOp(true); IGeometry resultEp = cbo.Union(geom0, geom1); // check that result is a valid point after the reshift to orginal precision if (!resultEp.IsValid) { throw originalEx; } return(resultEp); } catch (ApplicationException) { throw originalEx; } }
public static IGeometry Buffer(Geometry geom, double distance) { ApplicationException originalEx; try { Geometry result = (Geometry)geom.Buffer(distance); return(result); } catch (ApplicationException ex) { originalEx = ex; } /* * If we are here, the original op encountered a precision problem * (or some other problem). Retry the operation with * enhanced precision to see if it succeeds */ try { CommonBitsOp cbo = new CommonBitsOp(true); IGeometry resultEP = cbo.Buffer(geom, distance); // check that result is a valid point after the reshift to orginal precision if (!resultEP.IsValid) { throw originalEx; } return(resultEP); } catch (ApplicationException) { throw originalEx; } }
public static IGeometry Buffer(Geometry geom, double distance) { ApplicationException originalEx; try { Geometry result = (Geometry)geom.Buffer(distance); return result; } catch (ApplicationException ex) { originalEx = ex; } /* * If we are here, the original op encountered a precision problem * (or some other problem). Retry the operation with * enhanced precision to see if it succeeds */ try { CommonBitsOp cbo = new CommonBitsOp(true); IGeometry resultEP = cbo.Buffer(geom, distance); // check that result is a valid point after the reshift to orginal precision if (!resultEP.IsValid) throw originalEx; return resultEP; } catch (ApplicationException) { throw originalEx; } }