예제 #1
0
        public void FixUpShapes()
        {
            // MWGIS-90
            // Open shapefile:
            var sfInvalid = new Shapefile {
                GlobalCallback = this
            };
            Shapefile sfFixed = null;

            try
            {
                var result = sfInvalid.Open(@"sf\invalid.shp");
                Assert.IsTrue(result, "Could not open shapefile");

                Assert.IsTrue(sfInvalid.HasInvalidShapes(), "Shapefile has no invalid shapes");
                Helper.PrintExtents(sfInvalid.Extents);

                result = sfInvalid.FixUpShapes(out sfFixed);
                Assert.IsTrue(result, "Could not fix shapefile");
                Assert.IsFalse(sfFixed.HasInvalidShapes(), "Returning shapefile has invalid shapes");

                Assert.AreEqual(sfInvalid.NumShapes, sfFixed.NumShapes, "Number of shapes are not equal");
                Helper.PrintExtents(sfFixed.Extents);
            }
            finally
            {
                sfInvalid.Close();
                sfFixed?.Close();
            }
        }