/// <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()); }
/// <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; } }
/// <summary> /// Computes an overlay operation /// for the given geometry arguments. /// </summary> /// <param name="geom0">The first geometry argument</param> /// <param name="geom1">The second geometry argument</param> /// <param name="opCode">The code for the desired overlay operation</param> /// <returns>The result of the overlay operation</returns> /// <exception cref="TopologyException">Thrown if a robustness problem is encountered.</exception> public static Geometry Overlay(Geometry geom0, Geometry geom1, SpatialFunction opCode) { var gov = new OverlayOp(geom0, geom1); var geomOv = gov.GetResultGeometry(opCode); return(geomOv); }
/// <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; } } }
//private PointLocator _ptLocator; /// <summary> /// Creates an instance of this class /// </summary> /// <param name="op">The operation</param> /// <param name="geometryFactory">The geometry factory</param> public PointBuilder(OverlayOp op, GeometryFactory geometryFactory) { _op = op; _geometryFactory = geometryFactory; //_ptLocator = ptLocator; }
/// <summary> /// /// </summary> /// <param name="op"></param> /// <param name="geometryFactory"></param> /// <param name="ptLocator"></param> public LineBuilder(OverlayOp op, GeometryFactory geometryFactory, PointLocator ptLocator) { _op = op; _geometryFactory = geometryFactory; _ptLocator = ptLocator; }