JAL-1705 first pass at applying preset feature colouring for EnsemblGene
[jalview.git] / src / jalview / viewmodel / seqfeatures / FeatureRendererModel.java
index e912720..5b55e05 100644 (file)
@@ -21,6 +21,7 @@
 package jalview.viewmodel.seqfeatures;
 
 import jalview.api.AlignViewportI;
+import jalview.api.FeatureColourI;
 import jalview.api.FeaturesDisplayedI;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.SequenceFeature;
@@ -58,7 +59,7 @@ public abstract class FeatureRendererModel implements
   protected Object currentColour;
 
   /*
-   * ordering of rendering, where last means on top
+   * feature types in ordering of rendering, where last means on top
    */
   protected String[] renderOrder;
 
@@ -632,9 +633,18 @@ public abstract class FeatureRendererModel implements
     // Object c = featureColours.get(featureType);
     // if (c == null || c instanceof Color || (c instanceof GraduatedColor &&
     // !((GraduatedColor)c).getMaxColor().equals(_col)))
+    if (col instanceof FeatureColourI)
     {
-      featureColours.put(featureType, col);
+      if (((FeatureColourI) col).isGraduatedColour())
+      {
+        col = new GraduatedColor((FeatureColourI) col);
+      }
+      else
+      {
+        col = ((FeatureColourI) col).getColour();
+      }
     }
+      featureColours.put(featureType, col);
   }
 
   public void setTransparency(float value)