From dd509ed39effb2b08fbeb858d9f198e7230a2430 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 23 Sep 2013 12:35:46 +0200 Subject: [PATCH 1/7] Allow tileLoadFunction override for ol.source.OSM --- src/objectliterals.jsdoc | 2 ++ src/ol/source/osmsource.js | 1 + 2 files changed, 3 insertions(+) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 289dedd51f..3e18a80b06 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -506,6 +506,8 @@ * @property {ol.Attribution|undefined} attribution Attribution. * @property {Array.|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. */ diff --git a/src/ol/source/osmsource.js b/src/ol/source/osmsource.js index cab05acca9..808a172555 100644 --- a/src/ol/source/osmsource.js +++ b/src/ol/source/osmsource.js @@ -31,6 +31,7 @@ ol.source.OSM = function(opt_options) { crossOrigin: 'anonymous', opaque: true, maxZoom: options.maxZoom, + tileLoadFunction: options.tileLoadFunction, url: url }); From 5a99adfc68e952162852c7f8f9cc7f095032c329 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 23 Sep 2013 13:34:53 +0200 Subject: [PATCH 2/7] Allow tileLoadFunction override for ol.source.BingMaps --- src/objectliterals.jsdoc | 2 ++ src/ol/source/bingmapssource.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 3e18a80b06..8ba484fc00 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -492,6 +492,8 @@ * @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. */ /** diff --git a/src/ol/source/bingmapssource.js b/src/ol/source/bingmapssource.js index 7b75a68b3c..29b3b456ea 100644 --- a/src/ol/source/bingmapssource.js +++ b/src/ol/source/bingmapssource.js @@ -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 }); /** From 331005468c0961268b9b2a6918345d9ca47a69fd Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 23 Sep 2013 13:40:48 +0200 Subject: [PATCH 3/7] Allow tileLoadFunction override for ol.source.TileJSON --- src/objectliterals.jsdoc | 2 ++ src/ol/source/tilejsonsource.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 8ba484fc00..95ef1cdc0d 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -559,6 +559,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. */ diff --git a/src/ol/source/tilejsonsource.js b/src/ol/source/tilejsonsource.js index 9d790cb942..879e68d4a5 100644 --- a/src/ol/source/tilejsonsource.js +++ b/src/ol/source/tilejsonsource.js @@ -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 }); /** From 980d3116801543ce5c9a5684602101db0710411b Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 23 Sep 2013 13:43:45 +0200 Subject: [PATCH 4/7] Allow tileLoadFunction override for ol.source.TileWMS --- src/objectliterals.jsdoc | 2 ++ src/ol/source/tilewmssource.js | 1 + 2 files changed, 3 insertions(+) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 95ef1cdc0d..e8891aa9fb 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -579,6 +579,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.|undefined} urls WMS service urls. Use this instead * of `url` when the WMS supports multiple urls for GetMap requests. diff --git a/src/ol/source/tilewmssource.js b/src/ol/source/tilewmssource.js index 91013494fa..3d7ea4b3cb 100644 --- a/src/ol/source/tilewmssource.js +++ b/src/ol/source/tilewmssource.js @@ -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) }); From 4614a43d48ca6fa958629d3aab5e5e0ea98de1ac Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Mon, 23 Sep 2013 13:46:26 +0200 Subject: [PATCH 5/7] Allow tileLoadFunction override for ol.source.WMTS --- src/objectliterals.jsdoc | 2 ++ src/ol/source/wmtssource.js | 1 + 2 files changed, 3 insertions(+) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index e8891aa9fb..89dcb50726 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -640,6 +640,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.|undefined} urls Urls. */ diff --git a/src/ol/source/wmtssource.js b/src/ol/source/wmtssource.js index 47a64fa2f5..e229d1db9c 100644 --- a/src/ol/source/wmtssource.js +++ b/src/ol/source/wmtssource.js @@ -179,6 +179,7 @@ ol.source.WMTS = function(options) { extent: options.extent, projection: options.projection, tileGrid: tileGrid, + tileLoadFunction: options.tileLoadFunction, tileUrlFunction: tileUrlFunction }); From 9fcd057c1e9beb66941657143cbf2a62f375eefc Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 24 Sep 2013 09:31:31 +0200 Subject: [PATCH 6/7] Allow tileLoadFunction override for ol.source.Stamen --- src/objectliterals.jsdoc | 2 ++ src/ol/source/stamensource.js | 1 + 2 files changed, 3 insertions(+) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 89dcb50726..fa3742c684 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -540,6 +540,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. */ diff --git a/src/ol/source/stamensource.js b/src/ol/source/stamensource.js index 1486aa0d98..27bc6eb90e 100644 --- a/src/ol/source/stamensource.js +++ b/src/ol/source/stamensource.js @@ -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 }); From 907e796b5528f0dfc7e6cebee596c86814fd97f9 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 24 Sep 2013 15:54:53 +0200 Subject: [PATCH 7/7] Allow tileLoadFunction override for ol.source.MapQuestOSM and MapQuestOpenAerial --- src/objectliterals.jsdoc | 6 ++++++ src/ol/source/mapquestsource.js | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index fa3742c684..f6eea86b90 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -496,6 +496,12 @@ * 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. + */ + /** * @typedef {Object} ol.source.TileDebugOptions * @property {ol.Extent|undefined} extent Extent. diff --git a/src/ol/source/mapquestsource.js b/src/ol/source/mapquestsource.js index c7b2bce931..fb5b60f5a0 100644 --- a/src/ol/source/mapquestsource.js +++ b/src/ol/source/mapquestsource.js @@ -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' });