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

View File

@@ -3,6 +3,7 @@ goog.provide('ol.source.ImageMapGuide');
goog.require('goog.object');
goog.require('goog.uri.utils');
goog.require('ol.Image');
goog.require('ol.ImageLoadFunctionType');
goog.require('ol.ImageUrlFunction');
goog.require('ol.extent');
goog.require('ol.source.Image');
@@ -59,6 +60,13 @@ ol.source.ImageMapGuide = function(options) {
*/
this.imageUrlFunction_ = imageUrlFunction;
/**
* @private
* @type {ol.ImageLoadFunctionType}
*/
this.imageLoadFunction_ = goog.isDef(options.imageLoadFunction) ?
options.imageLoadFunction : ol.source.Image.defaultImageLoadFunction;
/**
* @private
* @type {boolean}
@@ -140,7 +148,8 @@ ol.source.ImageMapGuide.prototype.getImage =
var imageUrl = this.imageUrlFunction_(extent, size, projection);
if (goog.isDef(imageUrl)) {
image = new ol.Image(extent, resolution, pixelRatio,
this.getAttributions(), imageUrl, this.crossOrigin_);
this.getAttributions(), imageUrl, this.crossOrigin_,
this.imageLoadFunction_);
} else {
image = null;
}