public Band getBand() { return (Band) getRasterDataNode(); }
public BandOpImage(Band band, ResolutionLevel level) { super(band, level); if (Boolean.getBoolean("beam.imageManager.disableSourceTileCaching")) { setTileCache(null); } }
@Override protected void computeProductData(ProductData productData, Rectangle destRect) throws IOException { final ProductReader productReader = getBand().getProductReader(); if (productReader == null) { throw new IllegalStateException("no product reader for band " + getBand().getDisplayName()); } if (getLevel() == 0) { productReader.readBandRasterData(getBand(), destRect.x, destRect.y, destRect.width, destRect.height, productData, ProgressMonitor.NULL); } else { final int sourceWidth = getSourceWidth(destRect.width); final ProductData lineData = ProductData.createInstance(getBand().getDataType(), sourceWidth); final int[] sourceCoords = getSourceCoords(sourceWidth, destRect.width); final int srcX = getSourceX(destRect.x); final Band band = getBand(); for (int y = 0; y < destRect.height; y++) { productReader.readBandRasterData(band, srcX, getSourceY(destRect.y + y), lineData.getNumElems(), 1, lineData, ProgressMonitor.NULL); copyLine(y, destRect.width, lineData, productData, sourceCoords); } } } }
@Override public RenderedImage createImage(int level) { return new BandOpImage(Band.this, ResolutionLevel.create(getModel(), level)); } });
private boolean isProductReaderDirectlyUsable() { final ProductReader productReader = getProductReader(); if (productReader != null) { if (isSourceImageSet() && getSourceImage().getImage(0) instanceof BandOpImage) { final BandOpImage bandOpImage = (BandOpImage) getSourceImage().getImage(0); if (bandOpImage.getBand().getProductReader() == productReader) { return true; } } } return false; }