Jalview-JS/JAL-3253-applet more argument parsing
[jalview.git] / src / jalview / schemes / AnnotationColourGradient.java
index 334998f..5461ec0 100755 (executable)
@@ -78,8 +78,7 @@ public class AnnotationColourGradient extends FollowerColourScheme
 
   @Override
   public ColourSchemeI getInstance(AlignViewportI view,
-          AnnotatedCollectionI sg,
-          Map<SequenceI, SequenceCollectionI> hiddenRepSequences)
+          AnnotatedCollectionI sg)
   {
     AnnotationColourGradient acg = new AnnotationColourGradient(annotation,
             getColourScheme(), aboveAnnotationThreshold);
@@ -168,8 +167,8 @@ public class AnnotationColourGradient extends FollowerColourScheme
     if (annotation.isRNA())
     {
       // reset colour palette
-      ColourSchemeProperty.resetRnaHelicesShading();
-      ColourSchemeProperty.initRnaHelicesShading(1 + (int) aamax);
+      ColourSchemes.resetRnaHelicesShading();
+      ColourSchemes.initRnaHelicesShading(1 + (int) aamax);
     }
   }
 
@@ -219,7 +218,7 @@ public class AnnotationColourGradient extends FollowerColourScheme
       }
       if (rna)
       {
-        ColourSchemeProperty.initRnaHelicesShading(1 + (int) aamax);
+        ColourSchemes.initRnaHelicesShading(1 + (int) aamax);
       }
     }
   }
@@ -321,9 +320,9 @@ public class AnnotationColourGradient extends FollowerColourScheme
     if (annotationThreshold != null)
     {
       if ((aboveAnnotationThreshold == ABOVE_THRESHOLD
-              && aj.value < annotationThreshold.value)
+              && aj.value <= annotationThreshold.value)
               || (aboveAnnotationThreshold == BELOW_THRESHOLD
-                      && aj.value > annotationThreshold.value))
+                      && aj.value >= annotationThreshold.value))
       {
         return Color.white;
       }
@@ -356,7 +355,7 @@ public class AnnotationColourGradient extends FollowerColourScheme
         {
           if (ann.isRNA())
           {
-            result = ColourSchemeProperty.rnaHelices[(int) aj.value];
+            result = ColourSchemes.getInstance().rnaHelices[(int) aj.value];
           }
           else
           {
@@ -416,14 +415,17 @@ public class AnnotationColourGradient extends FollowerColourScheme
             && aboveAnnotationThreshold == ABOVE_THRESHOLD
             && value >= ann.threshold.value)
     {
-      range = (value - ann.threshold.value)
+      range = ann.graphMax == ann.threshold.value ? 1f
+              : (value - ann.threshold.value)
               / (ann.graphMax - ann.threshold.value);
     }
     else if (thresholdIsMinMax && ann.threshold != null
             && aboveAnnotationThreshold == BELOW_THRESHOLD
             && value <= ann.threshold.value)
     {
-      range = (value - ann.graphMin) / (ann.threshold.value - ann.graphMin);
+      range = ann.graphMin == ann.threshold.value ? 0f
+              : (value - ann.graphMin)
+                      / (ann.threshold.value - ann.graphMin);
     }
     else
     {
@@ -477,7 +479,7 @@ public class AnnotationColourGradient extends FollowerColourScheme
   @Override
   public String getSchemeName()
   {
-    return "Annotation";
+    return ANNOTATION_COLOUR;
   }
 
   @Override