Example #1
0
        }         // public void Build(GeometryGraph geomGraph)

        /// <summary>
        /// Insert nodes for all intersections on the edges of a Geometry.
        /// Label the created nodes the same as the edge label if they do not already have a label.
        ///	This allows nodes created by either self-intersections or
        ///	mutual intersections to be labelled.
        ///	Endpoint nodes will already be labelled from when they were inserted.
        /// Precondition: edge intersections have been computed.
        /// </summary>
        /// <param name="geomGraph"></param>
        /// <param name="argIndex"></param>
        public void ComputeIntersectionNodes(GeometryGraph geomGraph, int argIndex)
        {
            foreach (object obj in geomGraph.Edges)
            {
                Edge e    = (Edge)obj;
                int  eLoc = e.Label.GetLocation(argIndex);
                foreach (object objEdgeIntersection in e.EdgeIntersectionList)
                {
                    EdgeIntersection ei = (EdgeIntersection)objEdgeIntersection;
                    RelateNode       n  = (RelateNode)_nodes.AddNode(ei.Coordinate);
                    if (eLoc == Location.Boundary)
                    {
                        n.SetLabelBoundary(argIndex);
                    }
                    else
                    {
                        if (n.Label.IsNull(argIndex))
                        {
                            n.SetLabel(argIndex, Location.Interior);
                        }                         // if ( n.Label.IsNull( argIndex ) )
                    }
                    //Trace.WriteLine( n.ToString() );
                }
            }     // foreach ( object obj in geomGraph.Edges )
        }         // public void ComputeIntersectionNodes( GeometryGraph geomGraph, int argIndex )
Example #2
0
        }         // private void ComputeIntersectionNodes( int argIndex )

        /// <summary>
        /// For all intersections on the edges of a Geometry,
        /// label the corresponding node IF it doesn't already have a label.
        /// This allows nodes created by either self-intersections or
        ///	mutual intersections to be labelled.
        ///	Endpoint nodes will already be labelled from when they were inserted.
        /// </summary>
        /// <param name="argIndex"></param>
        private void LabelIntersectionNodes(int argIndex)
        {
            foreach (object obj in _arg[argIndex].Edges)
            {
                Edge e    = (Edge)obj;
                int  eLoc = e.Label.GetLocation(argIndex);
                foreach (object objEdgeIntersection in e.EdgeIntersectionList)
                {
                    EdgeIntersection ei = (EdgeIntersection)objEdgeIntersection;
                    RelateNode       n  = (RelateNode)_nodes.Find(ei.Coordinate);
                    if (n.Label.IsNull(argIndex))
                    {
                        if (eLoc == Location.Boundary)
                        {
                            n.SetLabelBoundary(argIndex);
                        }
                        else
                        {
                            n.SetLabel(argIndex, Location.Interior);
                        }
                    }
                    //Trace.WriteLine( n.ToString() );
                } // foreach ( object objEdgeIntersection in e.EdgeIntersectionList )
            }     // foreach ( object obj in _arg[argIndex].Edges )
        }         // private void LabelIntersectionNodes( int argIndex )
Example #3
0
        }         // private bool IsNodeEdgeAreaLabelsConsistent()

        private void LabelNodeEdges()
        {
            foreach (DictionaryEntry entry in _nodes)
            {
                RelateNode node = (RelateNode)entry.Value;
                node.Edges.ComputeLabelling(_arg);
                //Trace.WriteLine( node.Edges.ToString() );
                //Trace.WriteLine( node.ToString() );
            }
        }         // private void LabelNodeEdges()
Example #4
0
        }         // private void ComputeDisjointIM( IntersectionMatrix im )

        /// <summary>
        /// Check all nodes to see if their labels are consistent. If any are not, return false.
        /// </summary>
        /// <returns></returns>
        private bool IsNodeEdgeAreaLabelsConsistent()
        {
            foreach (DictionaryEntry entry in _nodes)
            {
                RelateNode node = (RelateNode)entry.Value;
                if (!node.Edges.IsAreaLabelsConsistent())
                {
                    _invalidPoint = (Coordinate)node.Coordinate.Clone();
                    return(false);
                }
            }     // foreach ( object obj in _nodes )
            return(true);
        }         // private bool IsNodeEdgeAreaLabelsConsistent()
Example #5
0
        }         // public bool IsNodeConsistentArea()

        /// <summary>
        /// Checks for two duplicate rings in an area.
        /// Duplicate rings are rings that are topologically equal
        /// (that is, which have the same sequence of points up to point order).
        /// If the area is topologically consistent (determined by calling the IsNodeConsistentArea,
        /// duplicate rings can be found by checking for EdgeBundles which contain
        /// more than one EdgeEnd.
        ///	(This is because topologically consistent areas cannot have two rings sharing
        ///	the same line segment, unless the rings are equal).
        /// The start point of one of the equal rings will be placed in
        /// invalidPoint.
        /// </summary>
        /// <returns>Returns true if this area Geometry is topologically consistent but has two
        /// duplicate rings.</returns>
        public bool HasDuplicateRings()
        {
            foreach (DictionaryEntry entry in _nodes)
            {
                RelateNode node = (RelateNode)entry.Value;
                foreach (object objEdgeEnd in node.Edges)
                {
                    EdgeEndBundle eeb = (EdgeEndBundle)objEdgeEnd;
                    if (eeb.EdgeEnds.Count > 1)
                    {
                        _invalidPoint = eeb.Edge.GetCoordinate();
                        return(true);
                    }
                }
            }     // foreach ( object obj in _nodes )
            return(false);
        }         // public bool HasDuplicateRings()
Example #6
0
        }         // private void LabelNodeEdges()

        /// <summary>
        /// Update the IM with the sum of the IMs for each component.
        /// </summary>
        /// <param name="im"></param>
        private void UpdateIM(IntersectionMatrix im)
        {
            //Trace.WriteLine( im.ToString() );
            foreach (object obj in _isolatedEdges)
            {
                Edge e = (Edge)obj;
                e.UpdateIM(im);
                //Trace.WriteLine( im.ToString() );
            }             // foreach ( object obj in _isolatedEdges )

            foreach (DictionaryEntry entry in _nodes)
            {
                RelateNode node = (RelateNode)entry.Value;
                node.UpdateIM(im);
                //Trace.WriteLine( im.ToString() );
                node.UpdateIMFromEdges(im);
                //Trace.WriteLine( im.ToString() );
                //Trace.WriteLine( node.ToString() );
            }     // foreach ( object obj in _nodes )
        }         // private void UpdateIM( IntersectionMatrix im )