public static int BELOW_THRESHOLD = 0;\r
public static int ABOVE_THRESHOLD = 1;\r
\r
- AlignmentAnnotation annotation;\r
+ public AlignmentAnnotation annotation;\r
int aboveAnnotationThreshold = -1;\r
+ public boolean thresholdIsMinMax = false;\r
\r
GraphLine annotationThreshold;\r
\r
float r1, g1, b1, rr, gg, bb, dr, dg, db;\r
- float range = 0;\r
\r
ColourSchemeI colourScheme;\r
\r
+ public boolean predefinedColours = false;\r
+\r
/**\r
* Creates a new AnnotationColourGradient object.\r
*/\r
rr = maxColour.getRed() - r1;\r
gg = maxColour.getGreen() - g1;\r
bb = maxColour.getBlue() - b1;\r
-\r
- range = annotation.graphMax - annotation.graphMin;\r
-\r
}\r
\r
public String getAnnotation()\r
&& annotation.annotations[j] != null\r
&& !jalview.util.Comparison.isGap(c))\r
{\r
+\r
+ if (predefinedColours)\r
+ {\r
+ if(annotation.annotations[j].colour != null)\r
+ return annotation.annotations[j].colour;\r
+ else\r
+ return currentColour;\r
+ }\r
+\r
if (aboveAnnotationThreshold == NO_THRESHOLD\r
||\r
(annotationThreshold != null && aboveAnnotationThreshold == ABOVE_THRESHOLD &&\r
(annotationThreshold != null && aboveAnnotationThreshold == BELOW_THRESHOLD &&\r
annotation.annotations[j].value <= annotationThreshold.value))\r
{\r
+\r
+ float range=1f;\r
+ if (thresholdIsMinMax\r
+ && annotation.threshold != null\r
+ && aboveAnnotationThreshold == ABOVE_THRESHOLD\r
+ && annotation.annotations[j].value>annotation.threshold.value)\r
+ {\r
+ range =\r
+ (annotation.annotations[j].value - annotation.threshold.value) /\r
+ (annotation.graphMax - annotation.threshold.value);\r
+ }\r
+ else if (thresholdIsMinMax\r
+ && annotation.threshold != null\r
+ && aboveAnnotationThreshold == BELOW_THRESHOLD\r
+ && annotation.annotations[j].value > annotation.graphMin)\r
+ {\r
+ range =\r
+ ( annotation.annotations[j].value - annotation.graphMin ) /\r
+ (annotation.threshold.value - annotation.graphMin );\r
+ }\r
+ else\r
+ {\r
+ range = (annotation.annotations[j].value -\r
+ annotation.graphMin) /\r
+ (annotation.graphMax - annotation.graphMin);\r
+ }\r
+\r
+\r
if (colourScheme != null)\r
{\r
currentColour = colourScheme.findColour(c, j);\r
}\r
else if (range != 0)\r
{\r
- dr = rr *\r
- ( (annotation.annotations[j].value - annotation.graphMin) /\r
- range)\r
- + r1;\r
- dg = gg *\r
- ( (annotation.annotations[j].value - annotation.graphMin) /\r
- range)\r
- + g1;\r
- db = bb *\r
- ( (annotation.annotations[j].value - annotation.graphMin) /\r
- range)\r
- + b1;\r
+ dr = rr * range + r1;\r
+ dg = gg * range + g1;\r
+ db = bb * range + b1;\r
\r
currentColour = new Color( (int) dr, (int) dg, (int) db);\r
}\r