X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FAnnotationColourGradient.java;h=ed8077f668abcf1b2282660d76bf02caec45e9cc;hb=57dd16688caa6dacaeaf465bab3ee8b6126e1a51;hp=4e5f78e4ff723e694043c864918fbc53f89166bc;hpb=25aaaa87042b3f507ad4348120df7dd073182759;p=jalview.git diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java index 4e5f78e..ed8077f 100755 --- a/src/jalview/schemes/AnnotationColourGradient.java +++ b/src/jalview/schemes/AnnotationColourGradient.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1) - * Copyright (C) 2014 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9) + * Copyright (C) 2015 The Jalview Authors * * This file is part of Jalview. * @@ -53,12 +53,14 @@ public class AnnotationColourGradient extends FollowerColourScheme private boolean predefinedColours = false; private boolean seqAssociated = false; + /** * false if the scheme was constructed without a minColour and maxColour used * to decide if existing colours should be taken from annotation elements when * they exist */ private boolean noGradient = false; + IdentityHashMap seqannot = null; @Override @@ -114,6 +116,7 @@ public class AnnotationColourGradient extends FollowerColourScheme bb = 0; noGradient = true; + checkLimits(); } /** @@ -140,10 +143,17 @@ public class AnnotationColourGradient extends FollowerColourScheme bb = maxColour.getBlue() - b1; noGradient = false; + checkLimits(); + } + + private void checkLimits() + { aamax = annotation.graphMax; aamin = annotation.graphMin; if (annotation.isRNA()) { + // reset colour palette + ColourSchemeProperty.resetRnaHelicesShading(); ColourSchemeProperty.initRnaHelicesShading(1 + (int) aamax); } } @@ -167,7 +177,7 @@ public class AnnotationColourGradient extends FollowerColourScheme // resolve the context containing all the annotation for the sequence AnnotatedCollectionI alcontext = alignment instanceof AlignmentI ? alignment : alignment.getContext(); - boolean f = true,rna=false; + boolean f = true, rna = false; for (AlignmentAnnotation alan : alcontext.findAnnotation(annotation .getCalcId())) { @@ -199,6 +209,7 @@ public class AnnotationColourGradient extends FollowerColourScheme } float aamin = 0f, aamax = 0f; + public String getAnnotation() { return annotation.label; @@ -258,8 +269,8 @@ public class AnnotationColourGradient extends FollowerColourScheme public Color findColour(char c, int j, SequenceI seq) { Color currentColour = Color.white; - AlignmentAnnotation annotation = (seqAssociated && seqannot!=null ? seqannot.get(seq) - : this.annotation); + AlignmentAnnotation annotation = (seqAssociated && seqannot != null ? seqannot + .get(seq) : this.annotation); if (annotation == null) { return currentColour; @@ -388,6 +399,7 @@ public class AnnotationColourGradient extends FollowerColourScheme return new Color(dr, dg, db); } + public boolean isPredefinedColours() { return predefinedColours;