Add getters to ol.style.Icon

This commit is contained in:
Éric Lemoine
2013-12-19 11:43:56 +01:00
parent 16047ff852
commit e4f2a7552e
2 changed files with 14 additions and 5 deletions
@@ -151,7 +151,7 @@ ol.renderer.canvas.VectorLayer.prototype.getVectorLayer = function() {
ol.renderer.canvas.VectorLayer.prototype.handleImageStyleChange_ = ol.renderer.canvas.VectorLayer.prototype.handleImageStyleChange_ =
function(event) { function(event) {
var imageStyle = /** @type {ol.style.Image} */ (event.target); var imageStyle = /** @type {ol.style.Image} */ (event.target);
if (imageStyle.imageState == ol.style.ImageState.LOADED) { if (imageStyle.getImageState() == ol.style.ImageState.LOADED) {
this.renderIfReadyAndVisible(); this.renderIfReadyAndVisible();
} }
}; };
@@ -246,16 +246,17 @@ ol.renderer.canvas.VectorLayer.prototype.renderFeature =
style = styles[i]; style = styles[i];
imageStyle = style.getImage(); imageStyle = style.getImage();
if (!goog.isNull(imageStyle)) { if (!goog.isNull(imageStyle)) {
if (imageStyle.imageState == ol.style.ImageState.IDLE) { if (imageStyle.getImageState() == ol.style.ImageState.IDLE) {
goog.events.listenOnce(imageStyle, goog.events.EventType.CHANGE, goog.events.listenOnce(imageStyle, goog.events.EventType.CHANGE,
this.handleImageStyleChange_, false, this); this.handleImageStyleChange_, false, this);
imageStyle.load(); imageStyle.load();
} else if (imageStyle.imageState == ol.style.ImageState.LOADED) { } else if (imageStyle.getImageState() == ol.style.ImageState.LOADED) {
ol.renderer.vector.renderFeature( ol.renderer.vector.renderFeature(
replayGroup, feature, style, squaredTolerance, feature); replayGroup, feature, style, squaredTolerance, feature);
} }
goog.asserts.assert(imageStyle.imageState != ol.style.ImageState.IDLE); goog.asserts.assert(
loading = imageStyle.imageState == ol.style.ImageState.LOADING; imageStyle.getImageState() != ol.style.ImageState.IDLE);
loading = imageStyle.getImageState() == ol.style.ImageState.LOADING;
} else { } else {
ol.renderer.vector.renderFeature( ol.renderer.vector.renderFeature(
replayGroup, feature, style, squaredTolerance, feature); replayGroup, feature, style, squaredTolerance, feature);
+8
View File
@@ -174,6 +174,14 @@ ol.style.Icon.prototype.getHitDetectionImage = function(pixelRatio) {
}; };
/**
* @return {string|undefined} Image src.
*/
ol.style.Icon.prototype.getSrc = function() {
return this.src_;
};
/** /**
* Load not yet loaded URI. * Load not yet loaded URI.
*/ */