/// <summary>
        /// Creates a raster image.
        /// </summary>
        /// <param name="other">The other raster image.</param>
        /// <returns>The produced raster image matching <paramref name="other"/>.</returns>
        /// <exception cref="System.ArgumentNullException">The other raster is null.</exception>
        public IRaster CreateRaster(IRaster other)
        {
            if (other == null)
            {
                throw new ArgumentNullException("other", "The other raster is null.");
            }

            IRaster raster = CreateRaster(other.Format, other.NumberOfBands, other.NumberOfRows, other.NumberOfColumns, other.RadiometricResolution, other.Mapper);

            switch (raster.Format)
            {
            case RasterFormat.Integer:
                for (Int32 bandIndex = 0; bandIndex < raster.NumberOfBands; bandIndex++)
                {
                    for (Int32 rowIndex = 0; rowIndex < raster.NumberOfRows; rowIndex++)
                    {
                        for (Int32 columnIndex = 0; columnIndex < raster.NumberOfColumns; columnIndex++)
                        {
                            raster.SetValue(rowIndex, columnIndex, bandIndex, raster.GetValue(rowIndex, columnIndex, bandIndex));
                        }
                    }
                }
                break;

            case RasterFormat.Floating:
                for (Int32 bandIndex = 0; bandIndex < raster.NumberOfBands; bandIndex++)
                {
                    for (Int32 rowIndex = 0; rowIndex < raster.NumberOfRows; rowIndex++)
                    {
                        for (Int32 columnIndex = 0; columnIndex < raster.NumberOfColumns; columnIndex++)
                        {
                            raster.SetFloatValue(rowIndex, columnIndex, bandIndex, raster.GetFloatValue(rowIndex, columnIndex, bandIndex));
                        }
                    }
                }
                break;
            }

            return(raster);
        }
示例#2
0
 /// <summary>
 /// Sets the spectral value at a specified index.
 /// </summary>
 /// <param name="rowIndex">The zero-based row index of the value.</param>
 /// <param name="columnIndex">The zero-based column index of the value.</param>
 /// <param name="bandIndex">The zero-based band index of the value.</param>
 /// <param name="spectralValue">The spectral value.</param>
 protected override void ApplySetFloatValue(Int32 rowIndex, Int32 columnIndex, Int32 bandIndex, Double spectralValue)
 {
     _source.SetFloatValue(_rowIndex + rowIndex, _columnIndex + columnIndex, bandIndex, spectralValue);
 }
示例#3
0
 /// <summary>
 /// Sets a spectral value at a specified row and column index.
 /// </summary>
 /// <param name="rowIndex">The zero-based column index of the value.</param>
 /// <param name="columnIndex">The zero-based row index of the value.</param>
 /// <param name="value">The spectral value.</param>
 /// <exception cref="System.NotSupportedException">The raster is not writable.</exception>
 /// <exception cref="System.ArgumentOutOfRangeException">
 /// The row index is less than 0.
 /// or
 /// The row index is equal to or greater than the number of rows.
 /// or
 /// The column index is less than 0.
 /// or
 /// the column index is equal to or greater than the number of columns.
 /// </exception>
 public void SetFloatValue(Int32 rowIndex, Int32 columnIndex, Double value)
 {
     _raster.SetFloatValue(rowIndex, columnIndex, _bandIndex, value);
 }