/// <summary>
        ///
        /// </summary>
        /// <param name="g"></param>
        /// <param name="distance"></param>
        /// <returns></returns>
        public IGeometry Buffer(IGeometry g, double distance)
        {
            PrecisionModel precisionModel = workingPrecisionModel;

            if (precisionModel == null)
            {
                precisionModel = new PrecisionModel(g.PrecisionModel);
            }

            // factory must be the same as the one used by the input
            geomFact = g.Factory;

            OffsetCurveBuilder curveBuilder = new OffsetCurveBuilder(precisionModel, quadrantSegments);

            curveBuilder.EndCapStyle = endCapStyle;
            OffsetCurveSetBuilder curveSetBuilder = new OffsetCurveSetBuilder(g, distance, curveBuilder);

            IList bufferSegStrList = curveSetBuilder.GetCurves();

            // short-circuit test
            if (bufferSegStrList.Count <= 0)
            {
                IGeometry emptyGeom = geomFact.CreateGeometryCollection(new Geometry[0]);
                return(emptyGeom);
            }

            ComputeNodedEdges(bufferSegStrList, precisionModel);
            graph = new PlanarGraph(new OverlayNodeFactory());
            graph.AddEdges(edgeList.Edges);

            IList          subgraphList = CreateSubgraphs(graph);
            PolygonBuilder polyBuilder  = new PolygonBuilder(geomFact);

            BuildSubgraphs(subgraphList, polyBuilder);
            IList resultPolyList = polyBuilder.Polygons;

            IGeometry resultGeom = geomFact.BuildGeometry(resultPolyList);

            return(resultGeom);
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="inputGeom"></param>
 /// <param name="distance"></param>
 /// <param name="curveBuilder"></param>
 public OffsetCurveSetBuilder(IGeometry inputGeom, double distance, OffsetCurveBuilder curveBuilder)
 {
     this.inputGeom    = inputGeom;
     this.distance     = distance;
     this.curveBuilder = curveBuilder;
 }