示例#1
0
        /// <summary>
        /// Buffer polygons by buffering the individual boundary segments and
        /// either unioning or differencing them.
        /// </summary>
        /// <param name="g"></param>
        /// <param name="distance"></param>
        /// <returns>The buffer geometry</returns>
        public static IGeometry BufferBySegments(IGeometry g, double distance)
        {
            var segs    = LineHandlingFunctions.ExtractSegments(g);
            var posDist = Math.Abs(distance);
            var segBuf  = BufferByComponents(segs, posDist);

            if (distance < 0.0)
            {
                return(g.Difference(segBuf));
            }
            return(g.Union(segBuf));
        }
示例#2
0
        public static IGeometry BufferByChains(IGeometry g, double distance, int maxChainSize)
        {
            if (maxChainSize <= 0)
            {
                throw new ArgumentOutOfRangeException("maxChainSize", "Maximum Chain Size must be specified as an input parameter");
            }
            var    segs    = LineHandlingFunctions.ExtractChains(g, maxChainSize);
            double posDist = Math.Abs(distance);
            var    segBuf  = BufferByComponents(segs, posDist);

            if (distance < 0.0)
            {
                return(g.Difference(segBuf));
            }
            return(g.Union(segBuf));
        }