Merge pull request #5105 from fredj/stamen_minZoom

Support minZoom in ol.source.Stamen
This commit is contained in:
Frédéric Junod
2016-04-01 09:56:20 +02:00
4 changed files with 11 additions and 4 deletions

View File

@@ -6128,7 +6128,7 @@ olx.source.XYZOptions.prototype.maxZoom;
/**
* Unsupported (TODO: remove this).
* Optional min zoom level. Default is `0`.
* @type {number|undefined}
* @api
*/

View File

@@ -70,7 +70,7 @@ ol.source.StamenProviderConfig = {
maxZoom: 20
},
'watercolor': {
minZoom: 3,
minZoom: 1,
maxZoom: 16
}
};
@@ -106,8 +106,7 @@ ol.source.Stamen = function(options) {
cacheSize: options.cacheSize,
crossOrigin: 'anonymous',
maxZoom: providerConfig.maxZoom,
// FIXME uncomment the following when tilegrid supports minZoom
//minZoom: providerConfig.minZoom,
minZoom: providerConfig.minZoom,
opaque: layerConfig.opaque,
reprojectionErrorThreshold: options.reprojectionErrorThreshold,
tileLoadFunction: options.tileLoadFunction,

View File

@@ -33,6 +33,7 @@ ol.source.XYZ = function(options) {
ol.tilegrid.createXYZ({
extent: ol.tilegrid.extentFromProjection(projection),
maxZoom: options.maxZoom,
minZoom: options.minZoom,
tileSize: options.tileSize
});

View File

@@ -20,6 +20,13 @@ describe('ol.source.XYZ', function() {
expect(tileSource.getTileGrid().getTileSize(0)).to.be(512);
});
it('can be constructed with a custom min zoom', function() {
var tileSource = new ol.source.XYZ({
minZoom: 2
});
expect(tileSource.getTileGrid().getMinZoom()).to.be(2);
});
});
describe('tileUrlFunction', function() {