Search in sources :

Example 1 with MCRIIIFImageTileInformation

use of org.mycore.iiif.image.model.MCRIIIFImageTileInformation in project mycore by MyCoRe-Org.

the class MCRIVIEWIIIFImageImpl method getInformation.

public MCRIIIFImageInformation getInformation(String identifier) throws MCRIIIFImageNotFoundException, MCRIIIFImageProvidingException, MCRAccessException {
    try {
        Path tiledFile = tileFileProvider.getTiledFile(identifier);
        MCRTiledPictureProps tiledPictureProps = getTiledPictureProps(tiledFile);
        MCRIIIFImageInformation imageInformation = new MCRIIIFImageInformation(MCRIIIFBase.API_IMAGE_2, buildURL(identifier), DEFAULT_PROTOCOL, tiledPictureProps.getWidth(), tiledPictureProps.getHeight());
        MCRIIIFImageTileInformation tileInformation = new MCRIIIFImageTileInformation(256, 256);
        for (int i = 0; i < tiledPictureProps.getZoomlevel(); i++) {
            tileInformation.scaleFactors.add((int) Math.pow(2, i));
        }
        imageInformation.tiles.add(tileInformation);
        return imageInformation;
    } catch (FileSystemNotFoundException e) {
        LOGGER.error("Could not find Iview ZIP for {}", identifier, e);
        throw new MCRIIIFImageNotFoundException(identifier);
    }
}
Also used : Path(java.nio.file.Path) MCRIIIFImageNotFoundException(org.mycore.iiif.image.impl.MCRIIIFImageNotFoundException) MCRIIIFImageTileInformation(org.mycore.iiif.image.model.MCRIIIFImageTileInformation) FileSystemNotFoundException(java.nio.file.FileSystemNotFoundException) MCRIIIFImageInformation(org.mycore.iiif.image.model.MCRIIIFImageInformation) MCRTiledPictureProps(org.mycore.imagetiler.MCRTiledPictureProps)

Aggregations

FileSystemNotFoundException (java.nio.file.FileSystemNotFoundException)1 Path (java.nio.file.Path)1 MCRIIIFImageNotFoundException (org.mycore.iiif.image.impl.MCRIIIFImageNotFoundException)1 MCRIIIFImageInformation (org.mycore.iiif.image.model.MCRIIIFImageInformation)1 MCRIIIFImageTileInformation (org.mycore.iiif.image.model.MCRIIIFImageTileInformation)1 MCRTiledPictureProps (org.mycore.imagetiler.MCRTiledPictureProps)1