Add tile error handling

This commit is contained in:
Andreas Hocevar
2015-09-12 20:02:14 +09:00
parent dbedbc19ee
commit 63629e1ee2
2 changed files with 25 additions and 9 deletions
+11 -4
View File
@@ -134,8 +134,7 @@ ol.VectorTile.prototype.getProjection = function() {
*/
ol.VectorTile.prototype.load = function() {
if (this.state == ol.TileState.IDLE) {
this.state = ol.TileState.LOADING;
this.changed();
this.setState(ol.TileState.LOADING);
this.tileLoadFunction_(this, this.url_);
this.loader_(null, NaN, null);
}
@@ -147,8 +146,7 @@ ol.VectorTile.prototype.load = function() {
*/
ol.VectorTile.prototype.setFeatures = function(features) {
this.features_ = features;
this.state = ol.TileState.LOADED;
this.changed();
this.setState(ol.TileState.LOADED);
};
@@ -160,6 +158,15 @@ ol.VectorTile.prototype.setProjection = function(projection) {
};
/**
* @param {ol.TileState} tileState Tile state.
*/
ol.VectorTile.prototype.setState = function(tileState) {
this.state = tileState;
this.changed();
};
/**
* Set the feeature loader for reading this tile's features.
* @param {ol.FeatureLoader} loader Feature loader.