mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 08:47:07 +00:00
Use DougalBinaryLoader for sequence points layers
This commit is contained in:
@@ -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]) {
|
||||
|
||||
Reference in New Issue
Block a user