Image source refactoring
This commit is contained in:
@@ -5,23 +5,16 @@ goog.require('goog.asserts');
|
||||
goog.require('ol.Attribution');
|
||||
goog.require('ol.Extent');
|
||||
goog.require('ol.Image');
|
||||
goog.require('ol.ImageUrlFunction');
|
||||
goog.require('ol.ImageUrlFunctionType');
|
||||
goog.require('ol.Size');
|
||||
goog.require('ol.array');
|
||||
goog.require('ol.source.Source');
|
||||
|
||||
|
||||
/**
|
||||
* @typedef {{attributions: (Array.<ol.Attribution>|undefined),
|
||||
* crossOrigin: (null|string|undefined),
|
||||
* extent: (null|ol.Extent|undefined),
|
||||
* logo: (string|undefined),
|
||||
* projection: ol.proj.ProjectionLike,
|
||||
* resolutions: (Array.<number>|undefined),
|
||||
* imageUrlFunction: (ol.ImageUrlFunctionType|
|
||||
* undefined)}}
|
||||
* @todo stability experimental
|
||||
* resolutions: (Array.<number>|undefined)}}
|
||||
*/
|
||||
ol.source.ImageOptions;
|
||||
|
||||
@@ -42,22 +35,6 @@ ol.source.Image = function(options) {
|
||||
projection: options.projection
|
||||
});
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {ol.ImageUrlFunctionType}
|
||||
*/
|
||||
this.imageUrlFunction =
|
||||
goog.isDef(options.imageUrlFunction) ?
|
||||
options.imageUrlFunction :
|
||||
ol.ImageUrlFunction.nullImageUrlFunction;
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @type {?string}
|
||||
*/
|
||||
this.crossOrigin =
|
||||
goog.isDef(options.crossOrigin) ? options.crossOrigin : null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Array.<number>}
|
||||
@@ -75,24 +52,10 @@ goog.inherits(ol.source.Image, ol.source.Source);
|
||||
|
||||
|
||||
/**
|
||||
* @protected
|
||||
* @param {ol.Extent} extent Extent.
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {ol.Size} size Size.
|
||||
* @param {ol.proj.Projection} projection Projection.
|
||||
* @return {ol.Image} Single image.
|
||||
* @return {Array.<number>} Resolutions.
|
||||
*/
|
||||
ol.source.Image.prototype.createImage =
|
||||
function(extent, resolution, pixelRatio, size, projection) {
|
||||
var image = null;
|
||||
var imageUrl = this.imageUrlFunction(extent, size, projection);
|
||||
if (goog.isDef(imageUrl)) {
|
||||
image = new ol.Image(
|
||||
extent, resolution, pixelRatio, imageUrl, this.crossOrigin,
|
||||
this.getAttributions());
|
||||
}
|
||||
return image;
|
||||
ol.source.Image.prototype.getResolutions = function() {
|
||||
return this.resolutions_;
|
||||
};
|
||||
|
||||
|
||||
@@ -116,6 +79,6 @@ ol.source.Image.prototype.findNearestResolution =
|
||||
* @param {number} resolution Resolution.
|
||||
* @param {number} pixelRatio Pixel ratio.
|
||||
* @param {ol.proj.Projection} projection Projection.
|
||||
* @return {ol.Image} Single image.
|
||||
* @return {ol.ImageBase} Single image.
|
||||
*/
|
||||
ol.source.Image.prototype.getImage = goog.abstractMethod;
|
||||
|
||||
Reference in New Issue
Block a user