Ejemplo n.º 1
0
        /// <summary>
        /// Creates a zeroed destination <CODE>Raster</CODE> with the correct size
        /// and number of bands.
        /// An <CODE>IllegalArgumentException</CODE> may be thrown if the number of
        /// bands in the source is incompatible with the matrix.  See
        /// the class comments for more details.
        /// </summary>
        /// <param name="src"> The <CODE>Raster</CODE> to be filtered.
        /// </param>
        /// <returns> The zeroed destination <CODE>Raster</CODE>. </returns>
        public virtual WritableRaster CreateCompatibleDestRaster(Raster src)
        {
            int nBands = src.NumBands;

            if ((Ncols != nBands) && (Ncols != (nBands + 1)))
            {
                throw new IllegalArgumentException("Number of columns in the " + "matrix (" + Ncols + ") must be equal to the number" + " of bands ([+1]) in src (" + nBands + ").");
            }
            if (src.NumBands == Nrows)
            {
                return(src.CreateCompatibleWritableRaster());
            }
            else
            {
                throw new IllegalArgumentException("Don't know how to create a " + " compatible Raster with " + Nrows + " bands.");
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a zeroed destination Raster with the correct size and number
 /// of bands, given this source.
 /// </summary>
 public virtual WritableRaster CreateCompatibleDestRaster(Raster src)
 {
     return(src.CreateCompatibleWritableRaster());
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a zeroed destination <CODE>Raster</CODE> with the correct size
        /// and number of bands.  A <CODE>RasterFormatException</CODE> may be thrown
        /// if the transformed width or height is equal to 0.
        /// </summary>
        /// <param name="src"> The <CODE>Raster</CODE> to be transformed.
        /// </param>
        /// <returns> The zeroed destination <CODE>Raster</CODE>. </returns>
        public virtual WritableRaster CreateCompatibleDestRaster(Raster src)
        {
            Rectangle2D r = GetBounds2D(src);

            return(src.CreateCompatibleWritableRaster((int)r.X, (int)r.Y, (int)r.Width, (int)r.Height));
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a zeroed-destination <code>Raster</code> with the correct
 /// size and number of bands, given this source. </summary>
 /// <param name="src">       the source <code>Raster</code> </param>
 /// <returns> the zeroed-destination <code>Raster</code>. </returns>
 public virtual WritableRaster CreateCompatibleDestRaster(Raster src)
 {
     return(src.CreateCompatibleWritableRaster(src.Width, src.Height));
 }