use of org.geotoolkit.storage.coverage.ImageTile in project geotoolkit by Geomatys.
the class XMLMosaic method getTile.
@Override
public ImageTile getTile(long col, long row, Map hints) throws DataStoreException {
final ImageTile tile;
// Before any heavy validation, just ensure that we can represent a point from given row/column
final Point tilePosition = new Point(Math.toIntExact(col), Math.toIntExact(row));
if (isEmpty(col, row)) {
tile = createEmptyTile(tilePosition);
} else {
Path tileFile = getTileFile(col, row);
if (tileFile == null) {
// It happens sometimes, but how ? We need to search further, or stop using XML-based pyramids.
LOGGER.warning(() -> "Tile is not marked empty, but associated file does not exists: " + tilePosition);
tile = createEmptyTile(tilePosition);
} else {
tile = new DefaultImageTile(pyramid.getPyramidSet().getReaderSpi(), tileFile, 0, tilePosition);
}
}
return tile;
}
Aggregations