Remove use of goog.array.forEach

This commit is contained in:
Frederic Junod
2015-09-24 11:03:39 +02:00
parent cd152cca14
commit 496cece074
22 changed files with 68 additions and 89 deletions

View File

@@ -1,7 +1,6 @@
goog.provide('ol.source.BingMaps');
goog.require('goog.Uri');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('goog.net.Jsonp');
goog.require('ol.Attribution');
@@ -150,26 +149,23 @@ ol.source.BingMaps.prototype.handleImageryMetadataResponse =
var html = imageryProvider.attribution;
/** @type {Object.<string, Array.<ol.TileRange>>} */
var tileRanges = {};
goog.array.forEach(
imageryProvider.coverageAreas,
function(coverageArea) {
var minZ = coverageArea.zoomMin;
var maxZ = Math.min(coverageArea.zoomMax, maxZoom);
var bbox = coverageArea.bbox;
var epsg4326Extent = [bbox[1], bbox[0], bbox[3], bbox[2]];
var extent = ol.extent.applyTransform(
epsg4326Extent, transform);
var tileRange, z, zKey;
for (z = minZ; z <= maxZ; ++z) {
zKey = z.toString();
tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z);
if (zKey in tileRanges) {
tileRanges[zKey].push(tileRange);
} else {
tileRanges[zKey] = [tileRange];
}
}
});
imageryProvider.coverageAreas.forEach(function(coverageArea) {
var minZ = coverageArea.zoomMin;
var maxZ = Math.min(coverageArea.zoomMax, maxZoom);
var bbox = coverageArea.bbox;
var epsg4326Extent = [bbox[1], bbox[0], bbox[3], bbox[2]];
var extent = ol.extent.applyTransform(epsg4326Extent, transform);
var tileRange, z, zKey;
for (z = minZ; z <= maxZ; ++z) {
zKey = z.toString();
tileRange = tileGrid.getTileRangeForExtentAndZ(extent, z);
if (zKey in tileRanges) {
tileRanges[zKey].push(tileRange);
} else {
tileRanges[zKey] = [tileRange];
}
}
});
return new ol.Attribution({html: html, tileRanges: tileRanges});
});
attributions.push(ol.source.BingMaps.TOS_ATTRIBUTION);

View File

@@ -374,7 +374,7 @@ ol.source.Vector.prototype.clear = function(opt_fast) {
if (opt_fast) {
for (var featureId in this.featureChangeKeys_) {
var keys = this.featureChangeKeys_[featureId];
goog.array.forEach(keys, goog.events.unlistenByKey);
keys.forEach(goog.events.unlistenByKey);
}
if (goog.isNull(this.featuresCollection_)) {
this.featureChangeKeys_ = {};
@@ -823,8 +823,7 @@ ol.source.Vector.prototype.removeFeatureInternal = function(feature) {
var featureKey = goog.getUid(feature).toString();
goog.asserts.assert(featureKey in this.featureChangeKeys_,
'featureKey exists in featureChangeKeys');
goog.array.forEach(this.featureChangeKeys_[featureKey],
goog.events.unlistenByKey);
this.featureChangeKeys_[featureKey].forEach(goog.events.unlistenByKey);
delete this.featureChangeKeys_[featureKey];
var id = feature.getId();
if (id !== undefined) {

View File

@@ -402,7 +402,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
var dimensions = {};
if ('Dimension' in l) {
goog.array.forEach(l['Dimension'], function(elt, index, array) {
l['Dimension'].forEach(function(elt, index, array) {
var key = elt['Identifier'];
var value = elt['default'];
if (value !== undefined) {
@@ -467,7 +467,7 @@ ol.source.WMTS.optionsFromCapabilities = function(wmtsCap, config) {
goog.string.startsWith(requestEncoding, 'REST')) {
// Add REST tile resource url
requestEncoding = ol.source.WMTSRequestEncoding.REST;
goog.array.forEach(l['ResourceURL'], function(elt, index, array) {
l['ResourceURL'].forEach(function(elt, index, array) {
if (elt['resourceType'] == 'tile') {
format = elt['format'];
urls.push(/** @type {string} */ (elt['template']));