private void TryCtor <T>(string imagePath)
            where T : IPixel, new()
        {
            WritableImage image = null;

            try {
                image = new WritableImage(imagePath);
                OutputRaster <T> raster = new OutputRaster <T>(image);
            }
            catch (System.Exception exc) {
                Data.Output.WriteLine(exc.Message);
                throw;
            }
            finally {
                if (image != null)
                {
                    image.Close();
                }
            }
        }
        public void Init()
        {
            gisImagePath = Data.MakeOutputPath("OutputRasterTests.gis");
            WritableImage image;

            image = new WritableImage(gisImagePath,
                                      new Dimensions(60, 40),
                                      1,
                                      System.TypeCode.Byte,
                                      null);
            image.Close();

            lanImagePath = Data.MakeOutputPath("OutputRasterTests.lan");
            image        = new WritableImage(lanImagePath,
                                             new Dimensions(100, 50),
                                             2,
                                             System.TypeCode.UInt16,
                                             null);
            image.Close();
        }
示例#3
0
        public void WriteTooManyPixels()
        {
            WritableImage image = null;

            try {
                Erdas74Pixel8 pixel = new Erdas74Pixel8();

                image = new WritableImage(outputGisImagePath,
                                          new Dimensions(10, 10),
                                          1,
                                          System.TypeCode.Byte,
                                          null);

                byte[] bytes = new byte[1];
                bytes[0] = 1;

                pixel[0].SetBytes(bytes, 0);

                int pixCount = image.Dimensions.Rows * image.Dimensions.Columns;

                for (int i = 0; i < pixCount; i++)
                {
                    image.WritePixel(pixel);
                }

                // one too many
                image.WritePixel(pixel);
            }
            catch (System.Exception exc) {
                Data.Output.WriteLine(exc.Message);
                throw;
            }
            finally {
                if (image != null)
                {
                    image.Close();
                }
            }
        }
示例#4
0
        public void WritePixels()
        {
            Erdas74Pixel8 pixel = new Erdas74Pixel8();

            WritableImage image = new WritableImage(outputGisImagePath,
                                                    new Dimensions(10, 10),
                                                    1,
                                                    System.TypeCode.Byte,
                                                    null);

            byte[] bytes = new byte[1];
            bytes[0] = 1;

            pixel[0].SetBytes(bytes, 0);

            int pixCount = image.Dimensions.Rows * image.Dimensions.Columns;

            for (int i = 0; i < pixCount; i++)
            {
                image.WritePixel(pixel);
            }

            image.Close();
        }