From dfbb41ec2e39d3712cc1df648e967b3308e5739e Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 28 Oct 2022 15:45:22 +0100 Subject: [PATCH] JAL-2961 centerViewOn command for structure viewers - called after superposition --- src/jalview/ext/jmol/JmolCommands.java | 16 +++++++++++++++- src/jalview/ext/pymol/PymolCommands.java | 7 +++++++ src/jalview/ext/rbvi/chimera/ChimeraCommands.java | 11 ++++++++--- src/jalview/structure/StructureCommandsI.java | 2 ++ 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/jalview/ext/jmol/JmolCommands.java b/src/jalview/ext/jmol/JmolCommands.java index 58b69ef..19d64f0 100644 --- a/src/jalview/ext/jmol/JmolCommands.java +++ b/src/jalview/ext/jmol/JmolCommands.java @@ -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 centerViewOn(List 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())); } diff --git a/src/jalview/ext/pymol/PymolCommands.java b/src/jalview/ext/pymol/PymolCommands.java index b8b6a98..08521a2 100644 --- a/src/jalview/ext/pymol/PymolCommands.java +++ b/src/jalview/ext/pymol/PymolCommands.java @@ -363,4 +363,11 @@ public class PymolCommands extends StructureCommandsBase return CLOSE_PYMOL; } + @Override + public List centerViewOn(List residues) + { + // TODO Auto-generated method stub + return null; + } + } diff --git a/src/jalview/ext/rbvi/chimera/ChimeraCommands.java b/src/jalview/ext/rbvi/chimera/ChimeraCommands.java index d3dd625..829f092 100644 --- a/src/jalview/ext/rbvi/chimera/ChimeraCommands.java +++ b/src/jalview/ext/rbvi/chimera/ChimeraCommands.java @@ -20,19 +20,17 @@ */ 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 centerViewOn(List residues) + { + // TODO Auto-generated method stub + return null; + } + } diff --git a/src/jalview/structure/StructureCommandsI.java b/src/jalview/structure/StructureCommandsI.java index c8c8070..575f256 100644 --- a/src/jalview/structure/StructureCommandsI.java +++ b/src/jalview/structure/StructureCommandsI.java @@ -243,4 +243,6 @@ public interface StructureCommandsI * @return */ StructureCommandI getResidueAttributes(String attName); + + List centerViewOn(List residues); } -- 1.7.10.2