Remove use of goog.array.flatten
This commit is contained in:
@@ -127,3 +127,18 @@ ol.array.reverseSubArray = function(arr, begin, end) {
|
|||||||
--end;
|
--end;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Array.<*>} arr Array.
|
||||||
|
* @return {!Array<?>} Flattened Array.
|
||||||
|
*/
|
||||||
|
ol.array.flatten = function(arr) {
|
||||||
|
var data = arr.reduce(function(flattened, value) {
|
||||||
|
if (goog.isArray(value)) {
|
||||||
|
return flattened.concat(ol.array.flatten(value));
|
||||||
|
} else {
|
||||||
|
return flattened.concat(value);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
return data;
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
goog.provide('ol.format.EsriJSON');
|
goog.provide('ol.format.EsriJSON');
|
||||||
|
|
||||||
goog.require('goog.array');
|
|
||||||
goog.require('goog.asserts');
|
goog.require('goog.asserts');
|
||||||
goog.require('goog.object');
|
goog.require('goog.object');
|
||||||
|
goog.require('ol.array');
|
||||||
goog.require('ol.Feature');
|
goog.require('ol.Feature');
|
||||||
goog.require('ol.extent');
|
goog.require('ol.extent');
|
||||||
goog.require('ol.format.Feature');
|
goog.require('ol.format.Feature');
|
||||||
@@ -104,7 +104,7 @@ ol.format.EsriJSON.convertRings_ = function(rings, layout) {
|
|||||||
var holes = [];
|
var holes = [];
|
||||||
var i, ii;
|
var i, ii;
|
||||||
for (i = 0, ii = rings.length; i < ii; ++i) {
|
for (i = 0, ii = rings.length; i < ii; ++i) {
|
||||||
var flatRing = goog.array.flatten(rings[i]);
|
var flatRing = ol.array.flatten(rings[i]);
|
||||||
// is this ring an outer ring? is it clockwise?
|
// is this ring an outer ring? is it clockwise?
|
||||||
var clockwise = ol.geom.flat.orient.linearRingIsClockwise(flatRing, 0,
|
var clockwise = ol.geom.flat.orient.linearRingIsClockwise(flatRing, 0,
|
||||||
flatRing.length, layout.length);
|
flatRing.length, layout.length);
|
||||||
|
|||||||
Reference in New Issue
Block a user