JAL-1925 update source version in license
[jalview.git] / src / jalview / ext / jmol / JalviewJmolBinding.java
index abd742e..94b10d8 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
- * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2)
+ * Copyright (C) 2015 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -63,11 +63,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
         implements JmolStatusListener, JmolSelectionListener,
         ComponentListener
 {
-  /*
-   * state flag used to check if the Jmol viewer's paint method can be called
-   */
-  private boolean finishedInit = false;
-
   boolean allChainsSelected = false;
 
   /*
@@ -236,10 +231,9 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
   public void superposeStructures(AlignmentI alignment, int refStructure,
           ColumnSelection hiddenCols)
   {
-    superposeStructures(new AlignmentI[]
-    { alignment }, new int[]
-    { refStructure }, new ColumnSelection[]
-    { hiddenCols });
+    superposeStructures(new AlignmentI[] { alignment },
+            new int[] { refStructure },
+            new ColumnSelection[] { hiddenCols });
   }
 
   /**
@@ -281,7 +275,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     String nSeconds = " ";
     if (files.length > 10)
     {
-      nSeconds = " 0.00001 ";
+      nSeconds = " 0.005 ";
     }
     else
     {
@@ -290,7 +284,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     }
     // see JAL-1345 - should really automatically turn off the animation for
     // large numbers of structures, but Jmol doesn't seem to allow that.
-    nSeconds = " ";
+    // nSeconds = " ";
     // union of all aligned positions are collected together.
     for (int a = 0; a < _alignment.length; a++)
     {
@@ -463,8 +457,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
                 + selectioncom.toString() + "); cartoons; ");
         // selcom.append("; ribbons; ");
         String cmdString = command.toString();
-        System.out
-.println("Superimpose command(s):\n" + cmdString);
+        System.out.println("Superimpose command(s):\n" + cmdString);
 
         evalStateCommand(cmdString);
       }
@@ -521,7 +514,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     }
     AlignmentI alignment = alignmentv.getAlignment();
 
-    for (jalview.structure.StructureMappingcommandSet cpdbbyseq : getColourBySequenceCommands(files, sr, fr, alignment))
+    for (jalview.structure.StructureMappingcommandSet cpdbbyseq : getColourBySequenceCommands(
+            files, sr, fr, alignment))
     {
       for (String cbyseq : cpdbbyseq.commands)
       {
@@ -541,10 +535,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
           String[] files, SequenceRenderer sr, FeatureRenderer fr,
           AlignmentI alignment)
   {
-    return JmolCommands
-            .getColourBySequenceCommand(getSsm(), files, getSequence(), sr,
-                    fr,
-                    alignment);
+    return JmolCommands.getColourBySequenceCommand(getSsm(), files,
+            getSequence(), sr, fr, alignment);
   }
 
   /**
@@ -597,8 +589,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     }
     // TODO: verify atomIndex is selecting correct model.
     // return new Color(viewer.getAtomArgb(atomIndex)); Jmol 12.2.4
-    int colour = viewer.ms.at[atomIndex]
-            .atomPropertyInt(T.color);
+    int colour = viewer.ms.at[atomIndex].atomPropertyInt(T.color);
     return new Color(colour);
   }
 
@@ -676,6 +667,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
           // applet path with docroot - discard as format won't match pdbfile
           mset[0] = m;
         }
+        _modelFileNameMap[0] = 0; // filename index for first model is always 0.
       }
       int j = 1;
       for (int i = 1; i < mset.length; i++)
@@ -895,8 +887,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
         pdbfilename = modelFileNames[_mp];
         if (pdbfilename == null)
         {
-          pdbfilename = new File(
-                  viewer.ms.getModelFileName(mnumber))
+          pdbfilename = new File(viewer.ms.getModelFileName(mnumber))
                   .getAbsolutePath();
         }
 
@@ -951,7 +942,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     String mdlString = "";
     if ((p = strInfo.indexOf(":")) > -1)
     {
-      picked += strInfo.substring(p + 1, strInfo.indexOf("."));
+      picked += strInfo.substring(p, strInfo.indexOf("."));
     }
 
     if ((p = strInfo.indexOf("/")) > -1)
@@ -1139,8 +1130,8 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
         pdbfile = viewer.getData("" + (1 + _modelFileNameMap[modelnum])
                 + ".0", "PDB");
       }
-        // search pdbentries and sequences to find correct pdbentry for this
-        // model
+      // search pdbentries and sequences to find correct pdbentry for this
+      // model
       for (int pe = 0; pe < getPdbCount(); pe++)
       {
         boolean matches = false;
@@ -1225,7 +1216,7 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     // }
     if (!isLoadingFromArchive())
     {
-      viewer.evalStringQuiet("model 0; select backbone;restrict;cartoon;wireframe off;spacefill off");
+      viewer.evalStringQuiet("model *; select backbone;restrict;cartoon;wireframe off;spacefill off");
     }
     // register ourselves as a listener and notify the gui that it needs to
     // update itself.
@@ -1410,16 +1401,6 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     return null;
   }
 
-  public boolean isFinishedInit()
-  {
-    return finishedInit;
-  }
-
-  public void setFinishedInit(boolean finishedInit)
-  {
-    this.finishedInit = finishedInit;
-  }
-
   /**
    * 
    */
@@ -1474,4 +1455,3 @@ public abstract class JalviewJmolBinding extends AAStructureBindingModel
     showConsole(false);
   }
 }
-