public void setBytes( int x, int y, int width, int height, int band, byte[] values ) { if ( values != null && values.length >= ( width * height ) ) { ByteBuffer buf = getByteBuffer(); for ( int h = 0; h < height; h++ ) { for ( int w = 0; w < width; w++ ) { buf.put( calculatePos( x + w, y + h, band ), values[( 2 * h ) + w] ); } } } }
public void setDoubles( int x, int y, int width, int height, int band, double[] values ) { if ( values != null && values.length >= ( width * height ) ) { ByteBuffer buf = getByteBuffer(); for ( int h = 0; h < height; h++ ) { for ( int w = 0; w < width; w++ ) { buf.putDouble( calculatePos( x + w, y + h, band ), values[( 2 * h ) + w] ); } } } }
public void setInts( int x, int y, int width, int height, int band, int[] values ) { if ( values != null && values.length >= ( width * height ) ) { ByteBuffer buf = getByteBuffer(); for ( int h = 0; h < height; h++ ) { for ( int w = 0; w < width; w++ ) { buf.putInt( calculatePos( x + w, y + h, band ), values[( 2 * h ) + w] ); } } } }
public void setShorts( int x, int y, int width, int height, int band, short[] values ) { if ( values != null && values.length >= ( width * height ) ) { ByteBuffer buf = getByteBuffer(); for ( int h = 0; h < height; h++ ) { for ( int w = 0; w < width; w++ ) { buf.putShort( calculatePos( x + w, y + h, band ), values[( 2 * h ) + w] ); } } } }
public void setFloats( int x, int y, int width, int height, int band, float[] values ) { if ( values != null && values.length >= ( width * height ) ) { ByteBuffer buf = getByteBuffer(); for ( int h = 0; h < height; h++ ) { for ( int w = 0; w < width; w++ ) { buf.putFloat( calculatePos( x + w, y + h, band ), values[( 2 * h ) + w] ); } } } }
public void setFloatSample( int x, int y, int band, float value ) { getByteBuffer().putFloat( calculatePos( x, y, band ), value ); }
public void setShortSample( int x, int y, int band, short value ) { getByteBuffer().putShort( calculatePos( x, y, band ), value ); }
public void setByteSample( int x, int y, int band, byte value ) { getByteBuffer().put( calculatePos( x, y, band ), value ); }
public void setFloatPixel( int x, int y, float[] pixel ) { ByteBuffer buf = getByteBuffer(); for ( int band = 0; band < getView().dataInfo.bands; band++ ) { buf.putFloat( calculatePos( x, y, band ), pixel[band] ); } }
public void setShortPixel( int x, int y, short[] pixel ) { ByteBuffer buf = getByteBuffer(); for ( int band = 0; band < getView().dataInfo.bands; band++ ) { buf.putShort( calculatePos( x, y, band ), pixel[band] ); } }
public void setBytePixel( int x, int y, byte[] pixel ) { ByteBuffer buf = getByteBuffer(); for ( int band = 0; band < getView().dataInfo.bands; band++ ) { buf.put( calculatePos( x, y, band ), pixel[band] ); } }
public void setDoublePixel( int x, int y, double[] pixel ) { ByteBuffer buf = getByteBuffer(); for ( int band = 0; band < getView().dataInfo.bands; band++ ) { buf.putDouble( calculatePos( x, y, band ), pixel[band] ); } }
public void setIntPixel( int x, int y, int[] pixel ) { ByteBuffer buf = getByteBuffer(); for ( int band = 0; band < getView().dataInfo.bands; band++ ) { buf.putInt( calculatePos( x, y, band ), pixel[band] ); } }
public void setSample( int x, int y, int band, byte[] value ) { if ( value == null || value.length < getView().dataInfo.dataSize ) { return; } ByteBuffer buf = getByteBuffer(); buf.position( calculatePos( x, y, band ) ); buf.put( value, 0, getView().dataInfo.dataSize ); }
public double getDoubleSample( int x, int y, int band ) { int pos = calculatePos( x, y, band ); if ( pos == -1 ) {// the position is outside the databuffer. ByteBuffer wrap = ByteBuffer.wrap( getView().dataInfo.noDataPixel ); return wrap.getDouble( getView().getBandOffset( band ) * getView().dataInfo.dataSize ); } return getByteBuffer().getDouble( pos ); }
public float getFloatSample( int x, int y, int band ) { int pos = calculatePos( x, y, band ); if ( pos == -1 ) {// the position is outside the databuffer. ByteBuffer wrap = ByteBuffer.wrap( getView().dataInfo.noDataPixel ); return wrap.getFloat( getView().getBandOffset( band ) * getView().dataInfo.dataSize ); } return getByteBuffer().getFloat( pos ); // return data.getFloat( calculatePos( x, y, band ) ); }
public int getIntSample( int x, int y, int band ) { int pos = calculatePos( x, y, band ); if ( pos == -1 ) {// the position is outside the databuffer. ByteBuffer wrap = ByteBuffer.wrap( getView().dataInfo.noDataPixel ); return wrap.getInt( getView().getBandOffset( band ) * getView().dataInfo.dataSize ); } return getByteBuffer().getInt( pos ); // return data.getInt( calculatePos( x, y, band ) ); }
public byte getByteSample( int x, int y, int band ) { int pos = calculatePos( x, y, band ); if ( pos == -1 ) {// the position is outside the databuffer. return getView().dataInfo.noDataPixel[getView().getBandOffset( band )]; } return getByteBuffer().get( pos ); }
public void setPixel( int x, int y, byte[] result ) { // operates on the view if ( result != null && result.length == ( getView().dataInfo.dataSize * getView().dataInfo.bands ) ) { int sampleSize = getView().dataInfo.dataSize; ByteBuffer buf = getByteBuffer(); for ( int b = 0; b < getView().dataInfo.bands; b++ ) { buf.position( calculatePos( x, y, b ) ); buf.put( result, b * sampleSize, sampleSize ); } } }
public byte[] getSample( int x, int y, int band, byte[] result ) { if ( result == null || result.length < getView().dataInfo.dataSize ) { result = new byte[getView().dataInfo.dataSize]; } int pos = calculatePos( x, y, band ); if ( pos == -1 ) {// the position is outside the databuffer. System.arraycopy( getView().dataInfo.noDataPixel, getView().getBandOffset( band ), result, 0, getView().dataInfo.dataSize ); } else { ByteBuffer buf = getByteBuffer(); buf.position( pos ); buf.get( result, 0, getView().dataInfo.dataSize ); } return result; }