UNPKG

@deck.gl/layers

Version:
33 lines (28 loc) 727 B
import { cutPolylineByGrid, cutPolylineByMercatorBounds } from '@math.gl/polygon'; export function normalizePath(path, size, gridResolution, wrapLongitude) { let flatPath; if (Array.isArray(path[0])) { const length = path.length * size; flatPath = new Array(length); for (let i = 0; i < path.length; i++) { for (let j = 0; j < size; j++) { flatPath[i * size + j] = path[i][j] || 0; } } } else { flatPath = path; } if (gridResolution) { return cutPolylineByGrid(flatPath, { size, gridResolution }); } if (wrapLongitude) { return cutPolylineByMercatorBounds(flatPath, { size }); } return flatPath; } //# sourceMappingURL=path.js.map