/// <summary> /// Comutes 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); }
public OffsetCurveBuilder( IPrecisionModel precisionModel, IBufferParameters bufParams ) { _precisionModel = precisionModel; _bufParams = bufParams; }
public OffsetCurveBuilder( IPrecisionModel precisionModel, IBufferParameters bufParams ) { _precisionModel = precisionModel; _bufParams = bufParams; }
private static IGeometry BuildCurveSet(IGeometry g, double dist, IBufferParameters bufParams) { // --- now construct curve var ocb = new OffsetCurveBuilder(g.Factory.PrecisionModel, bufParams); var ocsb = new OffsetCurveSetBuilder(g, dist, ocb); var curves = ocsb.GetCurves(); var lines = new List<IGeometry>(); foreach (var ss in curves) { var pts = ss.Coordinates; lines.Add(g.Factory.CreateLineString(pts)); } IGeometry curve = g.Factory.BuildGeometry(lines); return curve; }
private static IGeometry BuildCurveSet(IGeometry g, double dist, IBufferParameters bufParams) { // --- now construct curve var ocb = new OffsetCurveBuilder(g.Factory.PrecisionModel, bufParams); var ocsb = new OffsetCurveSetBuilder(g, dist, ocb); var curves = ocsb.GetCurves(); var lines = new List <IGeometry>(); foreach (var ss in curves) { var pts = ss.Coordinates; lines.Add(g.Factory.CreateLineString(pts)); } IGeometry curve = g.Factory.BuildGeometry(lines); return(curve); }
public OldOffsetCurveBuilder( IPrecisionModel precisionModel, IBufferParameters 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; }
public OffsetSegmentGenerator(IPrecisionModel precisionModel, IBufferParameters 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); }
public OldOffsetCurveBuilder( IPrecisionModel precisionModel, IBufferParameters 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; } }
public OffsetSegmentGenerator(IPrecisionModel precisionModel, IBufferParameters 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); }
/// <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(IGeometry g, IBufferParameters bufParams) { _argGeom = g; _bufParams = bufParams; }
/// <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(IGeometry g, IBufferParameters bufParams) { _argGeom = g; _bufParams = bufParams; }
/// <summary> /// Comutes 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; }
///<summary>Creates a new BufferBuilder</summary> public BufferBuilder(IBufferParameters bufParams) { _bufParams = bufParams; }
///<summary>Creates a new BufferBuilder</summary> public BufferBuilder(IBufferParameters bufParams) { _bufParams = bufParams; }
/// <summary> /// Computes a buffer region around this <c>Geometry</c> having the given /// width and with a specified number of segments used to approximate curves. /// The buffer of a Geometry is the Minkowski sum of the Geometry with /// a disc of radius <c>distance</c>. Curves in the buffer polygon are /// approximated with line segments. This method allows specifying the /// accuracy of that approximation. /// </summary> /// <remarks><para>Mathematically-exact buffer area boundaries can contain circular arcs. /// To represent these arcs using linear geometry they must be approximated with line segments. /// The <c>bufferParameters</c> argument has a property <c>QuadrantSegments</c> controlling the accuracy of /// the approximation by specifying the number of line segments used to /// represent a quadrant of a circle</para> /// <para>The <c>EndCapStyle</c> property of the <c>bufferParameters</c> argument specifies the buffer geometry that will be /// created at the ends of linestrings. The styles provided are: /// <ul> /// <li><see cref="EndCapStyle.Round" /> - (default) a semi-circle</li> /// <li><see cref="EndCapStyle.Flat" /> - a straight line perpendicular to the end segment</li> /// <li><see cref="EndCapStyle.Square" /> - a half-square</li> /// </ul></para> /// <para>The buffer operation always returns a polygonal result. The negative or /// zero-distance buffer of lines and points is always an empty <see cref="IPolygonal"/>. /// This is also the result for the buffers of degenerate (zero-area) polygons. /// </para> /// </remarks> /// <param name="distance"> /// The width of the buffer, interpreted according to the /// <c>PrecisionModel</c> of the <c>Geometry</c>. /// </param> /// <param name="bufferParameters">This argument type has a number of properties that control the construction of the /// buffer, including <c>QuadrantSegments</c>, <c>EndCapStyle</c>, <c>JoinStyle</c>, and <c>MitreLimit</c></param> /// <returns> /// a polygonal geometry representing the buffer region (which may be empty) /// </returns> /// <exception cref="TopologyException">If a robustness error occurs</exception> /// <seealso cref="Buffer(double)"/> ///// <seealso cref="Buffer(double, BufferStyle)"/> /// <seealso cref="Buffer(double, EndCapStyle)"/> /// <seealso cref="Buffer(double, int)"/> ///// <seealso cref="Buffer(double, int, BufferStyle)"/> /// <seealso cref="Buffer(double, int, EndCapStyle)"/> public IGeometry Buffer(double distance, IBufferParameters bufferParameters) { return BufferOp.Buffer(this, distance, bufferParameters); }