diff --git a/src/ol/extent.js b/src/ol/extent.js index 3091ad7a12..b90eaf9006 100644 --- a/src/ol/extent.js +++ b/src/ol/extent.js @@ -340,8 +340,7 @@ export function extendCoordinate(extent, coordinate) { * @return {ol.Extent} Extent. */ export function extendCoordinates(extent, coordinates) { - let i, ii; - for (i = 0, ii = coordinates.length; i < ii; ++i) { + for (let i = 0, ii = coordinates.length; i < ii; ++i) { extendCoordinate(extent, coordinates[i]); } return extent; @@ -370,8 +369,7 @@ export function extendFlatCoordinates(extent, flatCoordinates, offset, end, stri * @return {ol.Extent} Extent. */ export function extendRings(extent, rings) { - let i, ii; - for (i = 0, ii = rings.length; i < ii; ++i) { + for (let i = 0, ii = rings.length; i < ii; ++i) { extendCoordinates(extent, rings[i]); } return extent; diff --git a/src/ol/geom/GeometryCollection.js b/src/ol/geom/GeometryCollection.js index 4294fda6df..5fc11ea021 100644 --- a/src/ol/geom/GeometryCollection.js +++ b/src/ol/geom/GeometryCollection.js @@ -41,8 +41,7 @@ inherits(GeometryCollection, Geometry); */ GeometryCollection.cloneGeometries_ = function(geometries) { const clonedGeometries = []; - let i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { + for (let i = 0, ii = geometries.length; i < ii; ++i) { clonedGeometries.push(geometries[i].clone()); } return clonedGeometries; @@ -53,11 +52,10 @@ GeometryCollection.cloneGeometries_ = function(geometries) { * @private */ GeometryCollection.prototype.unlistenGeometriesChange_ = function() { - let i, ii; if (!this.geometries_) { return; } - for (i = 0, ii = this.geometries_.length; i < ii; ++i) { + for (let i = 0, ii = this.geometries_.length; i < ii; ++i) { _ol_events_.unlisten( this.geometries_[i], EventType.CHANGE, this.changed, this); @@ -69,11 +67,10 @@ GeometryCollection.prototype.unlistenGeometriesChange_ = function() { * @private */ GeometryCollection.prototype.listenGeometriesChange_ = function() { - let i, ii; if (!this.geometries_) { return; } - for (i = 0, ii = this.geometries_.length; i < ii; ++i) { + for (let i = 0, ii = this.geometries_.length; i < ii; ++i) { _ol_events_.listen( this.geometries_[i], EventType.CHANGE, this.changed, this); @@ -102,8 +99,7 @@ GeometryCollection.prototype.closestPointXY = function(x, y, closestPoint, minSq return minSquaredDistance; } const geometries = this.geometries_; - let i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { + for (let i = 0, ii = geometries.length; i < ii; ++i) { minSquaredDistance = geometries[i].closestPointXY( x, y, closestPoint, minSquaredDistance); } @@ -116,8 +112,7 @@ GeometryCollection.prototype.closestPointXY = function(x, y, closestPoint, minSq */ GeometryCollection.prototype.containsXY = function(x, y) { const geometries = this.geometries_; - let i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { + for (let i = 0, ii = geometries.length; i < ii; ++i) { if (geometries[i].containsXY(x, y)) { return true; } @@ -178,8 +173,7 @@ GeometryCollection.prototype.getSimplifiedGeometry = function(squaredTolerance) const simplifiedGeometries = []; const geometries = this.geometries_; let simplified = false; - let i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { + for (let i = 0, ii = geometries.length; i < ii; ++i) { const geometry = geometries[i]; const simplifiedGeometry = geometry.getSimplifiedGeometry(squaredTolerance); simplifiedGeometries.push(simplifiedGeometry); @@ -215,8 +209,7 @@ GeometryCollection.prototype.getType = function() { */ GeometryCollection.prototype.intersectsExtent = function(extent) { const geometries = this.geometries_; - let i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { + for (let i = 0, ii = geometries.length; i < ii; ++i) { if (geometries[i].intersectsExtent(extent)) { return true; } @@ -291,8 +284,7 @@ GeometryCollection.prototype.setGeometriesArray = function(geometries) { */ GeometryCollection.prototype.applyTransform = function(transformFn) { const geometries = this.geometries_; - let i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { + for (let i = 0, ii = geometries.length; i < ii; ++i) { geometries[i].applyTransform(transformFn); } this.changed(); @@ -308,8 +300,7 @@ GeometryCollection.prototype.applyTransform = function(transformFn) { */ GeometryCollection.prototype.translate = function(deltaX, deltaY) { const geometries = this.geometries_; - let i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { + for (let i = 0, ii = geometries.length; i < ii; ++i) { geometries[i].translate(deltaX, deltaY); } this.changed(); diff --git a/src/ol/geom/MultiLineString.js b/src/ol/geom/MultiLineString.js index 283aac83df..2a4e05cf71 100644 --- a/src/ol/geom/MultiLineString.js +++ b/src/ol/geom/MultiLineString.js @@ -186,8 +186,7 @@ MultiLineString.prototype.getLineStrings = function() { /** @type {Array.} */ const lineStrings = []; let offset = 0; - let i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { + for (let i = 0, ii = ends.length; i < ii; ++i) { const end = ends[i]; const lineString = new LineString(null); lineString.setFlatCoordinates(layout, flatCoordinates.slice(offset, end)); @@ -207,8 +206,7 @@ MultiLineString.prototype.getFlatMidpoints = function() { let offset = 0; const ends = this.ends_; const stride = this.stride; - let i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { + for (let i = 0, ii = ends.length; i < ii; ++i) { const end = ends[i]; const midpoint = _ol_geom_flat_interpolate_.lineString( flatCoordinates, offset, end, stride, 0.5); @@ -296,8 +294,7 @@ MultiLineString.prototype.setLineStrings = function(lineStrings) { let layout = this.getLayout(); const flatCoordinates = []; const ends = []; - let i, ii; - for (i = 0, ii = lineStrings.length; i < ii; ++i) { + for (let i = 0, ii = lineStrings.length; i < ii; ++i) { const lineString = lineStrings[i]; if (i === 0) { layout = lineString.getLayout(); diff --git a/src/ol/geom/MultiPoint.js b/src/ol/geom/MultiPoint.js index 29b3e13987..a975a36da9 100644 --- a/src/ol/geom/MultiPoint.js +++ b/src/ol/geom/MultiPoint.js @@ -67,13 +67,12 @@ MultiPoint.prototype.closestPointXY = function(x, y, closestPoint, minSquaredDis } const flatCoordinates = this.flatCoordinates; const stride = this.stride; - let i, ii, j; - for (i = 0, ii = flatCoordinates.length; i < ii; i += stride) { + for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) { const squaredDistance = squaredDx( x, y, flatCoordinates[i], flatCoordinates[i + 1]); if (squaredDistance < minSquaredDistance) { minSquaredDistance = squaredDistance; - for (j = 0; j < stride; ++j) { + for (let j = 0; j < stride; ++j) { closestPoint[j] = flatCoordinates[i + j]; } closestPoint.length = stride; @@ -102,8 +101,7 @@ MultiPoint.prototype.getCoordinates = function() { * @api */ MultiPoint.prototype.getPoint = function(index) { - const n = !this.flatCoordinates ? - 0 : this.flatCoordinates.length / this.stride; + const n = !this.flatCoordinates ? 0 : this.flatCoordinates.length / this.stride; if (index < 0 || n <= index) { return null; } @@ -125,8 +123,7 @@ MultiPoint.prototype.getPoints = function() { const stride = this.stride; /** @type {Array.} */ const points = []; - let i, ii; - for (i = 0, ii = flatCoordinates.length; i < ii; i += stride) { + for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) { const point = new Point(null); point.setFlatCoordinates(layout, flatCoordinates.slice(i, i + stride)); points.push(point); @@ -151,10 +148,9 @@ MultiPoint.prototype.getType = function() { MultiPoint.prototype.intersectsExtent = function(extent) { const flatCoordinates = this.flatCoordinates; const stride = this.stride; - let i, ii, x, y; - for (i = 0, ii = flatCoordinates.length; i < ii; i += stride) { - x = flatCoordinates[i]; - y = flatCoordinates[i + 1]; + for (let i = 0, ii = flatCoordinates.length; i < ii; i += stride) { + const x = flatCoordinates[i]; + const y = flatCoordinates[i + 1]; if (containsXY(extent, x, y)) { return true; } diff --git a/src/ol/geom/MultiPolygon.js b/src/ol/geom/MultiPolygon.js index c2f7bab8cd..f01b88d955 100644 --- a/src/ol/geom/MultiPolygon.js +++ b/src/ol/geom/MultiPolygon.js @@ -99,8 +99,7 @@ MultiPolygon.prototype.appendPolygon = function(polygon) { const offset = this.flatCoordinates.length; extend(this.flatCoordinates, polygon.getFlatCoordinates()); ends = polygon.getEnds().slice(); - let i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { + for (let i = 0, ii = ends.length; i < ii; ++i) { ends[i] += offset; } } @@ -293,8 +292,7 @@ MultiPolygon.prototype.getPolygon = function(index) { const ends = this.endss_[index].slice(); const end = ends[ends.length - 1]; if (offset !== 0) { - let i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { + for (let i = 0, ii = ends.length; i < ii; ++i) { ends[i] -= offset; } } @@ -316,12 +314,11 @@ MultiPolygon.prototype.getPolygons = function() { const endss = this.endss_; const polygons = []; let offset = 0; - let i, ii, j, jj; - for (i = 0, ii = endss.length; i < ii; ++i) { + for (let i = 0, ii = endss.length; i < ii; ++i) { const ends = endss[i].slice(); const end = ends[ends.length - 1]; if (offset !== 0) { - for (j = 0, jj = ends.length; j < jj; ++j) { + for (let j = 0, jj = ends.length; j < jj; ++j) { ends[j] -= offset; } } diff --git a/src/ol/geom/SimpleGeometry.js b/src/ol/geom/SimpleGeometry.js index 409f490597..97e6dc1047 100644 --- a/src/ol/geom/SimpleGeometry.js +++ b/src/ol/geom/SimpleGeometry.js @@ -230,8 +230,7 @@ SimpleGeometry.prototype.setLayout = function(layout, coordinates, nesting) { if (layout) { stride = getStrideForLayout(layout); } else { - let i; - for (i = 0; i < nesting; ++i) { + for (let i = 0; i < nesting; ++i) { if (coordinates.length === 0) { this.layout = GeometryLayout.XY; this.stride = 2; diff --git a/src/ol/geom/flat/center.js b/src/ol/geom/flat/center.js index e86a523c0c..27887f37d5 100644 --- a/src/ol/geom/flat/center.js +++ b/src/ol/geom/flat/center.js @@ -14,9 +14,8 @@ const _ol_geom_flat_center_ = {}; */ _ol_geom_flat_center_.linearRingss = function(flatCoordinates, offset, endss, stride) { const flatCenters = []; - let i, ii; let extent = createEmpty(); - for (i = 0, ii = endss.length; i < ii; ++i) { + for (let i = 0, ii = endss.length; i < ii; ++i) { const ends = endss[i]; extent = createOrUpdateFromFlatCoordinates(flatCoordinates, offset, ends[0], stride); flatCenters.push((extent[0] + extent[2]) / 2, (extent[1] + extent[3]) / 2); diff --git a/src/ol/geom/flat/closest.js b/src/ol/geom/flat/closest.js index 02ac2a1102..12d5802592 100644 --- a/src/ol/geom/flat/closest.js +++ b/src/ol/geom/flat/closest.js @@ -22,7 +22,7 @@ _ol_geom_flat_closest_.point = function(flatCoordinates, offset1, offset2, strid const y1 = flatCoordinates[offset1 + 1]; const dx = flatCoordinates[offset2] - x1; const dy = flatCoordinates[offset2 + 1] - y1; - let i, offset; + let offset; if (dx === 0 && dy === 0) { offset = offset1; } else { @@ -30,7 +30,7 @@ _ol_geom_flat_closest_.point = function(flatCoordinates, offset1, offset2, strid if (t > 1) { offset = offset2; } else if (t > 0) { - for (i = 0; i < stride; ++i) { + for (let i = 0; i < stride; ++i) { closestPoint[i] = lerp(flatCoordinates[offset1 + i], flatCoordinates[offset2 + i], t); } @@ -40,7 +40,7 @@ _ol_geom_flat_closest_.point = function(flatCoordinates, offset1, offset2, strid offset = offset1; } } - for (i = 0; i < stride; ++i) { + for (let i = 0; i < stride; ++i) { closestPoint[i] = flatCoordinates[offset + i]; } closestPoint.length = stride; @@ -83,8 +83,7 @@ _ol_geom_flat_closest_.getMaxSquaredDelta = function(flatCoordinates, offset, en * @return {number} Max squared delta. */ _ol_geom_flat_closest_.getsMaxSquaredDelta = function(flatCoordinates, offset, ends, stride, maxSquaredDelta) { - let i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { + for (let i = 0, ii = ends.length; i < ii; ++i) { const end = ends[i]; maxSquaredDelta = _ol_geom_flat_closest_.getMaxSquaredDelta( flatCoordinates, offset, end, stride, maxSquaredDelta); @@ -103,8 +102,7 @@ _ol_geom_flat_closest_.getsMaxSquaredDelta = function(flatCoordinates, offset, e * @return {number} Max squared delta. */ _ol_geom_flat_closest_.getssMaxSquaredDelta = function(flatCoordinates, offset, endss, stride, maxSquaredDelta) { - let i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { + for (let i = 0, ii = endss.length; i < ii; ++i) { const ends = endss[i]; maxSquaredDelta = _ol_geom_flat_closest_.getsMaxSquaredDelta( flatCoordinates, offset, ends, stride, maxSquaredDelta); @@ -213,8 +211,7 @@ _ol_geom_flat_closest_.getsClosestPoint = function(flatCoordinates, offset, ends stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) { const tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN]; - let i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { + for (let i = 0, ii = ends.length; i < ii; ++i) { const end = ends[i]; minSquaredDistance = _ol_geom_flat_closest_.getClosestPoint( flatCoordinates, offset, end, stride, @@ -243,8 +240,7 @@ _ol_geom_flat_closest_.getssClosestPoint = function(flatCoordinates, offset, endss, stride, maxDelta, isRing, x, y, closestPoint, minSquaredDistance, opt_tmpPoint) { const tmpPoint = opt_tmpPoint ? opt_tmpPoint : [NaN, NaN]; - let i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { + for (let i = 0, ii = endss.length; i < ii; ++i) { const ends = endss[i]; minSquaredDistance = _ol_geom_flat_closest_.getsClosestPoint( flatCoordinates, offset, ends, stride, diff --git a/src/ol/geom/flat/contains.js b/src/ol/geom/flat/contains.js index 00d72acfb2..cd4c54bf8b 100644 --- a/src/ol/geom/flat/contains.js +++ b/src/ol/geom/flat/contains.js @@ -81,8 +81,7 @@ _ol_geom_flat_contains_.linearRingsContainsXY = function(flatCoordinates, offset flatCoordinates, offset, ends[0], stride, x, y)) { return false; } - let i, ii; - for (i = 1, ii = ends.length; i < ii; ++i) { + for (let i = 1, ii = ends.length; i < ii; ++i) { if (_ol_geom_flat_contains_.linearRingContainsXY( flatCoordinates, ends[i - 1], ends[i], stride, x, y)) { return false; @@ -105,8 +104,7 @@ _ol_geom_flat_contains_.linearRingssContainsXY = function(flatCoordinates, offse if (endss.length === 0) { return false; } - let i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { + for (let i = 0, ii = endss.length; i < ii; ++i) { const ends = endss[i]; if (_ol_geom_flat_contains_.linearRingsContainsXY( flatCoordinates, offset, ends, stride, x, y)) { diff --git a/src/ol/geom/flat/deflate.js b/src/ol/geom/flat/deflate.js index 52f318a2d1..71539a5dca 100644 --- a/src/ol/geom/flat/deflate.js +++ b/src/ol/geom/flat/deflate.js @@ -12,8 +12,7 @@ const _ol_geom_flat_deflate_ = {}; * @return {number} offset Offset. */ _ol_geom_flat_deflate_.coordinate = function(flatCoordinates, offset, coordinate, stride) { - let i, ii; - for (i = 0, ii = coordinate.length; i < ii; ++i) { + for (let i = 0, ii = coordinate.length; i < ii; ++i) { flatCoordinates[offset++] = coordinate[i]; } return offset; @@ -28,8 +27,7 @@ _ol_geom_flat_deflate_.coordinate = function(flatCoordinates, offset, coordinate * @return {number} offset Offset. */ _ol_geom_flat_deflate_.coordinates = function(flatCoordinates, offset, coordinates, stride) { - let i, ii; - for (i = 0, ii = coordinates.length; i < ii; ++i) { + for (let i = 0, ii = coordinates.length; i < ii; ++i) { const coordinate = coordinates[i]; for (let j = 0; j < stride; ++j) { flatCoordinates[offset++] = coordinate[j]; @@ -50,8 +48,7 @@ _ol_geom_flat_deflate_.coordinates = function(flatCoordinates, offset, coordinat _ol_geom_flat_deflate_.coordinatess = function(flatCoordinates, offset, coordinatess, stride, opt_ends) { const ends = opt_ends ? opt_ends : []; let i = 0; - let j, jj; - for (j = 0, jj = coordinatess.length; j < jj; ++j) { + for (let j = 0, jj = coordinatess.length; j < jj; ++j) { const end = _ol_geom_flat_deflate_.coordinates( flatCoordinates, offset, coordinatess[j], stride); ends[i++] = end; @@ -73,8 +70,7 @@ _ol_geom_flat_deflate_.coordinatess = function(flatCoordinates, offset, coordina _ol_geom_flat_deflate_.coordinatesss = function(flatCoordinates, offset, coordinatesss, stride, opt_endss) { const endss = opt_endss ? opt_endss : []; let i = 0; - let j, jj; - for (j = 0, jj = coordinatesss.length; j < jj; ++j) { + for (let j = 0, jj = coordinatesss.length; j < jj; ++j) { const ends = _ol_geom_flat_deflate_.coordinatess( flatCoordinates, offset, coordinatesss[j], stride, endss[i]); endss[i++] = ends; diff --git a/src/ol/geom/flat/inflate.js b/src/ol/geom/flat/inflate.js index bbe7102a29..b95296c88c 100644 --- a/src/ol/geom/flat/inflate.js +++ b/src/ol/geom/flat/inflate.js @@ -15,8 +15,7 @@ const _ol_geom_flat_inflate_ = {}; _ol_geom_flat_inflate_.coordinates = function(flatCoordinates, offset, end, stride, opt_coordinates) { const coordinates = opt_coordinates !== undefined ? opt_coordinates : []; let i = 0; - let j; - for (j = offset; j < end; j += stride) { + for (let j = offset; j < end; j += stride) { coordinates[i++] = flatCoordinates.slice(j, j + stride); } coordinates.length = i; @@ -35,8 +34,7 @@ _ol_geom_flat_inflate_.coordinates = function(flatCoordinates, offset, end, stri _ol_geom_flat_inflate_.coordinatess = function(flatCoordinates, offset, ends, stride, opt_coordinatess) { const coordinatess = opt_coordinatess !== undefined ? opt_coordinatess : []; let i = 0; - let j, jj; - for (j = 0, jj = ends.length; j < jj; ++j) { + for (let j = 0, jj = ends.length; j < jj; ++j) { const end = ends[j]; coordinatess[i++] = _ol_geom_flat_inflate_.coordinates( flatCoordinates, offset, end, stride, coordinatess[i]); @@ -59,8 +57,7 @@ _ol_geom_flat_inflate_.coordinatess = function(flatCoordinates, offset, ends, st _ol_geom_flat_inflate_.coordinatesss = function(flatCoordinates, offset, endss, stride, opt_coordinatesss) { const coordinatesss = opt_coordinatesss !== undefined ? opt_coordinatesss : []; let i = 0; - let j, jj; - for (j = 0, jj = endss.length; j < jj; ++j) { + for (let j = 0, jj = endss.length; j < jj; ++j) { const ends = endss[j]; coordinatesss[i++] = _ol_geom_flat_inflate_.coordinatess( flatCoordinates, offset, ends, stride, coordinatesss[i]); diff --git a/src/ol/geom/flat/interiorpoint.js b/src/ol/geom/flat/interiorpoint.js index 079f154768..1c189648f9 100644 --- a/src/ol/geom/flat/interiorpoint.js +++ b/src/ol/geom/flat/interiorpoint.js @@ -85,8 +85,7 @@ _ol_geom_flat_interiorpoint_.linearRings = function(flatCoordinates, offset, */ _ol_geom_flat_interiorpoint_.linearRingss = function(flatCoordinates, offset, endss, stride, flatCenters) { let interiorPoints = []; - let i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { + for (let i = 0, ii = endss.length; i < ii; ++i) { const ends = endss[i]; interiorPoints = _ol_geom_flat_interiorpoint_.linearRings(flatCoordinates, offset, ends, stride, flatCenters, 2 * i, interiorPoints); diff --git a/src/ol/geom/flat/intersectsextent.js b/src/ol/geom/flat/intersectsextent.js index b632820fdf..911743f282 100644 --- a/src/ol/geom/flat/intersectsextent.js +++ b/src/ol/geom/flat/intersectsextent.js @@ -54,8 +54,7 @@ _ol_geom_flat_intersectsextent_.lineString = function(flatCoordinates, offset, e * @return {boolean} True if the geometry and the extent intersect. */ _ol_geom_flat_intersectsextent_.lineStrings = function(flatCoordinates, offset, ends, stride, extent) { - let i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { + for (let i = 0, ii = ends.length; i < ii; ++i) { if (_ol_geom_flat_intersectsextent_.lineString( flatCoordinates, offset, ends[i], stride, extent)) { return true; @@ -115,8 +114,7 @@ _ol_geom_flat_intersectsextent_.linearRings = function(flatCoordinates, offset, if (ends.length === 1) { return true; } - let i, ii; - for (i = 1, ii = ends.length; i < ii; ++i) { + for (let i = 1, ii = ends.length; i < ii; ++i) { if (_ol_geom_flat_contains_.linearRingContainsExtent( flatCoordinates, ends[i - 1], ends[i], stride, extent)) { return false; @@ -135,8 +133,7 @@ _ol_geom_flat_intersectsextent_.linearRings = function(flatCoordinates, offset, * @return {boolean} True if the geometry and the extent intersect. */ _ol_geom_flat_intersectsextent_.linearRingss = function(flatCoordinates, offset, endss, stride, extent) { - let i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { + for (let i = 0, ii = endss.length; i < ii; ++i) { const ends = endss[i]; if (_ol_geom_flat_intersectsextent_.linearRings( flatCoordinates, offset, ends, stride, extent)) { diff --git a/src/ol/geom/flat/length.js b/src/ol/geom/flat/length.js index 1dde4b171a..c1139211a4 100644 --- a/src/ol/geom/flat/length.js +++ b/src/ol/geom/flat/length.js @@ -15,8 +15,7 @@ _ol_geom_flat_length_.lineString = function(flatCoordinates, offset, end, stride let x1 = flatCoordinates[offset]; let y1 = flatCoordinates[offset + 1]; let length = 0; - let i; - for (i = offset + stride; i < end; i += stride) { + for (let i = offset + stride; i < end; i += stride) { const x2 = flatCoordinates[i]; const y2 = flatCoordinates[i + 1]; length += Math.sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); @@ -35,8 +34,7 @@ _ol_geom_flat_length_.lineString = function(flatCoordinates, offset, end, stride * @return {number} Perimeter. */ _ol_geom_flat_length_.linearRing = function(flatCoordinates, offset, end, stride) { - let perimeter = - _ol_geom_flat_length_.lineString(flatCoordinates, offset, end, stride); + let perimeter = _ol_geom_flat_length_.lineString(flatCoordinates, offset, end, stride); const dx = flatCoordinates[end - stride] - flatCoordinates[offset]; const dy = flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1]; perimeter += Math.sqrt(dx * dx + dy * dy); diff --git a/src/ol/geom/flat/simplify.js b/src/ol/geom/flat/simplify.js index 972a5f1fcd..a9928896a3 100644 --- a/src/ol/geom/flat/simplify.js +++ b/src/ol/geom/flat/simplify.js @@ -91,7 +91,6 @@ _ol_geom_flat_simplify_.douglasPeucker = function(flatCoordinates, offset, end, /** @type {Array.} */ const stack = [offset, end - stride]; let index = 0; - let i; while (stack.length > 0) { const last = stack.pop(); const first = stack.pop(); @@ -100,7 +99,7 @@ _ol_geom_flat_simplify_.douglasPeucker = function(flatCoordinates, offset, end, const y1 = flatCoordinates[first + 1]; const x2 = flatCoordinates[last]; const y2 = flatCoordinates[last + 1]; - for (i = first + stride; i < last; i += stride) { + for (let i = first + stride; i < last; i += stride) { const x = flatCoordinates[i]; const y = flatCoordinates[i + 1]; const squaredDistance = squaredSegmentDistance( @@ -120,7 +119,7 @@ _ol_geom_flat_simplify_.douglasPeucker = function(flatCoordinates, offset, end, } } } - for (i = 0; i < n; ++i) { + for (let i = 0; i < n; ++i) { if (markers[i]) { simplifiedFlatCoordinates[simplifiedOffset++] = flatCoordinates[offset + i * stride]; @@ -147,8 +146,7 @@ _ol_geom_flat_simplify_.douglasPeucker = function(flatCoordinates, offset, end, _ol_geom_flat_simplify_.douglasPeuckers = function(flatCoordinates, offset, ends, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) { - let i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { + for (let i = 0, ii = ends.length; i < ii; ++i) { const end = ends[i]; simplifiedOffset = _ol_geom_flat_simplify_.douglasPeucker( flatCoordinates, offset, end, stride, squaredTolerance, @@ -175,8 +173,7 @@ _ol_geom_flat_simplify_.douglasPeuckers = function(flatCoordinates, offset, _ol_geom_flat_simplify_.douglasPeuckerss = function( flatCoordinates, offset, endss, stride, squaredTolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) { - let i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { + for (let i = 0, ii = endss.length; i < ii; ++i) { const ends = endss[i]; const simplifiedEnds = []; simplifiedOffset = _ol_geom_flat_simplify_.douglasPeuckers( @@ -356,8 +353,7 @@ _ol_geom_flat_simplify_.quantizes = function( flatCoordinates, offset, ends, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEnds) { - let i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { + for (let i = 0, ii = ends.length; i < ii; ++i) { const end = ends[i]; simplifiedOffset = _ol_geom_flat_simplify_.quantize( flatCoordinates, offset, end, stride, @@ -386,8 +382,7 @@ _ol_geom_flat_simplify_.quantizess = function( flatCoordinates, offset, endss, stride, tolerance, simplifiedFlatCoordinates, simplifiedOffset, simplifiedEndss) { - let i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { + for (let i = 0, ii = endss.length; i < ii; ++i) { const ends = endss[i]; const simplifiedEnds = []; simplifiedOffset = _ol_geom_flat_simplify_.quantizes( diff --git a/src/ol/layer/Group.js b/src/ol/layer/Group.js index 32292d0f17..5457fb3206 100644 --- a/src/ol/layer/Group.js +++ b/src/ol/layer/Group.js @@ -109,9 +109,8 @@ LayerGroup.prototype.handleLayersChanged_ = function(event) { clear(this.listenerKeys_); const layersArray = layers.getArray(); - let i, ii, layer; - for (i = 0, ii = layersArray.length; i < ii; i++) { - layer = layersArray[i]; + for (let i = 0, ii = layersArray.length; i < ii; i++) { + const layer = layersArray[i]; this.listenerKeys_[getUid(layer).toString()] = [ _ol_events_.listen(layer, ObjectEventType.PROPERTYCHANGE, this.handleLayerChange_, this), @@ -205,9 +204,8 @@ LayerGroup.prototype.getLayerStatesArray = function(opt_states) { }); const ownLayerState = this.getLayerState(); - let i, ii, layerState; - for (i = pos, ii = states.length; i < ii; i++) { - layerState = states[i]; + for (let i = pos, ii = states.length; i < ii; i++) { + const layerState = states[i]; layerState.opacity *= ownLayerState.opacity; layerState.visible = layerState.visible && ownLayerState.visible; layerState.maxResolution = Math.min( diff --git a/src/ol/layer/Heatmap.js b/src/ol/layer/Heatmap.js index 0a4e691f39..4b1dba3dfa 100644 --- a/src/ol/layer/Heatmap.js +++ b/src/ol/layer/Heatmap.js @@ -243,9 +243,8 @@ Heatmap.prototype.handleRender_ = function(event) { const canvas = context.canvas; const image = context.getImageData(0, 0, canvas.width, canvas.height); const view8 = image.data; - let i, ii, alpha; - for (i = 0, ii = view8.length; i < ii; i += 4) { - alpha = view8[i + 3] * 4; + for (let i = 0, ii = view8.length; i < ii; i += 4) { + const alpha = view8[i + 3] * 4; if (alpha) { view8[i] = this.gradient_[alpha]; view8[i + 1] = this.gradient_[alpha + 1]; diff --git a/src/ol/render/canvas/Immediate.js b/src/ol/render/canvas/Immediate.js index af6416b908..eb47de06d0 100644 --- a/src/ol/render/canvas/Immediate.js +++ b/src/ol/render/canvas/Immediate.js @@ -265,8 +265,7 @@ CanvasImmediateRenderer.prototype.drawImages_ = function(flatCoordinates, offset if (this.imageRotateWithView_) { rotation += this.viewRotation_; } - let i, ii; - for (i = 0, ii = pixelCoordinates.length; i < ii; i += 2) { + for (let i = 0, ii = pixelCoordinates.length; i < ii; i += 2) { let x = pixelCoordinates[i] - this.imageAnchorX_; let y = pixelCoordinates[i + 1] - this.imageAnchorY_; if (this.imageSnapToPixel_) { @@ -384,8 +383,7 @@ CanvasImmediateRenderer.prototype.moveToLineTo_ = function(flatCoordinates, offs * @return {number} End. */ CanvasImmediateRenderer.prototype.drawRings_ = function(flatCoordinates, offset, ends, stride) { - let i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { + for (let i = 0, ii = ends.length; i < ii; ++i) { offset = this.moveToLineTo_( flatCoordinates, offset, ends[i], stride, true); } @@ -519,8 +517,7 @@ CanvasImmediateRenderer.prototype.drawFeature = function(feature, style) { */ CanvasImmediateRenderer.prototype.drawGeometryCollection = function(geometry) { const geometries = geometry.getGeometriesArray(); - let i, ii; - for (i = 0, ii = geometries.length; i < ii; ++i) { + for (let i = 0, ii = geometries.length; i < ii; ++i) { this.drawGeometry(geometries[i]); } }; @@ -612,8 +609,7 @@ CanvasImmediateRenderer.prototype.drawMultiLineString = function(geometry) { const ends = geometry.getEnds(); const stride = geometry.getStride(); context.beginPath(); - let i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { + for (let i = 0, ii = ends.length; i < ii; ++i) { offset = this.moveToLineTo_( flatCoordinates, offset, ends[i], stride, false); } @@ -684,9 +680,8 @@ CanvasImmediateRenderer.prototype.drawMultiPolygon = function(geometry) { let offset = 0; const endss = geometry.getEndss(); const stride = geometry.getStride(); - let i, ii; context.beginPath(); - for (i = 0, ii = endss.length; i < ii; ++i) { + for (let i = 0, ii = endss.length; i < ii; ++i) { const ends = endss[i]; offset = this.drawRings_(flatCoordinates, offset, ends, stride); } diff --git a/src/ol/render/canvas/LineStringReplay.js b/src/ol/render/canvas/LineStringReplay.js index 3228fb443b..14193caf85 100644 --- a/src/ol/render/canvas/LineStringReplay.js +++ b/src/ol/render/canvas/LineStringReplay.js @@ -95,8 +95,7 @@ CanvasLineStringReplay.prototype.drawMultiLineString = function(multiLineStringG const flatCoordinates = multiLineStringGeometry.getFlatCoordinates(); const stride = multiLineStringGeometry.getStride(); let offset = 0; - let i, ii; - for (i = 0, ii = ends.length; i < ii; ++i) { + for (let i = 0, ii = ends.length; i < ii; ++i) { offset = this.drawFlatCoordinates_( flatCoordinates, offset, ends[i], stride); } diff --git a/src/ol/render/canvas/PolygonReplay.js b/src/ol/render/canvas/PolygonReplay.js index a034955ee7..ac0ce155c1 100644 --- a/src/ol/render/canvas/PolygonReplay.js +++ b/src/ol/render/canvas/PolygonReplay.js @@ -178,8 +178,7 @@ CanvasPolygonReplay.prototype.drawMultiPolygon = function(multiPolygonGeometry, const flatCoordinates = multiPolygonGeometry.getOrientedFlatCoordinates(); const stride = multiPolygonGeometry.getStride(); let offset = 0; - let i, ii; - for (i = 0, ii = endss.length; i < ii; ++i) { + for (let i = 0, ii = endss.length; i < ii; ++i) { offset = this.drawFlatCoordinatess_( flatCoordinates, offset, endss[i], stride); } @@ -200,8 +199,7 @@ CanvasPolygonReplay.prototype.finish = function() { const tolerance = this.tolerance; if (tolerance !== 0) { const coordinates = this.coordinates; - let i, ii; - for (i = 0, ii = coordinates.length; i < ii; ++i) { + for (let i = 0, ii = coordinates.length; i < ii; ++i) { coordinates[i] = _ol_geom_flat_simplify_.snap(coordinates[i], tolerance); } } diff --git a/src/ol/style/Atlas.js b/src/ol/style/Atlas.js index d07358ce60..dc23e82929 100644 --- a/src/ol/style/Atlas.js +++ b/src/ol/style/Atlas.js @@ -74,9 +74,8 @@ Atlas.prototype.get = function(id) { * @return {?ol.AtlasInfo} The position and atlas image for the entry. */ Atlas.prototype.add = function(id, width, height, renderCallback, opt_this) { - let block, i, ii; - for (i = 0, ii = this.emptyBlocks_.length; i < ii; ++i) { - block = this.emptyBlocks_[i]; + for (let i = 0, ii = this.emptyBlocks_.length; i < ii; ++i) { + const block = this.emptyBlocks_[i]; if (block.width >= width + this.space_ && block.height >= height + this.space_) { // we found a block that is big enough for our entry diff --git a/src/ol/style/AtlasManager.js b/src/ol/style/AtlasManager.js index 7b40c260bf..8bd2b80b08 100644 --- a/src/ol/style/AtlasManager.js +++ b/src/ol/style/AtlasManager.js @@ -109,10 +109,9 @@ AtlasManager.prototype.getInfo = function(id) { * or `null` if the entry is not part of the atlases. */ AtlasManager.prototype.getInfo_ = function(atlases, id) { - let atlas, info, i, ii; - for (i = 0, ii = atlases.length; i < ii; ++i) { - atlas = atlases[i]; - info = atlas.get(id); + for (let i = 0, ii = atlases.length; i < ii; ++i) { + const atlas = atlases[i]; + const info = atlas.get(id); if (info) { return info; }