Be more consistent with source options
This commit is contained in:
@@ -20,9 +20,9 @@ goog.require('ol.tilegrid.XYZ');
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.ImageTileSource}
|
* @extends {ol.source.ImageTileSource}
|
||||||
* @param {ol.source.BingMapsOptions} bingMapsOptions Bing Maps options.
|
* @param {ol.source.BingMapsOptions} options Bing Maps options.
|
||||||
*/
|
*/
|
||||||
ol.source.BingMaps = function(bingMapsOptions) {
|
ol.source.BingMaps = function(options) {
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
crossOrigin: 'anonymous',
|
crossOrigin: 'anonymous',
|
||||||
@@ -34,8 +34,7 @@ ol.source.BingMaps = function(bingMapsOptions) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
this.culture_ = goog.isDef(bingMapsOptions.culture) ?
|
this.culture_ = goog.isDef(options.culture) ? options.culture : 'en-us';
|
||||||
bingMapsOptions.culture : 'en-us';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -44,12 +43,11 @@ ol.source.BingMaps = function(bingMapsOptions) {
|
|||||||
this.ready_ = false;
|
this.ready_ = false;
|
||||||
|
|
||||||
var uri = new goog.Uri(
|
var uri = new goog.Uri(
|
||||||
'//dev.virtualearth.net/REST/v1/Imagery/Metadata/' +
|
'//dev.virtualearth.net/REST/v1/Imagery/Metadata/' + options.style);
|
||||||
bingMapsOptions.style);
|
|
||||||
var jsonp = new goog.net.Jsonp(uri, 'jsonp');
|
var jsonp = new goog.net.Jsonp(uri, 'jsonp');
|
||||||
jsonp.send({
|
jsonp.send({
|
||||||
'include': 'ImageryProviders',
|
'include': 'ImageryProviders',
|
||||||
'key': bingMapsOptions.key
|
'key': options.key
|
||||||
}, goog.bind(this.handleImageryMetadataResponse, this));
|
}, goog.bind(this.handleImageryMetadataResponse, this));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ ol.DebugTile_.prototype.getImage = function(opt_context) {
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.TileSource}
|
* @extends {ol.source.TileSource}
|
||||||
* @param {ol.source.DebugTileSourceOptions} options Options.
|
* @param {ol.source.DebugTileSourceOptions} options Debug tile options.
|
||||||
*/
|
*/
|
||||||
ol.source.DebugTileSource = function(options) {
|
ol.source.DebugTileSource = function(options) {
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,7 @@ ol.source.ImageSourceOptions;
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.Source}
|
* @extends {ol.source.Source}
|
||||||
* @param {ol.source.ImageSourceOptions} options Single
|
* @param {ol.source.ImageSourceOptions} options Single image source options.
|
||||||
* image source options.
|
|
||||||
*/
|
*/
|
||||||
ol.source.ImageSource = function(options) {
|
ol.source.ImageSource = function(options) {
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
goog.provide('ol.source.ImageTileSource');
|
goog.provide('ol.source.ImageTileSource');
|
||||||
goog.provide('ol.source.ImageTileSourceOptions');
|
|
||||||
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('ol.Attribution');
|
goog.require('ol.Attribution');
|
||||||
@@ -26,14 +25,14 @@ goog.require('ol.tilegrid.TileGrid');
|
|||||||
* tileGrid: (ol.tilegrid.TileGrid|undefined),
|
* tileGrid: (ol.tilegrid.TileGrid|undefined),
|
||||||
* tileUrlFunction: (ol.TileUrlFunctionType|undefined)}}
|
* tileUrlFunction: (ol.TileUrlFunctionType|undefined)}}
|
||||||
*/
|
*/
|
||||||
ol.source.ImageTileSourceOptions;
|
ol.source.ImageTileOptions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.TileSource}
|
* @extends {ol.source.TileSource}
|
||||||
* @param {ol.source.ImageTileSourceOptions} options Options.
|
* @param {ol.source.ImageTileOptions} options Image tile options.
|
||||||
*/
|
*/
|
||||||
ol.source.ImageTileSource = function(options) {
|
ol.source.ImageTileSource = function(options) {
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ goog.require('ol.projection');
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {goog.events.EventTarget}
|
* @extends {goog.events.EventTarget}
|
||||||
* @param {ol.source.SourceOptions} sourceOptions Source options.
|
* @param {ol.source.SourceOptions} options Source options.
|
||||||
*/
|
*/
|
||||||
ol.source.Source = function(sourceOptions) {
|
ol.source.Source = function(options) {
|
||||||
|
|
||||||
goog.base(this);
|
goog.base(this);
|
||||||
|
|
||||||
@@ -22,28 +22,28 @@ ol.source.Source = function(sourceOptions) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ol.Projection}
|
* @type {ol.Projection}
|
||||||
*/
|
*/
|
||||||
this.projection_ = ol.projection.get(sourceOptions.projection);
|
this.projection_ = ol.projection.get(options.projection);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {ol.Extent}
|
* @type {ol.Extent}
|
||||||
*/
|
*/
|
||||||
this.extent_ = goog.isDef(sourceOptions.extent) ?
|
this.extent_ = goog.isDef(options.extent) ?
|
||||||
sourceOptions.extent : goog.isDef(sourceOptions.projection) ?
|
options.extent : goog.isDef(options.projection) ?
|
||||||
this.projection_.getExtent() : null;
|
this.projection_.getExtent() : null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Array.<ol.Attribution>}
|
* @type {Array.<ol.Attribution>}
|
||||||
*/
|
*/
|
||||||
this.attributions_ = goog.isDef(sourceOptions.attributions) ?
|
this.attributions_ = goog.isDef(options.attributions) ?
|
||||||
sourceOptions.attributions : null;
|
options.attributions : null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {string|undefined}
|
* @type {string|undefined}
|
||||||
*/
|
*/
|
||||||
this.logo_ = sourceOptions.logo;
|
this.logo_ = options.logo;
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.source.Source, goog.events.EventTarget);
|
goog.inherits(ol.source.Source, goog.events.EventTarget);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ ol.source.STAMEN_ATTRIBUTIONS = [new ol.Attribution(
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.XYZ}
|
* @extends {ol.source.XYZ}
|
||||||
* @param {ol.source.StamenOptions} options Options.
|
* @param {ol.source.StamenOptions} options Stamen options.
|
||||||
*/
|
*/
|
||||||
ol.source.Stamen = function(options) {
|
ol.source.Stamen = function(options) {
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ goog.require('ol.source.ImageSource');
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.ImageSource}
|
* @extends {ol.source.ImageSource}
|
||||||
* @param {ol.source.StaticImageOptions} options Options.
|
* @param {ol.source.StaticImageOptions} options Static image options.
|
||||||
*/
|
*/
|
||||||
ol.source.StaticImage = function(options) {
|
ol.source.StaticImage = function(options) {
|
||||||
|
|
||||||
|
|||||||
@@ -15,32 +15,32 @@ goog.require('ol.source.wms');
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.ImageTileSource}
|
* @extends {ol.source.ImageTileSource}
|
||||||
* @param {ol.source.TiledWMSOptions} tiledWMSOptions options.
|
* @param {ol.source.TiledWMSOptions} options Tiled WMS options.
|
||||||
*/
|
*/
|
||||||
ol.source.TiledWMS = function(tiledWMSOptions) {
|
ol.source.TiledWMS = function(options) {
|
||||||
var tileGrid;
|
var tileGrid;
|
||||||
if (goog.isDef(tiledWMSOptions.tileGrid)) {
|
if (goog.isDef(options.tileGrid)) {
|
||||||
tileGrid = tiledWMSOptions.tileGrid;
|
tileGrid = options.tileGrid;
|
||||||
}
|
}
|
||||||
|
|
||||||
var tileUrlFunction = ol.TileUrlFunction.nullTileUrlFunction;
|
var tileUrlFunction = ol.TileUrlFunction.nullTileUrlFunction;
|
||||||
var urls = tiledWMSOptions.urls;
|
var urls = options.urls;
|
||||||
if (!goog.isDef(urls) && goog.isDef(tiledWMSOptions.url)) {
|
if (!goog.isDef(urls) && goog.isDef(options.url)) {
|
||||||
urls = ol.TileUrlFunction.expandUrl(tiledWMSOptions.url);
|
urls = ol.TileUrlFunction.expandUrl(options.url);
|
||||||
}
|
}
|
||||||
if (goog.isDef(urls)) {
|
if (goog.isDef(urls)) {
|
||||||
var tileUrlFunctions = goog.array.map(
|
var tileUrlFunctions = goog.array.map(
|
||||||
urls, function(url) {
|
urls, function(url) {
|
||||||
return ol.TileUrlFunction.createFromParamsFunction(
|
return ol.TileUrlFunction.createFromParamsFunction(
|
||||||
url, tiledWMSOptions.params, ol.source.wms.getUrl);
|
url, options.params, ol.source.wms.getUrl);
|
||||||
});
|
});
|
||||||
tileUrlFunction = ol.TileUrlFunction.createFromTileUrlFunctions(
|
tileUrlFunction = ol.TileUrlFunction.createFromTileUrlFunctions(
|
||||||
tileUrlFunctions);
|
tileUrlFunctions);
|
||||||
}
|
}
|
||||||
|
|
||||||
var transparent = goog.isDef(tiledWMSOptions.params['TRANSPARENT']) ?
|
var transparent = goog.isDef(options.params['TRANSPARENT']) ?
|
||||||
tiledWMSOptions.params['TRANSPARENT'] : true;
|
options.params['TRANSPARENT'] : true;
|
||||||
var extent = tiledWMSOptions.extent;
|
var extent = options.extent;
|
||||||
|
|
||||||
var tileCoordTransform = function(tileCoord, projection) {
|
var tileCoordTransform = function(tileCoord, projection) {
|
||||||
var tileGrid = this.getTileGrid();
|
var tileGrid = this.getTileGrid();
|
||||||
@@ -72,12 +72,12 @@ ol.source.TiledWMS = function(tiledWMSOptions) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
attributions: tiledWMSOptions.attributions,
|
attributions: options.attributions,
|
||||||
crossOrigin: tiledWMSOptions.crossOrigin,
|
crossOrigin: options.crossOrigin,
|
||||||
extent: extent,
|
extent: extent,
|
||||||
tileGrid: tiledWMSOptions.tileGrid,
|
tileGrid: options.tileGrid,
|
||||||
opaque: !transparent,
|
opaque: !transparent,
|
||||||
projection: tiledWMSOptions.projection,
|
projection: options.projection,
|
||||||
tileUrlFunction: ol.TileUrlFunction.withTileCoordTransform(
|
tileUrlFunction: ol.TileUrlFunction.withTileCoordTransform(
|
||||||
tileCoordTransform, tileUrlFunction)
|
tileCoordTransform, tileUrlFunction)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -42,12 +42,12 @@ goog.exportSymbol('grid', grid);
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.ImageTileSource}
|
* @extends {ol.source.ImageTileSource}
|
||||||
* @param {ol.source.TileJSONOptions} tileJsonOptions TileJSON optios.
|
* @param {ol.source.TileJSONOptions} options TileJSON options.
|
||||||
*/
|
*/
|
||||||
ol.source.TileJSON = function(tileJsonOptions) {
|
ol.source.TileJSON = function(options) {
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
crossOrigin: tileJsonOptions.crossOrigin,
|
crossOrigin: options.crossOrigin,
|
||||||
projection: ol.projection.get('EPSG:3857')
|
projection: ol.projection.get('EPSG:3857')
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -61,8 +61,7 @@ ol.source.TileJSON = function(tileJsonOptions) {
|
|||||||
* @private
|
* @private
|
||||||
* @type {!goog.async.Deferred}
|
* @type {!goog.async.Deferred}
|
||||||
*/
|
*/
|
||||||
this.deferred_ =
|
this.deferred_ = goog.net.jsloader.load(options.url, {cleanupWhenDone: true});
|
||||||
goog.net.jsloader.load(tileJsonOptions.url, {cleanupWhenDone: true});
|
|
||||||
this.deferred_.addCallback(this.handleTileJSONResponse, this);
|
this.deferred_.addCallback(this.handleTileJSONResponse, this);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,30 +26,28 @@ ol.source.TileSourceOptions;
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.Source}
|
* @extends {ol.source.Source}
|
||||||
* @param {ol.source.TileSourceOptions} tileSourceOptions Tile source options.
|
* @param {ol.source.TileSourceOptions} options Tile source options.
|
||||||
*/
|
*/
|
||||||
ol.source.TileSource = function(tileSourceOptions) {
|
ol.source.TileSource = function(options) {
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
attributions: tileSourceOptions.attributions,
|
attributions: options.attributions,
|
||||||
extent: tileSourceOptions.extent,
|
extent: options.extent,
|
||||||
logo: tileSourceOptions.logo,
|
logo: options.logo,
|
||||||
projection: tileSourceOptions.projection
|
projection: options.projection
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
this.opaque_ = goog.isDef(tileSourceOptions.opaque) ?
|
this.opaque_ = goog.isDef(options.opaque) ? options.opaque : false;
|
||||||
tileSourceOptions.opaque : false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @protected
|
* @protected
|
||||||
* @type {ol.tilegrid.TileGrid}
|
* @type {ol.tilegrid.TileGrid}
|
||||||
*/
|
*/
|
||||||
this.tileGrid = goog.isDef(tileSourceOptions.tileGrid) ?
|
this.tileGrid = goog.isDef(options.tileGrid) ? options.tileGrid : null;
|
||||||
tileSourceOptions.tileGrid : null;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
goog.inherits(ol.source.TileSource, ol.source.Source);
|
goog.inherits(ol.source.TileSource, ol.source.Source);
|
||||||
|
|||||||
@@ -27,32 +27,30 @@ ol.source.WMTSRequestEncoding = {
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.ImageTileSource}
|
* @extends {ol.source.ImageTileSource}
|
||||||
* @param {ol.source.WMTSOptions} wmtsOptions WMTS options.
|
* @param {ol.source.WMTSOptions} options WMTS options.
|
||||||
*/
|
*/
|
||||||
ol.source.WMTS = function(wmtsOptions) {
|
ol.source.WMTS = function(options) {
|
||||||
|
|
||||||
// TODO: add support for TileMatrixLimits
|
// TODO: add support for TileMatrixLimits
|
||||||
|
|
||||||
var version = goog.isDef(wmtsOptions.version) ?
|
var version = goog.isDef(options.version) ? options.version : '1.0.0';
|
||||||
wmtsOptions.version : '1.0.0';
|
var format = goog.isDef(options.format) ? options.format : 'image/jpeg';
|
||||||
var format = goog.isDef(wmtsOptions.format) ?
|
var dimensions = options.dimensions || {};
|
||||||
wmtsOptions.format : 'image/jpeg';
|
|
||||||
var dimensions = wmtsOptions.dimensions || {};
|
|
||||||
|
|
||||||
// FIXME: should we guess this requestEncoding from wmtsOptions.url(s)
|
// FIXME: should we guess this requestEncoding from options.url(s)
|
||||||
// structure? that would mean KVP only if a template is not provided.
|
// structure? that would mean KVP only if a template is not provided.
|
||||||
var requestEncoding = goog.isDef(wmtsOptions.requestEncoding) ?
|
var requestEncoding = goog.isDef(options.requestEncoding) ?
|
||||||
wmtsOptions.requestEncoding : ol.source.WMTSRequestEncoding.KVP;
|
options.requestEncoding : ol.source.WMTSRequestEncoding.KVP;
|
||||||
|
|
||||||
// FIXME: should we create a default tileGrid?
|
// FIXME: should we create a default tileGrid?
|
||||||
// we could issue a getCapabilities xhr to retrieve missing configuration
|
// we could issue a getCapabilities xhr to retrieve missing configuration
|
||||||
var tileGrid = wmtsOptions.tileGrid;
|
var tileGrid = options.tileGrid;
|
||||||
|
|
||||||
var context = {
|
var context = {
|
||||||
'Layer': wmtsOptions.layer,
|
'Layer': options.layer,
|
||||||
'style': wmtsOptions.style,
|
'style': options.style,
|
||||||
'Style': wmtsOptions.style,
|
'Style': options.style,
|
||||||
'TileMatrixSet': wmtsOptions.matrixSet
|
'TileMatrixSet': options.matrixSet
|
||||||
};
|
};
|
||||||
goog.object.extend(context, dimensions);
|
goog.object.extend(context, dimensions);
|
||||||
var kvpParams;
|
var kvpParams;
|
||||||
@@ -98,9 +96,9 @@ ol.source.WMTS = function(wmtsOptions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var tileUrlFunction = ol.TileUrlFunction.nullTileUrlFunction;
|
var tileUrlFunction = ol.TileUrlFunction.nullTileUrlFunction;
|
||||||
var urls = wmtsOptions.urls;
|
var urls = options.urls;
|
||||||
if (!goog.isDef(urls) && goog.isDef(wmtsOptions.url)) {
|
if (!goog.isDef(urls) && goog.isDef(options.url)) {
|
||||||
urls = ol.TileUrlFunction.expandUrl(wmtsOptions.url);
|
urls = ol.TileUrlFunction.expandUrl(options.url);
|
||||||
}
|
}
|
||||||
if (goog.isDef(urls)) {
|
if (goog.isDef(urls)) {
|
||||||
tileUrlFunction = ol.TileUrlFunction.createFromTileUrlFunctions(
|
tileUrlFunction = ol.TileUrlFunction.createFromTileUrlFunctions(
|
||||||
@@ -126,8 +124,8 @@ ol.source.WMTS = function(wmtsOptions) {
|
|||||||
var y = -tileCoord.y - 1;
|
var y = -tileCoord.y - 1;
|
||||||
var tileExtent = tileGrid.getTileCoordExtent(tileCoord);
|
var tileExtent = tileGrid.getTileCoordExtent(tileCoord);
|
||||||
var projectionExtent = projection.getExtent();
|
var projectionExtent = projection.getExtent();
|
||||||
var extent = goog.isDef(wmtsOptions.extent) ?
|
var extent = goog.isDef(options.extent) ?
|
||||||
wmtsOptions.extent : projectionExtent;
|
options.extent : projectionExtent;
|
||||||
|
|
||||||
if (!goog.isNull(extent) && projection.isGlobal() &&
|
if (!goog.isNull(extent) && projection.isGlobal() &&
|
||||||
extent.minX === projectionExtent.minX &&
|
extent.minX === projectionExtent.minX &&
|
||||||
@@ -147,10 +145,10 @@ ol.source.WMTS = function(wmtsOptions) {
|
|||||||
tileUrlFunction);
|
tileUrlFunction);
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
attributions: wmtsOptions.attributions,
|
attributions: options.attributions,
|
||||||
crossOrigin: wmtsOptions.crossOrigin,
|
crossOrigin: options.crossOrigin,
|
||||||
extent: wmtsOptions.extent,
|
extent: options.extent,
|
||||||
projection: wmtsOptions.projection,
|
projection: options.projection,
|
||||||
tileGrid: tileGrid,
|
tileGrid: tileGrid,
|
||||||
tileUrlFunction: tileUrlFunction
|
tileUrlFunction: tileUrlFunction
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -33,38 +33,37 @@ ol.source.XYZOptions;
|
|||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.source.ImageTileSource}
|
* @extends {ol.source.ImageTileSource}
|
||||||
* @param {ol.source.XYZOptions} xyzOptions XYZ options.
|
* @param {ol.source.XYZOptions} options XYZ options.
|
||||||
*/
|
*/
|
||||||
ol.source.XYZ = function(xyzOptions) {
|
ol.source.XYZ = function(options) {
|
||||||
|
|
||||||
var projection = xyzOptions.projection ||
|
var projection = options.projection || ol.projection.get('EPSG:3857');
|
||||||
ol.projection.get('EPSG:3857');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {ol.TileUrlFunctionType}
|
* @type {ol.TileUrlFunctionType}
|
||||||
*/
|
*/
|
||||||
var tileUrlFunction = ol.TileUrlFunction.nullTileUrlFunction;
|
var tileUrlFunction = ol.TileUrlFunction.nullTileUrlFunction;
|
||||||
// FIXME use goog.nullFunction ?
|
// FIXME use goog.nullFunction ?
|
||||||
if (goog.isDef(xyzOptions.tileUrlFunction)) {
|
if (goog.isDef(options.tileUrlFunction)) {
|
||||||
tileUrlFunction = xyzOptions.tileUrlFunction;
|
tileUrlFunction = options.tileUrlFunction;
|
||||||
} else if (goog.isDef(xyzOptions.urls)) {
|
} else if (goog.isDef(options.urls)) {
|
||||||
tileUrlFunction = ol.TileUrlFunction.createFromTemplates(xyzOptions.urls);
|
tileUrlFunction = ol.TileUrlFunction.createFromTemplates(options.urls);
|
||||||
} else if (goog.isDef(xyzOptions.url)) {
|
} else if (goog.isDef(options.url)) {
|
||||||
tileUrlFunction = ol.TileUrlFunction.createFromTemplates(
|
tileUrlFunction = ol.TileUrlFunction.createFromTemplates(
|
||||||
ol.TileUrlFunction.expandUrl(xyzOptions.url));
|
ol.TileUrlFunction.expandUrl(options.url));
|
||||||
}
|
}
|
||||||
|
|
||||||
var tileGrid = new ol.tilegrid.XYZ({
|
var tileGrid = new ol.tilegrid.XYZ({
|
||||||
maxZoom: xyzOptions.maxZoom
|
maxZoom: options.maxZoom
|
||||||
});
|
});
|
||||||
|
|
||||||
// FIXME factor out common code
|
// FIXME factor out common code
|
||||||
var extent = xyzOptions.extent;
|
var extent = options.extent;
|
||||||
if (goog.isDefAndNotNull(extent)) {
|
if (goog.isDefAndNotNull(extent)) {
|
||||||
|
|
||||||
tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform(
|
tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform(
|
||||||
function(tileCoord) {
|
function(tileCoord) {
|
||||||
if (xyzOptions.maxZoom < tileCoord.z) {
|
if (options.maxZoom < tileCoord.z) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var n = 1 << tileCoord.z;
|
var n = 1 << tileCoord.z;
|
||||||
@@ -87,7 +86,7 @@ ol.source.XYZ = function(xyzOptions) {
|
|||||||
|
|
||||||
tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform(
|
tileUrlFunction = ol.TileUrlFunction.withTileCoordTransform(
|
||||||
function(tileCoord) {
|
function(tileCoord) {
|
||||||
if (xyzOptions.maxZoom < tileCoord.z) {
|
if (options.maxZoom < tileCoord.z) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
var n = 1 << tileCoord.z;
|
var n = 1 << tileCoord.z;
|
||||||
@@ -103,10 +102,10 @@ ol.source.XYZ = function(xyzOptions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
goog.base(this, {
|
goog.base(this, {
|
||||||
attributions: xyzOptions.attributions,
|
attributions: options.attributions,
|
||||||
crossOrigin: xyzOptions.crossOrigin,
|
crossOrigin: options.crossOrigin,
|
||||||
extent: xyzOptions.extent,
|
extent: options.extent,
|
||||||
logo: xyzOptions.logo,
|
logo: options.logo,
|
||||||
projection: projection,
|
projection: projection,
|
||||||
tileGrid: tileGrid,
|
tileGrid: tileGrid,
|
||||||
tileUrlFunction: tileUrlFunction
|
tileUrlFunction: tileUrlFunction
|
||||||
|
|||||||
Reference in New Issue
Block a user