/// <summary>
        /// Computes unary union using robust computation.
        /// </summary>
        /// <param name="geom">The geometry to union</param>
        /// <returns>The union result</returns>
        public static Geometry Union(Geometry geom)
        {
            if (geom == null)
            {
                throw new ArgumentNullException(nameof(geom));
            }

            var unionSRFun = new UnionStrategy((g0, g1) => Overlay(g0, g1, SpatialFunction.Union), true);
            var op         = new UnaryUnionOp(geom)
            {
                UnionStrategy = unionSRFun
            };

            return(op.Union());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Unions a collection of geometries
        /// using a given precision model.
        /// <para/>
        /// This class is most useful for performing UnaryUnion using
        /// a fixed-precision model.
        /// For unary union using floating precision,
        /// <see cref="OverlayNGRobust.Union(Geometry)"/> should be used.
        /// </summary>
        /// <param name="geom">The geometry to union</param>
        /// <param name="pm">The precision model to use</param>
        /// <returns>The union of the geometries</returns>
        /// <seealso cref="OverlayNGRobust"/>
        public static Geometry Union(Geometry geom, PrecisionModel pm)
        {
            if (geom == null)
            {
                throw new ArgumentNullException(nameof(geom));
            }

            var unionSRFun = new UnionStrategy((g0, g1) =>
                                               OverlayNG.Overlay(g0, g1, SpatialFunction.Union, pm), OverlayUtility.IsFloating(pm));

            var op = new UnaryUnionOp(geom)
            {
                UnionStrategy = unionSRFun
            };

            return(op.Union());
        }