@Override public void setPixel( int x, int y, byte[] result ) { if ( getView().dataInfo.bands != dataInfo.bands ) { // Is this a view on less bands? super.setPixel( x, y, result ); return; } ByteBuffer data = getByteBuffer(); data.position( calculatePos( x, y ) ); data.put( result, 0, dataInfo.noDataPixel.length ); }
/** * @return the loaded buffer and the rectangle for which the buffer has data. */ public Pair<ByteBuffer, RasterRect> getDataRect() { return new Pair<ByteBuffer, RasterRect>( getByteBuffer(), dataAccess.getDataRectangle() ); } }
@Override public byte[] getPixel( int x, int y, byte[] result ) { if ( getView().dataInfo.bands != dataInfo.bands ) { return super.getPixel( x, y, result ); } if ( result == null ) { result = new byte[dataInfo.noDataPixel.length]; } int pos = calculatePos( x, y ); if ( pos == -1 ) { System.arraycopy( dataInfo.noDataPixel, 0, result, 0, result.length ); } else { ByteBuffer data = getByteBuffer().asReadOnlyBuffer(); data.position( pos ); data.get( result, 0, dataInfo.noDataPixel.length ); } return result; }
private TextureTile getTextureTile( double minX, double minY, double maxX, double maxY ) { int width = (int) ( ( maxX - minX ) / res ); int height = (int) ( ( maxY - minY ) / res ); LOG.debug( "Fetching texture tile (" + width + "x" + height + ") via WMSClient." ); Envelope bbox = fac.createEnvelope( minX, minY, maxX, maxY, requestedCRS ); SimpleRaster raster = null; try { raster = getMapAsSimpleRaster( client, layers, width, height, bbox, requestedCRS, requestedFormat, true, true, requestTimeout ).first; LOG.debug( "Success" ); } catch ( IOException e ) { LOG.debug( "Failed: " + e.getMessage(), e ); // this must never happen, cause the above request uses errorsInImage=true throw new RuntimeException( e.getMessage() ); } PixelInterleavedRasterData rasterData = (PixelInterleavedRasterData) raster.getRasterData(); return new TextureTile( minX, minY, maxX, maxY, rasterData.getColumns(), rasterData.getRows(), rasterData.getByteBuffer(), true, true ); }
ByteBuffer srcData = raster.getByteBuffer().asReadOnlyBuffer(); ByteBuffer data = getByteBuffer(); for ( int i = 0; i < subHeight; i++ ) { int pos = raster.calculatePos( srcRasterPosx, i + srcRasterPosy );