From e8dba2ced1a06b2b4e8bd90d5d79817668e3f46b Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 5 Aug 2019 16:32:30 +0100 Subject: [PATCH] JAL-3390 redraw structures if alignment only and hidden regions change --- src/jalview/api/structures/JalviewStructureDisplayI.java | 8 -------- src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java | 10 ++++++---- src/jalview/gui/StructureViewerBase.java | 6 ------ .../structures/models/AAStructureBindingModel.java | 14 +++++++++++--- 4 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/jalview/api/structures/JalviewStructureDisplayI.java b/src/jalview/api/structures/JalviewStructureDisplayI.java index 0ca9061..cbd2131 100644 --- a/src/jalview/api/structures/JalviewStructureDisplayI.java +++ b/src/jalview/api/structures/JalviewStructureDisplayI.java @@ -23,7 +23,6 @@ package jalview.api.structures; import jalview.api.AlignmentViewPanel; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; -import jalview.schemes.ColourSchemeI; import jalview.structures.models.AAStructureBindingModel; public interface JalviewStructureDisplayI @@ -59,13 +58,6 @@ public interface JalviewStructureDisplayI void closeViewer(boolean closeExternalViewer); /** - * apply a colourscheme to the structures in the viewer - * - * @param colourScheme - */ - void setJalviewColourScheme(ColourSchemeI colourScheme); - - /** * * @return true if all background sequence/structure binding threads have * completed for this viewer instance diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java index fc6dd26..216320f 100644 --- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java +++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java @@ -899,7 +899,7 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel return; } - // Chimera expects RBG values in the range 0-1 + // Chimera expects RGB values in the range 0-1 final double normalise = 255D; viewerCommandHistory(false); StringBuilder command = new StringBuilder(128); @@ -912,9 +912,11 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel ? ResidueProperties.getSingleCharacterCode(resName) : resName.charAt(0); Color col = cs.findColour(res, 0, null, null, 0f); - command.append("color " + col.getRed() / normalise + "," - + col.getGreen() / normalise + "," + col.getBlue() / normalise - + " ::" + resName + ";"); + command.append("color ") + .append(String.valueOf(col.getRed() / normalise)).append(",") + .append(String.valueOf(col.getGreen() / normalise)) + .append(",").append(String.valueOf(col.getBlue() / normalise)) + .append(" ::").append(resName).append(";"); } sendAsynchronousCommand(command.toString(), COLOURING_CHIMERA); diff --git a/src/jalview/gui/StructureViewerBase.java b/src/jalview/gui/StructureViewerBase.java index ec51943..8eaeed2 100644 --- a/src/jalview/gui/StructureViewerBase.java +++ b/src/jalview/gui/StructureViewerBase.java @@ -779,12 +779,6 @@ public abstract class StructureViewerBase extends GStructureViewer buildColourMenu(); } - @Override - public void setJalviewColourScheme(ColourSchemeI cs) - { - getBinding().setJalviewColourScheme(cs); - } - /** * Sends commands to the structure viewer to superimpose structures based on * currently associated alignments. May optionally return an error message for diff --git a/src/jalview/structures/models/AAStructureBindingModel.java b/src/jalview/structures/models/AAStructureBindingModel.java index ef4fed3..d2fff3f 100644 --- a/src/jalview/structures/models/AAStructureBindingModel.java +++ b/src/jalview/structures/models/AAStructureBindingModel.java @@ -819,10 +819,18 @@ public abstract class AAStructureBindingModel { return; } - // todo: property change event for visibleAlignment - // to avoid unnecessary redraws here - if (!colourBySequence && !isShowAlignmentOnly()) + + /* + * if structure is not coloured by sequence, but restricted to the alignment, + * then redraw it (but don't recolour it) in case hidden regions have changed + * (todo: specific messaging for change of hidden region only) + */ + if (!colourBySequence) { + if (isShowAlignmentOnly()) + { + showStructures(alignmentv.getAlignViewport(), false); + } return; } if (getSsm() == null) -- 1.7.10.2