/// <summary>
        /// Simplifies the specified polygon.
        /// </summary>
        /// <param name="source">The polygon.</param>
        /// <param name="delta">The tolerance.</param>
        /// <param name="precisionModel">The precision model.</param>
        /// <returns>The simplified polygon.</returns>
        /// <exception cref="System.ArgumentNullException">The source is null.</exception>
        /// <exception cref="System.ArgumentOutOfRangeException">The delta is less than or equal to 0.</exception>
        public static IBasicPolygon Simplify(IBasicPolygon source, Double delta, PrecisionModel precisionModel)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source", "The source is null.");
            }
            if (source.Shell == null || source.Shell.Coordinates == null)
            {
                return(null);
            }

            DouglasPeuckerAlgorithm algorithm = new DouglasPeuckerAlgorithm(source.Shell.Coordinates, delta, precisionModel);

            algorithm.Compute();
            IList <Coordinate>         shell = algorithm.Result;
            List <IList <Coordinate> > holes = new List <IList <Coordinate> >();

            foreach (IBasicLineString hole in source.Holes)
            {
                if (hole == null || hole.Coordinates == null)
                {
                    continue;
                }

                algorithm = new DouglasPeuckerAlgorithm(hole.Coordinates, delta, precisionModel);
                algorithm.Compute();
                holes.Add(algorithm.Result);
            }

            return(new BasicPolygon(shell, holes));
        }
        /// <summary>
        /// Simplifies the specified line string.
        /// </summary>
        /// <param name="source">The coordinates of the line string.</param>
        /// <param name="delta">The tolerance.</param>
        /// <param name="precisionModel">The precision model.</param>
        /// <returns>The list of coordinates of the simplified line string.</returns>
        /// <exception cref="System.ArgumentNullException">The source is null.</exception>
        /// <exception cref="System.ArgumentOutOfRangeException">The delta is less than or equal to 0.</exception>
        public static IList <Coordinate> Simplify(IList <Coordinate> source, Double delta, PrecisionModel precisionModel)
        {
            DouglasPeuckerAlgorithm algorithm = new DouglasPeuckerAlgorithm(source, delta, precisionModel);

            algorithm.Compute();
            return(algorithm.Result);
        }
        /// <summary>
        /// Simplifies the specified line string.
        /// </summary>
        /// <param name="source">The line string.</param>
        /// <param name="delta">The tolerance.</param>
        /// <param name="precisionModel">The precision model.</param>
        /// <returns>The simplified line string.</returns>
        /// <exception cref="System.ArgumentNullException">The source is null.</exception>
        /// <exception cref="System.ArgumentOutOfRangeException">The delta is less than or equal to 0.</exception>
        public static IBasicLineString Simplify(IBasicLineString source, Double delta, PrecisionModel precisionModel)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source", "The source is null.");
            }
            if (source.Coordinates == null)
            {
                return(null);
            }

            DouglasPeuckerAlgorithm algorithm = new DouglasPeuckerAlgorithm(source.Coordinates, delta, precisionModel);

            algorithm.Compute();
            return(new BasicLineString(algorithm.Result));
        }