@rcsb/rcsb-saguaro-app
Version:
RCSB 1D Saguaro Web App
20 lines • 909 B
JavaScript
import { RcsbDistributionConfig } from "../../../../../RcsbAnnotationConfig/RcsbDistributionConfig";
export class TrackBlockFactory {
constructor(distributionConfig) {
this.distributionConfig = distributionConfig !== null && distributionConfig !== void 0 ? distributionConfig : new RcsbDistributionConfig();
}
getTrackBlocks(tracks) {
const trackMap = new Map();
tracks.forEach(t => {
var _a;
const blockType = this.distributionConfig.getBlockType(t.getId());
if (!blockType)
return;
if (!trackMap.has(blockType))
trackMap.set(blockType, []);
(_a = trackMap.get(blockType)) === null || _a === void 0 ? void 0 : _a.push(t);
});
return Array.from(trackMap.entries()).map(e => ({ blockType: e[0], tracks: e[1] }));
}
}
//# sourceMappingURL=TrackBlockFactory.js.map