Merge pull request #7636 from marcjansen/named-exports-array

Named exports from the ol/array module
This commit is contained in:
Marc Jansen
2017-12-19 22:32:14 +01:00
committed by GitHub
47 changed files with 296 additions and 298 deletions

View File

@@ -4,7 +4,7 @@
import {ENABLE_RASTER_REPROJECTION} from '../reproj/common.js';
import {inherits} from '../index.js';
import ImageState from '../ImageState.js';
import _ol_array_ from '../array.js';
import {linearFindNearest} from '../array.js';
import Event from '../events/Event.js';
import {equals} from '../extent.js';
import {equivalent} from '../proj.js';
@@ -72,7 +72,7 @@ _ol_source_Image_.prototype.getResolutions = function() {
*/
_ol_source_Image_.prototype.findNearestResolution = function(resolution) {
if (this.resolutions_) {
var idx = _ol_array_.linearFindNearest(this.resolutions_, resolution, 0);
var idx = linearFindNearest(this.resolutions_, resolution, 0);
resolution = this.resolutions_[idx];
}
return resolution;

View File

@@ -6,7 +6,7 @@ import {getUid, inherits, nullFunction} from '../index.js';
import _ol_Collection_ from '../Collection.js';
import CollectionEventType from '../CollectionEventType.js';
import ObjectEventType from '../ObjectEventType.js';
import _ol_array_ from '../array.js';
import {extend} from '../array.js';
import {assert} from '../asserts.js';
import _ol_events_ from '../events.js';
import Event from '../events/Event.js';
@@ -507,8 +507,7 @@ _ol_source_Vector_.prototype.getFeatures = function() {
} else if (this.featuresRtree_) {
features = this.featuresRtree_.getAll();
if (!_ol_obj_.isEmpty(this.nullGeometryFeatures_)) {
_ol_array_.extend(
features, _ol_obj_.getValues(this.nullGeometryFeatures_));
extend(features, _ol_obj_.getValues(this.nullGeometryFeatures_));
}
}
return /** @type {Array.<ol.Feature>} */ (features);

View File

@@ -3,7 +3,7 @@
*/
import {inherits} from '../index.js';
import {expandUrl, createFromTileUrlFunctions, nullTileUrlFunction} from '../tileurlfunction.js';
import _ol_array_ from '../array.js';
import {find, findIndex, includes} from '../array.js';
import {containsExtent} from '../extent.js';
import _ol_obj_ from '../obj.js';
import {get as getProjection, equivalent, transformExtent} from '../proj.js';
@@ -311,7 +311,7 @@ _ol_source_WMTS_.prototype.updateDimensions = function(dimensions) {
*/
_ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
var layers = wmtsCap['Contents']['Layer'];
var l = _ol_array_.find(layers, function(elt, index, array) {
var l = find(layers, function(elt, index, array) {
return elt['Identifier'] == config['layer'];
});
if (l === null) {
@@ -321,9 +321,9 @@ _ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
var idx, matrixSet, matrixLimits;
if (l['TileMatrixSetLink'].length > 1) {
if ('projection' in config) {
idx = _ol_array_.findIndex(l['TileMatrixSetLink'],
idx = findIndex(l['TileMatrixSetLink'],
function(elt, index, array) {
var tileMatrixSet = _ol_array_.find(tileMatrixSets, function(el) {
var tileMatrixSet = find(tileMatrixSets, function(el) {
return el['Identifier'] == elt['TileMatrixSet'];
});
var supportedCRS = tileMatrixSet['SupportedCRS'];
@@ -337,7 +337,7 @@ _ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
}
});
} else {
idx = _ol_array_.findIndex(l['TileMatrixSetLink'],
idx = findIndex(l['TileMatrixSetLink'],
function(elt, index, array) {
return elt['TileMatrixSet'] == config['matrixSet'];
});
@@ -357,7 +357,7 @@ _ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
if ('format' in config) {
format = config['format'];
}
idx = _ol_array_.findIndex(l['Style'], function(elt, index, array) {
idx = findIndex(l['Style'], function(elt, index, array) {
if ('style' in config) {
return elt['Title'] == config['style'];
} else {
@@ -382,7 +382,7 @@ _ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
}
var matrixSets = wmtsCap['Contents']['TileMatrixSet'];
var matrixSetObj = _ol_array_.find(matrixSets, function(elt, index, array) {
var matrixSetObj = find(matrixSets, function(elt, index, array) {
return elt['Identifier'] == matrixSet;
});
@@ -432,7 +432,7 @@ _ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
for (var i = 0, ii = gets.length; i < ii; ++i) {
if (gets[i]['Constraint']) {
var constraint = _ol_array_.find(gets[i]['Constraint'], function(element) {
var constraint = find(gets[i]['Constraint'], function(element) {
return element['name'] == 'GetEncoding';
});
var encodings = constraint['AllowedValues']['Value'];
@@ -442,7 +442,7 @@ _ol_source_WMTS_.optionsFromCapabilities = function(wmtsCap, config) {
requestEncoding = encodings[0];
}
if (requestEncoding === _ol_source_WMTSRequestEncoding_.KVP) {
if (_ol_array_.includes(encodings, _ol_source_WMTSRequestEncoding_.KVP)) {
if (includes(encodings, _ol_source_WMTSRequestEncoding_.KVP)) {
urls.push(/** @type {string} */ (gets[i]['href']));
}
} else {