Implement getImageSize in ol.style.Circle and RegularShape

This commit is contained in:
Éric Lemoine
2014-11-06 09:35:47 +01:00
parent 9029c0fdad
commit 64a7cdf372
4 changed files with 22 additions and 1 deletions

View File

@@ -506,7 +506,6 @@ ol.render.webgl.ImageReplay.prototype.setImageStyle = function(imageStyle) {
goog.asserts.assert(!goog.isNull(anchor));
var image = imageStyle.getImage(1);
goog.asserts.assert(!goog.isNull(image));
// FIXME getImageSize does not exist for circles
var imageSize = imageStyle.getImageSize();
goog.asserts.assert(!goog.isNull(imageSize));
var opacity = imageStyle.getOpacity();

View File

@@ -137,6 +137,14 @@ ol.style.Circle.prototype.getImageState = function() {
};
/**
* @inheritDoc
*/
ol.style.Circle.prototype.getImageSize = function() {
return this.size_;
};
/**
* @inheritDoc
* @api

View File

@@ -132,6 +132,12 @@ ol.style.Image.prototype.getImage = goog.abstractMethod;
ol.style.Image.prototype.getImageState = goog.abstractMethod;
/**
* @return {ol.Size} Image size.
*/
ol.style.Image.prototype.getImageSize = goog.abstractMethod;
/**
* @param {number} pixelRatio Pixel ratio.
* @return {HTMLCanvasElement|HTMLVideoElement|Image} Image element.

View File

@@ -147,6 +147,14 @@ ol.style.RegularShape.prototype.getImage = function(pixelRatio) {
};
/**
* @inheritDoc
*/
ol.style.RegularShape.prototype.getImageSize = function() {
return this.size_;
};
/**
* @inheritDoc
*/