/// <summary> /// /// </summary> private void BufferOriginalPrecision() { try { BufferBuilder bufBuilder = new BufferBuilder(); bufBuilder.QuadrantSegments = quadrantSegments; bufBuilder.EndCapStyle = endCapStyle; resultGeometry = bufBuilder.Buffer(argGeom, distance); } catch (TopologyException ex) { saveException = ex; // don't propagate the exception - it will be detected by fact that resultGeometry is null } }
/// <summary> /// /// </summary> /// <param name="precisionDigits"></param> private void BufferFixedPrecision(int precisionDigits) { double sizeBasedScaleFactor = PrecisionScaleFactor(argGeom, distance, precisionDigits); PrecisionModel fixedPM = new PrecisionModel(sizeBasedScaleFactor); // don't change the precision model of the Geometry, just reduce the precision SimpleGeometryPrecisionReducer reducer = new SimpleGeometryPrecisionReducer(fixedPM); IGeometry reducedGeom = reducer.Reduce(argGeom); BufferBuilder bufBuilder = new BufferBuilder(); bufBuilder.WorkingPrecisionModel = fixedPM; bufBuilder.QuadrantSegments = quadrantSegments; // this may throw an exception, if robustness errors are encountered resultGeometry = bufBuilder.Buffer(reducedGeom, distance); }