X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FAnnotationColourGradient.java;h=a390a15a23dbf0e6273c57fcc9ed5b33d4c5eea9;hb=HEAD;hp=c28ea5f7dd727fd6f1af5948a7dd1122f7d7a762;hpb=3d0101179759ef157b088ea135423cd909512d9f;p=jalview.git diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java index c28ea5f..a390a15 100755 --- a/src/jalview/schemes/AnnotationColourGradient.java +++ b/src/jalview/schemes/AnnotationColourGradient.java @@ -20,6 +20,7 @@ */ package jalview.schemes; +import jalview.api.AlignViewportI; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.AnnotatedCollectionI; @@ -76,8 +77,8 @@ public class AnnotationColourGradient extends FollowerColourScheme private IdentityHashMap seqannot = null; @Override - public ColourSchemeI getInstance(AnnotatedCollectionI sg, - Map hiddenRepSequences) + public ColourSchemeI getInstance(AlignViewportI view, + AnnotatedCollectionI sg) { AnnotationColourGradient acg = new AnnotationColourGradient(annotation, getColourScheme(), aboveAnnotationThreshold); @@ -185,7 +186,7 @@ public class AnnotationColourGradient extends FollowerColourScheme } else { - seqannot = new IdentityHashMap(); + seqannot = new IdentityHashMap<>(); } // resolve the context containing all the annotation for the sequence AnnotatedCollectionI alcontext = alignment instanceof AlignmentI @@ -319,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; } @@ -414,14 +415,17 @@ public class AnnotationColourGradient extends FollowerColourScheme && aboveAnnotationThreshold == ABOVE_THRESHOLD && value >= ann.threshold.value) { - range = (value - ann.threshold.value) - / (ann.graphMax - 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 { @@ -475,7 +479,7 @@ public class AnnotationColourGradient extends FollowerColourScheme @Override public String getSchemeName() { - return "Annotation"; + return ANNOTATION_COLOUR; } @Override