JAL-2055 prototype alternate feature colouring based on
[jalview.git] / src / jalview / schemes / GraduatedColor.java
index 2d1c572..f629d09 100644 (file)
@@ -34,6 +34,11 @@ import java.awt.Color;
  */
 public class GraduatedColor
 {
+  private static final Color[] colours = new Color[] { Color.blue,
+      Color.red };
+
+  private static int colourModulus = 0;
+
   int thresholdState = AnnotationColourGradient.NO_THRESHOLD; // or
                                                               // ABOVE_THRESHOLD
                                                               // or
@@ -104,6 +109,7 @@ public class GraduatedColor
     thrsh = oldcs.thrsh;
     autoScale = oldcs.autoScale;
     colourByLabel = oldcs.colourByLabel;
+    colourAlternately = oldcs.colourAlternately;
   }
 
   /**
@@ -182,6 +188,8 @@ public class GraduatedColor
 
   private boolean colourByLabel = false;
 
+  private boolean colourAlternately = false;
+
   /**
    * 
    * @return true if colourByLabel style is set
@@ -212,6 +220,12 @@ public class GraduatedColor
       }
       return ucs.createColourFromName(feature.getDescription());
     }
+    if (colourAlternately)
+    {
+      int minOrMax = feature.getFeatureNumber() % 2;
+      return minOrMax == 0 ? new Color(lr, lg, lb) : new Color(lr + dr, lg
+              + dg, lb + db);
+    }
     if (range == 0.0)
     {
       return getMaxColor();
@@ -301,4 +315,14 @@ public class GraduatedColor
       tolow = false;
     }
   }
+
+  public boolean isColourAlternately()
+  {
+    return colourAlternately;
+  }
+
+  public void setColourAlternately(boolean colourAlternately)
+  {
+    this.colourAlternately = colourAlternately;
+  }
 }