JAL-3404 explicit getModelForPdbFile lookup
[jalview.git] / src / jalview / ext / rbvi / chimera / JalviewChimeraBinding.java
index dd0a75e..3498f23 100644 (file)
@@ -647,13 +647,19 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
           String progressMsg);
 
   /**
-   * Sends a set of colour commands to the structure viewer
+   * Constructs a set of colour commands and sends them to the structure viewer
    * 
-   * @param commands
+   * @param viewPanel
    */
   @Override
-  protected void colourBySequence(String[] commands)
+  protected void colourBySequence(AlignmentViewPanel viewPanel)
   {
+    Map<Object, AtomSpecModel> colourMap = StructureCommands
+            .buildColoursMap(this, viewPanel);
+
+    String[] commands = ChimeraCommands
+            .getColourBySequenceCommand(colourMap, this);
+
     for (String command : commands)
     {
       sendAsynchronousCommand(command, COLOURING_CHIMERA);
@@ -661,23 +667,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
   }
 
   /**
-   * Computes and returns a set of commands to colour residues in Chimera the same
-   * as mapped residues in the alignment
-   * 
-   * @param files
-   * @param viewPanel
-   * @return
-   */
-  @Override
-  protected String[] getColourBySequenceCommands(
-          String[] files, AlignmentViewPanel viewPanel)
-  {
-    Map<Object, AtomSpecModel> colourMap = StructureCommands.buildColoursMap(this, viewPanel);
-
-    return ChimeraCommands.getColourBySequenceCommand(colourMap, this);
-  }
-
-  /**
    * @param command
    */
   protected void executeWhenReady(String command)
@@ -1022,6 +1011,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
   /**
    * Send a 'focus' command to Chimera to recentre the visible display
    */
+  @Override
   public void focusView()
   {
     sendChimeraCommand("focus", false);
@@ -1285,7 +1275,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
     cmd.append("ribbon ").append(atomSpec);
     if (!isShowAlignmentOnly())
     {
-      cmd.append("chain @CA|P; ribbon");
+      cmd.append("; chain @CA|P");
     }
     if (refocus)
     {
@@ -1293,4 +1283,18 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
     }
     sendChimeraCommand(cmd.toString(), false);
   }
+
+  @Override
+  public int getModelForPdbFile(String fileName, int fileIndex)
+  {
+    if (chimeraMaps.containsKey(fileName))
+    {
+      List<ChimeraModel> models = chimeraMaps.get(fileName);
+      if (!models.isEmpty())
+      {
+        return models.get(0).getModelNumber();
+      }
+    }
+    return -1;
+  }
 }