Remove unused context arg for tile.getImage()
This commit is contained in:
@@ -4,7 +4,6 @@ goog.require('ol');
|
||||
goog.require('ol.Tile');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.obj');
|
||||
|
||||
|
||||
/**
|
||||
@@ -80,22 +79,8 @@ ol.ImageTile.prototype.disposeInternal = function() {
|
||||
* @inheritDoc
|
||||
* @api
|
||||
*/
|
||||
ol.ImageTile.prototype.getImage = function(opt_context) {
|
||||
if (opt_context !== undefined) {
|
||||
var image;
|
||||
var key = ol.getUid(opt_context);
|
||||
if (key in this.imageByContext_) {
|
||||
return this.imageByContext_[key];
|
||||
} else if (ol.obj.isEmpty(this.imageByContext_)) {
|
||||
image = this.image_;
|
||||
} else {
|
||||
image = /** @type {Image} */ (this.image_.cloneNode(false));
|
||||
}
|
||||
this.imageByContext_[key] = image;
|
||||
return image;
|
||||
} else {
|
||||
return this.image_;
|
||||
}
|
||||
ol.ImageTile.prototype.getImage = function() {
|
||||
return this.image_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.extent');
|
||||
goog.require('ol.math');
|
||||
goog.require('ol.obj');
|
||||
goog.require('ol.reproj');
|
||||
goog.require('ol.reproj.Triangulation');
|
||||
|
||||
@@ -62,12 +61,6 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid,
|
||||
*/
|
||||
this.canvas_ = null;
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object.<number, HTMLCanvasElement>}
|
||||
*/
|
||||
this.canvasByContext_ = {};
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {ol.tilegrid.TileGrid}
|
||||
@@ -216,22 +209,8 @@ ol.reproj.Tile.prototype.disposeInternal = function() {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.reproj.Tile.prototype.getImage = function(opt_context) {
|
||||
if (opt_context !== undefined) {
|
||||
var image;
|
||||
var key = ol.getUid(opt_context);
|
||||
if (key in this.canvasByContext_) {
|
||||
return this.canvasByContext_[key];
|
||||
} else if (ol.obj.isEmpty(this.canvasByContext_)) {
|
||||
image = this.canvas_;
|
||||
} else {
|
||||
image = /** @type {HTMLCanvasElement} */ (this.canvas_.cloneNode(false));
|
||||
}
|
||||
this.canvasByContext_[key] = image;
|
||||
return image;
|
||||
} else {
|
||||
return this.canvas_;
|
||||
}
|
||||
ol.reproj.Tile.prototype.getImage = function() {
|
||||
return this.canvas_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -79,9 +79,9 @@ ol.source.TileDebug.Tile_ = function(tileCoord, tileSize, text) {
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object.<number, HTMLCanvasElement>}
|
||||
* @type {HTMLCanvasElement}
|
||||
*/
|
||||
this.canvasByContext_ = {};
|
||||
this.canvas_ = null;
|
||||
|
||||
};
|
||||
ol.inherits(ol.source.TileDebug.Tile_, ol.Tile);
|
||||
@@ -89,16 +89,12 @@ ol.inherits(ol.source.TileDebug.Tile_, ol.Tile);
|
||||
|
||||
/**
|
||||
* Get the image element for this tile.
|
||||
* @param {Object=} opt_context Optional context. Only used by the DOM
|
||||
* renderer.
|
||||
* @return {HTMLCanvasElement} Image.
|
||||
*/
|
||||
ol.source.TileDebug.Tile_.prototype.getImage = function(opt_context) {
|
||||
var key = opt_context !== undefined ? ol.getUid(opt_context) : -1;
|
||||
if (key in this.canvasByContext_) {
|
||||
return this.canvasByContext_[key];
|
||||
ol.source.TileDebug.Tile_.prototype.getImage = function() {
|
||||
if (this.canvas_) {
|
||||
return this.canvas_;
|
||||
} else {
|
||||
|
||||
var tileSize = this.tileSize_;
|
||||
var context = ol.dom.createCanvasContext2D(tileSize[0], tileSize[1]);
|
||||
|
||||
@@ -111,8 +107,7 @@ ol.source.TileDebug.Tile_.prototype.getImage = function(opt_context) {
|
||||
context.font = '24px sans-serif';
|
||||
context.fillText(this.text_, tileSize[0] / 2, tileSize[1] / 2);
|
||||
|
||||
this.canvasByContext_[key] = context.canvas;
|
||||
this.canvas_ = context.canvas;
|
||||
return context.canvas;
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
@@ -322,11 +322,9 @@ ol.inherits(ol.source.TileUTFGrid.Tile_, ol.Tile);
|
||||
|
||||
/**
|
||||
* Get the image element for this tile.
|
||||
* @param {Object=} opt_context Optional context. Only used for the DOM
|
||||
* renderer.
|
||||
* @return {Image} Image.
|
||||
*/
|
||||
ol.source.TileUTFGrid.Tile_.prototype.getImage = function(opt_context) {
|
||||
ol.source.TileUTFGrid.Tile_.prototype.getImage = function() {
|
||||
return null;
|
||||
};
|
||||
|
||||
|
||||
@@ -140,10 +140,9 @@ ol.source.Zoomify.Tile_ = function(
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @type {Object.<string,
|
||||
* HTMLCanvasElement|HTMLImageElement|HTMLVideoElement>}
|
||||
* @type {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement}
|
||||
*/
|
||||
this.zoomifyImageByContext_ = {};
|
||||
this.zoomifyImage_ = null;
|
||||
|
||||
};
|
||||
ol.inherits(ol.source.Zoomify.Tile_, ol.ImageTile);
|
||||
@@ -152,27 +151,24 @@ ol.inherits(ol.source.Zoomify.Tile_, ol.ImageTile);
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.source.Zoomify.Tile_.prototype.getImage = function(opt_context) {
|
||||
ol.source.Zoomify.Tile_.prototype.getImage = function() {
|
||||
if (this.zoomifyImage_) {
|
||||
return this.zoomifyImage_;
|
||||
}
|
||||
var tileSize = ol.DEFAULT_TILE_SIZE;
|
||||
var key = opt_context !== undefined ?
|
||||
ol.getUid(opt_context).toString() : '';
|
||||
if (key in this.zoomifyImageByContext_) {
|
||||
return this.zoomifyImageByContext_[key];
|
||||
} else {
|
||||
var image = ol.ImageTile.prototype.getImage.call(this, opt_context);
|
||||
if (this.state == ol.Tile.State.LOADED) {
|
||||
if (image.width == tileSize && image.height == tileSize) {
|
||||
this.zoomifyImageByContext_[key] = image;
|
||||
return image;
|
||||
} else {
|
||||
var context = ol.dom.createCanvasContext2D(tileSize, tileSize);
|
||||
context.drawImage(image, 0, 0);
|
||||
this.zoomifyImageByContext_[key] = context.canvas;
|
||||
return context.canvas;
|
||||
}
|
||||
} else {
|
||||
var image = ol.ImageTile.prototype.getImage.call(this);
|
||||
if (this.state == ol.Tile.State.LOADED) {
|
||||
if (image.width == tileSize && image.height == tileSize) {
|
||||
this.zoomifyImage_ = image;
|
||||
return image;
|
||||
} else {
|
||||
var context = ol.dom.createCanvasContext2D(tileSize, tileSize);
|
||||
context.drawImage(image, 0, 0);
|
||||
this.zoomifyImage_ = context.canvas;
|
||||
return context.canvas;
|
||||
}
|
||||
} else {
|
||||
return image;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -60,10 +60,9 @@ ol.Tile.prototype.changed = function() {
|
||||
/**
|
||||
* Get the HTML image element for this tile (may be a Canvas, Image, or Video).
|
||||
* @abstract
|
||||
* @param {Object=} opt_context Object.
|
||||
* @return {HTMLCanvasElement|HTMLImageElement|HTMLVideoElement} Image.
|
||||
*/
|
||||
ol.Tile.prototype.getImage = function(opt_context) {};
|
||||
ol.Tile.prototype.getImage = function() {};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user