Merge pull request #7771 from marcjansen/rename-loadingstrategy

Named exports from loadingstrategy
This commit is contained in:
Marc Jansen
2018-02-07 07:16:32 +01:00
committed by GitHub
7 changed files with 23 additions and 26 deletions
+11 -13
View File
@@ -1,7 +1,6 @@
/**
* @module ol/loadingstrategy
*/
const _ol_loadingstrategy_ = {};
/**
@@ -11,9 +10,9 @@ const _ol_loadingstrategy_ = {};
* @return {Array.<ol.Extent>} Extents.
* @api
*/
_ol_loadingstrategy_.all = function(extent, resolution) {
export function all(extent, resolution) {
return [[-Infinity, -Infinity, Infinity, Infinity]];
};
}
/**
@@ -24,9 +23,9 @@ _ol_loadingstrategy_.all = function(extent, resolution) {
* @return {Array.<ol.Extent>} Extents.
* @api
*/
_ol_loadingstrategy_.bbox = function(extent, resolution) {
export function bbox(extent, resolution) {
return [extent];
};
}
/**
@@ -35,13 +34,13 @@ _ol_loadingstrategy_.bbox = function(extent, resolution) {
* @return {function(ol.Extent, number): Array.<ol.Extent>} Loading strategy.
* @api
*/
_ol_loadingstrategy_.tile = function(tileGrid) {
export function tile(tileGrid) {
return (
/**
* @param {ol.Extent} extent Extent.
* @param {number} resolution Resolution.
* @return {Array.<ol.Extent>} Extents.
*/
/**
* @param {ol.Extent} extent Extent.
* @param {number} resolution Resolution.
* @return {Array.<ol.Extent>} Extents.
*/
function(extent, resolution) {
const z = tileGrid.getZForResolution(resolution);
const tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z);
@@ -58,5 +57,4 @@ _ol_loadingstrategy_.tile = function(tileGrid) {
}
return extents;
});
};
export default _ol_loadingstrategy_;
}
+2 -3
View File
@@ -14,7 +14,7 @@ import EventType from '../events/EventType.js';
import {containsExtent, equals} from '../extent.js';
import {xhr} from '../featureloader.js';
import {TRUE} from '../functions.js';
import _ol_loadingstrategy_ from '../loadingstrategy.js';
import {all as allStrategy} from '../loadingstrategy.js';
import {isEmpty, getValues} from '../obj.js';
import Source from '../source/Source.js';
import SourceState from '../source/State.js';
@@ -80,8 +80,7 @@ const VectorSource = function(opt_options) {
* @private
* @type {ol.LoadingStrategy}
*/
this.strategy_ = options.strategy !== undefined ? options.strategy :
_ol_loadingstrategy_.all;
this.strategy_ = options.strategy !== undefined ? options.strategy : allStrategy;
const useSpatialIndex =
options.useSpatialIndex !== undefined ? options.useSpatialIndex : true;