コード例 #1
0
        public void TestFixShapefile()
        {
            _timer.Restart();
            var fs             = OpenFeatureSet(Path.Combine(NlShapefilesPath, "Buurtkaart.shp"));
            var outputFilename = Path.ChangeExtension(fs.Filename, ".fixed.shp");

            FeatureSet.DeleteShapefile(outputFilename);

            Debug.Write("Fix shapefile");
            var tool = new FixShapefileTool {
                Input = new DatasourceInput(fs), Output = new OutputLayerInfo {
                    Filename = outputFilename, MemoryLayer = false, Overwrite = true
                }
            };

            RunTool(tool);

            Debug.Write(" ... ");
            var result = OpenFeatureSet(outputFilename);

            Assert.IsNotNull(result);

            // Check number of features:
            Assert.IsTrue(result.NumFeatures > 0);

            // Check envelop:
            Assert.IsTrue(fs.Envelope.EqualsTo(result.Envelope, 1), "The resulting envelop is not equal to the input envelop");
            Debug.Write(" ..the resulting envelope is OK.. ");

            Debug.WriteLine(" Done!");
            Debug.WriteLine("NumFeatures: " + result.NumFeatures);

            result.Close();
            result.Dispose();

            Debug.WriteLine("Elapsed time " + GetDateString(_timer.ElapsedMilliseconds));
        }