From 7baccbacc20ff22336ca8c94935f6124b5e5a135 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 11 Dec 2020 12:44:42 +0000 Subject: [PATCH] JAL-3612 use _last_ drawn colour per feature type in Overview --- .../renderer/seqfeatures/FeatureRenderer.java | 7 +- .../seqfeatures/FeatureColourFinderTest.java | 88 ++++++++++++-------- 2 files changed, 60 insertions(+), 35 deletions(-) diff --git a/src/jalview/renderer/seqfeatures/FeatureRenderer.java b/src/jalview/renderer/seqfeatures/FeatureRenderer.java index aa3328b..fe80e63 100644 --- a/src/jalview/renderer/seqfeatures/FeatureRenderer.java +++ b/src/jalview/renderer/seqfeatures/FeatureRenderer.java @@ -539,10 +539,15 @@ public class FeatureRenderer extends FeatureRendererModel continue; } + /* + * find features of this type, and the colour of the _last_ one + * (the one that would be drawn on top) that has a colour + */ List overlaps = seq.findFeatures(column, column, type); - for (SequenceFeature sequenceFeature : overlaps) + for (int i = overlaps.size() - 1 ; i >= 0 ; i--) { + SequenceFeature sequenceFeature = overlaps.get(i); if (!featureGroupNotShown(sequenceFeature)) { Color col = getColour(sequenceFeature); diff --git a/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java b/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java index 6b1fbd2..308adda 100644 --- a/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java +++ b/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java @@ -6,6 +6,13 @@ import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertNull; import static org.testng.Assert.assertTrue; +import java.awt.Color; +import java.util.List; + +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.Test; + import jalview.api.FeatureColourI; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; @@ -17,13 +24,6 @@ import jalview.schemes.FeatureColour; import jalview.viewmodel.seqfeatures.FeatureRendererModel; import jalview.viewmodel.seqfeatures.FeatureRendererModel.FeatureSettingsBean; -import java.awt.Color; -import java.util.List; - -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - /** * Unit tests for feature colour determination, including but not limited to *