Пример #1
0
        public void CanCreateMultiPartPolygons(string file)
        {
            var target = new RasterToPolygon();
            var p = new GdalRasterProvider();
            var raster = p.Open(file);
            var outShape = new PolygonShapefile {Filename = FileTools.GetTempFileName(".shp")};
            target.Execute(raster, outShape, new MockProgressHandler());
            FileTools.DeleteShapeFile(outShape.Filename);

            var mpCount = outShape.Features.Count(t => t.BasicGeometry is MultiPolygon);
            Assert.That(mpCount > 0);
        }
Пример #2
0
        public void CanCreateMultiPartPolygons(string path)
        {
            var target = new RasterToPolygon();
            var file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, path);
            
            var p = new GdalRasterProvider();
            var raster = p.Open(file);
            var outShape = new PolygonShapefile {Filename = Path.ChangeExtension(file, ".shp")};
            target.Execute(raster, outShape, new MockProgressHandler());

            var mpCount = outShape.Features.Count(t => t.BasicGeometry is MultiPolygon);
            Assert.That(mpCount > 0);
        }
Пример #3
0
        public void NoMultiPartPolygonsWithConnectionGrid(string rasterFile, string flowDirectionGridFile)
        {
            var p = new GdalRasterProvider();
            var raster = p.Open(rasterFile);
            var flowDirectionGrid = p.Open(flowDirectionGridFile);

            var target = new RasterToPolygon();
            var outShape = new PolygonShapefile { Filename = FileTools.GetTempFileName(".shp") };
            target.Execute(raster, flowDirectionGrid, outShape, new MockProgressHandler());
            FileTools.DeleteShapeFile(outShape.Filename);

            var mpCount = outShape.Features.Count(t => t.BasicGeometry is MultiPolygon);
            Assert.That(mpCount == 0);
        }
Пример #4
0
        public void CanCreateMultiPartPolygons(string file)
        {
            var target   = new RasterToPolygon();
            var p        = new GdalRasterProvider();
            var raster   = p.Open(file);
            var outShape = new PolygonShapefile {
                Filename = FileTools.GetTempFileName(".shp")
            };

            target.Execute(raster, outShape, new MockProgressHandler());
            FileTools.DeleteShapeFile(outShape.Filename);

            var mpCount = outShape.Features.Count(t => t.Geometry is MultiPolygon);

            Assert.That(mpCount > 0);
        }
Пример #5
0
        public void NoMultiPartPolygonsWithConnectionGrid(string rasterFile, string flowDirectionGridFile)
        {
            rasterFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, rasterFile);
            flowDirectionGridFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, flowDirectionGridFile);

            var p = new GdalRasterProvider();
            var raster = p.Open(rasterFile);
            var flowDirectionGrid = p.Open(flowDirectionGridFile);

            var target = new RasterToPolygon();
            var outShape = new PolygonShapefile { Filename = Path.ChangeExtension(rasterFile, ".shp") };
            target.Execute(raster, flowDirectionGrid, outShape, new MockProgressHandler());

            var mpCount = outShape.Features.Count(t => t.BasicGeometry is MultiPolygon);
            Assert.That(mpCount == 0);
        }
Пример #6
0
        public void NoMultiPartPolygonsWithConnectionGrid(string rasterFile, string flowDirectionGridFile)
        {
            var p                 = new GdalRasterProvider();
            var raster            = p.Open(rasterFile);
            var flowDirectionGrid = p.Open(flowDirectionGridFile);

            var target   = new RasterToPolygon();
            var outShape = new PolygonShapefile {
                Filename = FileTools.GetTempFileName(".shp")
            };

            target.Execute(raster, flowDirectionGrid, outShape, new MockProgressHandler());
            FileTools.DeleteShapeFile(outShape.Filename);

            var mpCount = outShape.Features.Count(t => t.Geometry is MultiPolygon);

            Assert.That(mpCount == 0);
        }