Ejemplo n.º 1
0
        public static InputBand <short> NewShortBand(GdalBand gdalBand,
                                                     PixelBand pixelBand)
        {
            RasterBandReader <short> rasterBandReader = RasterBandReaders.NewShortReader(gdalBand);

            switch (pixelBand.TypeCode)
            {
            case TypeCode.UInt16:
                return(new InputBand <short>(rasterBandReader, new PixelBandSetter <ushort, short>(pixelBand, Convert.ToUInt16)));

            case TypeCode.Int16:
                return(new InputBand <short>(rasterBandReader, new PixelBandSetter <short, short>(pixelBand, Convert.ToInt16)));

            case TypeCode.UInt32:
                return(new InputBand <short>(rasterBandReader, new PixelBandSetter <uint, short>(pixelBand, Convert.ToUInt32)));

            case TypeCode.Int32:
                return(new InputBand <short>(rasterBandReader, new PixelBandSetter <int, short>(pixelBand, Convert.ToInt32)));

            case TypeCode.Single:
                return(new InputBand <short>(rasterBandReader, new PixelBandSetter <float, short>(pixelBand, Convert.ToSingle)));

            case TypeCode.Double:
                return(new InputBand <short>(rasterBandReader, new PixelBandSetter <double, short>(pixelBand, Convert.ToDouble)));

            default:
                throw new ArgumentException("pixelBand.TypeCode is not ushort, short, uint, int, float, double");
            }
        }