Rename ol.loading to ol.loadingstrategy

This commit is contained in:
Tom Payne
2014-03-13 20:21:15 +01:00
parent de4a17b8e2
commit b8869805a7
7 changed files with 23 additions and 12 deletions

View File

@@ -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'

View File

@@ -911,7 +911,7 @@
* @property {function(ol.Extent, number, ol.proj.Projection): string} extentUrlFunction Extent URL function.
* @property {Object.<string, string>|undefined} headers Headers.
* @property {ol.format.Feature} format Format.
* @property {function(ol.Extent, number): Array.<ol.Extent>} loadingFunction Loading function.
* @property {function(ol.Extent, number): Array.<ol.Extent>} loadingStrategy Loading strategy.
* @property {string|undefined} logo Logo.
* @property {ol.proj.ProjectionLike} projection Projection.
*/

View File

@@ -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.

View File

@@ -1,3 +0,0 @@
@exportSymbol ol.loading.all
@exportSymbol ol.loading.bbox
@exportSymbol ol.loading.createTile

View File

@@ -0,0 +1,3 @@
@exportSymbol ol.loadingstrategy.all
@exportSymbol ol.loadingstrategy.bbox
@exportSymbol ol.loadingstrategy.createTile

View File

@@ -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.<ol.Extent>} 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.<ol.Extent>} 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.<ol.Extent>} Loading strategy.
*/
ol.loading.createTile = function(tileGrid) {
ol.loadingstrategy.createTile = function(tileGrid) {
return (
/**
* @param {ol.Extent} extent Extent.

View File

@@ -34,7 +34,7 @@ ol.source.ServerVector = function(options) {
* @private
* @type {function(ol.Extent, number): Array.<ol.Extent>}
*/
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];