コード例 #1
0
        /// <summary>
        /// Completes the building of the input subgraphs by depth-labelling them,
        /// and adds them to the PolygonBuilder.
        /// </summary>
        /// <remarks>
        /// The subgraph list must be sorted in rightmost-coordinate order.
        /// </remarks>
        /// <param name="subgraphList"> the subgraphs to build</param>
        /// <param name="polyBuilder"> the PolygonBuilder which will build the final polygons</param>
        private static void BuildSubgraphs(IEnumerable <BufferSubgraph> subgraphList, PolygonBuilder polyBuilder)
        {
            var processedGraphs = new List <BufferSubgraph>();

            foreach (var subgraph in subgraphList)
            {
                Coordinate p = subgraph.RightMostCoordinate;
                //      int outsideDepth = 0;
                //      if (polyBuilder.containsPoint(p))
                //        outsideDepth = 1;
                var locater      = new SubgraphDepthLocater(processedGraphs);
                int outsideDepth = locater.GetDepth(p);
                //      try {
                subgraph.ComputeDepth(outsideDepth);
                //      }
                //      catch (RuntimeException ex) {
                //        // debugging only
                //        //subgraph.saveDirEdges();
                //        throw ex;
                //      }
                subgraph.FindResultEdges();
                processedGraphs.Add(subgraph);
                polyBuilder.Add(new List <EdgeEnd>(
                                    Utilities.Caster.Upcast <DirectedEdge, EdgeEnd>(subgraph.DirectedEdges)), subgraph.Nodes);
            }
        }
コード例 #2
0
ファイル: OverlayOp.cs プロジェクト: spacefan/iGeospatial
		private void ComputeOverlay(OverlayType 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, false);
			arg[1].ComputeSelfNodes(li, false);
			
			// compute intersections between edges of the two input geometries
			arg[0].ComputeEdgeIntersections(arg[1], li, true);
			
			EdgeCollection baseSplitEdges = new EdgeCollection();
			arg[0].ComputeSplitEdges(baseSplitEdges);
			arg[1].ComputeSplitEdges(baseSplitEdges);
//			EdgeCollection splitEdges = baseSplitEdges;
			// Add the noded edges to this result graph
			InsertUniqueEdges(baseSplitEdges);
			
			ComputeLabelsFromDepths();
			ReplaceCollapsedEdges();
			
			graph.AddEdges(edgeList.Edges);
			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);
			polyBuilder.Add(graph);
			resultPolyList = polyBuilder.Build();
			
			LineBuilder lineBuilder = new LineBuilder(this, geomFact, ptLocator);
			resultLineList = lineBuilder.Build(opCode);
			
			PointBuilder pointBuilder = new PointBuilder(this, geomFact);
			resultPointList = pointBuilder.Build(opCode);
			
			// gather the results from all calculations into a single Geometry for the result set
			resultGeom = ComputeGeometry(resultPointList, resultLineList, resultPolyList);
		}
コード例 #3
0
        /// <summary>
        /// Completes the building of the input subgraphs by depth-labelling them,
        /// and adds them to the <see cref="PolygonBuilder" />.
        /// The subgraph list must be sorted in rightmost-coordinate order.
        /// </summary>
        /// <param name="subgraphList">The subgraphs to build.</param>
        /// <param name="polyBuilder">The PolygonBuilder which will build the final polygons.</param>
        private void BuildSubgraphs(IList subgraphList, PolygonBuilder polyBuilder)
        {
            IList processedGraphs = new ArrayList();

            foreach (object obj in subgraphList)
            {
                BufferSubgraph       subgraph = (BufferSubgraph)obj;
                ICoordinate          p        = subgraph.RightMostCoordinate;
                SubgraphDepthLocater locater  = new SubgraphDepthLocater(processedGraphs);
                int outsideDepth = locater.GetDepth(p);
                subgraph.ComputeDepth(outsideDepth);
                subgraph.FindResultEdges();
                processedGraphs.Add(subgraph);
                polyBuilder.Add(subgraph.DirectedEdges, subgraph.Nodes);
            }
        }
コード例 #4
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());
            }
        }
コード例 #5
0
		/// <summary> 
		/// Completes the building of the input subgraphs by depth-labelling them,
		/// and adds them to the PolygonBuilder.
		/// The subgraph list must be sorted in rightmost-coordinate order.
		/// </summary>
		/// <param name="subgraphList">the subgraphs to build
		/// </param>
		/// <param name="polyBuilder">the PolygonBuilder which will build the final polygons
		/// </param>
		private void BuildSubgraphs(IList subgraphList, PolygonBuilder polyBuilder)
		{
			ArrayList processedGraphs = new ArrayList();

            int nCount = subgraphList.Count;

            for (int i = 0; i < nCount; i++)
			{
				BufferSubgraph subgraph = (BufferSubgraph)subgraphList[i];
				Coordinate p = subgraph.RightmostCoordinate;

                SubgraphDepthLocater locater = new SubgraphDepthLocater(processedGraphs);
				int outsideDepth = locater.GetDepth(p);

                subgraph.ComputeDepth(outsideDepth);
				subgraph.FindResultEdges();
				processedGraphs.Add(subgraph);
				polyBuilder.Add(subgraph.DirectedEdges, subgraph.Nodes);
			}
		}