UNPKG

molstar

Version:

A comprehensive macromolecular library.

154 lines (153 loc) 6.15 kB
/** * Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author David Sehnal <david.sehnal@gmail.com> * @author Alexander Rose <alexander.rose@weirdbyte.de> */ import { ParamDefinition as PD } from '../../../../mol-util/param-definition'; import { PluginStateObject } from '../../../../mol-plugin-state/objects'; import { Volume } from '../../../../mol-model/volume'; import { VolumeServerInfo } from './model'; import { Vec3 } from '../../../../mol-math/linear-algebra'; import { Color } from '../../../../mol-util/color'; import { PluginBehavior } from '../../behavior'; import { Structure } from '../../../../mol-model/structure'; import { PluginContext } from '../../../context'; declare const VolumeStreaming_base: { new (data: VolumeStreaming.Behavior, props?: { label: string; description?: string | undefined; } | undefined): { id: import("../../../../mol-util/uuid").UUID; type: PluginStateObject.TypeInfo; label: string; description?: string | undefined; data: VolumeStreaming.Behavior; }; type: PluginStateObject.TypeInfo; is(obj?: import("../../../../mol-state/object").StateObject<any, import("../../../../mol-state/object").StateObject.Type<any>> | undefined): obj is { id: import("../../../../mol-util/uuid").UUID; type: PluginStateObject.TypeInfo; label: string; description?: string | undefined; data: VolumeStreaming.Behavior; }; }; export declare class VolumeStreaming extends VolumeStreaming_base { } export declare namespace VolumeStreaming { const RootTag = "volume-streaming-info"; interface ChannelParams { isoValue: Volume.IsoValue; color: Color; wireframe: boolean; opacity: number; } function createParams(options?: { data?: VolumeServerInfo.Data; defaultView?: ViewTypes; channelParams?: DefaultChannelParams; }): { entry: PD.Mapped<PD.NamedParams<PD.Values<{ view: PD.Mapped<PD.NamedParams<PD.Normalize<{}>, "cell"> | PD.NamedParams<PD.Normalize<{ radius: number; selectionDetailLevel: number; isSelection: boolean; bottomLeft: Vec3; topRight: Vec3; }>, "auto"> | PD.NamedParams<PD.Normalize<{}>, "off"> | PD.NamedParams<PD.Normalize<{ bottomLeft: Vec3; topRight: Vec3; }>, "box"> | PD.NamedParams<PD.Normalize<{ radius: number; bottomLeft: Vec3; topRight: Vec3; }>, "selection-box">>; detailLevel: PD.Select<number>; channels: PD.Group<PD.Normalize<{ em: PD.Normalize<ChannelParams>; }>> | PD.Group<PD.Normalize<{ '2fo-fc': PD.Normalize<ChannelParams>; 'fo-fc(+ve)': PD.Normalize<ChannelParams>; 'fo-fc(-ve)': PD.Normalize<ChannelParams>; }>>; }>, string>>; }; type EntryParamDefinition = ReturnType<typeof createEntryParams>; type EntryParams = PD.Values<EntryParamDefinition>; function createEntryParams(options: { entryData?: VolumeServerInfo.EntryData; defaultView?: ViewTypes; structure?: Structure; channelParams?: DefaultChannelParams; }): { view: PD.Mapped<PD.NamedParams<PD.Normalize<{}>, "cell"> | PD.NamedParams<PD.Normalize<{ radius: number; selectionDetailLevel: number; isSelection: boolean; bottomLeft: Vec3; topRight: Vec3; }>, "auto"> | PD.NamedParams<PD.Normalize<{}>, "off"> | PD.NamedParams<PD.Normalize<{ bottomLeft: Vec3; topRight: Vec3; }>, "box"> | PD.NamedParams<PD.Normalize<{ radius: number; bottomLeft: Vec3; topRight: Vec3; }>, "selection-box">>; detailLevel: PD.Select<number>; channels: PD.Group<PD.Normalize<{ em: PD.Normalize<ChannelParams>; }>> | PD.Group<PD.Normalize<{ '2fo-fc': PD.Normalize<ChannelParams>; 'fo-fc(+ve)': PD.Normalize<ChannelParams>; 'fo-fc(-ve)': PD.Normalize<ChannelParams>; }>>; }; const ViewTypeOptions: [ViewTypes, string][]; type ViewTypes = 'off' | 'box' | 'selection-box' | 'cell' | 'auto'; type ParamDefinition = ReturnType<typeof createParams>; type Params = PD.Values<ParamDefinition>; type ChannelType = 'em' | '2fo-fc' | 'fo-fc(+ve)' | 'fo-fc(-ve)'; const ChannelTypeOptions: [ChannelType, string][]; interface ChannelInfo { data: Volume; color: Color; wireframe: boolean; isoValue: Volume.IsoValue.Relative; opacity: number; } type Channels = { [name in ChannelType]?: ChannelInfo; }; type DefaultChannelParams = { [name in ChannelType]?: Partial<ChannelParams>; }; class Behavior extends PluginBehavior.WithSubscribers<Params> { plugin: PluginContext; data: VolumeServerInfo.Data; private cache; params: Params; private lastLoci; private ref; infoMap: Map<string, VolumeServerInfo.EntryData>; channels: Channels; get info(): VolumeServerInfo.EntryData; private queryData; private parseCif; private updateSelectionBoxParams; private updateAutoParams; private getStructureRoot; register(ref: string): void; unregister(): void; private _invTransform; private getBoxFromLoci; private updateAuto; private updateSelectionBox; update(params: Params): Promise<boolean>; private createChannel; getDescription(): "" | "Selection" | "Static Box" | "Cell"; constructor(plugin: PluginContext, data: VolumeServerInfo.Data); } } export {};