MCPcopy Create free account
hub / github.com/SuperMap/iClient-JavaScript / latLngsToCoords

Function latLngsToCoords

libs/leaflet/leaflet-src.js:9175–9190  ·  view source on GitHub ↗
(latlngs, levelsDeep, closed, precision)

Source from the content-addressed store, hash-verified

9173 // `closed` determines whether the first point should be appended to the end of the array to close the feature, only used when `levelsDeep` is 0. False by default.
9174 // Coordinates values are rounded with [`formatNum`](#util-formatnum) function.
9175 function latLngsToCoords(latlngs, levelsDeep, closed, precision) {
9176 var coords = [];
9177
9178 for (var i = 0, len = latlngs.length; i < len; i++) {
9179 // Check for flat arrays required to ensure unbalanced arrays are correctly converted in recursion
9180 coords.push(levelsDeep ?
9181 latLngsToCoords(latlngs[i], isFlat(latlngs[i]) ? 0 : levelsDeep - 1, closed, precision) :
9182 latLngToCoords(latlngs[i], precision));
9183 }
9184
9185 if (!levelsDeep && closed && coords.length > 0) {
9186 coords.push(coords[0].slice());
9187 }
9188
9189 return coords;
9190 }
9191
9192 function getFeature(layer, newGeometry) {
9193 return layer.feature ?

Callers 1

leaflet-src.jsFile · 0.85

Calls 3

isFlatFunction · 0.85
latLngToCoordsFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected