JAL-3070 JAL-3066 JAL-2808 allow feature filter definition via FeatureSettingsModelI
authorJim Procter <jprocter@issues.jalview.org>
Thu, 26 Sep 2019 15:25:16 +0000 (16:25 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 26 Sep 2019 15:25:16 +0000 (16:25 +0100)
src/jalview/api/FeatureSettingsModelI.java
src/jalview/gui/AlignViewport.java
src/jalview/schemes/FeatureSettingsAdapter.java

index c0fc523..5e910dc 100644 (file)
@@ -20,6 +20,8 @@
  */
 package jalview.api;
 
+import jalview.datamodel.features.FeatureMatcherSetI;
+
 import java.util.Comparator;
 
 /**
@@ -60,6 +62,15 @@ public interface FeatureSettingsModelI extends Comparator<String>
   FeatureColourI getFeatureColour(String type);
 
   /**
+   * Returns any filters defined for the feature type, or null if not known
+   * 
+   * @param type
+   * @return
+   */
+
+  FeatureMatcherSetI getFeatureFilters(String type);
+
+  /**
    * Returns the transparency value, from 0 (fully transparent) to 1 (fully
    * opaque)
    * 
index d6e2ae5..e60b76f 100644 (file)
@@ -39,6 +39,7 @@ import jalview.datamodel.SearchResults;
 import jalview.datamodel.SearchResultsI;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
+import jalview.datamodel.features.FeatureMatcherSetI;
 import jalview.renderer.ResidueShader;
 import jalview.schemes.ColourSchemeI;
 import jalview.schemes.ColourSchemeProperty;
@@ -1053,6 +1054,9 @@ public void setNormaliseSequenceLogo(boolean state)
     {
       FeatureColourI preferredColour = featureSettings
               .getFeatureColour(type);
+      FeatureMatcherSetI preferredFilters = featureSettings
+              .getFeatureFilters(type);
+
       FeatureColourI origColour = fr.getFeatureStyle(type);
       if (!mergeOnly || (!origRenderOrder.contains(type)
               || origColour == null
@@ -1067,6 +1071,11 @@ public void setNormaliseSequenceLogo(boolean state)
         {
           fr.setColour(type, preferredColour);
         }
+        if (preferredFilters != null
+                && (!mergeOnly || fr.getFeatureFilter(type) != null))
+        {
+          fr.setFeatureFilter(type, preferredFilters);
+        }
         if (featureSettings.isFeatureDisplayed(type))
         {
           displayed.setVisible(type);
index b15e4cf..3d82f9b 100644 (file)
@@ -22,6 +22,7 @@ package jalview.schemes;
 
 import jalview.api.FeatureColourI;
 import jalview.api.FeatureSettingsModelI;
+import jalview.datamodel.features.FeatureMatcherSetI;
 
 /**
  * An adapter class that may be extended to instantiate feature colour schemes
@@ -65,4 +66,10 @@ public class FeatureSettingsAdapter implements FeatureSettingsModelI
     return false;
   }
 
+  @Override
+  public FeatureMatcherSetI getFeatureFilters(String type)
+  {
+    return null;
+  }
+
 }