Ejemplo 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 Geometry Buffer(Geometry g, double distance, BufferParameters parameters)
        {
            var bufOp   = new BufferOp(g, parameters);
            var geomBuf = bufOp.GetResultGeometry(distance);

            return(geomBuf);
        }
Ejemplo n.º 2
0
 public OffsetCurveBuilder(
     PrecisionModel precisionModel,
     BufferParameters bufParams
     )
 {
     _precisionModel = precisionModel;
     _bufParams      = bufParams;
 }
Ejemplo n.º 3
0
        public OffsetSegmentGenerator(PrecisionModel precisionModel,
                                      BufferParameters bufParams, double distance)
        {
            _precisionModel = precisionModel;
            _bufParams      = bufParams;

            // compute intersections in full precision, to provide accuracy
            // the points are rounded as they are inserted into the curve line
            _li = new RobustLineIntersector();
            _filletAngleQuantum = Math.PI / 2.0 / bufParams.QuadrantSegments;

            /**
             * Non-round joins cause issues with short closing segments, so don't use
             * them. In any case, non-round joins only really make sense for relatively
             * small buffer distances.
             */
            if (bufParams.QuadrantSegments >= 8 &&
                bufParams.JoinStyle == JoinStyle.Round)
            {
                _closingSegLengthFactor = MaxClosingSegLenFactor;
            }
            Init(distance);
        }
Ejemplo n.º 4
0
        public OldOffsetCurveBuilder(
            PrecisionModel precisionModel,
            BufferParameters bufParams
            )
        {
            _precisionModel = precisionModel;
            _bufParams      = bufParams;

            // compute intersections in full precision, to provide accuracy
            // the points are rounded as they are inserted into the curve line
            _li = new RobustLineIntersector();
            _filletAngleQuantum = Math.PI / 2.0 / bufParams.QuadrantSegments;

            /**
             * Non-round joins cause issues with short closing segments,
             * so don't use them.  In any case, non-round joins
             * only really make sense for relatively small buffer distances.
             */
            if (bufParams.QuadrantSegments >= 8 &&
                bufParams.JoinStyle == JoinStyle.Round)
            {
                closingSegFactor = MAX_CLOSING_SEG_FRACTION;
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BufferBuilder"/> class using the given parameters.
 /// </summary>
 /// <param name="bufParams">The buffer parameters to use.</param>
 public BufferBuilder(BufferParameters bufParams)
 {
     _bufParams = bufParams;
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Initializes a buffer computation for the given geometry
 /// with the given set of parameters
 /// </summary>
 /// <param name="g"> the geometry to buffer</param>
 /// <param name="bufParams"> the buffer parameters to use</param>
 public BufferOp(Geometry g, BufferParameters bufParams)
 {
     _argGeom   = g;
     _bufParams = bufParams;
 }