Make tileSize a config option for ol.source.XYZ
This commit is contained in:
@@ -5053,6 +5053,7 @@ olx.source.WMTSOptions.prototype.urls;
|
||||
* minZoom: (number|undefined),
|
||||
* tileLoadFunction: (ol.TileLoadFunctionType|undefined),
|
||||
* tilePixelRatio: (number|undefined),
|
||||
* tileSize: (number|undefined),
|
||||
* tileUrlFunction: (ol.TileUrlFunctionType|undefined),
|
||||
* url: (string|undefined),
|
||||
* urls: (Array.<string>|undefined),
|
||||
@@ -5129,6 +5130,14 @@ olx.source.XYZOptions.prototype.tileLoadFunction;
|
||||
olx.source.XYZOptions.prototype.tilePixelRatio;
|
||||
|
||||
|
||||
/**
|
||||
* The tile size used by the tile service. Default is `256` pixels.
|
||||
* @type {number|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.source.XYZOptions.prototype.tileSize;
|
||||
|
||||
|
||||
/**
|
||||
* Optional function to get tile URL given a tile coordinate and the projection.
|
||||
* Required if url or urls are not provided.
|
||||
|
||||
@@ -22,7 +22,8 @@ ol.source.XYZ = function(options) {
|
||||
|
||||
var tileGrid = new ol.tilegrid.XYZ({
|
||||
extent: ol.tilegrid.extentFromProjection(projection),
|
||||
maxZoom: options.maxZoom
|
||||
maxZoom: options.maxZoom,
|
||||
tileSize: options.tileSize
|
||||
});
|
||||
|
||||
goog.base(this, {
|
||||
|
||||
@@ -3,6 +3,17 @@ goog.provide('ol.test.source.XYZ');
|
||||
|
||||
describe('ol.source.XYZ', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed with a custom tile size', function() {
|
||||
var tileSource = new ol.source.XYZ({
|
||||
tileSize: 512
|
||||
});
|
||||
expect(tileSource.getTileGrid().getTileSize(0)).to.be(512);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('tileUrlFunction', function() {
|
||||
|
||||
var xyzTileSource, tileGrid;
|
||||
|
||||
Reference in New Issue
Block a user