molstar
Version:
A comprehensive macromolecular library.
78 lines (77 loc) • 2.52 kB
TypeScript
/**
* Copyright (c) 2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
import { StructureElement, Structure } from '../mol-model/structure';
import { Script } from '../mol-script/script';
import { BitFlags } from '../mol-util/bit-flags';
export { Clipping };
declare type Clipping = {
readonly layers: ReadonlyArray<Clipping.Layer>;
};
declare function Clipping(layers: ReadonlyArray<Clipping.Layer>): Clipping;
declare namespace Clipping {
type Layer = {
readonly loci: StructureElement.Loci;
readonly groups: Groups;
};
const Empty: Clipping;
type Groups = BitFlags<Groups.Flag>;
namespace Groups {
const is: (g: Groups, f: Flag) => boolean;
const enum Flag {
None = 0,
One = 1,
Two = 2,
Three = 4,
Four = 8,
Five = 16,
Six = 32
}
function create(flags: Flag): Groups;
const Names: {
one: Flag;
two: Flag;
three: Flag;
four: Flag;
five: Flag;
six: Flag;
};
type Names = keyof typeof Names;
function isName(name: string): name is Names;
function fromName(name: Names): Flag;
function fromNames(names: Names[]): Flag;
function toNames(groups: Groups): Names[];
}
/** Clip object types */
const Type: {
none: number;
plane: number;
sphere: number;
cube: number;
cylinder: number;
infiniteCone: number;
};
type Variant = 'instance' | 'pixel';
function areEqual(cA: Clipping, cB: Clipping): boolean;
function isEmpty(clipping: Clipping): boolean;
function remap(clipping: Clipping, structure: Structure): {
layers: Layer[];
};
function merge(clipping: Clipping): Clipping;
function filter(clipping: Clipping, filter: Structure): Clipping;
type ScriptLayer = {
script: Script;
groups: Groups;
};
function ofScript(scriptLayers: ScriptLayer[], structure: Structure): Clipping;
type BundleLayer = {
bundle: StructureElement.Bundle;
groups: Groups;
};
function ofBundle(bundleLayers: BundleLayer[], structure: Structure): Clipping;
function toBundle(clipping: Clipping): {
layers: BundleLayer[];
};
}