JAL-3518 tidy method, remove obsolete comment
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 12 May 2020 13:20:15 +0000 (14:20 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 12 May 2020 13:20:15 +0000 (14:20 +0100)
src/jalview/ext/jmol/JalviewJmolBinding.java
src/jalview/structures/models/AAStructureBindingModel.java

index 061271a..08ea052 100644 (file)
@@ -260,52 +260,32 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
   public void highlightAtom(int atomIndex, int pdbResNum, String chain,
           String pdbfile)
   {
-    if (modelFileNames == null)
-    {
-      return;
-    }
-
-    // look up file model number for this pdbfile
-    int mdlNum = 0;
-    // may need to adjust for URLencoding here - we don't worry about that yet.
-    while (mdlNum < modelFileNames.length
-            && !pdbfile.equals(modelFileNames[mdlNum]))
-    {
-      mdlNum++;
-    }
-    if (mdlNum == modelFileNames.length)
+    String modelId = getModelIdForFile(pdbfile);
+    if (modelId.isEmpty())
     {
       return;
     }
 
     jmolHistory(false);
 
+    StringBuilder selection = new StringBuilder(32);
     StringBuilder cmd = new StringBuilder(64);
-    cmd.append("select ").append(String.valueOf(pdbResNum)); // +modelNum
-
-    resetLastRes.append("select ").append(String.valueOf(pdbResNum)); // +modelNum
-
-    cmd.append(":");
-    resetLastRes.append(":");
+    selection.append("select ").append(String.valueOf(pdbResNum));
+    selection.append(":");
     if (!chain.equals(" "))
     {
-      cmd.append(chain);
-      resetLastRes.append(chain);
+      selection.append(chain);
     }
-    {
-      cmd.append(" /").append(String.valueOf(mdlNum + 1));
-      resetLastRes.append("/").append(String.valueOf(mdlNum + 1));
-    }
-    cmd.append(";wireframe 100;" + cmd.toString() + " and not hetero;");
+    selection.append(" /").append(modelId);
 
-    resetLastRes.append(";wireframe 0;" + resetLastRes.toString()
-            + " and not hetero; spacefill 0;");
+    cmd.append(selection).append(";wireframe 100;").append(selection)
+            .append(" and not hetero;").append("spacefill 200;select none");
 
-    cmd.append("spacefill 200;select none");
+    resetLastRes.append(selection).append(";wireframe 0;").append(selection)
+            .append(" and not hetero; spacefill 0;");
 
     jmolViewer.evalStringQuiet(cmd.toString());
     jmolHistory(true);
-
   }
 
   private boolean debug = true;
index 7899c40..88c181c 100644 (file)
@@ -1374,7 +1374,6 @@ public abstract class AAStructureBindingModel
   
     for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
     {
-      // todo indirect this resolution / allow override
       final String modelId = getModelIdForFile(files[pdbfnum]);
       StructureMapping[] mapping = ssm.getMapping(files[pdbfnum]);