From b8869805a77dbcf0d4d18e6e9852a322261fe681 Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Thu, 13 Mar 2014 20:21:15 +0100 Subject: [PATCH] Rename ol.loading to ol.loadingstrategy --- examples/vector-osm.js | 4 ++-- src/objectliterals.jsdoc | 2 +- src/ol/extent.js | 11 +++++++++++ src/ol/loading.exports | 3 --- src/ol/loadingstrategy.exports | 3 +++ src/ol/{loading.js => loadingstrategy.js} | 8 ++++---- src/ol/source/servervectorsource.js | 4 ++-- 7 files changed, 23 insertions(+), 12 deletions(-) delete mode 100644 src/ol/loading.exports create mode 100644 src/ol/loadingstrategy.exports rename src/ol/{loading.js => loadingstrategy.js} (86%) diff --git a/examples/vector-osm.js b/examples/vector-osm.js index 94427a1b14..cba43f1d7f 100644 --- a/examples/vector-osm.js +++ b/examples/vector-osm.js @@ -3,7 +3,7 @@ goog.require('ol.View2D'); goog.require('ol.format.OSMXML'); goog.require('ol.layer.Tile'); goog.require('ol.layer.Vector'); -goog.require('ol.loading'); +goog.require('ol.loadingstrategy'); goog.require('ol.proj'); goog.require('ol.source.BingMaps'); goog.require('ol.source.ServerVector'); @@ -95,7 +95,7 @@ var vectorSource = new ol.source.ServerVector({ epsg4326Extent.join(','); }, format: new ol.format.OSMXML(), - loadingFunction: ol.loading.createTile(new ol.tilegrid.XYZ({ + loadingStrategy: ol.loadingstrategy.createTile(new ol.tilegrid.XYZ({ maxZoom: 19 })), projection: 'EPSG:3857' diff --git a/src/objectliterals.jsdoc b/src/objectliterals.jsdoc index 7d03ce5bb8..9e566be949 100644 --- a/src/objectliterals.jsdoc +++ b/src/objectliterals.jsdoc @@ -911,7 +911,7 @@ * @property {function(ol.Extent, number, ol.proj.Projection): string} extentUrlFunction Extent URL function. * @property {Object.|undefined} headers Headers. * @property {ol.format.Feature} format Format. - * @property {function(ol.Extent, number): Array.} loadingFunction Loading function. + * @property {function(ol.Extent, number): Array.} loadingStrategy Loading strategy. * @property {string|undefined} logo Logo. * @property {ol.proj.ProjectionLike} projection Projection. */ diff --git a/src/ol/extent.js b/src/ol/extent.js index ba146637fc..10f36db01d 100644 --- a/src/ol/extent.js +++ b/src/ol/extent.js @@ -597,6 +597,17 @@ ol.extent.isEmpty = function(extent) { }; +/** + * @param {ol.Extent} extent Extent. + * @return {boolean} Is infinite. + * @todo stability experimental + */ +ol.extent.isInfinite = function(extent) { + return extent[0] == -Infinity || extent[1] == -Infinity || + extent[2] == Infinity || extent[3] == Infinity; +}; + + /** * @param {ol.Extent} extent Extent. * @param {ol.Coordinate} coordinate Coordinate. diff --git a/src/ol/loading.exports b/src/ol/loading.exports deleted file mode 100644 index 7564c21668..0000000000 --- a/src/ol/loading.exports +++ /dev/null @@ -1,3 +0,0 @@ -@exportSymbol ol.loading.all -@exportSymbol ol.loading.bbox -@exportSymbol ol.loading.createTile diff --git a/src/ol/loadingstrategy.exports b/src/ol/loadingstrategy.exports new file mode 100644 index 0000000000..711262d776 --- /dev/null +++ b/src/ol/loadingstrategy.exports @@ -0,0 +1,3 @@ +@exportSymbol ol.loadingstrategy.all +@exportSymbol ol.loadingstrategy.bbox +@exportSymbol ol.loadingstrategy.createTile diff --git a/src/ol/loading.js b/src/ol/loadingstrategy.js similarity index 86% rename from src/ol/loading.js rename to src/ol/loadingstrategy.js index 272d3b2887..58a5dd4b3b 100644 --- a/src/ol/loading.js +++ b/src/ol/loadingstrategy.js @@ -1,4 +1,4 @@ -goog.provide('ol.loading'); +goog.provide('ol.loadingstrategy'); goog.require('ol.TileCoord'); @@ -8,7 +8,7 @@ goog.require('ol.TileCoord'); * @param {number} resolution Resolution. * @return {Array.} Extents. */ -ol.loading.all = function(extent, resolution) { +ol.loadingstrategy.all = function(extent, resolution) { return [[-Infinity, -Infinity, Infinity, Infinity]]; }; @@ -18,7 +18,7 @@ ol.loading.all = function(extent, resolution) { * @param {number} resolution Resolution. * @return {Array.} Extents. */ -ol.loading.bbox = function(extent, resolution) { +ol.loadingstrategy.bbox = function(extent, resolution) { return [extent]; }; @@ -27,7 +27,7 @@ ol.loading.bbox = function(extent, resolution) { * @param {ol.tilegrid.TileGrid} tileGrid Tile grid. * @return {function(ol.Extent, number): Array.} Loading strategy. */ -ol.loading.createTile = function(tileGrid) { +ol.loadingstrategy.createTile = function(tileGrid) { return ( /** * @param {ol.Extent} extent Extent. diff --git a/src/ol/source/servervectorsource.js b/src/ol/source/servervectorsource.js index 7f30394494..5f1e5570bf 100644 --- a/src/ol/source/servervectorsource.js +++ b/src/ol/source/servervectorsource.js @@ -34,7 +34,7 @@ ol.source.ServerVector = function(options) { * @private * @type {function(ol.Extent, number): Array.} */ - this.loadingFunction_ = options.loadingFunction; + this.loadingStrategy_ = options.loadingStrategy; /** * @private @@ -77,7 +77,7 @@ ol.source.ServerVector.prototype.addFeaturesInternal = function(features) { ol.source.ServerVector.prototype.loadFeatures = function(extent, resolution, projection) { var loadedExtents = this.loadedExtents_; - var extentsToLoad = this.loadingFunction_(extent, resolution); + var extentsToLoad = this.loadingStrategy_(extent, resolution); var i, ii; for (i = 0, ii = extentsToLoad.length; i < ii; ++i) { var extentToLoad = extentsToLoad[i];