Add imageLoadFunction option to ol.source.ImageMapGuide

This commit is contained in:
Andreas Hocevar
2014-10-29 20:08:55 +01:00
parent f5761daa61
commit 46870456ac
2 changed files with 11 additions and 1 deletions
+1
View File
@@ -3863,6 +3863,7 @@ olx.source.IGCOptions.prototype.urls;
* projection: ol.proj.ProjectionLike, * projection: ol.proj.ProjectionLike,
* ratio: (number|undefined), * ratio: (number|undefined),
* resolutions: (Array.<number>|undefined), * resolutions: (Array.<number>|undefined),
* imageLoadFunction: (ol.ImageLoadFunctionType|undefined),
* params: (Object|undefined)}} * params: (Object|undefined)}}
* @api * @api
*/ */
+10 -1
View File
@@ -3,6 +3,7 @@ goog.provide('ol.source.ImageMapGuide');
goog.require('goog.object'); goog.require('goog.object');
goog.require('goog.uri.utils'); goog.require('goog.uri.utils');
goog.require('ol.Image'); goog.require('ol.Image');
goog.require('ol.ImageLoadFunctionType');
goog.require('ol.ImageUrlFunction'); goog.require('ol.ImageUrlFunction');
goog.require('ol.extent'); goog.require('ol.extent');
goog.require('ol.source.Image'); goog.require('ol.source.Image');
@@ -59,6 +60,13 @@ ol.source.ImageMapGuide = function(options) {
*/ */
this.imageUrlFunction_ = imageUrlFunction; this.imageUrlFunction_ = imageUrlFunction;
/**
* @private
* @type {ol.ImageLoadFunctionType}
*/
this.imageLoadFunction_ = goog.isDef(options.imageLoadFunction) ?
options.imageLoadFunction : ol.source.Image.defaultImageLoadFunction;
/** /**
* @private * @private
* @type {boolean} * @type {boolean}
@@ -140,7 +148,8 @@ ol.source.ImageMapGuide.prototype.getImage =
var imageUrl = this.imageUrlFunction_(extent, size, projection); var imageUrl = this.imageUrlFunction_(extent, size, projection);
if (goog.isDef(imageUrl)) { if (goog.isDef(imageUrl)) {
image = new ol.Image(extent, resolution, pixelRatio, image = new ol.Image(extent, resolution, pixelRatio,
this.getAttributions(), imageUrl, this.crossOrigin_); this.getAttributions(), imageUrl, this.crossOrigin_,
this.imageLoadFunction_);
} else { } else {
image = null; image = null;
} }