Beispiel #1
0
        public static OutputBand <int> NewIntBand(GdalBand gdalBand,
                                                  PixelBand pixelBand)
        {
            RasterBandWriter <int> rasterBandWriter = RasterBandWriters.NewIntWriter(gdalBand);

            switch (pixelBand.TypeCode)
            {
            case TypeCode.Byte:
                return(new OutputBand <int>(rasterBandWriter, new PixelBandGetter <byte, int>(pixelBand, Convert.ToInt32)));

            case TypeCode.SByte:
                return(new OutputBand <int>(rasterBandWriter, new PixelBandGetter <sbyte, int>(pixelBand, Convert.ToInt32)));

            case TypeCode.UInt16:
                return(new OutputBand <int>(rasterBandWriter, new PixelBandGetter <ushort, int>(pixelBand, Convert.ToInt32)));

            case TypeCode.Int16:
                return(new OutputBand <int>(rasterBandWriter, new PixelBandGetter <short, int>(pixelBand, Convert.ToInt32)));

            case TypeCode.UInt32:
                return(new OutputBand <int>(rasterBandWriter, new PixelBandGetter <uint, int>(pixelBand, Convert.ToInt32)));

            case TypeCode.Int32:
                return(new OutputBand <int>(rasterBandWriter, new PixelBandGetter <int, int>(pixelBand, Convert.ToInt32)));

            default:
                throw new ArgumentException("pixelBand.TypeCode is not byte, sbyte, ushort, short, uint, int");
            }
        }
Beispiel #2
0
        public static OutputBand <double> NewDoubleBand(GdalBand gdalBand,
                                                        PixelBand pixelBand)
        {
            RasterBandWriter <double> rasterBandWriter = RasterBandWriters.NewDoubleWriter(gdalBand);

            switch (pixelBand.TypeCode)
            {
            case TypeCode.Byte:
                return(new OutputBand <double>(rasterBandWriter, new PixelBandGetter <byte, double>(pixelBand, Convert.ToDouble)));

            case TypeCode.SByte:
                return(new OutputBand <double>(rasterBandWriter, new PixelBandGetter <sbyte, double>(pixelBand, Convert.ToDouble)));

            case TypeCode.UInt16:
                return(new OutputBand <double>(rasterBandWriter, new PixelBandGetter <ushort, double>(pixelBand, Convert.ToDouble)));

            case TypeCode.Int16:
                return(new OutputBand <double>(rasterBandWriter, new PixelBandGetter <short, double>(pixelBand, Convert.ToDouble)));

            case TypeCode.UInt32:
                return(new OutputBand <double>(rasterBandWriter, new PixelBandGetter <uint, double>(pixelBand, Convert.ToDouble)));

            case TypeCode.Int32:
                return(new OutputBand <double>(rasterBandWriter, new PixelBandGetter <int, double>(pixelBand, Convert.ToDouble)));

            case TypeCode.Single:
                return(new OutputBand <double>(rasterBandWriter, new PixelBandGetter <float, double>(pixelBand, Convert.ToDouble)));

            case TypeCode.Double:
                return(new OutputBand <double>(rasterBandWriter, new PixelBandGetter <double, double>(pixelBand, Convert.ToDouble)));

            default:
                throw new ArgumentException("pixelBand.TypeCode is not byte, sbyte, ushort, short, uint, int, float, double");
            }
        }
Beispiel #3
0
        public static OutputBand <byte> NewByteBand(GdalBand gdalBand,
                                                    PixelBand pixelBand)
        {
            RasterBandWriter <byte> rasterBandWriter = RasterBandWriters.NewByteWriter(gdalBand);

            switch (pixelBand.TypeCode)
            {
            case TypeCode.Byte:
                return(new OutputBand <byte>(rasterBandWriter, new PixelBandGetter <byte, byte>(pixelBand, Convert.ToByte)));

            case TypeCode.SByte:
                return(new OutputBand <byte>(rasterBandWriter, new PixelBandGetter <sbyte, byte>(pixelBand, Convert.ToByte)));

            default:
                throw new ArgumentException("pixelBand.TypeCode is not byte or sbyte");
            }
        }