Beispiel #1
0
        /// <summary>
        /// BufferSubgraphs are compared on the x-value of their rightmost Coordinate. This defines a partial
        /// ordering on the graphs such that:
        /// g1 &gt;= g2 &lt;==&gt; Ring(g2) does not contain Ring(g1)
        /// where Polygon(g) is the buffer polygon that is built from g.
        /// This relationship is used to sort the BufferSubgraphs so that shells are guaranteed to
        /// be built before holes.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int CompareTo(object obj)
        {
            BufferSubgraph graph = (BufferSubgraph)obj;

            if (this.GetRightmostCoordinate().X < graph.GetRightmostCoordinate().X)
            {
                return(-1);
            }
            if (this.GetRightmostCoordinate().X > graph.GetRightmostCoordinate().X)
            {
                return(1);
            }
            return(0);
        }
Beispiel #2
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());
            }
        }