Skip to content
Snippets Groups Projects
Commit 3b1a2f19 authored by Alexander Rose's avatar Alexander Rose
Browse files

wip, structure tools, repr presets

parent 6b874786
No related branches found
No related tags found
No related merge requests found
......@@ -10,9 +10,7 @@ import { Structure, StructureElement } from '../../../mol-model/structure';
import { isEmptyLoci } from '../../../mol-model/loci';
import { ColorOptions, ParameterControls } from '../controls/parameters';
import { Color } from '../../../mol-util/color';
import { ButtonSelect, Options } from '../controls/common';
import { StructureSelectionQueries as Q } from '../../util/structure-selection-helper';
import { MolScriptBuilder as MS } from '../../../mol-script/language/builder';
import { ButtonSelect, Options } from '../controls/common'
import { ParamDefinition as PD } from '../../../mol-util/param-definition';
abstract class BaseStructureRepresentationControls extends PluginUIComponent {
......@@ -92,13 +90,7 @@ class SelectionStructureRepresentationControls extends BaseStructureRepresentati
export class StructureRepresentationControls extends PluginUIComponent {
preset = async () => {
const { structureRepresentation: rep } = this.plugin.helpers
await rep.clear()
await rep.setFromExpression('add', 'cartoon', Q.all)
await rep.setFromExpression('add', 'carbohydrate', Q.all)
await rep.setFromExpression('add', 'ball-and-stick', MS.struct.modifier.union([
MS.struct.combinator.merge([ Q.ligandsPlusConnected, Q.branchedConnectedOnly, Q.water ])
]))
await this.plugin.helpers.structureRepresentation.preset()
}
onChange = async (p: { param: PD.Base<any>, name: string, value: any }) => {
......
......@@ -12,6 +12,8 @@ import { PluginContext } from '../context';
import { StructureRepresentation3DHelpers } from '../state/transforms/representation';
import Expression from '../../mol-script/language/expression';
import { compile } from '../../mol-script/runtime/query/compiler';
import { StructureSelectionQueries as Q } from '../util/structure-selection-helper';
import { MolScriptBuilder as MS } from '../../mol-script/language/builder';
type StructureTransform = StateObjectCell<PSO.Molecule.Structure, StateTransform<StateTransformer<any, PSO.Molecule.Structure, any>>>
const RepresentationManagerTag = 'representation-controls'
......@@ -145,6 +147,16 @@ export class StructureRepresentationHelper {
this._ignoreHydrogens = ignoreHydrogens
}
async preset() {
// TODO generalize and make configurable
await this.clear()
await this.setFromExpression('add', 'cartoon', Q.all)
await this.setFromExpression('add', 'carbohydrate', Q.all)
await this.setFromExpression('add', 'ball-and-stick', MS.struct.modifier.union([
MS.struct.combinator.merge([ Q.ligandsPlusConnected, Q.branchedConnectedOnly, Q.water ])
]))
}
constructor(private plugin: PluginContext) {
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment