Kaynağa Gözat

Issue #2: label provider under dev. with debug stuffs

cycle20 2 yıl önce
ebeveyn
işleme
8a0b9d22e0

+ 2 - 1
src/extensions/tmdet/behavior.ts

@@ -26,7 +26,7 @@ import { MembraneOrientationProvider, MembraneOrientation, TmDetDescriptorCache
 import { applyTransformations, createMembraneOrientation } from './transformation';
 import { ComponentsType, PDBTMDescriptor, PMS } from './types';
 import { registerTmDetSymmetry } from './symmetry';
-import { LabeledResidues } from './labeling';
+import { LabeledResidues, TmLabelProvider } from './labeling';
 import { TmDetColorThemeProvider } from './tmdet-color-theme';
 import { loadInitialSnapshot, rotateCamera, storeCameraSnapshot } from './camera';
 
@@ -54,6 +54,7 @@ export const TMDETMembraneOrientation = PluginBehavior.create<{ autoAttach: bool
             this.ctx.query.structure.registry.add(isTransmembrane);
 
             this.ctx.representation.structure.themes.colorThemeRegistry.add(TmDetColorThemeProvider);
+            LabeledResidues.labelProvider!.label = TmLabelProvider.label;
             this.ctx.managers.lociLabels.addProvider(LabeledResidues.labelProvider!);
             this.ctx.customModelProperties.register(LabeledResidues.propertyProvider, true);
 

+ 19 - 1
src/extensions/tmdet/labeling.ts

@@ -7,10 +7,14 @@
 
 import { DebugUtil } from '../../apps/tm-viewer';
 import { CustomElementProperty } from '../../mol-model-props/common/custom-element-property';
-import { Model, ElementIndex } from '../../mol-model/structure';
+import { Model, ElementIndex, StructureElement } from '../../mol-model/structure';
+import { Loci } from '../../mol-model/loci';
+import { LociLabel, LociLabelProvider } from '../../mol-plugin-state/manager/loci-label';
+import { Representation } from '../../mol-repr/representation';
 import { TmDetDescriptorCache } from './prop';
 import { createResidueListsPerChain } from './tmdet-color-theme';
 import { ChainList } from './types';
+import { OrderedSet } from '../../mol-data/int';
 
 const siteLabels = [
     "Side1",
@@ -76,3 +80,17 @@ export const LabeledResidues = CustomElementProperty.create<number>({
         return siteLabels[e];
     }
 });
+
+
+export const TmLabelProvider: LociLabelProvider = {
+    label: (loci: Loci): LociLabel => {
+        if (loci.kind == 'element-loci') {
+            DebugUtil.log('LabelProvider:', loci.elements[0].unit.model.atomicHierarchy.chains.auth_asym_id.toArray());
+            DebugUtil.log('LabelProvider:', loci.elements[0].unit.model.atomicHierarchy.chains.label_asym_id.toArray());
+            DebugUtil.log('LabelProvider:', loci.elements[0].unit.model.atomicHierarchy.chains.label_entity_id.toArray());
+            DebugUtil.log('IsLocation:', loci.structure.elementLocations());
+            DebugUtil.log('start:', OrderedSet.start(loci.elements[0].indices));
+        }
+        return "hello";
+    }
+}