From ba2c558b728ebc8a79acbf61fe344569f7225eb2 Mon Sep 17 00:00:00 2001 From: Lutz Helm Date: Fri, 3 May 2019 16:39:59 +0200 Subject: [PATCH] Add typedefs for IIIF info.json responses --- src/ol/format/IIIFInfo.js | 79 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 2 deletions(-) diff --git a/src/ol/format/IIIFInfo.js b/src/ol/format/IIIFInfo.js index 9159bf5d42..b917249ce2 100644 --- a/src/ol/format/IIIFInfo.js +++ b/src/ol/format/IIIFInfo.js @@ -21,6 +21,81 @@ import {assert} from '../asserts.js'; * @property {Array} [qualities] Supported IIIF image qualities. */ +/** + * @typedef {Object} ImageInformationResponse1_0 + * @property {string} identifier + * @property {number} width + * @property {number} height + * @property {Array} [scale_factors] Resolution scaling factors. + * @property {number} [tile_width] + * @property {number} [tile_height] + * @property {Array} [formats] Supported image formats. + * @property {string} [profile] Compliance level URI. + */ + +/** + * @typedef {Object} ImageInformationResponse1_1 + * @property {string} "@id" The base URI of the image service. + * @property {string} "@context" JSON-LD context URI. + * @property {number} width Full image width. + * @property {number} height Full image height. + * @property {Array} [scale_factors] Resolution scaling factors. + * @property {number} [tile_width] + * @property {number} [tile_height] + * @property {Array} [formats] Supported image formats. + * @property {string} [profile] Compliance level URI. + */ + +/** + * @typedef {Object} TileInfo + * @property {Array} scaleFactors Supported resolution scaling factors. + * @property {number} width Tile width in pixels. + * @property {number} [height] Tile height in pixels. Same as tile width if height is + * not given. + */ + +/** + * @typedef {Object} IiifProfile + * @property {Array} [formats] Supported image formats for the image service. + * @property {Array} [qualities] Supported IIIF image qualities. + * @property {Array} [supports] Supported features. + * @property {number} [maxArea] Maximum area (pixels) available for this image service. + * @property {number} [maxHeight] Maximum height. + * @property {number} [maxWidth] Maximum width. + */ + +/** + * @typedef {Object} ImageInformationResponse2 + * @property {string} "@id" The base URI of the image service. + * @property {string} "@context" JSON-LD context IRI + * @property {number} width Full image width. + * @property {number} height Full image height. + * @property {Array} profile Additional informations about the image + * service's capabilities. + * @property {Array>} [sizes] Supported full image dimensions. + * @property {Array} [tiles] Supported tile sizes and resolution scaling factors. + */ + +/** + * @typedef {Object} ImageInformationResponse3 + * @property {string} id The base URI of the image service. + * @property {string} "@context" JSON-LD context IRI + * @property {number} width Full image width. + * @property {number} height Full image height. + * @property {string} profile Compliance level, one of 'level0', 'level1' or 'level2' + * @property {Array>} [sizes] Supported full image dimensions. + * @property {Array} [tiles] Supported tile sizes and resolution scaling factors. + * @property {number} [maxArea] Maximum area (pixels) available for this image service. + * @property {number} [maxHeight] Maximum height. + * @property {number} [maxWidth] Maximum width. + * @property {Array} [extraQualities] IIIF image qualities supported by the + * image service additional to the ones indicated by the compliance level. + * @property {Array} [extraFormats] Image formats supported by the + * image service additional to the ones indicated by the compliance level. + * @property {Array} [extraFeatures] Additional supported features whose support + * is not indicated by the compliance level. + */ + /** * @enum {string} */ @@ -200,8 +275,8 @@ versionFunctions[Versions.VERSION3] = generateVersion3Options; class IIIFInfo { /** - * @param {Object|string} imageInfo Deserialized image information JSON response - * object or JSON response as string + * @param {ImageInformationResponse1_0|ImageInformationResponse1_1|ImageInformationResponse2|ImageInformationResponse3|string} imageInfo + * Deserialized image information JSON response object or JSON response as string */ constructor(imageInfo) { this.setImageInfo(imageInfo);