From: gmungoc Date: Tue, 6 Nov 2018 16:03:52 +0000 (+0000) Subject: JAL-3148 don't test av.showFeatures in FeatureColourFinder X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3207f84e04c66fc89da22ed04876e50b66e94649;p=jalview.git JAL-3148 don't test av.showFeatures in FeatureColourFinder --- diff --git a/src/jalview/api/FeatureRenderer.java b/src/jalview/api/FeatureRenderer.java index cf3c8da..dc9b9b9 100644 --- a/src/jalview/api/FeatureRenderer.java +++ b/src/jalview/api/FeatureRenderer.java @@ -43,6 +43,11 @@ public interface FeatureRenderer * taking into account sequence feature locations, feature colour schemes, * render ordering, feature and feature group visibility, and transparency. *

+ * Does not take into account global feature visibility (show features on or + * off). Test for this before calling this method if necessary. This allows, + * for example, feature colours to be computed for structures even if not + * shown on the alignment. + *

* The graphics argument should be provided if transparency is applied * (getTransparency() < 1). With feature transparency, visible features are * written to the graphics context and the composite colour may be read off diff --git a/src/jalview/renderer/OverviewRenderer.java b/src/jalview/renderer/OverviewRenderer.java index e9b4de4..2441637 100644 --- a/src/jalview/renderer/OverviewRenderer.java +++ b/src/jalview/renderer/OverviewRenderer.java @@ -79,7 +79,8 @@ public class OverviewRenderer AlignmentI alignment, ResidueShaderI resshader, OverviewResColourFinder colFinder) { - finder = new FeatureColourFinder(fr); + finder = fr.getViewport().isShowSequenceFeatures() ? + new FeatureColourFinder(fr) : null; resColFinder = colFinder; al = alignment; diff --git a/src/jalview/renderer/seqfeatures/FeatureColourFinder.java b/src/jalview/renderer/seqfeatures/FeatureColourFinder.java index cfe2735..99b5fb5 100644 --- a/src/jalview/renderer/seqfeatures/FeatureColourFinder.java +++ b/src/jalview/renderer/seqfeatures/FeatureColourFinder.java @@ -83,7 +83,7 @@ public class FeatureColourFinder { if (noFeaturesDisplayed()) { - return defaultColour; + // return defaultColour; } Graphics g = null; diff --git a/src/jalview/renderer/seqfeatures/FeatureRenderer.java b/src/jalview/renderer/seqfeatures/FeatureRenderer.java index 795cd36..73399cc 100644 --- a/src/jalview/renderer/seqfeatures/FeatureRenderer.java +++ b/src/jalview/renderer/seqfeatures/FeatureRenderer.java @@ -211,11 +211,6 @@ public class FeatureRenderer extends FeatureRendererModel @Override public Color findFeatureColour(SequenceI seq, int column, Graphics g) { - if (!av.isShowSequenceFeatures()) - { - return null; - } - // column is 'base 1' but getCharAt is an array index (ie from 0) if (Comparison.isGap(seq.getCharAt(column - 1))) { diff --git a/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java b/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java index d8b905e..657fcef 100644 --- a/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java +++ b/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java @@ -110,9 +110,14 @@ public class FeatureColourFinderTest seq.addSequenceFeature(new SequenceFeature("Metal", "Metal", 2, 12, Float.NaN, "MetalGroup")); fr.featuresAdded(); + fr.setColour("Metal", new FeatureColour(Color.red)); + + /* + * global show features flag is _not_ checked by findFeatureColour + */ av.setShowSequenceFeatures(false); Color c = finder.findFeatureColour(Color.blue, seq, 10); - assertEquals(c, Color.blue); + assertEquals(c, Color.red); } @Test(groups = "Functional")