Use ol.array.safeExtend in ol.geom.MultiLineString

This commit is contained in:
Tom Payne
2014-03-23 19:45:02 +01:00
parent de2ee2451e
commit 765985c5a9

View File

@@ -2,6 +2,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');
@@ -57,7 +58,7 @@ ol.geom.MultiLineString.prototype.appendLineString = function(lineString) {
if (goog.isNull(this.flatCoordinates)) {
this.flatCoordinates = lineString.getFlatCoordinates().slice();
} else {
goog.array.extend(
ol.array.safeExtend(
this.flatCoordinates, lineString.getFlatCoordinates().slice());
}
this.ends_.push(this.flatCoordinates.length);
@@ -202,7 +203,7 @@ ol.geom.MultiLineString.prototype.getFlatMidpoints = function() {
var end = ends[i];
var midpoint = ol.geom.flat.interpolate.lineString(
flatCoordinates, offset, end, stride, 0.5);
goog.array.extend(midpoints, midpoint);
ol.array.safeExtend(midpoints, midpoint);
offset = end;
}
return midpoints;
@@ -293,7 +294,7 @@ ol.geom.MultiLineString.prototype.setLineStrings = function(lineStrings) {
// FIXME better handle the case of non-matching layouts
goog.asserts.assert(lineString.getLayout() == layout);
}
goog.array.extend(flatCoordinates, lineString.getFlatCoordinates());
ol.array.safeExtend(flatCoordinates, lineString.getFlatCoordinates());
ends.push(flatCoordinates.length);
}
this.setFlatCoordinates(layout, flatCoordinates, ends);