Use DougalBinaryLoader for sequence points layers

This commit is contained in:
D. Berge
2025-08-03 11:51:47 +02:00
parent d977d9c40b
commit 5b82f8540d

View File

@@ -14,6 +14,7 @@ import * as d3a from 'd3-array';
import { DougalBinaryBundle, DougalBinaryChunkSequential, DougalBinaryChunkInterleaved } from '@dougal/binary';
import { DougalShotLayer } from '@/lib/deck.gl';
import { DougalSequenceLayer, DougalEventsLayer } from '@/lib/deck.gl';
import DougalBinaryLoader from '@/lib/deck.gl/DougalBinaryLoader';
import { colors } from 'vuetify/lib'
@@ -387,50 +388,15 @@ export default {
},
rawSequencesPointsLayer (options = {}) {
const { positions, values, udv } = this.sequenceBinaryData;
if (!positions.length || !values.length) {
console.warn('No valid data for seqrp');
return new DougalSequenceLayer({
id: 'seqrp',
data: { length: 0, attributes: {} },
...options
});
}
const pointCount = positions.length / 2;
if (!values.every(arr => arr.length === pointCount)) {
console.warn(`Length mismatch in seqrp: positions/2 (${pointCount}) ≠ values (${values.map(arr => arr.length)})`);
}
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 new DougalSequenceLayer({
id: 'seqrp',
data: {
length: pointCount,
attributes
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' }
}
},
getRadius: 2,
getFillColor: [0, 120, 220, 200],
@@ -439,6 +405,21 @@ export default {
});
},
...options
});
}
}
};
data: {
},
...options
});
},
rawSequencesIJErrorLayer(options = {}) {
const { positions, values } = this.sequenceBinaryData;
if (!positions.length || !values[3] || !values[4]) {