Ejemplo n.º 1
0
		private void BuildSubgraphs(ArrayList subgraphList, PolygonBuilder polyBuilder)
		{
			//for (Iterator i = subgraphList.iterator(); i.hasNext(); ) 
			foreach(object obj in subgraphList)
			{
				BufferSubgraph subgraph = (BufferSubgraph)obj;
				Coordinate p = subgraph.GetRightmostCoordinate();
				int outsideDepth = 0;
				if (polyBuilder.ContainsPoint(p))
					outsideDepth = 1;
				subgraph.ComputeDepth(outsideDepth);
				subgraph.FindResultEdges();

				polyBuilder.Add(subgraph.GetDirectedEdges(), subgraph.GetNodes());
			}
		}
Ejemplo n.º 2
0
		} // public Geometry GetResultGeometry( int funcCode )

		private void ComputeOverlay( int opCode )
		{
			// copy points from input Geometries.
			// This ensures that any Point geometries
			// in the input are considered for inclusion in the result set
			CopyPoints(0);
			CopyPoints(1);

			// node the input Geometries
			_arg[0].ComputeSelfNodes( _li );
			_arg[1].ComputeSelfNodes( _li );

			// compute intersections between edges of the two input geometries
			_arg[0].ComputeEdgeIntersections( _arg[1], _li, true );

			ArrayList baseSplitEdges = new ArrayList();
			_arg[0].ComputeSplitEdges( baseSplitEdges );
			_arg[1].ComputeSplitEdges( baseSplitEdges );
			ArrayList splitEdges = new ArrayList( baseSplitEdges );


			/* NO LONGER USED
			// if we are working in fixed precision, we must renode to ensure noding is complete
			if (makePrecise) {
			  List splitEdges1 = completeEdgeNoding(baseSplitEdges);
			  splitEdges = completeEdgeNoding(splitEdges1);
			} */

			// add the noded edges to this result graph
			InsertUniqueEdges( baseSplitEdges );

			ComputeLabelsFromDepths();
			ReplaceCollapsedEdges();

			//Trace.WriteLine( edgeList.ToString());

			_graph.AddEdges( _edgeList );
			ComputeLabelling();
			LabelIncompleteNodes();

			 // The ordering of building the result Geometries is important.
			 // Areas must be built before lines, which must be built before points.
			 // This is so that lines which are covered by areas are not included
			 // explicitly, and similarly for points.

			FindResultAreaEdges( opCode );
			CancelDuplicateResultEdges();
			PolygonBuilder polyBuilder = new PolygonBuilder( _geomFact, _cga );
			polyBuilder.Add( _graph );
			_resultPolyList = polyBuilder.GetPolygons();

			LineBuilder lineBuilder = new LineBuilder( this, _geomFact, _ptLocator );
			_resultLineList = lineBuilder.Build( opCode );

			PointBuilder pointBuilder = new PointBuilder( this, _geomFact, _ptLocator );
			_resultPointList = pointBuilder.Build( opCode );

			// gather the results from all calculations into a single Geometry for the result set
			_resultGeom = ComputeGeometry( _resultPointList, _resultLineList, _resultPolyList );
		} //private void ComputeOverlay( int opCode )
Ejemplo n.º 3
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);
		}
Ejemplo n.º 4
0
        }         // public Geometry GetResultGeometry( int funcCode )

        private void ComputeOverlay(int opCode)
        {
            // copy points from input Geometries.
            // This ensures that any Point geometries
            // in the input are considered for inclusion in the result set
            CopyPoints(0);
            CopyPoints(1);

            // node the input Geometries
            _arg[0].ComputeSelfNodes(_li);
            _arg[1].ComputeSelfNodes(_li);

            // compute intersections between edges of the two input geometries
            _arg[0].ComputeEdgeIntersections(_arg[1], _li, true);

            ArrayList baseSplitEdges = new ArrayList();

            _arg[0].ComputeSplitEdges(baseSplitEdges);
            _arg[1].ComputeSplitEdges(baseSplitEdges);
            ArrayList splitEdges = new ArrayList(baseSplitEdges);


            /* NO LONGER USED
             * // if we are working in fixed precision, we must renode to ensure noding is complete
             * if (makePrecise) {
             * List splitEdges1 = completeEdgeNoding(baseSplitEdges);
             * splitEdges = completeEdgeNoding(splitEdges1);
             * } */

            // add the noded edges to this result graph
            InsertUniqueEdges(baseSplitEdges);

            ComputeLabelsFromDepths();
            ReplaceCollapsedEdges();

            //Trace.WriteLine( edgeList.ToString());

            _graph.AddEdges(_edgeList);
            ComputeLabelling();
            LabelIncompleteNodes();

            // The ordering of building the result Geometries is important.
            // Areas must be built before lines, which must be built before points.
            // This is so that lines which are covered by areas are not included
            // explicitly, and similarly for points.

            FindResultAreaEdges(opCode);
            CancelDuplicateResultEdges();
            PolygonBuilder polyBuilder = new PolygonBuilder(_geomFact, _cga);

            polyBuilder.Add(_graph);
            _resultPolyList = polyBuilder.GetPolygons();

            LineBuilder lineBuilder = new LineBuilder(this, _geomFact, _ptLocator);

            _resultLineList = lineBuilder.Build(opCode);

            PointBuilder pointBuilder = new PointBuilder(this, _geomFact, _ptLocator);

            _resultPointList = pointBuilder.Build(opCode);

            // gather the results from all calculations into a single Geometry for the result set
            _resultGeom = ComputeGeometry(_resultPointList, _resultLineList, _resultPolyList);
        }         //private void ComputeOverlay( int opCode )