From 93a98337d87f4db4b0b2a6ddacfa89187926ea23 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 7 Jun 2016 15:23:14 +0200 Subject: [PATCH 1/3] Remove olx.source.WMTSOptions#maxZoom option The option is not handled by `ol.source.WMTS` --- externs/olx.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index ea8cc2fb2e..27e449d199 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5903,7 +5903,6 @@ olx.source.VectorOptions.prototype.wrapX; * matrixSet: string, * dimensions: (!Object|undefined), * url: (string|undefined), - * maxZoom: (number|undefined), * tileLoadFunction: (ol.TileLoadFunctionType|undefined), * urls: (Array.|undefined), * tileClass: (function(new: ol.ImageTile, ol.TileCoord, @@ -6064,14 +6063,6 @@ olx.source.WMTSOptions.prototype.dimensions; olx.source.WMTSOptions.prototype.url; -/** - * Maximum zoom. - * @type {number|undefined} - * @api - */ -olx.source.WMTSOptions.prototype.maxZoom; - - /** * Optional function to load a tile given a URL. The default is * ```js From 1b662ff048ea77551a0a3acc44c0df12190ce39b Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 8 Jun 2016 08:32:13 +0200 Subject: [PATCH 2/3] Use minZoom and maxZoom olx.source.StamenOptions --- src/ol/source/stamensource.js | 4 ++-- test/spec/ol/source/stamensource.test.js | 28 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 test/spec/ol/source/stamensource.test.js diff --git a/src/ol/source/stamensource.js b/src/ol/source/stamensource.js index 13c2635576..ba70a0af1f 100644 --- a/src/ol/source/stamensource.js +++ b/src/ol/source/stamensource.js @@ -105,8 +105,8 @@ ol.source.Stamen = function(options) { attributions: ol.source.Stamen.ATTRIBUTIONS, cacheSize: options.cacheSize, crossOrigin: 'anonymous', - maxZoom: providerConfig.maxZoom, - minZoom: providerConfig.minZoom, + maxZoom: options.maxZoom != undefined ? options.maxZoom : providerConfig.maxZoom, + minZoom: options.minZoom != undefined ? options.minZoom : providerConfig.minZoom, opaque: layerConfig.opaque, reprojectionErrorThreshold: options.reprojectionErrorThreshold, tileLoadFunction: options.tileLoadFunction, diff --git a/test/spec/ol/source/stamensource.test.js b/test/spec/ol/source/stamensource.test.js new file mode 100644 index 0000000000..189d16b139 --- /dev/null +++ b/test/spec/ol/source/stamensource.test.js @@ -0,0 +1,28 @@ +goog.provide('ol.test.source.Stamen'); + +describe('ol.source.Stamen', function() { + + describe('constructor', function() { + + it('can be constructed with a custom minZoom', function() { + var source = new ol.source.Stamen({ + layer: 'watercolor', + minZoom: 10 + }); + expect(source.getTileGrid().getMinZoom()).to.be(10); + }); + + it('can be constructed with a custom maxZoom', function() { + var source = new ol.source.Stamen({ + layer: 'watercolor', + maxZoom: 8 + }); + expect(source.getTileGrid().getMaxZoom()).to.be(8); + + }); + + }); + +}); + +goog.require('ol.source.Stamen'); From 7a43a667ce9d75e8b75889ba983d74640adad048 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 8 Jun 2016 08:49:48 +0200 Subject: [PATCH 3/3] Remove olx.source.TileWMSOptions#maxZoom option --- externs/olx.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/externs/olx.js b/externs/olx.js index 27e449d199..4f1d6f5f07 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5598,7 +5598,6 @@ olx.source.TileJSONOptions.prototype.wrapX; * hidpi: (boolean|undefined), * logo: (string|olx.LogoOptions|undefined), * tileGrid: (ol.tilegrid.TileGrid|undefined), - * maxZoom: (number|undefined), * projection: ol.ProjectionLike, * reprojectionErrorThreshold: (number|undefined), * serverType: (ol.source.wms.ServerType|string|undefined), @@ -5692,14 +5691,6 @@ olx.source.TileWMSOptions.prototype.logo; olx.source.TileWMSOptions.prototype.tileGrid; -/** - * Maximum zoom. - * @type {number|undefined} - * @api - */ -olx.source.TileWMSOptions.prototype.maxZoom; - - /** * Projection. * @type {ol.ProjectionLike}