Exemplo n.º 1
0
        /// <summary>
        /// Computes the buffer for a geometry for a given buffer distance
        /// and accuracy of approximation.
        /// </summary>
        /// <param name="g"> the geometry to buffer</param>
        /// <param name="distance"> the buffer distance</param>
        /// <param name="parameters"> the buffer parameters to use</param>
        /// <returns> the buffer of the input geometry</returns>
        public static IGeometry Buffer(IGeometry g, double distance, IBufferParameters parameters)
        {
            var bufOp   = new BufferOp(g, parameters);
            var geomBuf = bufOp.GetResultGeometry(distance);

            return(geomBuf);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Computes the buffer for a geometry for a given buffer distance
        /// and accuracy of approximation.
        /// </summary>
        /// <param name="g"> the geometry to buffer</param>
        /// <param name="distance"> the buffer distance</param>
        /// <param name="quadrantSegments"> the number of segments used to approximate a quarter circle</param>
        /// <returns> the buffer of the input geometry</returns>
        public static IGeometry Buffer(IGeometry g, double distance, int quadrantSegments)
        {
            var bufOp = new BufferOp(g);

            bufOp.QuadrantSegments = quadrantSegments;
            var geomBuf = bufOp.GetResultGeometry(distance);

            return(geomBuf);
        }
Exemplo n.º 3
0
        /*
         * private static double OldPrecisionScaleFactor(Geometry g,
         *  double distance,
         * int maxPrecisionDigits)
         * {
         *  var env = g.EnvelopeInternal;
         *  var envSize = Math.Max(env.Height, env.Width);
         *  var expandByDistance = distance > 0.0 ? distance : 0.0;
         *  var bufEnvSize = envSize + 2 * expandByDistance;
         *
         *  // the smallest power of 10 greater than the buffer envelope
         *  var bufEnvLog10 = (int)(Math.Log(bufEnvSize) / Math.Log(10) + 1.0);
         *  var minUnitLog10 = bufEnvLog10 - maxPrecisionDigits;
         *  // scale factor is inverse of min Unit size, so flip sign of exponent
         *  var scaleFactor = Math.Pow(10.0, -minUnitLog10);
         *  return scaleFactor;
         * }
         */

        /// <summary>
        /// Computes the buffer of a geometry for a given buffer distance.
        /// </summary>
        /// <param name="g"> the geometry to buffer</param>
        /// <param name="distance"> the buffer distance</param>
        /// <returns> the buffer of the input geometry</returns>
        public static IGeometry Buffer(IGeometry g, double distance)
        {
            var gBuf    = new BufferOp(g);
            var geomBuf = gBuf.GetResultGeometry(distance);

            //BufferDebug.saveBuffer(geomBuf);
            //BufferDebug.runCount++;
            return(geomBuf);
        }