|
@@ -8,98 +8,12 @@
|
|
|
*
|
|
|
* @author David Sehnal <david.sehnal@gmail.com>
|
|
|
*/
|
|
|
-/*
|
|
|
-import Environment from '../environment'
|
|
|
-import Expression from '../expression'
|
|
|
-import Context from '../context'
|
|
|
-import AtomSet from '../../data/atom-set'
|
|
|
-import AtomSelection from '../../data/atom-selection'
|
|
|
-import ElementAddress from '../../data/element-address'
|
|
|
-import { FastSet } from '../../../utils/collections'
|
|
|
-import { getAtomSetProperties } from './filters'
|
|
|
-*/
|
|
|
|
|
|
-import { StructureQuery} from '../query';
|
|
|
-import { StructureSelection } from '../selection';
|
|
|
-//import { getCurrentStructurePropertiesInternal, UnitTypeProperties } from './filters';
|
|
|
-import { getCurrentStructurePropertiesInternal} from './filters';
|
|
|
-import { QueryContext, QueryFn } from '../context';
|
|
|
-// import { none } from './generators';
|
|
|
-// import { HashSet } from '../../../../mol-data/generic';
|
|
|
-// import { Structure } from '../../structure';
|
|
|
-
|
|
|
-
|
|
|
-/*
|
|
|
-import { SetUtils } from '../../../../mol-util/set';
|
|
|
-import { Unit } from '../../structure';
|
|
|
-import { QueryContext, QueryFn, QueryPredicate } from '../context';
|
|
|
import { StructureQuery } from '../query';
|
|
|
import { StructureSelection } from '../selection';
|
|
|
-import { structureAreIntersecting } from '../utils/structure-set';
|
|
|
-import { Vec3 } from '../../../../mol-math/linear-algebra';
|
|
|
-import { checkStructureMaxRadiusDistance, checkStructureMinMaxDistance } from '../utils/structure-distance';
|
|
|
-import { Structure } from '../../structure/structure';
|
|
|
-import { StructureElement } from '../../structure/element';
|
|
|
-import { SortedArray } from '../../../../mol-data/int';
|
|
|
-*/
|
|
|
-/*
|
|
|
-export function pick(query: StructureQuery, pred: QueryPredicate): StructureQuery {
|
|
|
- return ctx => {
|
|
|
- const sel = query(ctx);
|
|
|
- const ret = StructureSelection.LinearBuilder(ctx.inputStructure);
|
|
|
- ctx.pushCurrentElement();
|
|
|
- StructureSelection.forEach(sel, (s, i) => {
|
|
|
- ctx.currentStructure = s;
|
|
|
- if (pred(ctx)) ret.add(s);
|
|
|
- if (i % 100) ctx.throwIfTimedOut();
|
|
|
- });
|
|
|
- ctx.popCurrentStructure();
|
|
|
- return ret.getSelection();
|
|
|
- };
|
|
|
-}
|
|
|
-
|
|
|
-export function pick(env: Environment, selection: Selection, pred: Expression<boolean>) {
|
|
|
- const sel = selection(env);
|
|
|
- const ret = AtomSelection.linearBuilder();
|
|
|
-
|
|
|
- Environment.lockSlot(env, 'atomSet');
|
|
|
- const { slots } = env;
|
|
|
- for (const atomSet of AtomSelection.atomSets(sel)) {
|
|
|
- slots.atomSet = atomSet;
|
|
|
- if (pred(env)) ret.add(atomSet);
|
|
|
- }
|
|
|
- Environment.unlockSlot(env, 'atomSet');
|
|
|
- return ret.getSelection();
|
|
|
-}
|
|
|
-
|
|
|
-*/
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-// xport function merge(queries: ArrayLike<StructureQuery>): S
|
|
|
-
|
|
|
-// export function atomCount(env: Environment) {
|
|
|
-// return AtomSet.count(env.slots.atomSet);
|
|
|
-// }
|
|
|
-
|
|
|
-// export function atomCount(query : StructureSelection) : StructureQuery {
|
|
|
-
|
|
|
-
|
|
|
+import { getCurrentStructureProperties } from './filters';
|
|
|
+import { QueryContext, QueryFn } from '../context';
|
|
|
|
|
|
-// export function atomCount(env: Environment) {
|
|
|
-// return AtomSet.count(env.slots.atomSet);
|
|
|
-// }
|
|
|
-
|
|
|
-/*
|
|
|
-export function atomCount(ctx: QueryContext) {
|
|
|
- return (ctx: QueryContext) => {
|
|
|
- const all = StructureSelection.Singletons(ctx.inputStructure, ctx.inputStructure)
|
|
|
- const x: number = StructureSelection.structureCount(all);
|
|
|
- return x;
|
|
|
- };
|
|
|
-}
|
|
|
-*/
|
|
|
|
|
|
export function atomCount(ctx: QueryContext) {
|
|
|
return (ctx: QueryContext) => {
|
|
@@ -109,19 +23,6 @@ export function atomCount(ctx: QueryContext) {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-// export function atomCount(ctx: QueryContext) {
|
|
|
-// return (ctx: any) => {
|
|
|
-// const x: number = StructureSelection.structureCount(ctx);
|
|
|
-// return x;
|
|
|
-// };
|
|
|
-// }
|
|
|
-
|
|
|
-// export function countQuery(env: Environment, query: Expression<AtomSelection>) {
|
|
|
-// const sel = query(Environment(Context.ofAtomSet(env.context, env.slots.atomSet)))
|
|
|
-// return AtomSelection.atomSets(sel).length;
|
|
|
-// }
|
|
|
-
|
|
|
export function countQuery(ctx: QueryContext, query: StructureQuery) {
|
|
|
return (ctx: QueryContext) => {
|
|
|
const sel = query(ctx);
|
|
@@ -131,29 +32,13 @@ export function countQuery(ctx: QueryContext, query: StructureQuery) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-//export function propertySet(ctx: QueryContext, prop: UnitTypeProperties) {
|
|
|
+// export function propertySet(ctx: QueryContext, prop: UnitTypeProperties) {
|
|
|
export function propertySet(ctx: QueryContext, prop: QueryFn<any>) {
|
|
|
return (ctx: QueryContext) => {
|
|
|
const set = new Set();
|
|
|
- const x = getCurrentStructurePropertiesInternal(ctx, prop, set);
|
|
|
+ const x = getCurrentStructureProperties(ctx, prop, set);
|
|
|
// console.log(x)
|
|
|
return x;
|
|
|
};
|
|
|
}
|
|
|
|
|
|
-/*
|
|
|
-unction getSelectionProperties(ctx: QueryContext, query: StructureQuery, props: UnitTypeProperties) {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- const sel = query(ctx);
|
|
|
- ctx.pushCurrentElement();
|
|
|
- StructureSelection.forEach(sel, (s, i) => {
|
|
|
- ctx.currentStructure = s;
|
|
|
- getCurrentStructureProperties(ctx, props, set);
|
|
|
-
|
|
|
- if (i % 10) ctx.throwIfTimedOut();
|
|
|
- });
|
|
|
- ctx.popCurrentElement();
|
|
|
- return set;
|
|
|
-*/
|