Rename #getImageElement to #getImage

This adds consistency between ol.Image and ol.ImageTile. Now both have
an exportable getImage method.
This commit is contained in:
Andreas Hocevar
2014-10-29 20:05:34 +01:00
parent abb86e16f0
commit 87a06c0086
6 changed files with 7 additions and 6 deletions
+2 -1
View File
@@ -66,8 +66,9 @@ goog.inherits(ol.Image, ol.ImageBase);
/** /**
* @param {Object=} opt_context Object. * @param {Object=} opt_context Object.
* @return {HTMLCanvasElement|Image|HTMLVideoElement} Image. * @return {HTMLCanvasElement|Image|HTMLVideoElement} Image.
* @api
*/ */
ol.Image.prototype.getImageElement = function(opt_context) { ol.Image.prototype.getImage = function(opt_context) {
if (goog.isDef(opt_context)) { if (goog.isDef(opt_context)) {
var image; var image;
var key = goog.getUid(opt_context); var key = goog.getUid(opt_context);
+1 -1
View File
@@ -95,7 +95,7 @@ ol.ImageBase.prototype.getExtent = function() {
* @param {Object=} opt_context Object. * @param {Object=} opt_context Object.
* @return {HTMLCanvasElement|Image|HTMLVideoElement} Image. * @return {HTMLCanvasElement|Image|HTMLVideoElement} Image.
*/ */
ol.ImageBase.prototype.getImageElement = goog.abstractMethod; ol.ImageBase.prototype.getImage = goog.abstractMethod;
/** /**
+1 -1
View File
@@ -33,6 +33,6 @@ goog.inherits(ol.ImageCanvas, ol.ImageBase);
/** /**
* @inheritDoc * @inheritDoc
*/ */
ol.ImageCanvas.prototype.getImageElement = function(opt_context) { ol.ImageCanvas.prototype.getImage = function(opt_context) {
return this.canvas_; return this.canvas_;
}; };
@@ -69,7 +69,7 @@ ol.renderer.canvas.ImageLayer.prototype.forEachFeatureAtPixel =
*/ */
ol.renderer.canvas.ImageLayer.prototype.getImage = function() { ol.renderer.canvas.ImageLayer.prototype.getImage = function() {
return goog.isNull(this.image_) ? return goog.isNull(this.image_) ?
null : this.image_.getImageElement(); null : this.image_.getImage();
}; };
+1 -1
View File
@@ -129,7 +129,7 @@ ol.renderer.dom.ImageLayer.prototype.prepareFrame =
(imageExtent[0] - viewCenter[0]) / imageResolution, (imageExtent[0] - viewCenter[0]) / imageResolution,
(viewCenter[1] - imageExtent[3]) / imageResolution); (viewCenter[1] - imageExtent[3]) / imageResolution);
if (image != this.image_) { if (image != this.image_) {
var imageElement = image.getImageElement(this); var imageElement = image.getImage(this);
// Bootstrap sets the style max-width: 100% for all images, which breaks // Bootstrap sets the style max-width: 100% for all images, which breaks
// prevents the image from being displayed in FireFox. Workaround by // prevents the image from being displayed in FireFox. Workaround by
// overriding the max-width style. // overriding the max-width style.
@@ -48,7 +48,7 @@ ol.renderer.webgl.ImageLayer.prototype.createTexture_ = function(image) {
// http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences#Non-Power_of_Two_Texture_Support // http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences#Non-Power_of_Two_Texture_Support
// http://learningwebgl.com/blog/?p=2101 // http://learningwebgl.com/blog/?p=2101
var imageElement = image.getImageElement(); var imageElement = image.getImage();
var gl = this.getWebGLMapRenderer().getGL(); var gl = this.getWebGLMapRenderer().getGL();
var texture = gl.createTexture(); var texture = gl.createTexture();