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.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_();
}