JAL-3210 fudge for JalviewJS to avoid IntervalStore incompatibility
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 7 Apr 2020 13:30:47 +0000 (14:30 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 7 Apr 2020 13:30:47 +0000 (14:30 +0100)
src/jalview/renderer/seqfeatures/FeatureRenderer.java
src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java

index a1980c7..1fccfa2 100644 (file)
  */
 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<SequenceFeature> overlaps = seq.getFeatures().findFeatures(
               visiblePositions.getBegin(), visiblePositions.getEnd(), type);
 
-      if (fc.isSimpleColour())
+      if (overlaps.size() > 1 && fc.isSimpleColour())
       {
         filterFeaturesForDisplay(overlaps);
       }
index 9e707f3..68345b9 100644 (file)
  */
 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<SequenceFeature> 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