public byte[] getBytes( int x, int y, int width, int height, int band, byte[] result ) { checkBoundsEx( x, y, width, height ); if ( result == null || result.length < ( width * height ) ) { result = new byte[width * height]; } for ( int h = 0; h < height; h++ ) { for ( int w = 0; w < width; w++ ) { int pos = calculatePos( x + w, y + h, band ); int rOffset = ( 2 * h ) + w; if ( pos == -1 ) {// the position is outside the databuffer. result[rOffset] = getView().dataInfo.noDataPixel[getView().getBandOffset( band )]; } else { result[rOffset] = getByteBuffer().get( pos ); } } } return result; }
public double[] getDoubles( int x, int y, int width, int height, int band, double[] result ) { checkBoundsEx( x, y, width, height ); if ( result == null || result.length < ( width * height ) ) { result = new double[width * height]; } for ( int h = 0; h < height; h++ ) { for ( int w = 0; w < width; w++ ) { int pos = calculatePos( x + w, y + h, band ); int rOffset = ( 2 * h ) + w; if ( pos == -1 ) {// the position is outside the databuffer. System.arraycopy( getView().dataInfo.noDataPixel, getView().getBandOffset( band ) * getView().dataInfo.dataSize, result, rOffset, getView().dataInfo.dataSize ); } else { result[rOffset] = getByteBuffer().getDouble( pos ); } } } return result; }
public int[] getInts( int x, int y, int width, int height, int band, int[] result ) { checkBoundsEx( x, y, width, height ); if ( result == null || result.length < ( width * height ) ) { result = new int[width * height]; } for ( int h = 0; h < height; h++ ) { for ( int w = 0; w < width; w++ ) { int pos = calculatePos( x + w, y + h, band ); int rOffset = ( 2 * h ) + w; if ( pos == -1 ) {// the position is outside the databuffer. System.arraycopy( getView().dataInfo.noDataPixel, getView().getBandOffset( band ) * getView().dataInfo.dataSize, result, rOffset, getView().dataInfo.dataSize ); } else { result[rOffset] = getByteBuffer().getInt( pos ); } // result[( 2 * h ) + w] = data.getInt( calculatePos( x + w, y + h, band ) ); } } return result; }
public float[] getFloats( int x, int y, int width, int height, int band, float[] result ) { checkBoundsEx( x, y, width, height ); if ( result == null || result.length < ( width * height ) ) { result = new float[width * height]; } for ( int h = 0; h < height; h++ ) { for ( int w = 0; w < width; w++ ) { int pos = calculatePos( x + w, y + h, band ); int rOffset = ( 2 * h ) + w; if ( pos == -1 ) {// the position is outside the databuffer. System.arraycopy( getView().dataInfo.noDataPixel, getView().getBandOffset( band ) * getView().dataInfo.dataSize, result, rOffset, getView().dataInfo.dataSize ); } else { result[rOffset] = getByteBuffer().getFloat( pos ); } // result[( 2 * h ) + w] = data.getFloat( calculatePos( x + w, y + h, band ) ); } } return result; }
public short[] getShorts( int x, int y, int width, int height, int band, short[] result ) { checkBoundsEx( x, y, width, height ); if ( result == null || result.length < ( width * height ) ) { result = new short[width * height]; } for ( int h = 0; h < height; h++ ) { for ( int w = 0; w < width; w++ ) { int pos = calculatePos( x + w, y + h, band ); int rOffset = ( 2 * h ) + w; if ( pos == -1 ) {// the position is outside the databuffer. System.arraycopy( getView().dataInfo.noDataPixel, getView().getBandOffset( band ) * getView().dataInfo.dataSize, result, rOffset, getView().dataInfo.dataSize ); } else { result[rOffset] = getByteBuffer().getShort( pos ); } // result[( 2 * h ) + w] = data.getShort( calculatePos( x + w, y + h, band ) ); } } return result; }