Beispiel #1
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, SpatialFunctions opCode, IList edges)
        {
            Label 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 == SpatialFunctions.Intersection)
            {
                edges.Add(de.Edge);
                de.VisitedEdge = true;
            }
        }
Beispiel #2
0
        public static IGeometry Overlay(IGeometry geom0, IGeometry geom1, SpatialFunction opCode)
        {
            var gov    = new OverlayOp(geom0, geom1);
            var geomOv = gov.GetResultGeometry(opCode);

            return(geomOv);
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="de"></param>
        /// <param name="opCode"></param>
        /// <param name="edges"></param>
        public void CollectLineEdge(DirectedEdge de, SpatialFunctions opCode, IList edges)
        {
            Label label = de.Label;
            Edge  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;
                }
            }
        }
Beispiel #4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="opCode"></param>
 /// <returns></returns>
 private IList CollectNodes(SpatialFunction opCode)
 {
     IList resultNodeList = new ArrayList();
     // add nodes from edge intersections which have not already been included in the result
     IEnumerator nodeit = op.Graph.Nodes.GetEnumerator();
     while (nodeit.MoveNext()) 
     {
         Node n = (Node) nodeit.Current;
         if (!n.IsInResult)
         {
             Label label = n.Label;
             if (OverlayOp.IsResultOfOp(label, opCode))                    
                 resultNodeList.Add(n);                    
         }
     }
     return resultNodeList;
 }
Beispiel #5
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="op"></param>
 /// <param name="geometryFactory"></param>
 /// <param name="ptLocator"></param>
 public LineBuilder(OverlayOp op, IGeometryFactory geometryFactory, PointLocator ptLocator)
 {
     this.op = op;
     this.geometryFactory = geometryFactory;
     this.ptLocator = ptLocator;
 }
Beispiel #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="op"></param>
 /// <param name="geometryFactory"></param>
 /// <param name="ptLocator"></param>
 public LineBuilder(OverlayOp op, IGeometryFactory geometryFactory, PointLocator ptLocator)
 {
     this.op = op;
     this.geometryFactory = geometryFactory;
     this.ptLocator       = ptLocator;
 }
Beispiel #7
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="geom0"></param>
 /// <param name="geom1"></param>
 /// <param name="opCode"></param>
 /// <returns></returns>
 public static IGeometry Overlay(IGeometry geom0, IGeometry geom1, SpatialFunctions opCode)
 {
     OverlayOp gov = new OverlayOp(geom0, geom1);
     IGeometry geomOv = gov.GetResultGeometry(opCode);
     return geomOv;
 }