Allow tileLoadFunction override for ol.source.MapQuestOSM and MapQuestOpenAerial

This commit is contained in:
Frederic Junod
2013-09-24 15:54:53 +02:00
parent 9fcd057c1e
commit 907e796b55
2 changed files with 16 additions and 2 deletions

View File

@@ -496,6 +496,12 @@
* function to load a tile given a URL. * 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 * @typedef {Object} ol.source.TileDebugOptions
* @property {ol.Extent|undefined} extent Extent. * @property {ol.Extent|undefined} extent Extent.

View File

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