Пример #1
0
        /// <summary>
        /// Collect edges from area inputs which should be in the result but
        /// which have not been included in a result area.
        /// </summary>
        /// <remarks>
        /// This happens ONLY:
        /// <list type="bullet">
        /// <item>
        /// <description>
        /// During an intersection when the boundaries of two areas touch
        /// in a line segment.
        /// </description>
        /// </item>
        /// <item>
        /// <description>OR as a result of a dimensional collapse.</description>
        /// </item>
        /// </list>
        /// </remarks>
        private void CollectBoundaryTouchEdge(DirectedEdge de,
                                              OverlayType opCode, ArrayList edges)
        {
            Label label = de.Label;

            if (de.LineEdge)
            {
                return;  // only interested in area edges
            }
            if (de.Visited)
            {
                return;  // already processed
            }
            if (de.InteriorAreaEdge)
            {
                return;  // added to handle dimensional collapses
            }
            if (de.Edge.InResult)
            {
                return;  // if the edge linework is already included, don't include it again
            }
            // sanity check for labelling of result edgerings
            Debug.Assert(!(de.InResult || de.Sym.InResult) || !de.Edge.InResult);

            // include the linework if it's in the result of the operation
            if (OverlayOp.IsResultOfOp(label, opCode) &&
                opCode == OverlayType.Intersection)
            {
                edges.Add(de.Edge);
                de.VisitedEdge = true;
            }
        }
Пример #2
0
        /// <summary>
        /// Determines nodes which are in the result, and creates
        /// {@link Point}s for them.
        ///
        /// This method determines nodes which are candidates for the result via their
        /// labelling and their graph topology.
        ///
        /// </summary>
        /// <param name="opCode">the overlay operation
        /// </param>
        private void ExtractNonCoveredResultNodes(OverlayType opCode)
        {
            // Add nodes from edge intersections which have not already been included in the result
            for (IEnumerator nodeit = op.Graph.Nodes.GetEnumerator(); nodeit.MoveNext();)
            {
                Node n = (Node)nodeit.Current;

                // filter out nodes which are known to be in the result
                if (n.InResult)
                {
                    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 == OverlayType.Intersection)
                {
                    // For nodes on edges, only INTERSECTION can result in
                    // edge nodes being included even
                    // if none of their incident edges are included
                    Label label = n.Label;
                    if (OverlayOp.IsResultOfOp(label, opCode))
                    {
                        FilterCoveredNodeToPoint(n);
                    }
                }
            }
        }
        private static bool IsValidResult(SpatialFunction overlayOp, Location[] location)
        {
            bool expectedInterior = OverlayOp.IsResultOfOp(location[0], location[1], overlayOp);

            bool resultInInterior = (location[2] == Location.Interior);
            // MD use simpler: boolean isValid = (expectedInterior == resultInInterior);
            bool isValid = !(expectedInterior ^ resultInInterior);

            if (!isValid)
            {
                ReportResult(overlayOp, location, expectedInterior);
            }

            return(isValid);
        }
Пример #4
0
        /// <summary>
        /// Collect line edges which are in the result.
        /// Line edges are in the result if they are not part of
        /// an area boundary, if they are in the result of the overlay operation,
        /// and if they are not covered by a result area.
        /// </summary>
        /// <param name="de">the directed edge to test</param>
        /// <param name="opCode">the overlap operation</param>
        /// <param name="edges">the list of included line edges</param>
        private void CollectLineEdge(DirectedEdge de, OverlayType opCode, ArrayList edges)
        {
            Label label = de.Label;
            Edge  e     = de.Edge;

            // include L edges which are in the result
            if (de.LineEdge)
            {
                if (!de.Visited && OverlayOp.IsResultOfOp(label, opCode) && !e.Covered)
                {
                    edges.Add(e);
                    de.VisitedEdge = true;
                }
            }
        }