Use sequenceBinaryData for raw data points layer.

Saves us from ending up with an extra copy of the data.
This commit is contained in:
D. Berge
2025-08-08 12:18:07 +02:00
parent 07874ffe0b
commit f5ad9d7182

View File

@@ -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,