+ private ColourSchemeI constructAnnotationColour(
+ AnnotationColours viewAnnColour, AlignFrame af, Alignment al,
+ JalviewModelSequence jms, boolean checkGroupAnnColour)
+ {
+ boolean propagateAnnColour = false;
+ ColourSchemeI cs = null;
+ AlignmentI annAlignment = af != null ? af.viewport.getAlignment() : al;
+ if (checkGroupAnnColour && al.getGroups() != null
+ && al.getGroups().size() > 0)
+ {
+ // pre 2.8.1 behaviour
+ // check to see if we should transfer annotation colours
+ propagateAnnColour = true;
+ for (jalview.datamodel.SequenceGroup sg : al.getGroups())
+ {
+ if (sg.cs instanceof AnnotationColourGradient)
+ {
+ propagateAnnColour = false;
+ }
+ }
+ }
+ // int find annotation
+ if (annAlignment.getAlignmentAnnotation() != null)
+ {
+ for (int i = 0; i < annAlignment.getAlignmentAnnotation().length; i++)
+ {
+ if (annAlignment.getAlignmentAnnotation()[i].label
+ .equals(viewAnnColour.getAnnotation()))
+ {
+ if (annAlignment.getAlignmentAnnotation()[i].getThreshold() == null)
+ {
+ annAlignment.getAlignmentAnnotation()[i]
+ .setThreshold(new jalview.datamodel.GraphLine(
+ viewAnnColour.getThreshold(), "Threshold",
+ java.awt.Color.black)
+
+ );
+ }
+
+ if (viewAnnColour.getColourScheme().equals("None"))
+ {
+ cs = new AnnotationColourGradient(
+ annAlignment.getAlignmentAnnotation()[i],
+ new java.awt.Color(viewAnnColour.getMinColour()),
+ new java.awt.Color(viewAnnColour.getMaxColour()),
+ viewAnnColour.getAboveThreshold());
+ }
+ else if (viewAnnColour.getColourScheme().startsWith("ucs"))
+ {
+ cs = new AnnotationColourGradient(
+ annAlignment.getAlignmentAnnotation()[i],
+ GetUserColourScheme(jms,
+ viewAnnColour.getColourScheme()),
+ viewAnnColour.getAboveThreshold());
+ }
+ else
+ {
+ cs = new AnnotationColourGradient(
+ annAlignment.getAlignmentAnnotation()[i],
+ ColourSchemeProperty.getColour(al,
+ viewAnnColour.getColourScheme()),
+ viewAnnColour.getAboveThreshold());
+ }
+ if (viewAnnColour.hasPerSequence())
+ {
+ ((AnnotationColourGradient) cs).setSeqAssociated(viewAnnColour
+ .isPerSequence());
+ }
+ if (viewAnnColour.hasPredefinedColours())
+ {
+ ((AnnotationColourGradient) cs)
+ .setPredefinedColours(viewAnnColour
+ .isPredefinedColours());
+ }
+ if (propagateAnnColour && al.getGroups() != null)
+ {
+ // Also use these settings for all the groups
+ for (int g = 0; g < al.getGroups().size(); g++)
+ {
+ jalview.datamodel.SequenceGroup sg = al.getGroups().get(g);
+
+ if (sg.cs == null)
+ {
+ continue;
+ }
+
+ /*
+ * if (viewAnnColour.getColourScheme().equals("None" )) { sg.cs =
+ * new AnnotationColourGradient(
+ * annAlignment.getAlignmentAnnotation()[i], new
+ * java.awt.Color(viewAnnColour. getMinColour()), new
+ * java.awt.Color(viewAnnColour. getMaxColour()),
+ * viewAnnColour.getAboveThreshold()); } else
+ */
+ {
+ sg.cs = new AnnotationColourGradient(
+ annAlignment.getAlignmentAnnotation()[i], sg.cs,
+ viewAnnColour.getAboveThreshold());
+ if (cs instanceof AnnotationColourGradient)
+ {
+ if (viewAnnColour.hasPerSequence())
+ {
+ ((AnnotationColourGradient) cs)
+ .setSeqAssociated(viewAnnColour.isPerSequence());
+ }
+ if (viewAnnColour.hasPredefinedColours())
+ {
+ ((AnnotationColourGradient) cs)
+ .setPredefinedColours(viewAnnColour
+ .isPredefinedColours());
+ }
+ }
+ }
+
+ }
+ }
+
+ break;
+ }
+
+ }
+ }
+ return cs;
+ }
+