From: gmungoc Date: Tue, 31 May 2016 06:53:45 +0000 (+0100) Subject: JAL-2123 use "rlabel" command to highlight with label on mouseover X-Git-Tag: Release_2_10_0~196^2~5 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=099b1327538a96d825c891d8206b27da977ad347;p=jalview.git JAL-2123 use "rlabel" command to highlight with label on mouseover --- diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java index 1ce0d2b..944ef52 100644 --- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java +++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java @@ -101,17 +101,13 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel private String lastCommand; - private boolean loadedInline; - - /** + /* * current set of model filenames loaded */ String[] modelFileNames = null; String lastHighlightCommand; - private List lastReply; - /* * incremented every time a load notification is successfully handled - * lightweight mechanism for other threads to detect when they can start @@ -617,7 +613,8 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel if (lastCommand == null || !lastCommand.equals(command)) { // trim command or it may never find a match in the replyLog!! - lastReply = viewer.sendChimeraCommand(command.trim(), logResponse); + List lastReply = viewer.sendChimeraCommand(command.trim(), + logResponse); if (logResponse && debug) { log("Response from command ('" + command + "') was:\n" + lastReply); @@ -715,17 +712,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel // End StructureListener // ////////////////////////// - public Color getColour(int atomIndex, int pdbResNum, String chain, - String pdbfile) - { - if (getModelNum(pdbfile) < 0) - { - return null; - } - log("get model / residue colour attribute unimplemented"); - return null; - } - /** * returns the current featureRenderer that should be used to colour the * structures @@ -795,15 +781,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel } /** - * map from string to applet - */ - public Map getRegistryInfo() - { - // TODO Auto-generated method stub - return null; - } - - /** * returns the current sequenceRenderer that should be used to colour the * structures * @@ -815,20 +792,18 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel AlignmentViewPanel alignment); /** - * Construct and send a command to highlight zero, one or more atoms. - * - *
-   * Done by generating a command like (to 'highlight' positions 44 and 46)
-   *   show #0:44,46.C
-   * 
+ * Construct and send a command to highlight zero, one or more atoms. We do + * this by sending an "rlabel" command to show the residue label at that + * position. */ @Override public void highlightAtoms(List atoms) { - if (atoms == null) + if (atoms == null || atoms.size() == 0) { return; } + StringBuilder cmd = new StringBuilder(128); boolean first = true; boolean found = false; @@ -843,7 +818,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel { if (first) { - cmd.append("show #").append(cms.get(0).getModelNumber()) + cmd.append("rlabel #").append(cms.get(0).getModelNumber()) .append(":"); } else @@ -851,7 +826,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel cmd.append(","); } first = false; - cmd.append(cms.get(0).getModelNumber()).append(":"); cmd.append(pdbResNum); if (!chain.equals(" ")) { @@ -863,19 +837,24 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel String command = cmd.toString(); /* - * Avoid repeated commands for the same residue + * avoid repeated commands for the same residue */ if (command.equals(lastHighlightCommand)) { return; } - viewerCommandHistory(false); + /* + * unshow the label for the previous residue + */ + if (lastHighlightCommand != null) + { + viewer.sendChimeraCommand("~" + lastHighlightCommand, false); + } if (found) { - viewer.sendChimeraCommand(command.toString(), false); + viewer.sendChimeraCommand(command, false); } - viewerCommandHistory(true); this.lastHighlightCommand = command; }