From 30acfc20c3306e4d3fc84317b39e787084e400c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Sat, 7 Sep 2013 23:20:22 +0200 Subject: [PATCH 1/5] Stricter type def for ol.ImageUrlFunctionType --- src/ol/imageurlfunction.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ol/imageurlfunction.js b/src/ol/imageurlfunction.js index ebddedebdb..95a9a0a99b 100644 --- a/src/ol/imageurlfunction.js +++ b/src/ol/imageurlfunction.js @@ -5,8 +5,8 @@ goog.require('ol.Size'); /** - * @typedef {function(this:ol.source.Source, ol.Extent, ol.Size, ol.Projection): - * (string|undefined)} + * @typedef {function(this:ol.source.ImageSource, ol.Extent, ol.Size, + * ol.Projection): (string|undefined)} */ ol.ImageUrlFunctionType; @@ -22,6 +22,7 @@ ol.ImageUrlFunction.createFromParamsFunction = function(baseUrl, params, paramsFunction) { return ( /** + * @this {ol.source.ImageSource} * @param {ol.Extent} extent Extent. * @param {ol.Size} size Size. * @param {ol.Projection} projection Projection. @@ -34,6 +35,7 @@ ol.ImageUrlFunction.createFromParamsFunction = /** + * @this {ol.source.ImageSource} * @param {ol.Extent} extent Extent. * @param {ol.Size} size Size. * @return {string|undefined} Image URL. From 1e308e34f987aa759b5a95722a912ea77ae60794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Sat, 7 Sep 2013 23:32:02 +0200 Subject: [PATCH 2/5] Stricter type def for ol.TileUrlFunctionType --- src/ol/tileurlfunction.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ol/tileurlfunction.js b/src/ol/tileurlfunction.js index 545ae0e6a3..4ba3922ddf 100644 --- a/src/ol/tileurlfunction.js +++ b/src/ol/tileurlfunction.js @@ -8,7 +8,8 @@ goog.require('ol.extent'); /** - * @typedef {function(ol.TileCoord, ol.Projection): (string|undefined)} + * @typedef {function(this: ol.source.ImageTileSource, ol.TileCoord, + * ol.Projection): (string|undefined)} */ ol.TileUrlFunctionType; @@ -20,6 +21,7 @@ ol.TileUrlFunctionType; ol.TileUrlFunction.createFromTemplate = function(template) { return ( /** + * @this {ol.source.ImageTileSource} * @param {ol.TileCoord} tileCoord Tile Coordinate. * @param {ol.Projection} projection Projection. * @return {string|undefined} Tile URL. @@ -56,6 +58,7 @@ ol.TileUrlFunction.createFromTileUrlFunctions = function(tileUrlFunctions) { } return ( /** + * @this {ol.source.ImageTileSource} * @param {ol.TileCoord} tileCoord Tile Coordinate. * @param {ol.Projection} projection Projection. * @return {string|undefined} Tile URL. @@ -84,6 +87,7 @@ ol.TileUrlFunction.createFromParamsFunction = var tmpExtent = ol.extent.createEmpty(); return ( /** + * @this {ol.source.ImageTileSource} * @param {ol.TileCoord} tileCoord Tile Coordinate. * @param {ol.Projection} projection Projection. * @return {string|undefined} Tile URL. @@ -106,6 +110,7 @@ ol.TileUrlFunction.createFromParamsFunction = /** + * @this {ol.source.ImageTileSource} * @param {ol.TileCoord} tileCoord Tile coordinate. * @param {ol.Projection} projection Projection. * @return {string|undefined} Tile URL. @@ -126,6 +131,7 @@ ol.TileUrlFunction.withTileCoordTransform = var tmpTileCoord = new ol.TileCoord(0, 0, 0); return ( /** + * @this {ol.source.ImageTileSource} * @param {ol.TileCoord} tileCoord Tile Coordinate. * @param {ol.Projection} projection Projection. * @return {string|undefined} Tile URL. From 3036ee01ad06c2ac46aedf96a336cab9879ce34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Sat, 7 Sep 2013 23:49:37 +0200 Subject: [PATCH 3/5] Be stricter with types in BingMaps --- src/ol/source/bingmapssource.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ol/source/bingmapssource.js b/src/ol/source/bingmapssource.js index 226138140f..ceb5588d04 100644 --- a/src/ol/source/bingmapssource.js +++ b/src/ol/source/bingmapssource.js @@ -88,6 +88,7 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse = .replace('{culture}', culture); return ( /** + * @this {ol.source.BingMaps} * @param {ol.TileCoord} tileCoord Tile coordinate. * @param {ol.Projection} projection Projection. * @return {string|undefined} Tile URL. From e01344f0da4ad19268a9e88f118e413c36abdcac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Sat, 7 Sep 2013 23:50:01 +0200 Subject: [PATCH 4/5] Be stricter with types in WMTS --- src/ol/source/wmtssource.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ol/source/wmtssource.js b/src/ol/source/wmtssource.js index 0e5a0312fa..cdb2a1f53e 100644 --- a/src/ol/source/wmtssource.js +++ b/src/ol/source/wmtssource.js @@ -75,10 +75,12 @@ ol.source.WMTS = function(options) { function createFromWMTSTemplate(template) { return ( /** + * @this {ol.source.WMTS} * @param {ol.TileCoord} tileCoord Tile coordinate. + * @param {ol.Projection} projection Projection. * @return {string|undefined} Tile URL. */ - function(tileCoord) { + function(tileCoord, projection) { if (goog.isNull(tileCoord)) { return undefined; } else { @@ -122,7 +124,13 @@ ol.source.WMTS = function(options) { var tmpExtent = ol.extent.createEmpty(); var tmpTileCoord = new ol.TileCoord(0, 0, 0); tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform( - function(tileCoord, projection) { + /** + * @param {ol.TileCoord} tileCoord Tile coordinate. + * @param {ol.Projection} projection Projection. + * @param {ol.TileCoord=} opt_tileCoord Tile coordinate. + * @return {ol.TileCoord} Tile coordinate. + */ + function(tileCoord, projection, opt_tileCoord) { var tileGrid = this.getTileGrid(); goog.asserts.assert(!goog.isNull(tileGrid)); if (tileGrid.getResolutions().length <= tileCoord.z) { From 02a285665b639daf1eaadb6bb3f77b3168a3eab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Sat, 7 Sep 2013 23:50:15 +0200 Subject: [PATCH 5/5] Remove unneeded FIXME --- src/ol/source/wmtssource.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ol/source/wmtssource.js b/src/ol/source/wmtssource.js index cdb2a1f53e..12132d7d45 100644 --- a/src/ol/source/wmtssource.js +++ b/src/ol/source/wmtssource.js @@ -94,7 +94,6 @@ ol.source.WMTS = function(options) { } var url = template; for (var key in localContext) { - // FIXME: should we filter properties with hasOwnProperty? url = url.replace('{' + key + '}', localContext[key]) .replace('%7B' + key + '%7D', localContext[key]); }