ソースを参照

rm `CCDCoordinateTypeProp`

Sebastian Bittrich 1 年間 前
コミット
95a7a2cef9

+ 3 - 5
src/mol-model-formats/structure/mmcif.ts

@@ -144,11 +144,9 @@ async function createCcdModels(data: CCD_Database, format: CCDFormat, ctx: Runti
     const models = [];
     if (ideal) models.push(ideal.representative);
     if (model) models.push(model.representative);
-    for (let i = 0, il = models.length; i < il; i++) {
-        Model.TrajectoryInfo.set(models[i], { index: i, size: models.length });
-        // TODO smarter way to 'tag' model as ideal/model
-        Model.CCDCoordinateType.set(models[i], { coordinateType: models[i] === ideal?.representative ? CCDFormat.CoordinateType.Ideal : CCDFormat.CoordinateType.Model });
-    }
+    // model index tags models as either 'ideal' (index 0) or 'model' (index 1)
+    if (ideal) Model.TrajectoryInfo.set(models[0], { index: 0, size: models.length });
+    if (model) Model.TrajectoryInfo.set(models[models.length - 1], { index: 1, size: models.length });
 
     return new ArrayTrajectory(models);
 }

+ 1 - 12
src/mol-model/structure/model/model.ts

@@ -20,7 +20,7 @@ import { Topology } from '../topology';
 import { Task } from '../../../mol-task';
 import { IndexPairBonds } from '../../../mol-model-formats/structure/property/bonds/index-pair';
 import { createModels } from '../../../mol-model-formats/structure/basic/parser';
-import { CCDFormat, MmcifFormat } from '../../../mol-model-formats/structure/mmcif';
+import { MmcifFormat } from '../../../mol-model-formats/structure/mmcif';
 import { ChainIndex, ElementIndex } from './indexing';
 import { SymmetryOperator } from '../../../mol-math/geometry';
 import { ModelSymmetry } from '../../../mol-model-formats/structure/property/symmetry';
@@ -200,17 +200,6 @@ export namespace Model {
         }
     };
 
-    const CCDCoordinateTypeProp = '__CCDCoordinateType__';
-    export type CCDCoordinateType = { readonly coordinateType: CCDFormat.CoordinateType }
-    export const CCDCoordinateType = {
-        get(model: Model): CCDCoordinateType {
-            return model._dynamicPropertyData[CCDCoordinateTypeProp] || { coordinateType: CCDFormat.CoordinateType.Ideal };
-        },
-        set(model: Model, ccdCoordinateType: CCDCoordinateType) {
-            return model._dynamicPropertyData[CCDCoordinateTypeProp] = ccdCoordinateType;
-        }
-    };
-
     const AsymIdCountProp = '__AsymIdCount__';
     export type AsymIdCount = { readonly auth: number, readonly label: number }
     export const AsymIdCount = {

+ 2 - 2
src/mol-plugin-state/builder/structure/hierarchy-preset.ts

@@ -160,8 +160,8 @@ const ccd = TrajectoryHierarchyPresetProvider({
 
         // degenerate case where either model or ideal coordinates are missing
         if (tr.frameCount !== 2) {
-            // 'ideal' variables are 1st model, which might actually be 'model' coordinates
-            const coordinateType = Model.CCDCoordinateType.get(idealModel.obj?.data!).coordinateType;
+            // variables are 1st model but not necessarily ideal coordinates -- consult trajectory index to distinguish ideal/model coordinates
+            const coordinateType = Model.TrajectoryInfo.get(idealModel.obj!.data).index === 0 ? CCDFormat.CoordinateType.Ideal : CCDFormat.CoordinateType.Model;
             await builder.representation.applyPreset(idealStructureProperties, representationPreset, { ...representationPresetParams, coordinateType });
 
             return { models: [idealModel], structures: [idealStructure] };