JAL-2961 centerViewOn command for structure viewers - called after superposition
authorJim Procter <j.procter@dundee.ac.uk>
Fri, 28 Oct 2022 14:45:22 +0000 (15:45 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Fri, 28 Oct 2022 15:29:30 +0000 (16:29 +0100)
src/jalview/ext/jmol/JmolCommands.java
src/jalview/ext/pymol/PymolCommands.java
src/jalview/ext/rbvi/chimera/ChimeraCommands.java
src/jalview/structure/StructureCommandsI.java

index 58b69ef..19d64f0 100644 (file)
@@ -40,7 +40,6 @@ import jalview.structure.StructureCommandI;
 import jalview.structure.StructureCommandsBase;
 import jalview.structure.StructureMapping;
 import jalview.structure.StructureSelectionManager;
-import jalview.structure.StructureCommandsI.AtomSpecType;
 import jalview.util.Comparison;
 import jalview.util.Platform;
 
@@ -207,7 +206,22 @@ public class JmolCommands extends StructureCommandsBase
             .append("|");
     sb.append(getAtomSpec(refAtoms, AtomSpecType.RESIDUE_ONLY))
             .append(getCommandSeparator()).append("cartoons");
+    return Arrays.asList(new StructureCommand(sb.toString()));
+  }
 
+  @Override
+  public List<StructureCommandI> centerViewOn(List<AtomSpecModel> residues)
+  {
+    StringBuilder sb = new StringBuilder(64);
+    sb.append("center ");
+    for (AtomSpecModel ranges : residues)
+    {
+      if (sb.length() > 9)
+      {
+        sb.append(" or ");
+      }
+      sb.append(getAtomSpec(ranges, AtomSpecType.RESIDUE_ONLY));
+    }
     return Arrays.asList(new StructureCommand(sb.toString()));
   }
 
index b8b6a98..08521a2 100644 (file)
@@ -363,4 +363,11 @@ public class PymolCommands extends StructureCommandsBase
     return CLOSE_PYMOL;
   }
 
+  @Override
+  public List<StructureCommandI> centerViewOn(List<AtomSpecModel> residues)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
 }
index d3dd625..829f092 100644 (file)
  */
 package jalview.ext.rbvi.chimera;
 
-import java.util.Locale;
-
 import java.awt.Color;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import jalview.structure.AtomSpecModel;
 import jalview.structure.StructureCommand;
 import jalview.structure.StructureCommandI;
 import jalview.structure.StructureCommandsBase;
-import jalview.structure.StructureCommandsI.AtomSpecType;
 import jalview.util.ColorUtils;
 
 /**
@@ -456,4 +454,11 @@ public class ChimeraCommands extends StructureCommandsBase
     return new StructureCommand("list residues attr '" + attName + "'");
   }
 
+  @Override
+  public List<StructureCommandI> centerViewOn(List<AtomSpecModel> residues)
+  {
+    // TODO Auto-generated method stub
+    return null;
+  }
+
 }
index c8c8070..575f256 100644 (file)
@@ -243,4 +243,6 @@ public interface StructureCommandsI
    * @return
    */
   StructureCommandI getResidueAttributes(String attName);
+
+  List<StructureCommandI> centerViewOn(List<AtomSpecModel> residues);
 }