import { SaguaroChain, StructureViewerInterface, SaguaroPluginModelMapType, SaguaroPosition, SaguaroRange, ViewerCallbackManagerInterface, ViewerActionManagerInterface, ViewerManagerFactoryInterface } from "../StructureViewerInterface"; import {PluginContext} from "molstar/lib/mol-plugin/context"; import { RcsbFvSelectorManager } from "../../RcsbFvSelection/RcsbFvSelectorManager"; import {StructureRepresentationRegistry} from "molstar/lib/mol-repr/structure/registry"; import {ColorTheme} from "molstar/lib/mol-theme/color"; export class StructureViewer implements StructureViewerInterface { private readonly structureViewerManagerFactory: ViewerManagerFactoryInterface; private callbackManager: ViewerCallbackManagerInterface; private actionManager: ViewerActionManagerInterface; constructor(structureViewerManagerFactory: ViewerManagerFactoryInterface) { this.structureViewerManagerFactory = structureViewerManagerFactory; } public init(selection: RcsbFvSelectorManager, args:S): void { const {actionManager,callbackManager} = this.structureViewerManagerFactory.getViewerManagerFactory(selection, args); this.actionManager = actionManager; this.callbackManager = callbackManager; } public async clear(): Promise{ await this.actionManager.clear(); } async load(loadConfig: R|Array): Promise{ await this.actionManager.load(loadConfig); } public setBackground(color: number) { } public select(modelId:string, labelAsymId: string, begin: number, end: number, mode: 'select'|'hover', operation:'add'|'set', operatorName?:string): void; public select(selection: Array, mode: 'select'|'hover', operation:'add'|'set'): void; public select(selection: Array, mode: 'select'|'hover', operation:'add'|'set'): void; public select(...args: any[]): void{ this.actionManager.select(args[0],args[1],args[2],args[3],args[4],args[5],args[6]); } public clearSelection(mode:'select'|'hover', option?:SaguaroChain): void { this.actionManager.clearSelection(mode,option); } public setFocus(modelId: string, labelAsymId: string, begin: number, end: number, operatorName?:string): void{ this.actionManager.setFocus(modelId,labelAsymId,begin,end,operatorName); } public clearFocus(): void { this.actionManager.clearFocus(); } public cameraFocus(modelId: string, labelAsymId: string, positions:Array, operatorName?:string): void; public cameraFocus(modelId: string, labelAsymId: string, begin: number, end: number, operatorName?:string): void; public cameraFocus(...args: any[]): void{ this.actionManager.cameraFocus(args[0],args[1],args[2],args[3],args[4]); } public async createComponent(componentLabel: string, modelId:string, labelAsymId: string, begin: number, end : number, representationType: StructureRepresentationRegistry.BuiltIn, operatorName?:string): Promise; public async createComponent(componentLabel: string, modelId:string, labelAsymId: string, representationType: StructureRepresentationRegistry.BuiltIn, operatorName?:string): Promise; public async createComponent(componentLabel: string, residues: Array, representationType: StructureRepresentationRegistry.BuiltIn): Promise; public async createComponent(componentLabel: string, residues: Array, representationType: StructureRepresentationRegistry.BuiltIn): Promise; public async createComponent(...args: any[]): Promise { await this.actionManager.createComponent(args[0],args[1],args[2],args[3],args[4],args[5],args[6]); } public isComponent(componentLabel: string): boolean{ return this.actionManager.isComponent(componentLabel); } public async colorComponent(componentLabel: string, color: ColorTheme.BuiltIn): Promise{ await this.actionManager.colorComponent(componentLabel,color); } public getComponentSet(): Set{ return this.actionManager.getComponentSet(); } public async removeComponent(componentLabel?: string): Promise{ await this.actionManager.removeComponent(componentLabel); } public displayComponent(componentLabel: string): boolean; public displayComponent(componentLabel: string, visibilityFlag: boolean): void; public displayComponent(componentLabel: string, visibilityFlag?: boolean): void|boolean { return this.actionManager.displayComponent(componentLabel as any,visibilityFlag as any); } public setRepresentationChangeCallback(g:()=>void){ this.callbackManager.setRepresentationChangeCallback(g); } public setHoverCallback(g:()=>void){ this.callbackManager.setHoverCallback(g); } public setSelectCallback(g:(flag?:boolean)=>void){ this.callbackManager.setSelectCallback(g); } public pluginCall(f: (plugin: PluginContext) => void){ this.callbackManager.pluginCall(f); } public setModelChangeCallback(f:(modelMap:SaguaroPluginModelMapType)=>void){ this.callbackManager.setModelChangeCallback(f); } public getModelChangeCallback(): (modelMap: SaguaroPluginModelMapType) => void { return this.callbackManager.getModelChangeCallback(); } public unsetCallbacks(): void { this.callbackManager.unsetCallbacks(); } public resetCamera(): void { this.actionManager.resetCamera(); } }