Remove ol.ImageUrlFunction
This was only used in ol.source.ImageMapGuide, and added unnecessary overhead there.
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
goog.provide('ol.ImageUrlFunction');
|
||||
goog.provide('ol.ImageUrlFunctionType');
|
||||
|
||||
goog.require('ol.Size');
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {function(this:ol.source.Image, ol.Extent, ol.Size,
|
||||
* ol.proj.Projection): (string|undefined)}
|
||||
*/
|
||||
ol.ImageUrlFunctionType;
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} baseUrl Base URL (may have query data).
|
||||
* @param {Object.<string,*>} params to encode in the URL.
|
||||
* @param {function(string, Object.<string,*>, ol.Extent, ol.Size,
|
||||
* ol.proj.Projection): (string|undefined)} paramsFunction params function.
|
||||
* @return {ol.ImageUrlFunctionType} Image URL function.
|
||||
*/
|
||||
ol.ImageUrlFunction.createFromParamsFunction =
|
||||
function(baseUrl, params, paramsFunction) {
|
||||
return (
|
||||
/**
|
||||
* @this {ol.source.Image}
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {ol.Size} size Size.
|
||||
* @param {ol.proj.Projection} projection Projection.
|
||||
* @return {string|undefined} URL.
|
||||
*/
|
||||
function(extent, size, projection) {
|
||||
return paramsFunction(baseUrl, params, extent, size, projection);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @this {ol.source.Image}
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {ol.Size} size Size.
|
||||
* @return {string|undefined} Image URL.
|
||||
*/
|
||||
ol.ImageUrlFunction.nullImageUrlFunction =
|
||||
function(extent, size) {
|
||||
return undefined;
|
||||
};
|
||||
@@ -6,7 +6,6 @@ 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');
|
||||
|
||||
@@ -49,19 +48,11 @@ ol.source.ImageMapGuide = function(options) {
|
||||
*/
|
||||
this.params_ = options.params !== undefined ? options.params : {};
|
||||
|
||||
var imageUrlFunction;
|
||||
if (options.url !== undefined) {
|
||||
imageUrlFunction = ol.ImageUrlFunction.createFromParamsFunction(
|
||||
options.url, this.params_, goog.bind(this.getUrl, this));
|
||||
} else {
|
||||
imageUrlFunction = ol.ImageUrlFunction.nullImageUrlFunction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.ImageUrlFunctionType}
|
||||
* @type {string|undefined}
|
||||
*/
|
||||
this.imageUrlFunction_ = imageUrlFunction;
|
||||
this.url_ = options.url;
|
||||
|
||||
/**
|
||||
* @private
|
||||
@@ -148,8 +139,9 @@ ol.source.ImageMapGuide.prototype.getImageInternal =
|
||||
var height = ol.extent.getHeight(extent) / resolution;
|
||||
var size = [width * pixelRatio, height * pixelRatio];
|
||||
|
||||
var imageUrl = this.imageUrlFunction_(extent, size, projection);
|
||||
if (imageUrl !== undefined) {
|
||||
if (this.url_ !== undefined) {
|
||||
var imageUrl = this.getUrl(this.url_, this.params_, extent, size,
|
||||
projection);
|
||||
image = new ol.Image(extent, resolution, pixelRatio,
|
||||
this.getAttributions(), imageUrl, this.crossOrigin_,
|
||||
this.imageLoadFunction_);
|
||||
|
||||
Reference in New Issue
Block a user