Use goog.array.extend instead of ol.array.safeExtend

The upstream implementation now supports large arrays.
See https://github.com/google/closure-library/pull/356
This commit is contained in:
Frederic Junod
2014-11-17 11:49:05 +01:00
parent 443c9749fb
commit f8b59dbd53
9 changed files with 18 additions and 39 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
goog.provide('ol.geom.LineString');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('ol.array');
goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.SimpleGeometry');
@@ -69,7 +69,7 @@ ol.geom.LineString.prototype.appendCoordinate = function(coordinate) {
if (goog.isNull(this.flatCoordinates)) {
this.flatCoordinates = coordinate.slice();
} else {
ol.array.safeExtend(this.flatCoordinates, coordinate);
goog.array.extend(this.flatCoordinates, coordinate);
}
this.changed();
};
+4 -4
View File
@@ -1,7 +1,7 @@
goog.provide('ol.geom.MultiLineString');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('ol.array');
goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.LineString');
@@ -63,7 +63,7 @@ ol.geom.MultiLineString.prototype.appendLineString = function(lineString) {
if (goog.isNull(this.flatCoordinates)) {
this.flatCoordinates = lineString.getFlatCoordinates().slice();
} else {
ol.array.safeExtend(
goog.array.extend(
this.flatCoordinates, lineString.getFlatCoordinates().slice());
}
this.ends_.push(this.flatCoordinates.length);
@@ -212,7 +212,7 @@ ol.geom.MultiLineString.prototype.getFlatMidpoints = function() {
var end = ends[i];
var midpoint = ol.geom.flat.interpolate.lineString(
flatCoordinates, offset, end, stride, 0.5);
ol.array.safeExtend(midpoints, midpoint);
goog.array.extend(midpoints, midpoint);
offset = end;
}
return midpoints;
@@ -313,7 +313,7 @@ ol.geom.MultiLineString.prototype.setLineStrings = function(lineStrings) {
// FIXME better handle the case of non-matching layouts
goog.asserts.assert(lineString.getLayout() == layout);
}
ol.array.safeExtend(flatCoordinates, lineString.getFlatCoordinates());
goog.array.extend(flatCoordinates, lineString.getFlatCoordinates());
ends.push(flatCoordinates.length);
}
this.setFlatCoordinates(layout, flatCoordinates, ends);
+2 -2
View File
@@ -1,7 +1,7 @@
goog.provide('ol.geom.MultiPoint');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('ol.array');
goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.Point');
@@ -39,7 +39,7 @@ ol.geom.MultiPoint.prototype.appendPoint = function(point) {
if (goog.isNull(this.flatCoordinates)) {
this.flatCoordinates = point.getFlatCoordinates().slice();
} else {
ol.array.safeExtend(this.flatCoordinates, point.getFlatCoordinates());
goog.array.extend(this.flatCoordinates, point.getFlatCoordinates());
}
this.changed();
};
+3 -3
View File
@@ -1,7 +1,7 @@
goog.provide('ol.geom.MultiPolygon');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('ol.array');
goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.MultiPoint');
@@ -97,7 +97,7 @@ ol.geom.MultiPolygon.prototype.appendPolygon = function(polygon) {
this.endss_.push();
} else {
var offset = this.flatCoordinates.length;
ol.array.safeExtend(this.flatCoordinates, polygon.getFlatCoordinates());
goog.array.extend(this.flatCoordinates, polygon.getFlatCoordinates());
ends = polygon.getEnds().slice();
var i, ii;
for (i = 0, ii = ends.length; i < ii; ++i) {
@@ -397,7 +397,7 @@ ol.geom.MultiPolygon.prototype.setPolygons = function(polygons) {
for (j = 0, jj = ends.length; j < jj; ++j) {
ends[j] += offset;
}
ol.array.safeExtend(flatCoordinates, polygon.getFlatCoordinates());
goog.array.extend(flatCoordinates, polygon.getFlatCoordinates());
endss.push(ends);
}
this.setFlatCoordinates(layout, flatCoordinates, endss);
+1 -2
View File
@@ -2,7 +2,6 @@ goog.provide('ol.geom.Polygon');
goog.require('goog.array');
goog.require('goog.asserts');
goog.require('ol.array');
goog.require('ol.extent');
goog.require('ol.geom.GeometryType');
goog.require('ol.geom.LinearRing');
@@ -92,7 +91,7 @@ ol.geom.Polygon.prototype.appendLinearRing = function(linearRing) {
if (goog.isNull(this.flatCoordinates)) {
this.flatCoordinates = linearRing.getFlatCoordinates().slice();
} else {
ol.array.safeExtend(this.flatCoordinates, linearRing.getFlatCoordinates());
goog.array.extend(this.flatCoordinates, linearRing.getFlatCoordinates());
}
this.ends_.push(this.flatCoordinates.length);
this.changed();