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
Branches
Tags
No related merge requests found
...@@ -10,9 +10,7 @@ import { Structure, StructureElement } from '../../../mol-model/structure'; ...@@ -10,9 +10,7 @@ import { Structure, StructureElement } from '../../../mol-model/structure';
import { isEmptyLoci } from '../../../mol-model/loci'; import { isEmptyLoci } from '../../../mol-model/loci';
import { ColorOptions, ParameterControls } from '../controls/parameters'; import { ColorOptions, ParameterControls } from '../controls/parameters';
import { Color } from '../../../mol-util/color'; import { Color } from '../../../mol-util/color';
import { ButtonSelect, Options } from '../controls/common'; 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 { ParamDefinition as PD } from '../../../mol-util/param-definition'; import { ParamDefinition as PD } from '../../../mol-util/param-definition';
abstract class BaseStructureRepresentationControls extends PluginUIComponent { abstract class BaseStructureRepresentationControls extends PluginUIComponent {
...@@ -92,13 +90,7 @@ class SelectionStructureRepresentationControls extends BaseStructureRepresentati ...@@ -92,13 +90,7 @@ class SelectionStructureRepresentationControls extends BaseStructureRepresentati
export class StructureRepresentationControls extends PluginUIComponent { export class StructureRepresentationControls extends PluginUIComponent {
preset = async () => { preset = async () => {
const { structureRepresentation: rep } = this.plugin.helpers await this.plugin.helpers.structureRepresentation.preset()
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 ])
]))
} }
onChange = async (p: { param: PD.Base<any>, name: string, value: any }) => { onChange = async (p: { param: PD.Base<any>, name: string, value: any }) => {
......
...@@ -12,6 +12,8 @@ import { PluginContext } from '../context'; ...@@ -12,6 +12,8 @@ import { PluginContext } from '../context';
import { StructureRepresentation3DHelpers } from '../state/transforms/representation'; import { StructureRepresentation3DHelpers } from '../state/transforms/representation';
import Expression from '../../mol-script/language/expression'; import Expression from '../../mol-script/language/expression';
import { compile } from '../../mol-script/runtime/query/compiler'; 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>>> type StructureTransform = StateObjectCell<PSO.Molecule.Structure, StateTransform<StateTransformer<any, PSO.Molecule.Structure, any>>>
const RepresentationManagerTag = 'representation-controls' const RepresentationManagerTag = 'representation-controls'
...@@ -145,6 +147,16 @@ export class StructureRepresentationHelper { ...@@ -145,6 +147,16 @@ export class StructureRepresentationHelper {
this._ignoreHydrogens = ignoreHydrogens 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) { constructor(private plugin: PluginContext) {
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment