Merge pull request #1044 from fredj/tileLoadFunction_override

Allow tile load override for all ol.source.TileImage based classes
This commit is contained in:
Frédéric Junod
2013-09-26 03:36:31 -07:00
8 changed files with 36 additions and 4 deletions

View File

@@ -492,6 +492,14 @@
* @property {string} key Bing Maps API key. Get yours at
* http://bingmapsportal.com/.
* @property {string} style Style.
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
* function to load a tile given a URL.
*/
/**
* @typedef {Object} ol.source.MapQuestOptions
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
* function to load a tile given a URL.
*/
/**
@@ -506,6 +514,8 @@
* @property {ol.Attribution|undefined} attribution Attribution.
* @property {Array.<ol.Attribution>|undefined} attributions Attributions.
* @property {number|undefined} maxZoom Max zoom.
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
* function to load a tile given a URL.
* @property {string|undefined} url URL.
*/
@@ -536,6 +546,8 @@
* @property {number|undefined} minZoom Minimum zoom.
* @property {number|undefined} maxZoom Maximum zoom.
* @property {boolean|undefined} opaque Whether the layer is opaque.
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
* function to load a tile given a URL.
* @property {string|undefined} url URL.
*/
@@ -555,6 +567,8 @@
* @typedef {Object} ol.source.TileJSONOptions
* @property {null|string|undefined} crossOrigin crossOriin setting for image
* requests.
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
* function to load a tile given a URL.
* @property {string} url URL.
*/
@@ -573,6 +587,8 @@
* @property {ol.tilegrid.TileGrid|undefined} tileGrid Tile grid.
* @property {number|undefined} maxZoom Maximum zoom.
* @property {ol.proj.ProjectionLike} projection Projection.
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
* function to load a tile given a URL.
* @property {string|undefined} url WMS service URL.
* @property {Array.<string>|undefined} urls WMS service urls. Use this instead
* of `url` when the WMS supports multiple urls for GetMap requests.
@@ -632,6 +648,8 @@
* @property {Object|undefined} dimensions Dimensions.
* @property {string|undefined} url URL.
* @property {number|undefined} maxZoom Maximum zoom.
* @property {ol.TileLoadFunctionType|undefined} tileLoadFunction Optional
* function to load a tile given a URL.
* @property {Array.<string>|undefined} urls Urls.
*/

View File

@@ -24,7 +24,8 @@ ol.source.BingMaps = function(options) {
goog.base(this, {
crossOrigin: 'anonymous',
opaque: true,
projection: ol.proj.get('EPSG:3857')
projection: ol.proj.get('EPSG:3857'),
tileLoadFunction: options.tileLoadFunction
});
/**

View File

@@ -10,8 +10,11 @@ goog.require('ol.source.XYZ');
/**
* @constructor
* @extends {ol.source.XYZ}
* @param {ol.source.MapQuestOptions=} opt_options MapQuest options.
*/
ol.source.MapQuestOSM = function() {
ol.source.MapQuestOSM = function(opt_options) {
var options = goog.isDef(opt_options) ? opt_options : {};
var attributions = [
new ol.Attribution({
@@ -27,6 +30,7 @@ ol.source.MapQuestOSM = function() {
logo: 'http://developer.mapquest.com/content/osm/mq_logo.png',
opaque: true,
maxZoom: 28,
tileLoadFunction: options.tileLoadFunction,
url: 'http://otile{1-4}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg'
});
@@ -38,8 +42,11 @@ goog.inherits(ol.source.MapQuestOSM, ol.source.XYZ);
/**
* @constructor
* @extends {ol.source.XYZ}
* @param {ol.source.MapQuestOptions=} opt_options MapQuest options.
*/
ol.source.MapQuestOpenAerial = function() {
ol.source.MapQuestOpenAerial = function(opt_options) {
var options = goog.isDef(opt_options) ? opt_options : {};
var attributions = [
new ol.Attribution({
@@ -58,6 +65,7 @@ ol.source.MapQuestOpenAerial = function() {
logo: 'http://developer.mapquest.com/content/osm/mq_logo.png',
maxZoom: 18,
opaque: true,
tileLoadFunction: options.tileLoadFunction,
url: 'http://oatile{1-4}.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.jpg'
});

View File

@@ -31,6 +31,7 @@ ol.source.OSM = function(opt_options) {
crossOrigin: 'anonymous',
opaque: true,
maxZoom: options.maxZoom,
tileLoadFunction: options.tileLoadFunction,
url: url
});

View File

@@ -103,6 +103,7 @@ ol.source.Stamen = function(options) {
// FIXME uncomment the following when tilegrid supports minZoom
//minZoom: providerConfig.minZoom,
opaque: layerConfig.opaque,
tileLoadFunction: options.tileLoadFunction,
url: url
});

View File

@@ -45,7 +45,8 @@ ol.source.TileJSON = function(options) {
goog.base(this, {
crossOrigin: options.crossOrigin,
projection: ol.proj.get('EPSG:3857')
projection: ol.proj.get('EPSG:3857'),
tileLoadFunction: options.tileLoadFunction
});
/**

View File

@@ -98,6 +98,7 @@ ol.source.TileWMS = function(options) {
tileGrid: options.tileGrid,
opaque: !transparent,
projection: options.projection,
tileLoadFunction: options.tileLoadFunction,
tileUrlFunction: ol.TileUrlFunction.withTileCoordTransform(
tileCoordTransform, tileUrlFunction)
});

View File

@@ -179,6 +179,7 @@ ol.source.WMTS = function(options) {
extent: options.extent,
projection: options.projection,
tileGrid: tileGrid,
tileLoadFunction: options.tileLoadFunction,
tileUrlFunction: tileUrlFunction
});