コード例 #1
0
        public void CreateRasterForGivenType(Type type)
        {
            var target   = new BinaryRasterProvider();
            var fileName = FileTools.GetTempFileName(".bgd");

            try
            {
                var raster = target.Create(fileName, string.Empty, 2, 2, 1, type, null);
                Assert.IsNotNull(raster);

                // assume that any tested type contains 0 and 1 values
                raster.Value[0, 0] = 1;
                raster.Value[0, 1] = 0;
                raster.Value[1, 0] = 0;
                raster.Value[1, 1] = 1;

                raster.Save();

                // Now open the file
                var openRaster = target.Open(fileName);
                Assert.IsNotNull(raster);

                for (var i = 0; i < openRaster.NumRows; i++)
                {
                    for (var j = 0; j < openRaster.NumColumns; j++)
                    {
                        Assert.AreEqual(raster.Value[i, j], openRaster.Value[i, j]);
                    }
                }
            }
            finally
            {
                File.Delete(fileName);
            }
        }
コード例 #2
0
        public void CreateRasterForGivenType(Type type)
        {
            var target = new BinaryRasterProvider();
            var fileName = FileTools.GetTempFileName(".bgd");

            try
            {
                var raster = target.Create(fileName, "", 2, 2, 1, type, null);
                Assert.IsNotNull(raster);

                // assume that any tested type contains 0 and 1 values
                raster.Value[0, 0] = 1;
                raster.Value[0, 1] = 0;
                raster.Value[1, 0] = 0;
                raster.Value[1, 1] = 1;

                raster.Save();

                // Now open the file
                var openRaster = target.Open(fileName);
                Assert.IsNotNull(raster);

                for (var i = 0; i < openRaster.NumRows; i++)
                    for (var j = 0; j < openRaster.NumColumns; j++)
                    {
                        Assert.AreEqual(raster.Value[i, j], openRaster.Value[i, j]);
                    }
            }
            finally 
            {
                File.Delete(fileName);
            }
        }