From f5ad9d7182fc9d619aba0d93702eaf2210251ea9 Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Fri, 8 Aug 2025 12:18:07 +0200 Subject: [PATCH] Use `sequenceBinaryData` for raw data points layer. Saves us from ending up with an extra copy of the data. --- .../source/src/views/MapLayersMixin.vue | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/lib/www/client/source/src/views/MapLayersMixin.vue b/lib/www/client/source/src/views/MapLayersMixin.vue index 1616465..d47c38b 100644 --- a/lib/www/client/source/src/views/MapLayersMixin.vue +++ b/lib/www/client/source/src/views/MapLayersMixin.vue @@ -88,6 +88,40 @@ export default { return scale[i]; }, + + makeDataFromBinary ( {positions, values, udv} ) { + const totalCount = positions.length / 2; + + const attributes = { + getPosition: { + value: positions, + type: 'float32', + size: 2 + }, + udv + }; + + values.forEach((valArray, k) => { + let value = valArray; + if (valArray instanceof BigUint64Array) { + value = Float64Array.from(valArray, v => Number(v)); + } + attributes[`value${k}`] = { + value, + type: value instanceof Float64Array ? 'float64' : + value instanceof Uint16Array ? 'uint16' : + value instanceof Uint32Array ? 'uint32' : 'float32', + size: 1 + }; + }); + + return { + length: totalCount, + attributes + }; + }, + + osmLayer (options = {}) { return new TileLayer({ id: "osm", @@ -427,16 +461,10 @@ export default { }, rawSequencesPointsLayer (options = {}) { + return new DougalSequenceLayer({ id: 'seqrp', - data: `/api/project/${this.$route.params.project}/sequence?type=2`, // API endpoint returning binary data - loaders: [DougalBinaryLoader], - loadOptions: { - fetch: { - method: 'GET', - headers: { Accept: 'application/vnd.aaltronav.dougal+octet-stream' } - } - }, + data: this.makeDataFromBinary(this.sequenceBinaryData), getRadius: 2, getFillColor: [0, 120, 220, 200], pickable: true,