From 6506efab0c107131b547704fca8119d2b54295a4 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Fri, 1 Oct 2021 17:06:13 -0600 Subject: [PATCH] Add more definitions for GeoTIFF types --- src/ol/source/GeoTIFF.js | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/ol/source/GeoTIFF.js b/src/ol/source/GeoTIFF.js index cacb5aad83..784cc28852 100644 --- a/src/ol/source/GeoTIFF.js +++ b/src/ol/source/GeoTIFF.js @@ -46,6 +46,18 @@ import {fromCode as unitsFromCode} from '../proj/Units.js'; * @property {number} ProjectedCSTypeGeoKey Projected coordinate system code. */ +/** + * @typedef {Object} GeoTIFF + * @property {function():Promise} getImageCount Get the number of internal subfile images. + * @property {function(number):Promise} getImage Get the image at the specified index. + */ + +/** + * @typedef {Object} MultiGeoTIFF + * @property {function():Promise} getImageCount Get the number of internal subfile images. + * @property {function(number):Promise} getImage Get the image at the specified index. + */ + /** * @typedef {Object} GeoTIFFImage * @property {Object} fileDirectory The file directory. @@ -56,6 +68,12 @@ import {fromCode as unitsFromCode} from '../proj/Units.js'; * @property {function():Array} getBoundingBox Get the image bounding box. * @property {function():Array} getOrigin Get the image origin. * @property {function(GeoTIFFImage):Array} getResolution Get the image resolution. + * @property {function():number} getWidth Get the pixel width of the image. + * @property {function():number} getHeight Get the pixel height of the image. + * @property {function():number} getTileWidth Get the pixel width of image tiles. + * @property {function():number} getTileHeight Get the pixel height of image tiles. + * @property {function():number|null} getGDALNoData Get the nodata value (or null if none). + * @property {function():number} getSamplesPerPixel Get the number of samples per pixel. */ let workerPool; @@ -156,8 +174,8 @@ function getProjection(image) { } /** - * @param {import("geotiff/src/geotiff.js").GeoTIFF|import("geotiff/src/geotiff.js").MultiGeoTIFF} tiff A GeoTIFF. - * @return {Promise>} Resolves to a list of images. + * @param {GeoTIFF|MultiGeoTIFF} tiff A GeoTIFF. + * @return {Promise>} Resolves to a list of images. */ function getImagesForTIFF(tiff) { return tiff.getImageCount().then(function (count) { @@ -171,7 +189,7 @@ function getImagesForTIFF(tiff) { /** * @param {SourceInfo} source The GeoTIFF source. - * @return {Promise>} Resolves to a list of images. + * @return {Promise>} Resolves to a list of images. */ function getImagesForSource(source) { let request; @@ -311,7 +329,7 @@ class GeoTIFFSource extends DataTile { const numSources = this.sourceInfo_.length; /** - * @type {Array>} + * @type {Array>} * @private */ this.sourceImagery_ = new Array(numSources); @@ -394,7 +412,7 @@ class GeoTIFFSource extends DataTile { /** * Configure the tile grid based on images within the source GeoTIFFs. Each GeoTIFF * must have the same internal tiled structure. - * @param {Array>} sources Each source is a list of images + * @param {Array>} sources Each source is a list of images * from a single GeoTIFF. * @private */