/** * Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author Koya Sakuma * Adapted from MolQL implemtation of atom-set.ts * * Copyright (c) 2017 MolQL contributors, licensed under MIT, See LICENSE file for more info. * * @author David Sehnal */ import { StructureQuery } from '../query'; import { StructureSelection } from '../selection'; import { getCurrentStructureProperties } from './filters'; import { QueryContext, QueryFn } from '../context'; export function atomCount(ctx: QueryContext) { return (ctx: QueryContext) => { const all = StructureSelection.Singletons(ctx.currentStructure, ctx.currentStructure); const x: number = StructureSelection.structureCount(all); return x; }; } export function countQuery(ctx: QueryContext, query: StructureQuery) { return (ctx: QueryContext) => { const sel = query(ctx); const x: number = StructureSelection.structureCount(sel); return x; }; } // export function propertySet(ctx: QueryContext, prop: UnitTypeProperties) { export function propertySet(ctx: QueryContext, prop: QueryFn) { return (ctx: QueryContext) => { const set = new Set(); const x = getCurrentStructureProperties(ctx, prop, set); // console.log(x) return x; }; }