@rcsb/rcsb-saguaro-app
Version:
RCSB 1D Saguaro Web App
24 lines (23 loc) • 1.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.TrackBlockFactory = void 0;
const RcsbDistributionConfig_1 = require("../../../../../RcsbAnnotationConfig/RcsbDistributionConfig");
class TrackBlockFactory {
constructor(distributionConfig) {
this.distributionConfig = distributionConfig !== null && distributionConfig !== void 0 ? distributionConfig : new RcsbDistributionConfig_1.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] }));
}
}
exports.TrackBlockFactory = TrackBlockFactory;