@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);
}
}
}
}