public void PerformCascadedPolygonUnion()
        {
            var reader     = new ShapefileReader("tnp_pol.shp");
            var collection = reader.ReadAll().Where(e => e is IPolygon).ToList();
            var u1         = collection[0];

            for (var i = 1; i < collection.Count; i++)
            {
                u1 = SnapIfNeededOverlayOp.Overlay(u1, collection[i], SpatialFunction.Union);
            }
            var u2 = CascadedPolygonUnion.Union(collection);

            if (!u1.Equals(u2))
            {
                Assert.Fail("failure");
            }
        }
コード例 #2
0
        /// <summary>
        /// Computes a unary union with no extra optimization, and no short-circuiting.
        /// </summary>
        /// <remarks>
        /// Due to the way the overlay operations are implemented, this is still efficient in the case of linear and puntal geometries.
        /// </remarks>
        /// <param name="g0">A geometry</param>
        /// <returns>The union of the input geometry</returns>
        private Geometry UnionNoOpt(Geometry g0)
        {
            var empty = _geomFact.CreatePoint();

            return(SnapIfNeededOverlayOp.Overlay(g0, empty, SpatialFunction.Union));
        }
コード例 #3
0
 protected override Geometry Overlay(Geometry geom0, Geometry geom1, SpatialFunction opCode)
 {
     return(SnapIfNeededOverlayOp.Overlay(geom0, geom1, opCode));
 }