diff --git a/src/ol/image.js b/src/ol/image.js
index 25e38539b2..7939432bf3 100644
--- a/src/ol/image.js
+++ b/src/ol/image.js
@@ -1,8 +1,8 @@
goog.provide('ol.Image');
goog.require('ol');
+goog.require('ol.Image');
goog.require('ol.ImageBase');
-goog.require('ol.ImageState');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.extent');
@@ -23,7 +23,7 @@ goog.require('ol.obj');
ol.Image = function(extent, resolution, pixelRatio, attributions, src,
crossOrigin, imageLoadFunction) {
- ol.ImageBase.call(this, extent, resolution, pixelRatio, ol.ImageState.IDLE,
+ ol.ImageBase.call(this, extent, resolution, pixelRatio, ol.Image.State.IDLE,
attributions);
/**
@@ -55,9 +55,9 @@ ol.Image = function(extent, resolution, pixelRatio, attributions, src,
/**
* @protected
- * @type {ol.ImageState}
+ * @type {ol.Image.State}
*/
- this.state = ol.ImageState.IDLE;
+ this.state = ol.Image.State.IDLE;
/**
* @private
@@ -100,7 +100,7 @@ ol.Image.prototype.getImage = function(opt_context) {
* @private
*/
ol.Image.prototype.handleImageError_ = function() {
- this.state = ol.ImageState.ERROR;
+ this.state = ol.Image.State.ERROR;
this.unlistenImage_();
this.changed();
};
@@ -115,7 +115,7 @@ ol.Image.prototype.handleImageLoad_ = function() {
if (this.resolution === undefined) {
this.resolution = ol.extent.getHeight(this.extent) / this.image_.height;
}
- this.state = ol.ImageState.LOADED;
+ this.state = ol.Image.State.LOADED;
this.unlistenImage_();
this.changed();
};
@@ -128,8 +128,8 @@ ol.Image.prototype.handleImageLoad_ = function() {
* @api
*/
ol.Image.prototype.load = function() {
- if (this.state == ol.ImageState.IDLE || this.state == ol.ImageState.ERROR) {
- this.state = ol.ImageState.LOADING;
+ if (this.state == ol.Image.State.IDLE || this.state == ol.Image.State.ERROR) {
+ this.state = ol.Image.State.LOADING;
this.changed();
goog.DEBUG && console.assert(!this.imageListenerKeys_,
'this.imageListenerKeys_ should be null');
@@ -161,3 +161,14 @@ ol.Image.prototype.unlistenImage_ = function() {
this.imageListenerKeys_.forEach(ol.events.unlistenByKey);
this.imageListenerKeys_ = null;
};
+
+
+/**
+ * @enum {number}
+ */
+ol.Image.State = {
+ IDLE: 0,
+ LOADING: 1,
+ LOADED: 2,
+ ERROR: 3
+};
diff --git a/src/ol/imagebase.js b/src/ol/imagebase.js
index 05e2c0d13c..98cf8295ac 100644
--- a/src/ol/imagebase.js
+++ b/src/ol/imagebase.js
@@ -1,29 +1,17 @@
goog.provide('ol.ImageBase');
-goog.provide('ol.ImageState');
goog.require('ol');
goog.require('ol.events.EventTarget');
goog.require('ol.events.EventType');
-/**
- * @enum {number}
- */
-ol.ImageState = {
- IDLE: 0,
- LOADING: 1,
- LOADED: 2,
- ERROR: 3
-};
-
-
/**
* @constructor
* @extends {ol.events.EventTarget}
* @param {ol.Extent} extent Extent.
* @param {number|undefined} resolution Resolution.
* @param {number} pixelRatio Pixel ratio.
- * @param {ol.ImageState} state State.
+ * @param {ol.Image.State} state State.
* @param {Array.
} attributions Attributions.
*/
ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) {
@@ -56,7 +44,7 @@ ol.ImageBase = function(extent, resolution, pixelRatio, state, attributions) {
/**
* @protected
- * @type {ol.ImageState}
+ * @type {ol.Image.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() {
return this.state;
diff --git a/src/ol/imagecanvas.js b/src/ol/imagecanvas.js
index 9b05fc87aa..a070739116 100644
--- a/src/ol/imagecanvas.js
+++ b/src/ol/imagecanvas.js
@@ -1,8 +1,8 @@
goog.provide('ol.ImageCanvas');
goog.require('ol');
+goog.require('ol.Image');
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;
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);
@@ -64,9 +64,9 @@ ol.ImageCanvas.prototype.getError = function() {
ol.ImageCanvas.prototype.handleLoad_ = function(err) {
if (err) {
this.error_ = err;
- this.state = ol.ImageState.ERROR;
+ this.state = ol.Image.State.ERROR;
} else {
- this.state = ol.ImageState.LOADED;
+ this.state = ol.Image.State.LOADED;
}
this.changed();
};
@@ -76,9 +76,9 @@ ol.ImageCanvas.prototype.handleLoad_ = function(err) {
* Trigger drawing on canvas.
*/
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');
- this.state = ol.ImageState.LOADING;
+ this.state = ol.Image.State.LOADING;
this.changed();
this.loader_(this.handleLoad_.bind(this));
}
diff --git a/src/ol/renderer/layer.js b/src/ol/renderer/layer.js
index 23659bc023..41a4a71f23 100644
--- a/src/ol/renderer/layer.js
+++ b/src/ol/renderer/layer.js
@@ -1,7 +1,7 @@
goog.provide('ol.renderer.Layer');
goog.require('ol');
-goog.require('ol.ImageState');
+goog.require('ol.Image');
goog.require('ol.Observable');
goog.require('ol.Tile');
goog.require('ol.asserts');
@@ -121,7 +121,7 @@ ol.renderer.Layer.prototype.getLayer = function() {
*/
ol.renderer.Layer.prototype.handleImageChange_ = function(event) {
var image = /** @type {ol.Image} */ (event.target);
- if (image.getState() === ol.ImageState.LOADED) {
+ if (image.getState() === ol.Image.State.LOADED) {
this.renderIfReadyAndVisible();
}
};
@@ -137,24 +137,24 @@ ol.renderer.Layer.prototype.handleImageChange_ = function(event) {
*/
ol.renderer.Layer.prototype.loadImage = function(image) {
var imageState = image.getState();
- if (imageState != ol.ImageState.LOADED &&
- imageState != ol.ImageState.ERROR) {
+ if (imageState != ol.Image.State.LOADED &&
+ imageState != ol.Image.State.ERROR) {
// the image is either "idle" or "loading", register the change
// listener (a noop if the listener was already registered)
- goog.DEBUG && console.assert(imageState == ol.ImageState.IDLE ||
- imageState == ol.ImageState.LOADING,
+ goog.DEBUG && console.assert(imageState == ol.Image.State.IDLE ||
+ imageState == ol.Image.State.LOADING,
'imageState is "idle" or "loading"');
ol.events.listen(image, ol.events.EventType.CHANGE,
this.handleImageChange_, this);
}
- if (imageState == ol.ImageState.IDLE) {
+ if (imageState == ol.Image.State.IDLE) {
image.load();
imageState = image.getState();
- goog.DEBUG && console.assert(imageState == ol.ImageState.LOADING ||
- imageState == ol.ImageState.LOADED,
+ goog.DEBUG && console.assert(imageState == ol.Image.State.LOADING ||
+ imageState == ol.Image.State.LOADED,
'imageState is "loading" or "loaded"');
}
- return imageState == ol.ImageState.LOADED;
+ return imageState == ol.Image.State.LOADED;
};
diff --git a/src/ol/renderer/vector.js b/src/ol/renderer/vector.js
index 881432edb0..48960f4fcc 100644
--- a/src/ol/renderer/vector.js
+++ b/src/ol/renderer/vector.js
@@ -1,7 +1,7 @@
goog.provide('ol.renderer.vector');
goog.require('ol');
-goog.require('ol.ImageState');
+goog.require('ol.Image');
goog.require('ol.render.ReplayType');
@@ -79,15 +79,15 @@ ol.renderer.vector.renderFeature = function(
imageStyle = style.getImage();
if (imageStyle) {
imageState = imageStyle.getImageState();
- if (imageState == ol.ImageState.LOADED ||
- imageState == ol.ImageState.ERROR) {
+ if (imageState == ol.Image.State.LOADED ||
+ imageState == ol.Image.State.ERROR) {
imageStyle.unlistenImageChange(listener, thisArg);
} else {
- if (imageState == ol.ImageState.IDLE) {
+ if (imageState == ol.Image.State.IDLE) {
imageStyle.load();
}
imageState = imageStyle.getImageState();
- goog.DEBUG && console.assert(imageState == ol.ImageState.LOADING,
+ goog.DEBUG && console.assert(imageState == ol.Image.State.LOADING,
'imageState should be LOADING');
imageStyle.listenImageChange(listener, thisArg);
loading = true;
@@ -227,7 +227,7 @@ ol.renderer.vector.renderMultiPolygonGeometry_ = function(replayGroup, geometry,
ol.renderer.vector.renderPointGeometry_ = function(replayGroup, geometry, style, feature) {
var imageStyle = style.getImage();
if (imageStyle) {
- if (imageStyle.getImageState() != ol.ImageState.LOADED) {
+ if (imageStyle.getImageState() != ol.Image.State.LOADED) {
return;
}
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) {
var imageStyle = style.getImage();
if (imageStyle) {
- if (imageStyle.getImageState() != ol.ImageState.LOADED) {
+ if (imageStyle.getImageState() != ol.Image.State.LOADED) {
return;
}
var imageReplay = replayGroup.getReplay(
diff --git a/src/ol/reproj/image.js b/src/ol/reproj/image.js
index af3c73f682..183b7347ae 100644
--- a/src/ol/reproj/image.js
+++ b/src/ol/reproj/image.js
@@ -1,8 +1,8 @@
goog.provide('ol.reproj.Image');
goog.require('ol');
+goog.require('ol.Image');
goog.require('ol.ImageBase');
-goog.require('ol.ImageState');
goog.require('ol.events');
goog.require('ol.events.EventType');
goog.require('ol.extent');
@@ -99,11 +99,11 @@ ol.reproj.Image = function(sourceProj, targetProj,
this.sourceListenerKey_ = null;
- var state = ol.ImageState.LOADED;
+ var state = ol.Image.State.LOADED;
var attributions = [];
if (this.sourceImage_) {
- state = ol.ImageState.IDLE;
+ state = ol.Image.State.IDLE;
attributions = this.sourceImage_.getAttributions();
}
@@ -117,7 +117,7 @@ ol.inherits(ol.reproj.Image, ol.ImageBase);
* @inheritDoc
*/
ol.reproj.Image.prototype.disposeInternal = function() {
- if (this.state == ol.ImageState.LOADING) {
+ if (this.state == ol.Image.State.LOADING) {
this.unlistenSource_();
}
ol.ImageBase.prototype.disposeInternal.call(this);
@@ -145,7 +145,7 @@ ol.reproj.Image.prototype.getProjection = function() {
*/
ol.reproj.Image.prototype.reproject_ = function() {
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 height =
ol.extent.getHeight(this.targetExtent_) / this.targetResolution_;
@@ -166,20 +166,20 @@ ol.reproj.Image.prototype.reproject_ = function() {
* @inheritDoc
*/
ol.reproj.Image.prototype.load = function() {
- if (this.state == ol.ImageState.IDLE) {
- this.state = ol.ImageState.LOADING;
+ if (this.state == ol.Image.State.IDLE) {
+ this.state = ol.Image.State.LOADING;
this.changed();
var sourceState = this.sourceImage_.getState();
- if (sourceState == ol.ImageState.LOADED ||
- sourceState == ol.ImageState.ERROR) {
+ if (sourceState == ol.Image.State.LOADED ||
+ sourceState == ol.Image.State.ERROR) {
this.reproject_();
} else {
this.sourceListenerKey_ = ol.events.listen(this.sourceImage_,
ol.events.EventType.CHANGE, function(e) {
var sourceState = this.sourceImage_.getState();
- if (sourceState == ol.ImageState.LOADED ||
- sourceState == ol.ImageState.ERROR) {
+ if (sourceState == ol.Image.State.LOADED ||
+ sourceState == ol.Image.State.ERROR) {
this.unlistenSource_();
this.reproject_();
}
diff --git a/src/ol/source/image.js b/src/ol/source/image.js
index a190f2cd0c..e88ac509fe 100644
--- a/src/ol/source/image.js
+++ b/src/ol/source/image.js
@@ -2,7 +2,7 @@ goog.provide('ol.source.Image');
goog.provide('ol.source.ImageEvent');
goog.require('ol');
-goog.require('ol.ImageState');
+goog.require('ol.Image');
goog.require('ol.array');
goog.require('ol.events.Event');
goog.require('ol.extent');
@@ -148,17 +148,17 @@ ol.source.Image.prototype.getImageInternal = function(extent, resolution, pixelR
ol.source.Image.prototype.handleImageChange = function(event) {
var image = /** @type {ol.Image} */ (event.target);
switch (image.getState()) {
- case ol.ImageState.LOADING:
+ case ol.Image.State.LOADING:
this.dispatchEvent(
new ol.source.ImageEvent(ol.source.ImageEventType.IMAGELOADSTART,
image));
break;
- case ol.ImageState.LOADED:
+ case ol.Image.State.LOADED:
this.dispatchEvent(
new ol.source.ImageEvent(ol.source.ImageEventType.IMAGELOADEND,
image));
break;
- case ol.ImageState.ERROR:
+ case ol.Image.State.ERROR:
this.dispatchEvent(
new ol.source.ImageEvent(ol.source.ImageEventType.IMAGELOADERROR,
image));
diff --git a/src/ol/source/imagestatic.js b/src/ol/source/imagestatic.js
index 15eb7df329..93137f7875 100644
--- a/src/ol/source/imagestatic.js
+++ b/src/ol/source/imagestatic.js
@@ -2,7 +2,6 @@ goog.provide('ol.source.ImageStatic');
goog.require('ol');
goog.require('ol.Image');
-goog.require('ol.ImageState');
goog.require('ol.dom');
goog.require('ol.events');
goog.require('ol.events.EventType');
@@ -71,7 +70,7 @@ ol.source.ImageStatic.prototype.getImageInternal = function(extent, resolution,
* @inheritDoc
*/
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 image = this.image_.getImage();
var imageWidth, imageHeight;
diff --git a/src/ol/style/circle.js b/src/ol/style/circle.js
index 93fc018763..1b87e268cc 100644
--- a/src/ol/style/circle.js
+++ b/src/ol/style/circle.js
@@ -5,7 +5,7 @@ goog.require('ol.color');
goog.require('ol.colorlike');
goog.require('ol.dom');
goog.require('ol.has');
-goog.require('ol.ImageState');
+goog.require('ol.Image');
goog.require('ol.render.canvas');
goog.require('ol.style.Image');
@@ -150,7 +150,7 @@ ol.style.Circle.prototype.getImage = function(pixelRatio) {
* @inheritDoc
*/
ol.style.Circle.prototype.getImageState = function() {
- return ol.ImageState.LOADED;
+ return ol.Image.State.LOADED;
};
diff --git a/src/ol/style/icon.js b/src/ol/style/icon.js
index 53ead4b8af..4a381fb364 100644
--- a/src/ol/style/icon.js
+++ b/src/ol/style/icon.js
@@ -7,7 +7,7 @@ goog.require('ol.asserts');
goog.require('ol.color');
goog.require('ol.events');
goog.require('ol.events.EventType');
-goog.require('ol.ImageState');
+goog.require('ol.Image');
goog.require('ol.style.IconImage');
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
/**
- * @type {ol.ImageState}
+ * @type {ol.Image.State}
*/
var imageState = options.src !== undefined ?
- ol.ImageState.IDLE : ol.ImageState.LOADED;
+ ol.Image.State.IDLE : ol.Image.State.LOADED;
/**
* @type {ol.Color}
diff --git a/src/ol/style/iconimage.js b/src/ol/style/iconimage.js
index 766e2a32f2..5ab3c351d4 100644
--- a/src/ol/style/iconimage.js
+++ b/src/ol/style/iconimage.js
@@ -5,7 +5,7 @@ goog.require('ol.dom');
goog.require('ol.events');
goog.require('ol.events.EventTarget');
goog.require('ol.events.EventType');
-goog.require('ol.ImageState');
+goog.require('ol.Image');
goog.require('ol.style');
@@ -15,7 +15,7 @@ goog.require('ol.style');
* @param {string|undefined} src Src.
* @param {ol.Size} size Size.
* @param {?string} crossOrigin Cross origin.
- * @param {ol.ImageState} imageState Image state.
+ * @param {ol.Image.State} imageState Image state.
* @param {ol.Color} color Color.
* @extends {ol.events.EventTarget}
*/
@@ -62,7 +62,7 @@ ol.style.IconImage = function(image, src, size, crossOrigin, imageState,
/**
* @private
- * @type {ol.ImageState}
+ * @type {ol.Image.State}
*/
this.imageState_ = imageState;
@@ -83,7 +83,7 @@ ol.style.IconImage = function(image, src, size, crossOrigin, imageState,
* @type {boolean}
*/
this.tainting_ = false;
- if (this.imageState_ == ol.ImageState.LOADED) {
+ if (this.imageState_ == ol.Image.State.LOADED) {
this.determineTainting_();
}
@@ -96,7 +96,7 @@ ol.inherits(ol.style.IconImage, ol.events.EventTarget);
* @param {string} src Src.
* @param {ol.Size} size Size.
* @param {?string} crossOrigin Cross origin.
- * @param {ol.ImageState} imageState Image state.
+ * @param {ol.Image.State} imageState Image state.
* @param {ol.Color} color Color.
* @return {ol.style.IconImage} Icon image.
*/
@@ -139,7 +139,7 @@ ol.style.IconImage.prototype.dispatchChangeEvent_ = function() {
* @private
*/
ol.style.IconImage.prototype.handleImageError_ = function() {
- this.imageState_ = ol.ImageState.ERROR;
+ this.imageState_ = ol.Image.State.ERROR;
this.unlistenImage_();
this.dispatchChangeEvent_();
};
@@ -149,7 +149,7 @@ ol.style.IconImage.prototype.handleImageError_ = function() {
* @private
*/
ol.style.IconImage.prototype.handleImageLoad_ = function() {
- this.imageState_ = ol.ImageState.LOADED;
+ this.imageState_ = ol.Image.State.LOADED;
if (this.size_) {
this.image_.width = this.size_[0];
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() {
return this.imageState_;
@@ -219,12 +219,12 @@ ol.style.IconImage.prototype.getSrc = function() {
* Load not yet loaded URI.
*/
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,
'this.src_ must not be undefined');
goog.DEBUG && console.assert(!this.imageListenerKeys_,
'no listener keys existing');
- this.imageState_ = ol.ImageState.LOADING;
+ this.imageState_ = ol.Image.State.LOADING;
this.imageListenerKeys_ = [
ol.events.listenOnce(this.image_, ol.events.EventType.ERROR,
this.handleImageError_, this),
diff --git a/src/ol/style/image.js b/src/ol/style/image.js
index 894a88f960..dc9566a1a9 100644
--- a/src/ol/style/image.js
+++ b/src/ol/style/image.js
@@ -124,7 +124,7 @@ ol.style.Image.prototype.getHitDetectionImage = function(pixelRatio) {};
/**
* @abstract
- * @return {ol.ImageState} Image state.
+ * @return {ol.Image.State} Image state.
*/
ol.style.Image.prototype.getImageState = function() {};
diff --git a/src/ol/style/regularshape.js b/src/ol/style/regularshape.js
index a3ae01208d..edd744fb20 100644
--- a/src/ol/style/regularshape.js
+++ b/src/ol/style/regularshape.js
@@ -5,7 +5,7 @@ goog.require('ol.color');
goog.require('ol.colorlike');
goog.require('ol.dom');
goog.require('ol.has');
-goog.require('ol.ImageState');
+goog.require('ol.Image');
goog.require('ol.render.canvas');
goog.require('ol.style.Image');
@@ -205,7 +205,7 @@ ol.style.RegularShape.prototype.getHitDetectionImageSize = function() {
* @inheritDoc
*/
ol.style.RegularShape.prototype.getImageState = function() {
- return ol.ImageState.LOADED;
+ return ol.Image.State.LOADED;
};