Remove ol.style.ImageState and use ol.ImageState instead
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
goog.provide('ol.renderer.vector');
|
||||
|
||||
goog.require('ol');
|
||||
goog.require('ol.ImageState');
|
||||
goog.require('ol.render.ReplayType');
|
||||
goog.require('ol.style.ImageState');
|
||||
|
||||
|
||||
/**
|
||||
@@ -79,15 +79,15 @@ ol.renderer.vector.renderFeature = function(
|
||||
imageStyle = style.getImage();
|
||||
if (imageStyle) {
|
||||
imageState = imageStyle.getImageState();
|
||||
if (imageState == ol.style.ImageState.LOADED ||
|
||||
imageState == ol.style.ImageState.ERROR) {
|
||||
if (imageState == ol.ImageState.LOADED ||
|
||||
imageState == ol.ImageState.ERROR) {
|
||||
imageStyle.unlistenImageChange(listener, thisArg);
|
||||
} else {
|
||||
if (imageState == ol.style.ImageState.IDLE) {
|
||||
if (imageState == ol.ImageState.IDLE) {
|
||||
imageStyle.load();
|
||||
}
|
||||
imageState = imageStyle.getImageState();
|
||||
goog.DEBUG && console.assert(imageState == ol.style.ImageState.LOADING,
|
||||
goog.DEBUG && console.assert(imageState == ol.ImageState.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.style.ImageState.LOADED) {
|
||||
if (imageStyle.getImageState() != ol.ImageState.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.style.ImageState.LOADED) {
|
||||
if (imageStyle.getImageState() != ol.ImageState.LOADED) {
|
||||
return;
|
||||
}
|
||||
var imageReplay = replayGroup.getReplay(
|
||||
|
||||
@@ -5,9 +5,9 @@ goog.require('ol.color');
|
||||
goog.require('ol.colorlike');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.has');
|
||||
goog.require('ol.ImageState');
|
||||
goog.require('ol.render.canvas');
|
||||
goog.require('ol.style.Image');
|
||||
goog.require('ol.style.ImageState');
|
||||
|
||||
|
||||
/**
|
||||
@@ -150,7 +150,7 @@ ol.style.Circle.prototype.getImage = function(pixelRatio) {
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.style.Circle.prototype.getImageState = function() {
|
||||
return ol.style.ImageState.LOADED;
|
||||
return ol.ImageState.LOADED;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ goog.require('ol.asserts');
|
||||
goog.require('ol.color');
|
||||
goog.require('ol.events');
|
||||
goog.require('ol.events.EventType');
|
||||
goog.require('ol.ImageState');
|
||||
goog.require('ol.style.IconImage');
|
||||
goog.require('ol.style.Image');
|
||||
goog.require('ol.style.ImageState');
|
||||
|
||||
|
||||
/**
|
||||
@@ -113,10 +113,10 @@ ol.style.Icon = function(opt_options) {
|
||||
6); // A defined and non-empty `src` or `image` must be provided
|
||||
|
||||
/**
|
||||
* @type {ol.style.ImageState}
|
||||
* @type {ol.ImageState}
|
||||
*/
|
||||
var imageState = options.src !== undefined ?
|
||||
ol.style.ImageState.IDLE : ol.style.ImageState.LOADED;
|
||||
ol.ImageState.IDLE : ol.ImageState.LOADED;
|
||||
|
||||
/**
|
||||
* @type {ol.Color}
|
||||
|
||||
@@ -5,8 +5,8 @@ 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.style');
|
||||
goog.require('ol.style.ImageState');
|
||||
|
||||
|
||||
/**
|
||||
@@ -15,7 +15,7 @@ goog.require('ol.style.ImageState');
|
||||
* @param {string|undefined} src Src.
|
||||
* @param {ol.Size} size Size.
|
||||
* @param {?string} crossOrigin Cross origin.
|
||||
* @param {ol.style.ImageState} imageState Image state.
|
||||
* @param {ol.ImageState} 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.style.ImageState}
|
||||
* @type {ol.ImageState}
|
||||
*/
|
||||
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.style.ImageState.LOADED) {
|
||||
if (this.imageState_ == ol.ImageState.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.style.ImageState} imageState Image state.
|
||||
* @param {ol.ImageState} 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.style.ImageState.ERROR;
|
||||
this.imageState_ = ol.ImageState.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.style.ImageState.LOADED;
|
||||
this.imageState_ = ol.ImageState.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.style.ImageState} Image state.
|
||||
* @return {ol.ImageState} 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.style.ImageState.IDLE) {
|
||||
if (this.imageState_ == ol.ImageState.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.style.ImageState.LOADING;
|
||||
this.imageState_ = ol.ImageState.LOADING;
|
||||
this.imageListenerKeys_ = [
|
||||
ol.events.listenOnce(this.image_, ol.events.EventType.ERROR,
|
||||
this.handleImageError_, this),
|
||||
|
||||
@@ -1,16 +1,4 @@
|
||||
goog.provide('ol.style.Image');
|
||||
goog.provide('ol.style.ImageState');
|
||||
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
ol.style.ImageState = {
|
||||
IDLE: 0,
|
||||
LOADING: 1,
|
||||
LOADED: 2,
|
||||
ERROR: 3
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@@ -136,7 +124,7 @@ ol.style.Image.prototype.getHitDetectionImage = function(pixelRatio) {};
|
||||
|
||||
/**
|
||||
* @abstract
|
||||
* @return {ol.style.ImageState} Image state.
|
||||
* @return {ol.ImageState} Image state.
|
||||
*/
|
||||
ol.style.Image.prototype.getImageState = function() {};
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ goog.require('ol.color');
|
||||
goog.require('ol.colorlike');
|
||||
goog.require('ol.dom');
|
||||
goog.require('ol.has');
|
||||
goog.require('ol.ImageState');
|
||||
goog.require('ol.render.canvas');
|
||||
goog.require('ol.style.Image');
|
||||
goog.require('ol.style.ImageState');
|
||||
|
||||
|
||||
/**
|
||||
@@ -205,7 +205,7 @@ ol.style.RegularShape.prototype.getHitDetectionImageSize = function() {
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.style.RegularShape.prototype.getImageState = function() {
|
||||
return ol.style.ImageState.LOADED;
|
||||
return ol.ImageState.LOADED;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user