(coords)
| 19 | } |
| 20 | |
| 21 | export function geojsonCoords2UGDoubleArray(coords) { |
| 22 | if (!coords) { |
| 23 | throw new Error('No GeoJSON coords provided') |
| 24 | } |
| 25 | |
| 26 | if (!coords || coords.length === 0) { |
| 27 | return null |
| 28 | } |
| 29 | const length = coords.length |
| 30 | const coordArr = new Float64Array(coords) |
| 31 | const coordPtr = window.ugcModule._malloc(length * 8) |
| 32 | window.ugcModule.HEAPF64.set(coordArr, coordPtr / 8) |
| 33 | const pDoubleArray = window.ugcModule._UGCWasm_Helper_CreateDoubleArray(coordPtr, length) |
| 34 | window.ugcModule._free(coordPtr) |
| 35 | |
| 36 | return pDoubleArray |
| 37 | } |
| 38 | |
| 39 | export function getJSArrayFromUGDoubleArray(pDoubleArray) { |
| 40 | // get length of doublearray |
no test coverage detected