Search in sources :

Example 6 with ImageTile

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;
}
Also used : Path(java.nio.file.Path) DefaultImageTile(org.geotoolkit.storage.coverage.DefaultImageTile) ImageTile(org.geotoolkit.storage.coverage.ImageTile) DefaultImageTile(org.geotoolkit.storage.coverage.DefaultImageTile) Point(java.awt.Point)

Aggregations

ImageTile (org.geotoolkit.storage.coverage.ImageTile)6 DefaultImageTile (org.geotoolkit.storage.coverage.DefaultImageTile)5 Test (org.junit.Test)4 Point (java.awt.Point)3 BufferedImage (java.awt.image.BufferedImage)3 TileMatrix (org.geotoolkit.storage.multires.TileMatrix)3 TileMatrixSet (org.geotoolkit.storage.multires.TileMatrixSet)3 RenderedImage (java.awt.image.RenderedImage)2 Path (java.nio.file.Path)2 Dimension (java.awt.Dimension)1 BufferedInputStream (java.io.BufferedInputStream)1 BufferedOutputStream (java.io.BufferedOutputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1 GZIPOutputStream (java.util.zip.GZIPOutputStream)1 IIOImage (javax.imageio.IIOImage)1