Browse Source

ensure sec struct for putty repr

Alexander Rose 4 years ago
parent
commit
abfb1d5992
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/mol-repr/structure/representation/putty.ts

+ 8 - 2
src/mol-repr/structure/representation/putty.ts

@@ -1,5 +1,5 @@
 /**
- * Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ * Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
  *
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
  */
@@ -12,6 +12,8 @@ import { StructureRepresentation, StructureRepresentationProvider, StructureRepr
 import { Representation, RepresentationParamsGetter, RepresentationContext } from '../../../mol-repr/representation';
 import { Structure, Unit } from '../../../mol-model/structure';
 import { ThemeRegistryContext } from '../../../mol-theme/theme';
+import { CustomProperty } from '../../../mol-model-props/common/custom-property';
+import { SecondaryStructureProvider } from '../../../mol-model-props/computed/secondary-structure';
 
 const PuttyVisuals = {
     'polymer-tube': (ctx: RepresentationContext, getParams: RepresentationParamsGetter<Structure, PolymerTubeParams>) => UnitsRepresentation('Polymer tube mesh', ctx, getParams, PolymerTubeVisual),
@@ -52,5 +54,9 @@ export const PuttyRepresentationProvider = StructureRepresentationProvider({
     defaultValues: PD.getDefaultValues(PuttyParams),
     defaultColorTheme: { name: 'chain-id' },
     defaultSizeTheme: { name: 'uncertainty' },
-    isApplicable: (structure: Structure) => structure.polymerResidueCount > 0
+    isApplicable: (structure: Structure) => structure.polymerResidueCount > 0,
+    ensureCustomProperties: {
+        attach: (ctx: CustomProperty.Context, structure: Structure) => SecondaryStructureProvider.attach(ctx, structure, void 0, true),
+        detach: (data) => SecondaryStructureProvider.ref(data, false)
+    }
 });