Exemplo n.º 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 virtual void CollectBoundaryTouchEdge(DirectedEdge de, SpatialFunction 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 == SpatialFunction.Intersection)
            {
                edges.Add(de.Edge);
                de.VisitedEdge = true;
            }
        }
Exemplo n.º 2
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, SpatialFunction opCode)
        {
            OverlayOp gov    = new OverlayOp(geom0, geom1);
            IGeometry geomOv = gov.GetResultGeometry(opCode);

            return(geomOv);
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="de"></param>
        /// <param name="opCode"></param>
        /// <param name="edges"></param>
        public void CollectLineEdge(DirectedEdge de, SpatialFunction 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;
                }
            }
        }
Exemplo n.º 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)
                {
                    continue;
                }
                Label label = n.Label;
                if (OverlayOp.IsResultOfOp(label, opCode))
                {
                    resultNodeList.Add(n);
                }
            }
            return(resultNodeList);
        }
Exemplo n.º 5
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="op"></param>
 /// <param name="geometryFactory"></param>
 public PointBuilder(OverlayOp op, IGeometryFactory geometryFactory)
 {
     _op = op;
     _geometryFactory = geometryFactory;
 }
Exemplo n.º 6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="op"></param>
 /// <param name="geometryFactory"></param>
 /// <param name="ptLocator"></param>
 public LineBuilder(OverlayOp op, IGeometryFactory geometryFactory, PointLocator ptLocator)
 {
     _op = op;
     _geometryFactory = geometryFactory;
     _ptLocator       = ptLocator;
 }
Exemplo n.º 7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="op"></param>
 /// <param name="geometryFactory"></param>
 /// <param name="ptLocator"></param>
 public LineBuilder(OverlayOp op, IGeometryFactory geometryFactory, PointLocator ptLocator)
 {
     _op = op;
     _geometryFactory = geometryFactory;
     _ptLocator = ptLocator;
 }
Exemplo n.º 8
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, SpatialFunction opCode)
 {
     OverlayOp gov = new OverlayOp(geom0, geom1);
     IGeometry geomOv = gov.GetResultGeometry(opCode);
     return geomOv;
 }
Exemplo n.º 9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="op"></param>
 /// <param name="geometryFactory"></param>
 public PointBuilder(OverlayOp op, IGeometryFactory geometryFactory)
 {
     _op = op;
     _geometryFactory = geometryFactory;
 }