Merge pull request #8684 from wallw-bits/fix-typecheck-bingmaps

Define BingMapsImageryMetadataResponse type
This commit is contained in:
Tim Schaub
2018-09-21 16:57:13 -06:00
committed by GitHub
+47 -2
View File
@@ -45,6 +45,48 @@ const TOS_ATTRIBUTION = '<a class="ol-attribution-bing-tos" ' +
*/ */
/**
* @typedef {Object} BingMapsImageryMetadataResponse
* @property {number} statusCode The response status code
* @property {string} statusDescription The response status description
* @property {string} authenticationResultCode The authentication result code
* @property {Array<ResourceSet>} resourceSets The array of resource sets
*/
/**
* @typedef {Object} ResourceSet
* @property {Array<Resource>} resources
*/
/**
* @typedef {Object} Resource
* @property {number} imageHeight The image height
* @property {number} imageWidth The image width
* @property {number} zoomMin The minimum zoom level
* @property {number} zoomMax The maximum zoom level
* @property {string} imageUrl The image URL
* @property {Array<string>} imageUrlSubdomains The image URL subdomains for rotation
* @property {Array<ImageryProvider>} [imageryProviders] The array of ImageryProviders
*/
/**
* @typedef {Object} ImageryProvider
* @property {Array<CoverageArea>} coverageAreas The coverage areas
* @property {string} [attribution] The attribution
*/
/**
* @typedef {Object} CoverageArea
* @property {number} zoomMin The minimum zoom
* @property {number} zoomMax The maximum zoom
* @property {Array<number>} bbox The coverage bounding box
*/
/** /**
* @classdesc * @classdesc
* Layer source for Bing Maps tile data. * Layer source for Bing Maps tile data.
@@ -150,13 +192,16 @@ class BingMaps extends TileImage {
const sourceProjection = this.getProjection(); const sourceProjection = this.getProjection();
const extent = extentFromProjection(sourceProjection); const extent = extentFromProjection(sourceProjection);
const scale = this.hidpi_ ? 2 : 1;
const tileSize = resource.imageWidth == resource.imageHeight ? const tileSize = resource.imageWidth == resource.imageHeight ?
resource.imageWidth : [resource.imageWidth, resource.imageHeight]; resource.imageWidth / scale :
[resource.imageWidth / scale, resource.imageHeight / scale];
const tileGrid = createXYZ({ const tileGrid = createXYZ({
extent: extent, extent: extent,
minZoom: resource.zoomMin, minZoom: resource.zoomMin,
maxZoom: maxZoom, maxZoom: maxZoom,
tileSize: tileSize / (this.hidpi_ ? 2 : 1) tileSize: tileSize
}); });
this.tileGrid = tileGrid; this.tileGrid = tileGrid;