コード例 #1
0
        public OffsetCurveSetBuilder(Geometry inputGeom,
                                     double distance, OffsetCurveBuilder curveBuilder)
        {
            curveList = new ArrayList();

            this.inputGeom    = inputGeom;
            m_dDistance       = distance;
            this.curveBuilder = curveBuilder;
        }
コード例 #2
0
		public virtual Geometry Buffer(Geometry g, double distance)
		{
			PrecisionModel precisionModel = workingPrecisionModel;
			if (precisionModel == null)
				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);
			
			ArrayList bufferSegStrList = curveSetBuilder.Curves;
			
			// short-circuit test
			if (bufferSegStrList.Count <= 0)
			{
				Geometry 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);

			GeometryList resultPolyList = polyBuilder.Build();
			
			Geometry resultGeom = geomFact.BuildGeometry(resultPolyList);

			return resultGeom;
		}