Change ol.ImageState to ol.Image.State

This commit is contained in:
Frederic Junod
2016-08-29 10:53:09 +02:00
parent 1fecb6fd16
commit bed95e3b5b
13 changed files with 79 additions and 81 deletions

View File

@@ -1,8 +1,8 @@
goog.provide('ol.Image'); goog.provide('ol.Image');
goog.require('ol'); goog.require('ol');
goog.require('ol.Image');
goog.require('ol.ImageBase'); goog.require('ol.ImageBase');
goog.require('ol.ImageState');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('ol.extent'); goog.require('ol.extent');
@@ -23,7 +23,7 @@ goog.require('ol.obj');
ol.Image = function(extent, resolution, pixelRatio, attributions, src, ol.Image = function(extent, resolution, pixelRatio, attributions, src,
crossOrigin, imageLoadFunction) { crossOrigin, imageLoadFunction) {
ol.ImageBase.call(this, extent, resolution, pixelRatio, ol.ImageState.IDLE, ol.ImageBase.call(this, extent, resolution, pixelRatio, ol.Image.State.IDLE,
attributions); attributions);
/** /**
@@ -55,9 +55,9 @@ ol.Image = function(extent, resolution, pixelRatio, attributions, src,
/** /**
* @protected * @protected
* @type {ol.ImageState} * @type {ol.Image.State}
*/ */
this.state = ol.ImageState.IDLE; this.state = ol.Image.State.IDLE;
/** /**
* @private * @private
@@ -100,7 +100,7 @@ ol.Image.prototype.getImage = function(opt_context) {
* @private * @private
*/ */
ol.Image.prototype.handleImageError_ = function() { ol.Image.prototype.handleImageError_ = function() {
this.state = ol.ImageState.ERROR; this.state = ol.Image.State.ERROR;
this.unlistenImage_(); this.unlistenImage_();
this.changed(); this.changed();
}; };
@@ -115,7 +115,7 @@ ol.Image.prototype.handleImageLoad_ = function() {
if (this.resolution === undefined) { if (this.resolution === undefined) {
this.resolution = ol.extent.getHeight(this.extent) / this.image_.height; this.resolution = ol.extent.getHeight(this.extent) / this.image_.height;
} }
this.state = ol.ImageState.LOADED; this.state = ol.Image.State.LOADED;
this.unlistenImage_(); this.unlistenImage_();
this.changed(); this.changed();
}; };
@@ -128,8 +128,8 @@ ol.Image.prototype.handleImageLoad_ = function() {
* @api * @api
*/ */
ol.Image.prototype.load = function() { ol.Image.prototype.load = function() {
if (this.state == ol.ImageState.IDLE || this.state == ol.ImageState.ERROR) { if (this.state == ol.Image.State.IDLE || this.state == ol.Image.State.ERROR) {
this.state = ol.ImageState.LOADING; this.state = ol.Image.State.LOADING;
this.changed(); this.changed();
goog.DEBUG && console.assert(!this.imageListenerKeys_, goog.DEBUG && console.assert(!this.imageListenerKeys_,
'this.imageListenerKeys_ should be null'); 'this.imageListenerKeys_ should be null');
@@ -161,3 +161,14 @@ ol.Image.prototype.unlistenImage_ = function() {
this.imageListenerKeys_.forEach(ol.events.unlistenByKey); this.imageListenerKeys_.forEach(ol.events.unlistenByKey);
this.imageListenerKeys_ = null; this.imageListenerKeys_ = null;
}; };
/**
* @enum {number}
*/
ol.Image.State = {
IDLE: 0,
LOADING: 1,
LOADED: 2,
ERROR: 3
};

View File

@@ -1,29 +1,17 @@
goog.provide('ol.ImageBase'); goog.provide('ol.ImageBase');
goog.provide('ol.ImageState');
goog.require('ol'); goog.require('ol');
goog.require('ol.events.EventTarget'); goog.require('ol.events.EventTarget');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
/**
* @enum {number}
*/
ol.ImageState = {
IDLE: 0,
LOADING: 1,
LOADED: 2,
ERROR: 3
};
/** /**
* @constructor * @constructor
* @extends {ol.events.EventTarget} * @extends {ol.events.EventTarget}
* @param {ol.Extent} extent Extent. * @param {ol.Extent} extent Extent.
* @param {number|undefined} resolution Resolution. * @param {number|undefined} resolution Resolution.
* @param {number} pixelRatio Pixel ratio. * @param {number} pixelRatio Pixel ratio.
* @param {ol.ImageState} state State. * @param {ol.Image.State} state State.
* @param {Array.<ol.Attribution>} attributions Attributions. * @param {Array.<ol.Attribution>} attributions Attributions.
*/ */
ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) { ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) {
@@ -56,7 +44,7 @@ ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) {
/** /**
* @protected * @protected
* @type {ol.ImageState} * @type {ol.Image.State}
*/ */
this.state = state; this.state = state;
@@ -114,7 +102,7 @@ ol.ImageBase.prototype.getResolution = function() {
/** /**
* @return {ol.ImageState} State. * @return {ol.Image.State} State.
*/ */
ol.ImageBase.prototype.getState = function() { ol.ImageBase.prototype.getState = function() {
return this.state; return this.state;

View File

@@ -1,8 +1,8 @@
goog.provide('ol.ImageCanvas'); goog.provide('ol.ImageCanvas');
goog.require('ol'); goog.require('ol');
goog.require('ol.Image');
goog.require('ol.ImageBase'); goog.require('ol.ImageBase');
goog.require('ol.ImageState');
/** /**
@@ -27,7 +27,7 @@ ol.ImageCanvas = function(extent, resolution, pixelRatio, attributions,
this.loader_ = opt_loader !== undefined ? opt_loader : null; this.loader_ = opt_loader !== undefined ? opt_loader : null;
var state = opt_loader !== undefined ? var state = opt_loader !== undefined ?
ol.ImageState.IDLE : ol.ImageState.LOADED; ol.Image.State.IDLE : ol.Image.State.LOADED;
ol.ImageBase.call(this, extent, resolution, pixelRatio, state, attributions); ol.ImageBase.call(this, extent, resolution, pixelRatio, state, attributions);
@@ -64,9 +64,9 @@ ol.ImageCanvas.prototype.getError = function() {
ol.ImageCanvas.prototype.handleLoad_ = function(err) { ol.ImageCanvas.prototype.handleLoad_ = function(err) {
if (err) { if (err) {
this.error_ = err; this.error_ = err;
this.state = ol.ImageState.ERROR; this.state = ol.Image.State.ERROR;
} else { } else {
this.state = ol.ImageState.LOADED; this.state = ol.Image.State.LOADED;
} }
this.changed(); this.changed();
}; };
@@ -76,9 +76,9 @@ ol.ImageCanvas.prototype.handleLoad_ = function(err) {
* Trigger drawing on canvas. * Trigger drawing on canvas.
*/ */
ol.ImageCanvas.prototype.load = function() { ol.ImageCanvas.prototype.load = function() {
if (this.state == ol.ImageState.IDLE) { if (this.state == ol.Image.State.IDLE) {
goog.DEBUG && console.assert(this.loader_, 'this.loader_ must be set'); goog.DEBUG && console.assert(this.loader_, 'this.loader_ must be set');
this.state = ol.ImageState.LOADING; this.state = ol.Image.State.LOADING;
this.changed(); this.changed();
this.loader_(this.handleLoad_.bind(this)); this.loader_(this.handleLoad_.bind(this));
} }

View File

@@ -1,7 +1,7 @@
goog.provide('ol.renderer.Layer'); goog.provide('ol.renderer.Layer');
goog.require('ol'); goog.require('ol');
goog.require('ol.ImageState'); goog.require('ol.Image');
goog.require('ol.Observable'); goog.require('ol.Observable');
goog.require('ol.Tile'); goog.require('ol.Tile');
goog.require('ol.asserts'); goog.require('ol.asserts');
@@ -121,7 +121,7 @@ ol.renderer.Layer.prototype.getLayer = function() {
*/ */
ol.renderer.Layer.prototype.handleImageChange_ = function(event) { ol.renderer.Layer.prototype.handleImageChange_ = function(event) {
var image = /** @type {ol.Image} */ (event.target); var image = /** @type {ol.Image} */ (event.target);
if (image.getState() === ol.ImageState.LOADED) { if (image.getState() === ol.Image.State.LOADED) {
this.renderIfReadyAndVisible(); this.renderIfReadyAndVisible();
} }
}; };
@@ -137,24 +137,24 @@ ol.renderer.Layer.prototype.handleImageChange_ = function(event) {
*/ */
ol.renderer.Layer.prototype.loadImage = function(image) { ol.renderer.Layer.prototype.loadImage = function(image) {
var imageState = image.getState(); var imageState = image.getState();
if (imageState != ol.ImageState.LOADED && if (imageState != ol.Image.State.LOADED &&
imageState != ol.ImageState.ERROR) { imageState != ol.Image.State.ERROR) {
// the image is either "idle" or "loading", register the change // the image is either "idle" or "loading", register the change
// listener (a noop if the listener was already registered) // listener (a noop if the listener was already registered)
goog.DEBUG && console.assert(imageState == ol.ImageState.IDLE || goog.DEBUG && console.assert(imageState == ol.Image.State.IDLE ||
imageState == ol.ImageState.LOADING, imageState == ol.Image.State.LOADING,
'imageState is "idle" or "loading"'); 'imageState is "idle" or "loading"');
ol.events.listen(image, ol.events.EventType.CHANGE, ol.events.listen(image, ol.events.EventType.CHANGE,
this.handleImageChange_, this); this.handleImageChange_, this);
} }
if (imageState == ol.ImageState.IDLE) { if (imageState == ol.Image.State.IDLE) {
image.load(); image.load();
imageState = image.getState(); imageState = image.getState();
goog.DEBUG && console.assert(imageState == ol.ImageState.LOADING || goog.DEBUG && console.assert(imageState == ol.Image.State.LOADING ||
imageState == ol.ImageState.LOADED, imageState == ol.Image.State.LOADED,
'imageState is "loading" or "loaded"'); 'imageState is "loading" or "loaded"');
} }
return imageState == ol.ImageState.LOADED; return imageState == ol.Image.State.LOADED;
}; };

View File

@@ -1,7 +1,7 @@
goog.provide('ol.renderer.vector'); goog.provide('ol.renderer.vector');
goog.require('ol'); goog.require('ol');
goog.require('ol.ImageState'); goog.require('ol.Image');
goog.require('ol.render.ReplayType'); goog.require('ol.render.ReplayType');
@@ -79,15 +79,15 @@ ol.renderer.vector.renderFeature = function(
imageStyle = style.getImage(); imageStyle = style.getImage();
if (imageStyle) { if (imageStyle) {
imageState = imageStyle.getImageState(); imageState = imageStyle.getImageState();
if (imageState == ol.ImageState.LOADED || if (imageState == ol.Image.State.LOADED ||
imageState == ol.ImageState.ERROR) { imageState == ol.Image.State.ERROR) {
imageStyle.unlistenImageChange(listener, thisArg); imageStyle.unlistenImageChange(listener, thisArg);
} else { } else {
if (imageState == ol.ImageState.IDLE) { if (imageState == ol.Image.State.IDLE) {
imageStyle.load(); imageStyle.load();
} }
imageState = imageStyle.getImageState(); imageState = imageStyle.getImageState();
goog.DEBUG && console.assert(imageState == ol.ImageState.LOADING, goog.DEBUG && console.assert(imageState == ol.Image.State.LOADING,
'imageState should be LOADING'); 'imageState should be LOADING');
imageStyle.listenImageChange(listener, thisArg); imageStyle.listenImageChange(listener, thisArg);
loading = true; loading = true;
@@ -227,7 +227,7 @@ ol.renderer.vector.renderMultiPolygonGeometry_ = function(replayGroup, geometry,
ol.renderer.vector.renderPointGeometry_ = function(replayGroup, geometry, style, feature) { ol.renderer.vector.renderPointGeometry_ = function(replayGroup, geometry, style, feature) {
var imageStyle = style.getImage(); var imageStyle = style.getImage();
if (imageStyle) { if (imageStyle) {
if (imageStyle.getImageState() != ol.ImageState.LOADED) { if (imageStyle.getImageState() != ol.Image.State.LOADED) {
return; return;
} }
var imageReplay = replayGroup.getReplay( var imageReplay = replayGroup.getReplay(
@@ -256,7 +256,7 @@ ol.renderer.vector.renderPointGeometry_ = function(replayGroup, geometry, style,
ol.renderer.vector.renderMultiPointGeometry_ = function(replayGroup, geometry, style, feature) { ol.renderer.vector.renderMultiPointGeometry_ = function(replayGroup, geometry, style, feature) {
var imageStyle = style.getImage(); var imageStyle = style.getImage();
if (imageStyle) { if (imageStyle) {
if (imageStyle.getImageState() != ol.ImageState.LOADED) { if (imageStyle.getImageState() != ol.Image.State.LOADED) {
return; return;
} }
var imageReplay = replayGroup.getReplay( var imageReplay = replayGroup.getReplay(

View File

@@ -1,8 +1,8 @@
goog.provide('ol.reproj.Image'); goog.provide('ol.reproj.Image');
goog.require('ol'); goog.require('ol');
goog.require('ol.Image');
goog.require('ol.ImageBase'); goog.require('ol.ImageBase');
goog.require('ol.ImageState');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('ol.extent'); goog.require('ol.extent');
@@ -99,11 +99,11 @@ ol.reproj.Image = function(sourceProj, targetProj,
this.sourceListenerKey_ = null; this.sourceListenerKey_ = null;
var state = ol.ImageState.LOADED; var state = ol.Image.State.LOADED;
var attributions = []; var attributions = [];
if (this.sourceImage_) { if (this.sourceImage_) {
state = ol.ImageState.IDLE; state = ol.Image.State.IDLE;
attributions = this.sourceImage_.getAttributions(); attributions = this.sourceImage_.getAttributions();
} }
@@ -117,7 +117,7 @@ ol.inherits(ol.reproj.Image, ol.ImageBase);
* @inheritDoc * @inheritDoc
*/ */
ol.reproj.Image.prototype.disposeInternal = function() { ol.reproj.Image.prototype.disposeInternal = function() {
if (this.state == ol.ImageState.LOADING) { if (this.state == ol.Image.State.LOADING) {
this.unlistenSource_(); this.unlistenSource_();
} }
ol.ImageBase.prototype.disposeInternal.call(this); ol.ImageBase.prototype.disposeInternal.call(this);
@@ -145,7 +145,7 @@ ol.reproj.Image.prototype.getProjection = function() {
*/ */
ol.reproj.Image.prototype.reproject_ = function() { ol.reproj.Image.prototype.reproject_ = function() {
var sourceState = this.sourceImage_.getState(); var sourceState = this.sourceImage_.getState();
if (sourceState == ol.ImageState.LOADED) { if (sourceState == ol.Image.State.LOADED) {
var width = ol.extent.getWidth(this.targetExtent_) / this.targetResolution_; var width = ol.extent.getWidth(this.targetExtent_) / this.targetResolution_;
var height = var height =
ol.extent.getHeight(this.targetExtent_) / this.targetResolution_; ol.extent.getHeight(this.targetExtent_) / this.targetResolution_;
@@ -166,20 +166,20 @@ ol.reproj.Image.prototype.reproject_ = function() {
* @inheritDoc * @inheritDoc
*/ */
ol.reproj.Image.prototype.load = function() { ol.reproj.Image.prototype.load = function() {
if (this.state == ol.ImageState.IDLE) { if (this.state == ol.Image.State.IDLE) {
this.state = ol.ImageState.LOADING; this.state = ol.Image.State.LOADING;
this.changed(); this.changed();
var sourceState = this.sourceImage_.getState(); var sourceState = this.sourceImage_.getState();
if (sourceState == ol.ImageState.LOADED || if (sourceState == ol.Image.State.LOADED ||
sourceState == ol.ImageState.ERROR) { sourceState == ol.Image.State.ERROR) {
this.reproject_(); this.reproject_();
} else { } else {
this.sourceListenerKey_ = ol.events.listen(this.sourceImage_, this.sourceListenerKey_ = ol.events.listen(this.sourceImage_,
ol.events.EventType.CHANGE, function(e) { ol.events.EventType.CHANGE, function(e) {
var sourceState = this.sourceImage_.getState(); var sourceState = this.sourceImage_.getState();
if (sourceState == ol.ImageState.LOADED || if (sourceState == ol.Image.State.LOADED ||
sourceState == ol.ImageState.ERROR) { sourceState == ol.Image.State.ERROR) {
this.unlistenSource_(); this.unlistenSource_();
this.reproject_(); this.reproject_();
} }

View File

@@ -2,7 +2,7 @@ goog.provide('ol.source.Image');
goog.provide('ol.source.ImageEvent'); goog.provide('ol.source.ImageEvent');
goog.require('ol'); goog.require('ol');
goog.require('ol.ImageState'); goog.require('ol.Image');
goog.require('ol.array'); goog.require('ol.array');
goog.require('ol.events.Event'); goog.require('ol.events.Event');
goog.require('ol.extent'); goog.require('ol.extent');
@@ -148,17 +148,17 @@ ol.source.Image.prototype.getImageInternal = function(extent, resolution, pixelR
ol.source.Image.prototype.handleImageChange = function(event) { ol.source.Image.prototype.handleImageChange = function(event) {
var image = /** @type {ol.Image} */ (event.target); var image = /** @type {ol.Image} */ (event.target);
switch (image.getState()) { switch (image.getState()) {
case ol.ImageState.LOADING: case ol.Image.State.LOADING:
this.dispatchEvent( this.dispatchEvent(
new ol.source.ImageEvent(ol.source.ImageEventType.IMAGELOADSTART, new ol.source.ImageEvent(ol.source.ImageEventType.IMAGELOADSTART,
image)); image));
break; break;
case ol.ImageState.LOADED: case ol.Image.State.LOADED:
this.dispatchEvent( this.dispatchEvent(
new ol.source.ImageEvent(ol.source.ImageEventType.IMAGELOADEND, new ol.source.ImageEvent(ol.source.ImageEventType.IMAGELOADEND,
image)); image));
break; break;
case ol.ImageState.ERROR: case ol.Image.State.ERROR:
this.dispatchEvent( this.dispatchEvent(
new ol.source.ImageEvent(ol.source.ImageEventType.IMAGELOADERROR, new ol.source.ImageEvent(ol.source.ImageEventType.IMAGELOADERROR,
image)); image));

View File

@@ -2,7 +2,6 @@ goog.provide('ol.source.ImageStatic');
goog.require('ol'); goog.require('ol');
goog.require('ol.Image'); goog.require('ol.Image');
goog.require('ol.ImageState');
goog.require('ol.dom'); goog.require('ol.dom');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
@@ -71,7 +70,7 @@ ol.source.ImageStatic.prototype.getImageInternal = function(extent, resolution,
* @inheritDoc * @inheritDoc
*/ */
ol.source.ImageStatic.prototype.handleImageChange = function(evt) { ol.source.ImageStatic.prototype.handleImageChange = function(evt) {
if (this.image_.getState() == ol.ImageState.LOADED) { if (this.image_.getState() == ol.Image.State.LOADED) {
var imageExtent = this.image_.getExtent(); var imageExtent = this.image_.getExtent();
var image = this.image_.getImage(); var image = this.image_.getImage();
var imageWidth, imageHeight; var imageWidth, imageHeight;

View File

@@ -5,7 +5,7 @@ goog.require('ol.color');
goog.require('ol.colorlike'); goog.require('ol.colorlike');
goog.require('ol.dom'); goog.require('ol.dom');
goog.require('ol.has'); goog.require('ol.has');
goog.require('ol.ImageState'); goog.require('ol.Image');
goog.require('ol.render.canvas'); goog.require('ol.render.canvas');
goog.require('ol.style.Image'); goog.require('ol.style.Image');
@@ -150,7 +150,7 @@ ol.style.Circle.prototype.getImage = function(pixelRatio) {
* @inheritDoc * @inheritDoc
*/ */
ol.style.Circle.prototype.getImageState = function() { ol.style.Circle.prototype.getImageState = function() {
return ol.ImageState.LOADED; return ol.Image.State.LOADED;
}; };

View File

@@ -7,7 +7,7 @@ goog.require('ol.asserts');
goog.require('ol.color'); goog.require('ol.color');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('ol.ImageState'); goog.require('ol.Image');
goog.require('ol.style.IconImage'); goog.require('ol.style.IconImage');
goog.require('ol.style.Image'); goog.require('ol.style.Image');
@@ -113,10 +113,10 @@ ol.style.Icon = function(opt_options) {
6); // A defined and non-empty `src` or `image` must be provided 6); // A defined and non-empty `src` or `image` must be provided
/** /**
* @type {ol.ImageState} * @type {ol.Image.State}
*/ */
var imageState = options.src !== undefined ? var imageState = options.src !== undefined ?
ol.ImageState.IDLE : ol.ImageState.LOADED; ol.Image.State.IDLE : ol.Image.State.LOADED;
/** /**
* @type {ol.Color} * @type {ol.Color}

View File

@@ -5,7 +5,7 @@ goog.require('ol.dom');
goog.require('ol.events'); goog.require('ol.events');
goog.require('ol.events.EventTarget'); goog.require('ol.events.EventTarget');
goog.require('ol.events.EventType'); goog.require('ol.events.EventType');
goog.require('ol.ImageState'); goog.require('ol.Image');
goog.require('ol.style'); goog.require('ol.style');
@@ -15,7 +15,7 @@ goog.require('ol.style');
* @param {string|undefined} src Src. * @param {string|undefined} src Src.
* @param {ol.Size} size Size. * @param {ol.Size} size Size.
* @param {?string} crossOrigin Cross origin. * @param {?string} crossOrigin Cross origin.
* @param {ol.ImageState} imageState Image state. * @param {ol.Image.State} imageState Image state.
* @param {ol.Color} color Color. * @param {ol.Color} color Color.
* @extends {ol.events.EventTarget} * @extends {ol.events.EventTarget}
*/ */
@@ -62,7 +62,7 @@ ol.style.IconImage = function(image, src, size, crossOrigin, imageState,
/** /**
* @private * @private
* @type {ol.ImageState} * @type {ol.Image.State}
*/ */
this.imageState_ = imageState; this.imageState_ = imageState;
@@ -83,7 +83,7 @@ ol.style.IconImage = function(image, src, size, crossOrigin, imageState,
* @type {boolean} * @type {boolean}
*/ */
this.tainting_ = false; this.tainting_ = false;
if (this.imageState_ == ol.ImageState.LOADED) { if (this.imageState_ == ol.Image.State.LOADED) {
this.determineTainting_(); this.determineTainting_();
} }
@@ -96,7 +96,7 @@ ol.inherits(ol.style.IconImage, ol.events.EventTarget);
* @param {string} src Src. * @param {string} src Src.
* @param {ol.Size} size Size. * @param {ol.Size} size Size.
* @param {?string} crossOrigin Cross origin. * @param {?string} crossOrigin Cross origin.
* @param {ol.ImageState} imageState Image state. * @param {ol.Image.State} imageState Image state.
* @param {ol.Color} color Color. * @param {ol.Color} color Color.
* @return {ol.style.IconImage} Icon image. * @return {ol.style.IconImage} Icon image.
*/ */
@@ -139,7 +139,7 @@ ol.style.IconImage.prototype.dispatchChangeEvent_ = function() {
* @private * @private
*/ */
ol.style.IconImage.prototype.handleImageError_ = function() { ol.style.IconImage.prototype.handleImageError_ = function() {
this.imageState_ = ol.ImageState.ERROR; this.imageState_ = ol.Image.State.ERROR;
this.unlistenImage_(); this.unlistenImage_();
this.dispatchChangeEvent_(); this.dispatchChangeEvent_();
}; };
@@ -149,7 +149,7 @@ ol.style.IconImage.prototype.handleImageError_ = function() {
* @private * @private
*/ */
ol.style.IconImage.prototype.handleImageLoad_ = function() { ol.style.IconImage.prototype.handleImageLoad_ = function() {
this.imageState_ = ol.ImageState.LOADED; this.imageState_ = ol.Image.State.LOADED;
if (this.size_) { if (this.size_) {
this.image_.width = this.size_[0]; this.image_.width = this.size_[0];
this.image_.height = this.size_[1]; this.image_.height = this.size_[1];
@@ -172,7 +172,7 @@ ol.style.IconImage.prototype.getImage = function(pixelRatio) {
/** /**
* @return {ol.ImageState} Image state. * @return {ol.Image.State} Image state.
*/ */
ol.style.IconImage.prototype.getImageState = function() { ol.style.IconImage.prototype.getImageState = function() {
return this.imageState_; return this.imageState_;
@@ -219,12 +219,12 @@ ol.style.IconImage.prototype.getSrc = function() {
* Load not yet loaded URI. * Load not yet loaded URI.
*/ */
ol.style.IconImage.prototype.load = function() { ol.style.IconImage.prototype.load = function() {
if (this.imageState_ == ol.ImageState.IDLE) { if (this.imageState_ == ol.Image.State.IDLE) {
goog.DEBUG && console.assert(this.src_ !== undefined, goog.DEBUG && console.assert(this.src_ !== undefined,
'this.src_ must not be undefined'); 'this.src_ must not be undefined');
goog.DEBUG && console.assert(!this.imageListenerKeys_, goog.DEBUG && console.assert(!this.imageListenerKeys_,
'no listener keys existing'); 'no listener keys existing');
this.imageState_ = ol.ImageState.LOADING; this.imageState_ = ol.Image.State.LOADING;
this.imageListenerKeys_ = [ this.imageListenerKeys_ = [
ol.events.listenOnce(this.image_, ol.events.EventType.ERROR, ol.events.listenOnce(this.image_, ol.events.EventType.ERROR,
this.handleImageError_, this), this.handleImageError_, this),

View File

@@ -124,7 +124,7 @@ ol.style.Image.prototype.getHitDetectionImage = function(pixelRatio) {};
/** /**
* @abstract * @abstract
* @return {ol.ImageState} Image state. * @return {ol.Image.State} Image state.
*/ */
ol.style.Image.prototype.getImageState = function() {}; ol.style.Image.prototype.getImageState = function() {};

View File

@@ -5,7 +5,7 @@ goog.require('ol.color');
goog.require('ol.colorlike'); goog.require('ol.colorlike');
goog.require('ol.dom'); goog.require('ol.dom');
goog.require('ol.has'); goog.require('ol.has');
goog.require('ol.ImageState'); goog.require('ol.Image');
goog.require('ol.render.canvas'); goog.require('ol.render.canvas');
goog.require('ol.style.Image'); goog.require('ol.style.Image');
@@ -205,7 +205,7 @@ ol.style.RegularShape.prototype.getHitDetectionImageSize = function() {
* @inheritDoc * @inheritDoc
*/ */
ol.style.RegularShape.prototype.getImageState = function() { ol.style.RegularShape.prototype.getImageState = function() {
return ol.ImageState.LOADED; return ol.Image.State.LOADED;
}; };