瀏覽代碼

add InterUnitBonds.hasBond

Alexander Rose 5 年之前
父節點
當前提交
56fd6d6a5b
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/mol-model/structure/structure/unit/links/data.ts

+ 5 - 0
src/mol-model/structure/structure/unit/links/data.ts

@@ -38,6 +38,11 @@ class InterUnitBonds {
         return index !== undefined ? index : -1
         return index !== undefined ? index : -1
     }
     }
 
 
+    /** Check if bond exists */
+    hasBond(indexA: StructureElement.UnitIndex, unitA: Unit, indexB: StructureElement.UnitIndex, unitB: Unit): boolean {
+        return this.getBondIndex(indexA, unitA, indexB, unitB) !== -1
+    }
+
     /** Get inter-unit bond given a pair of indices and units */
     /** Get inter-unit bond given a pair of indices and units */
     getBond(indexA: StructureElement.UnitIndex, unitA: Unit, indexB: StructureElement.UnitIndex, unitB: Unit): InterUnitBonds.Bond | undefined {
     getBond(indexA: StructureElement.UnitIndex, unitA: Unit, indexB: StructureElement.UnitIndex, unitB: Unit): InterUnitBonds.Bond | undefined {
         const index = this.getBondIndex(indexA, unitA, indexB, unitB)
         const index = this.getBondIndex(indexA, unitA, indexB, unitB)