public byte[] getBytePixel( int x, int y, byte[] result ) { if ( result == null || result.length < getView().dataInfo.bands ) { result = new byte[getView().dataInfo.bands]; } for ( int band = 0; band < getView().dataInfo.bands; band++ ) { result[band] = getByteSample( x, y, band ); } return result; }
public double[] getDoublePixel( int x, int y, double[] result ) { if ( result == null || result.length < getView().dataInfo.bands ) { result = new double[getView().dataInfo.bands]; } for ( int band = 0; band < getView().dataInfo.bands; band++ ) { result[band] = getDoubleSample( x, y, band ); } return result; }
public float[] getFloatPixel( int x, int y, float[] result ) { if ( result == null || result.length < getView().dataInfo.bands ) { result = new float[getView().dataInfo.bands]; } for ( int band = 0; band < getView().dataInfo.bands; band++ ) { result[band] = getFloatSample( x, y, band ); } return result; }
public short[] getShortPixel( int x, int y, short[] result ) { if ( result == null || result.length < getView().dataInfo.bands ) { result = new short[getView().dataInfo.bands]; } for ( int band = 0; band < getView().dataInfo.bands; band++ ) { result[band] = getShortSample( x, y, band ); } return result; }
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 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 ByteBufferRasterData createCompatibleRasterData() { // just use the view on the data return createCompatibleRasterData( getView() ); }
public byte[] getNullPixel( byte[] result ) { return getView().dataInfo.getNoDataPixel( result ); }
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 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 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 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 ByteBufferRasterData createCompatibleRasterData( BandType[] bands ) { // create a new view from the given bands return createCompatibleRasterData( new DataView( getView(), createRasterDataInfo( bands ), dataInfo ) ); }