Rename _ol_source_State_ to SourceState

This commit is contained in:
Frederic Junod
2017-12-19 08:33:14 +01:00
parent 003c7bb209
commit d0728a5e65
12 changed files with 35 additions and 35 deletions

View File

@@ -12,7 +12,7 @@ import EventType from '../events/EventType.js';
import {getIntersection} from '../extent.js'; import {getIntersection} from '../extent.js';
import _ol_layer_Base_ from '../layer/Base.js'; import _ol_layer_Base_ from '../layer/Base.js';
import _ol_obj_ from '../obj.js'; import _ol_obj_ from '../obj.js';
import _ol_source_State_ from '../source/State.js'; import SourceState from '../source/State.js';
/** /**
@@ -232,7 +232,7 @@ _ol_layer_Group_.prototype.getLayerStatesArray = function(opt_states) {
* @inheritDoc * @inheritDoc
*/ */
_ol_layer_Group_.prototype.getSourceState = function() { _ol_layer_Group_.prototype.getSourceState = function() {
return _ol_source_State_.READY; return SourceState.READY;
}; };
export default _ol_layer_Group_; export default _ol_layer_Group_;

View File

@@ -9,7 +9,7 @@ import _ol_layer_Base_ from '../layer/Base.js';
import _ol_layer_Property_ from '../layer/Property.js'; import _ol_layer_Property_ from '../layer/Property.js';
import _ol_obj_ from '../obj.js'; import _ol_obj_ from '../obj.js';
import RenderEventType from '../render/EventType.js'; import RenderEventType from '../render/EventType.js';
import _ol_source_State_ from '../source/State.js'; import SourceState from '../source/State.js';
/** /**
* @classdesc * @classdesc
@@ -124,7 +124,7 @@ _ol_layer_Layer_.prototype.getSource = function() {
*/ */
_ol_layer_Layer_.prototype.getSourceState = function() { _ol_layer_Layer_.prototype.getSourceState = function() {
var source = this.getSource(); var source = this.getSource();
return !source ? _ol_source_State_.UNDEFINED : source.getState(); return !source ? SourceState.UNDEFINED : source.getState();
}; };

View File

@@ -8,7 +8,7 @@ import _ol_TileState_ from '../TileState.js';
import _ol_events_ from '../events.js'; import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import {FALSE} from '../functions.js'; import {FALSE} from '../functions.js';
import _ol_source_State_ from '../source/State.js'; import SourceState from '../source/State.js';
/** /**
* @constructor * @constructor
@@ -130,7 +130,7 @@ _ol_renderer_Layer_.prototype.loadImage = function(image) {
*/ */
_ol_renderer_Layer_.prototype.renderIfReadyAndVisible = function() { _ol_renderer_Layer_.prototype.renderIfReadyAndVisible = function() {
var layer = this.getLayer(); var layer = this.getLayer();
if (layer.getVisible() && layer.getSourceState() == _ol_source_State_.READY) { if (layer.getVisible() && layer.getSourceState() == SourceState.READY) {
this.changed(); this.changed();
} }
}; };

View File

@@ -15,7 +15,7 @@ import _ol_render_canvas_ from '../../render/canvas.js';
import _ol_render_canvas_Immediate_ from '../../render/canvas/Immediate.js'; import _ol_render_canvas_Immediate_ from '../../render/canvas/Immediate.js';
import _ol_renderer_Map_ from '../Map.js'; import _ol_renderer_Map_ from '../Map.js';
import RendererType from '../Type.js'; import RendererType from '../Type.js';
import _ol_source_State_ from '../../source/State.js'; import SourceState from '../../source/State.js';
/** /**
* @constructor * @constructor
@@ -180,7 +180,7 @@ _ol_renderer_canvas_Map_.prototype.renderFrame = function(frameState) {
layer = layerState.layer; layer = layerState.layer;
layerRenderer = /** @type {ol.renderer.canvas.Layer} */ (this.getLayerRenderer(layer)); layerRenderer = /** @type {ol.renderer.canvas.Layer} */ (this.getLayerRenderer(layer));
if (!_ol_layer_Layer_.visibleAtResolution(layerState, viewResolution) || if (!_ol_layer_Layer_.visibleAtResolution(layerState, viewResolution) ||
layerState.sourceState != _ol_source_State_.READY) { layerState.sourceState != SourceState.READY) {
continue; continue;
} }
if (layerRenderer.prepareFrame(frameState, layerState)) { if (layerRenderer.prepareFrame(frameState, layerState)) {

View File

@@ -14,7 +14,7 @@ import RenderEventType from '../../render/EventType.js';
import _ol_render_webgl_Immediate_ from '../../render/webgl/Immediate.js'; import _ol_render_webgl_Immediate_ from '../../render/webgl/Immediate.js';
import _ol_renderer_Map_ from '../Map.js'; import _ol_renderer_Map_ from '../Map.js';
import RendererType from '../Type.js'; import RendererType from '../Type.js';
import _ol_source_State_ from '../../source/State.js'; import SourceState from '../../source/State.js';
import LRUCache from '../../structs/LRUCache.js'; import LRUCache from '../../structs/LRUCache.js';
import PriorityQueue from '../../structs/PriorityQueue.js'; import PriorityQueue from '../../structs/PriorityQueue.js';
import _ol_webgl_ from '../../webgl.js'; import _ol_webgl_ from '../../webgl.js';
@@ -450,7 +450,7 @@ _ol_renderer_webgl_Map_.prototype.renderFrame = function(frameState) {
for (i = 0, ii = layerStatesArray.length; i < ii; ++i) { for (i = 0, ii = layerStatesArray.length; i < ii; ++i) {
layerState = layerStatesArray[i]; layerState = layerStatesArray[i];
if (_ol_layer_Layer_.visibleAtResolution(layerState, viewResolution) && if (_ol_layer_Layer_.visibleAtResolution(layerState, viewResolution) &&
layerState.sourceState == _ol_source_State_.READY) { layerState.sourceState == SourceState.READY) {
layerRenderer = /** @type {ol.renderer.webgl.Layer} */ (this.getLayerRenderer(layerState.layer)); layerRenderer = /** @type {ol.renderer.webgl.Layer} */ (this.getLayerRenderer(layerState.layer));
if (layerRenderer.prepareFrame(frameState, layerState, context)) { if (layerRenderer.prepareFrame(frameState, layerState, context)) {
layerStatesToDraw.push(layerState); layerStatesToDraw.push(layerState);

View File

@@ -6,7 +6,7 @@ import {createFromTileUrlFunctions} from '../tileurlfunction.js';
import {applyTransform, intersects} from '../extent.js'; import {applyTransform, intersects} from '../extent.js';
import _ol_net_ from '../net.js'; import _ol_net_ from '../net.js';
import {get as getProjection, getTransformFromProjections} from '../proj.js'; import {get as getProjection, getTransformFromProjections} from '../proj.js';
import _ol_source_State_ from '../source/State.js'; import SourceState from '../source/State.js';
import _ol_source_TileImage_ from '../source/TileImage.js'; import _ol_source_TileImage_ from '../source/TileImage.js';
import _ol_tilecoord_ from '../tilecoord.js'; import _ol_tilecoord_ from '../tilecoord.js';
import _ol_tilegrid_ from '../tilegrid.js'; import _ol_tilegrid_ from '../tilegrid.js';
@@ -34,7 +34,7 @@ var _ol_source_BingMaps_ = function(options) {
opaque: true, opaque: true,
projection: getProjection('EPSG:3857'), projection: getProjection('EPSG:3857'),
reprojectionErrorThreshold: options.reprojectionErrorThreshold, reprojectionErrorThreshold: options.reprojectionErrorThreshold,
state: _ol_source_State_.LOADING, state: SourceState.LOADING,
tileLoadFunction: options.tileLoadFunction, tileLoadFunction: options.tileLoadFunction,
tilePixelRatio: this.hidpi_ ? 2 : 1, tilePixelRatio: this.hidpi_ ? 2 : 1,
wrapX: options.wrapX !== undefined ? options.wrapX : true, wrapX: options.wrapX !== undefined ? options.wrapX : true,
@@ -121,7 +121,7 @@ _ol_source_BingMaps_.prototype.handleImageryMetadataResponse = function(response
response.authenticationResultCode != 'ValidCredentials' || response.authenticationResultCode != 'ValidCredentials' ||
response.resourceSets.length != 1 || response.resourceSets.length != 1 ||
response.resourceSets[0].resources.length != 1) { response.resourceSets[0].resources.length != 1) {
this.setState(_ol_source_State_.ERROR); this.setState(SourceState.ERROR);
return; return;
} }
@@ -204,6 +204,6 @@ _ol_source_BingMaps_.prototype.handleImageryMetadataResponse = function(response
}); });
} }
this.setState(_ol_source_State_.READY); this.setState(SourceState.READY);
}; };
export default _ol_source_BingMaps_; export default _ol_source_BingMaps_;

View File

@@ -3,7 +3,7 @@
*/ */
import {inherits} from '../index.js'; import {inherits} from '../index.js';
import _ol_obj_ from '../obj.js'; import _ol_obj_ from '../obj.js';
import _ol_source_State_ from '../source/State.js'; import SourceState from '../source/State.js';
import _ol_source_XYZ_ from '../source/XYZ.js'; import _ol_source_XYZ_ from '../source/XYZ.js';
/** /**
@@ -48,7 +48,7 @@ var _ol_source_CartoDB_ = function(options) {
maxZoom: options.maxZoom !== undefined ? options.maxZoom : 18, maxZoom: options.maxZoom !== undefined ? options.maxZoom : 18,
minZoom: options.minZoom, minZoom: options.minZoom,
projection: options.projection, projection: options.projection,
state: _ol_source_State_.LOADING, state: SourceState.LOADING,
wrapX: options.wrapX wrapX: options.wrapX
}); });
this.initializeMap_(); this.initializeMap_();
@@ -132,14 +132,14 @@ _ol_source_CartoDB_.prototype.handleInitResponse_ = function(paramHash, event) {
try { try {
response = /** @type {CartoDBLayerInfo} */(JSON.parse(client.responseText)); response = /** @type {CartoDBLayerInfo} */(JSON.parse(client.responseText));
} catch (err) { } catch (err) {
this.setState(_ol_source_State_.ERROR); this.setState(SourceState.ERROR);
return; return;
} }
this.applyTemplate_(response); this.applyTemplate_(response);
this.templateCache_[paramHash] = response; this.templateCache_[paramHash] = response;
this.setState(_ol_source_State_.READY); this.setState(SourceState.READY);
} else { } else {
this.setState(_ol_source_State_.ERROR); this.setState(SourceState.ERROR);
} }
}; };
@@ -149,7 +149,7 @@ _ol_source_CartoDB_.prototype.handleInitResponse_ = function(paramHash, event) {
* @param {Event} event Event. * @param {Event} event Event.
*/ */
_ol_source_CartoDB_.prototype.handleInitError_ = function(event) { _ol_source_CartoDB_.prototype.handleInitError_ = function(event) {
this.setState(_ol_source_State_.ERROR); this.setState(SourceState.ERROR);
}; };

View File

@@ -17,7 +17,7 @@ import _ol_renderer_canvas_ImageLayer_ from '../renderer/canvas/ImageLayer.js';
import _ol_renderer_canvas_TileLayer_ from '../renderer/canvas/TileLayer.js'; import _ol_renderer_canvas_TileLayer_ from '../renderer/canvas/TileLayer.js';
import _ol_source_Image_ from '../source/Image.js'; import _ol_source_Image_ from '../source/Image.js';
import _ol_source_RasterOperationType_ from '../source/RasterOperationType.js'; import _ol_source_RasterOperationType_ from '../source/RasterOperationType.js';
import _ol_source_State_ from '../source/State.js'; import SourceState from '../source/State.js';
import _ol_source_Tile_ from '../source/Tile.js'; import _ol_source_Tile_ from '../source/Tile.js';
import _ol_transform_ from '../transform.js'; import _ol_transform_ from '../transform.js';
@@ -201,7 +201,7 @@ _ol_source_Raster_.prototype.allSourcesReady_ = function() {
var source; var source;
for (var i = 0, ii = this.renderers_.length; i < ii; ++i) { for (var i = 0, ii = this.renderers_.length; i < ii; ++i) {
source = this.renderers_[i].getLayer().getSource(); source = this.renderers_[i].getLayer().getSource();
if (source.getState() !== _ol_source_State_.READY) { if (source.getState() !== SourceState.READY) {
ready = false; ready = false;
break; break;
} }

View File

@@ -4,7 +4,7 @@
import {inherits, nullFunction} from '../index.js'; import {inherits, nullFunction} from '../index.js';
import _ol_Object_ from '../Object.js'; import _ol_Object_ from '../Object.js';
import {get as getProjection} from '../proj.js'; import {get as getProjection} from '../proj.js';
import _ol_source_State_ from '../source/State.js'; import SourceState from '../source/State.js';
/** /**
@@ -42,7 +42,7 @@ var _ol_source_Source_ = function(options) {
* @type {ol.source.State} * @type {ol.source.State}
*/ */
this.state_ = options.state !== undefined ? this.state_ = options.state !== undefined ?
options.state : _ol_source_State_.READY; options.state : SourceState.READY;
/** /**
* @private * @private

View File

@@ -13,7 +13,7 @@ import {assert} from '../asserts.js';
import {applyTransform, intersects} from '../extent.js'; import {applyTransform, intersects} from '../extent.js';
import _ol_net_ from '../net.js'; import _ol_net_ from '../net.js';
import {get as getProjection, getTransformFromProjections} from '../proj.js'; import {get as getProjection, getTransformFromProjections} from '../proj.js';
import _ol_source_State_ from '../source/State.js'; import SourceState from '../source/State.js';
import _ol_source_TileImage_ from '../source/TileImage.js'; import _ol_source_TileImage_ from '../source/TileImage.js';
import _ol_tilegrid_ from '../tilegrid.js'; import _ol_tilegrid_ from '../tilegrid.js';
@@ -40,7 +40,7 @@ var _ol_source_TileJSON_ = function(options) {
crossOrigin: options.crossOrigin, crossOrigin: options.crossOrigin,
projection: getProjection('EPSG:3857'), projection: getProjection('EPSG:3857'),
reprojectionErrorThreshold: options.reprojectionErrorThreshold, reprojectionErrorThreshold: options.reprojectionErrorThreshold,
state: _ol_source_State_.LOADING, state: SourceState.LOADING,
tileLoadFunction: options.tileLoadFunction, tileLoadFunction: options.tileLoadFunction,
wrapX: options.wrapX !== undefined ? options.wrapX : true, wrapX: options.wrapX !== undefined ? options.wrapX : true,
transition: options.transition transition: options.transition
@@ -148,7 +148,7 @@ _ol_source_TileJSON_.prototype.handleTileJSONResponse = function(tileJSON) {
} }
this.tileJSON_ = tileJSON; this.tileJSON_ = tileJSON;
this.setState(_ol_source_State_.READY); this.setState(SourceState.READY);
}; };
@@ -157,6 +157,6 @@ _ol_source_TileJSON_.prototype.handleTileJSONResponse = function(tileJSON) {
* @protected * @protected
*/ */
_ol_source_TileJSON_.prototype.handleTileJSONError = function() { _ol_source_TileJSON_.prototype.handleTileJSONError = function() {
this.setState(_ol_source_State_.ERROR); this.setState(SourceState.ERROR);
}; };
export default _ol_source_TileJSON_; export default _ol_source_TileJSON_;

View File

@@ -11,7 +11,7 @@ import EventType from '../events/EventType.js';
import {applyTransform, intersects} from '../extent.js'; import {applyTransform, intersects} from '../extent.js';
import _ol_net_ from '../net.js'; import _ol_net_ from '../net.js';
import {get as getProjection, getTransformFromProjections} from '../proj.js'; import {get as getProjection, getTransformFromProjections} from '../proj.js';
import _ol_source_State_ from '../source/State.js'; import SourceState from '../source/State.js';
import _ol_source_Tile_ from '../source/Tile.js'; import _ol_source_Tile_ from '../source/Tile.js';
import _ol_tilecoord_ from '../tilecoord.js'; import _ol_tilecoord_ from '../tilecoord.js';
import _ol_tilegrid_ from '../tilegrid.js'; import _ol_tilegrid_ from '../tilegrid.js';
@@ -28,7 +28,7 @@ import _ol_tilegrid_ from '../tilegrid.js';
var _ol_source_TileUTFGrid_ = function(options) { var _ol_source_TileUTFGrid_ = function(options) {
_ol_source_Tile_.call(this, { _ol_source_Tile_.call(this, {
projection: getProjection('EPSG:3857'), projection: getProjection('EPSG:3857'),
state: _ol_source_State_.LOADING state: SourceState.LOADING
}); });
/** /**
@@ -155,7 +155,7 @@ _ol_source_TileUTFGrid_.prototype.forDataAtCoordinateAndResolution = function(
* @protected * @protected
*/ */
_ol_source_TileUTFGrid_.prototype.handleTileJSONError = function() { _ol_source_TileUTFGrid_.prototype.handleTileJSONError = function() {
this.setState(_ol_source_State_.ERROR); this.setState(SourceState.ERROR);
}; };
@@ -189,7 +189,7 @@ _ol_source_TileUTFGrid_.prototype.handleTileJSONResponse = function(tileJSON) {
var grids = tileJSON.grids; var grids = tileJSON.grids;
if (!grids) { if (!grids) {
this.setState(_ol_source_State_.ERROR); this.setState(SourceState.ERROR);
return; return;
} }
@@ -207,7 +207,7 @@ _ol_source_TileUTFGrid_.prototype.handleTileJSONResponse = function(tileJSON) {
}); });
} }
this.setState(_ol_source_State_.READY); this.setState(SourceState.READY);
}; };

View File

@@ -17,7 +17,7 @@ import {TRUE} from '../functions.js';
import _ol_loadingstrategy_ from '../loadingstrategy.js'; import _ol_loadingstrategy_ from '../loadingstrategy.js';
import _ol_obj_ from '../obj.js'; import _ol_obj_ from '../obj.js';
import _ol_source_Source_ from '../source/Source.js'; import _ol_source_Source_ from '../source/Source.js';
import _ol_source_State_ from '../source/State.js'; import SourceState from '../source/State.js';
import _ol_source_VectorEventType_ from '../source/VectorEventType.js'; import _ol_source_VectorEventType_ from '../source/VectorEventType.js';
import RBush from '../structs/RBush.js'; import RBush from '../structs/RBush.js';
@@ -40,7 +40,7 @@ var _ol_source_Vector_ = function(opt_options) {
_ol_source_Source_.call(this, { _ol_source_Source_.call(this, {
attributions: options.attributions, attributions: options.attributions,
projection: undefined, projection: undefined,
state: _ol_source_State_.READY, state: SourceState.READY,
wrapX: options.wrapX !== undefined ? options.wrapX : true wrapX: options.wrapX !== undefined ? options.wrapX : true
}); });