Skip to content
Snippets Groups Projects
Select Git revision
  • 4901a1bd87e700fe8825a0dc084d50f9a20c5af7
  • master default protected
  • base-pairs-ladder
  • rednatco-v2
  • rednatco
  • test
  • ntc-tube-uniform-color
  • ntc-tube-missing-atoms
  • restore-vertex-array-per-program
  • watlas2
  • dnatco_new
  • cleanup-old-nodejs
  • webmmb
  • fix_auth_seq_id
  • update_deps
  • ext_dev
  • ntc_balls
  • nci-2
  • plugin
  • bugfix-0.4.5
  • nci
  • v0.5.0-dev.1
  • v0.4.5
  • v0.4.4
  • v0.4.3
  • v0.4.2
  • v0.4.1
  • v0.4.0
  • v0.3.12
  • v0.3.11
  • v0.3.10
  • v0.3.9
  • v0.3.8
  • v0.3.7
  • v0.3.6
  • v0.3.5
  • v0.3.4
  • v0.3.3
  • v0.3.2
  • v0.3.1
  • v0.3.0
41 results

viewport-screenshot.ts

Blame
  • symmetry.ts 1.64 KiB
    /**
     * Copyright (c) 2017 mol* contributors, licensed under MIT, See LICENSE file for more info.
     *
     * @author David Sehnal <david.sehnal@gmail.com>
     */
    
    import { SymmetryOperator } from 'mol-math/geometry/symmetry-operator'
    import { arrayFind } from 'mol-data/util'
    import { Query } from '../../query'
    import { Model } from '../../model'
    
    /** Determine an atom set and a list of operators that should be applied to that set  */
    export interface OperatorGroup {
        readonly selector: Query,
        readonly operators: ReadonlyArray<SymmetryOperator>
    }
    
    export type OperatorGroups = ReadonlyArray<OperatorGroup>
    
    export class Assembly {
        readonly id: string;
        readonly details: string;
    
        private _operators: OperatorGroups;
        get operatorGroups(): OperatorGroups {
            if (this._operators) return this._operators;
            this._operators = this.operatorsProvider();
            return this._operators;
        }
    
        constructor(id: string, details: string, private operatorsProvider: () => OperatorGroups) {
            this.id = id;
            this.details = details;
        }
    }
    
    export namespace Assembly {
        export function create(id: string, details: string, operatorsProvider: () => OperatorGroups): Assembly {
            return new Assembly(id, details, operatorsProvider);
        }
    }
    
    interface Symmetry {
        readonly assemblies: ReadonlyArray<Assembly>,
    }
    
    namespace Symmetry {
        export const Empty: Symmetry = { assemblies: [] };
    
        export function findAssembly(model: Model, id: string): Assembly | undefined {
            const _id = id.toLocaleLowerCase();
            return arrayFind(model.symmetry.assemblies, a => a.id.toLowerCase() === _id);
        }
    }
    
    export default Symmetry