예제 #1
0
        /// <summary>
        /// Determines nodes which are in the result, and creates <see cref="Point"/>s for them.
        /// </summary>
        /// <remarks>
        /// This method determines nodes which are candidates for the result via their
        /// labelling and their graph topology.
        /// </remarks>
        /// <param name="opCode">The overlay operation</param>
        private void ExtractNonCoveredResultNodes(SpatialFunction opCode)
        {
            // testing only
            //if (true) return resultNodeList;

            foreach (var n in _op.Graph.Nodes)
            {
                // filter out nodes which are known to be in the result
                if (n.IsInResult)
                {
                    continue;
                }
                // if an incident edge is in the result, then the node coordinate is included already
                if (n.IsIncidentEdgeInResult())
                {
                    continue;
                }
                if (n.Edges.Degree == 0 || opCode == SpatialFunction.Intersection)
                {
                    /**
                     * For nodes on edges, only INTERSECTION can result in edge nodes being included even
                     * if none of their incident edges are included
                     */
                    var label = n.Label;
                    if (OverlayOp.IsResultOfOp(label, opCode))
                    {
                        FilterCoveredNodeToPoint(n);
                    }
                }
            }
            //Console.Writeline("connectedResultNodes collected = " + connectedResultNodes.size());
        }
예제 #2
0
        /// <summary>
        /// Collect edges from Area inputs which should be in the result but
        /// which have not been included in a result area.
        /// This happens ONLY:
        /// during an intersection when the boundaries of two
        /// areas touch in a line segment
        /// OR as a result of a dimensional collapse.
        /// </summary>
        /// <param name="de"></param>
        /// <param name="opCode"></param>
        /// <param name="edges"></param>
        public void CollectBoundaryTouchEdge(DirectedEdge de, SpatialFunction opCode, IList <Edge> edges)
        {
            var label = de.Label;

            if (de.IsLineEdge)
            {
                return;         // only interested in area edges
            }
            if (de.IsVisited)
            {
                return;         // already processed
            }
            if (de.IsInteriorAreaEdge)
            {
                return; // added to handle dimensional collapses
            }
            if (de.Edge.IsInResult)
            {
                return;     // if the edge linework is already included, don't include it again
            }
            // sanity check for labelling of result edgerings
            Assert.IsTrue(!(de.IsInResult || de.Sym.IsInResult) || !de.Edge.IsInResult);
            // include the linework if it's in the result of the operation
            if (OverlayOp.IsResultOfOp(label, opCode) && opCode == SpatialFunction.Intersection)
            {
                edges.Add(de.Edge);
                de.VisitedEdge = true;
            }
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="de"></param>
        /// <param name="opCode"></param>
        /// <param name="edges"></param>
        public void CollectLineEdge(DirectedEdge de, SpatialFunction opCode, IList <Edge> edges)
        {
            var label = de.Label;
            var e     = de.Edge;

            // include Curve edges which are in the result
            if (de.IsLineEdge)
            {
                if (!de.IsVisited && OverlayOp.IsResultOfOp(label, opCode) && !e.IsCovered)
                {
                    edges.Add(e);
                    de.VisitedEdge = true;
                }
            }
        }