From 60c6ea6da3878e1807c961046296f578605bcf39 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Tue, 7 Apr 2020 14:30:47 +0100 Subject: [PATCH] JAL-3210 fudge for JalviewJS to avoid IntervalStore incompatibility --- .../renderer/seqfeatures/FeatureRenderer.java | 16 ++++---- .../seqfeatures/FeatureRendererModel.java | 41 ++++++++++++-------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/src/jalview/renderer/seqfeatures/FeatureRenderer.java b/src/jalview/renderer/seqfeatures/FeatureRenderer.java index a1980c7..1fccfa2 100644 --- a/src/jalview/renderer/seqfeatures/FeatureRenderer.java +++ b/src/jalview/renderer/seqfeatures/FeatureRenderer.java @@ -20,6 +20,13 @@ */ package jalview.renderer.seqfeatures; +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.util.List; + import jalview.api.AlignViewportI; import jalview.api.FeatureColourI; import jalview.datamodel.ContiguousI; @@ -32,13 +39,6 @@ import jalview.util.Comparison; import jalview.util.ReverseListIterator; import jalview.viewmodel.seqfeatures.FeatureRendererModel; -import java.awt.AlphaComposite; -import java.awt.Color; -import java.awt.FontMetrics; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.util.List; - public class FeatureRenderer extends FeatureRendererModel { private static final AlphaComposite NO_TRANSPARENCY = AlphaComposite @@ -319,7 +319,7 @@ public class FeatureRenderer extends FeatureRendererModel List overlaps = seq.getFeatures().findFeatures( visiblePositions.getBegin(), visiblePositions.getEnd(), type); - if (fc.isSimpleColour()) + if (overlaps.size() > 1 && fc.isSimpleColour()) { filterFeaturesForDisplay(overlaps); } diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java index 9e707f3..68345b9 100644 --- a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java +++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java @@ -20,6 +20,21 @@ */ package jalview.viewmodel.seqfeatures; +import java.awt.Color; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; + import jalview.api.AlignViewportI; import jalview.api.FeatureColourI; import jalview.api.FeaturesDisplayedI; @@ -37,21 +52,7 @@ import jalview.datamodel.features.SequenceFeatures; import jalview.renderer.seqfeatures.FeatureRenderer; import jalview.schemes.FeatureColour; import jalview.util.ColorUtils; - -import java.awt.Color; -import java.beans.PropertyChangeListener; -import java.beans.PropertyChangeSupport; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; +import jalview.util.Platform; public abstract class FeatureRendererModel implements jalview.api.FeatureRenderer @@ -1046,6 +1047,14 @@ public abstract class FeatureRendererModel public void filterFeaturesForDisplay(List features) { /* + * fudge: JalviewJS's IntervalStore lacks the sort method called :-( + */ + if (Platform.isJS()) + { + return; + } + + /* * don't remove 'redundant' features if * - transparency is applied (feature count affects depth of feature colour) * - filters are applied (not all features may be displayable) @@ -1121,7 +1130,7 @@ public abstract class FeatureRendererModel /** * Answers the colour for the feature, or null if the feature is excluded by * feature group visibility, by filters, or by colour threshold settings. This - * method does not take feature visibility into account. + * method does not take feature type visibility into account. * * @param sf * @param fc -- 1.7.10.2