Exemple #1
0
        private void ComputeBuffer(double distance, int quadrantSegments)
        {
            if (_makePrecise)
            {
                double scale = GetArgGeometry(0).PrecisionModel.Scale;
                distance *= scale;
            }
            BufferEdgeBuilder bufEdgeBuilder = new BufferEdgeBuilder(_cga, _li, distance, _makePrecise, quadrantSegments);
            ArrayList         bufferEdgeList = bufEdgeBuilder.GetEdges(GetArgGeometry(0));

            // DEBUGGING ONLY
            //WKTWriter wktWriter = new WKTWriter();
            //Debug.println("Rings: " + wktWriter.write(toLineStrings(bufferEdgeList.iterator())));

            ArrayList nodedEdges = this.NodeEdges(bufferEdgeList);

            //TESTING - node again to ensure edges are noded completely

            /*
             * List nodedEdges2 = nodeEdges(nodedEdges);
             * List nodedEdges3 = nodeEdges(nodedEdges2);
             * List nodedEdges4 = nodeEdges(nodedEdges3);
             * List nodedEdges5 = nodeEdges(nodedEdges4);
             * List nodedEdges6 = nodeEdges(nodedEdges5);
             */
            //for (Iterator i = nodedEdges.iterator(); i.hasNext(); )
            foreach (object obj in nodedEdges)
            {
                Edge e = (Edge)obj;
                InsertEdge(e);
            }
            ReplaceCollapsedEdges();

            // DEBUGGING ONLY
            //Debug.println("Noded: " + wktWriter.write(toLineStrings(edgeList.iterator())));

            _graph.AddEdges(_edgeList);

            ArrayList      subgraphList = CreateSubgraphs();
            PolygonBuilder polyBuilder  = new PolygonBuilder(_geomFact, _cga);

            BuildSubgraphs(subgraphList, polyBuilder);
            ArrayList resultPolyList = polyBuilder.GetPolygons();

            _resultGeom = ComputeGeometry(resultPolyList);
            //computeBufferLine(graph);
        }