X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FGraduatedColor.java;h=a99a2f297da9e19e1541feb1fac11c72701264a2;hb=7cfd47072d793d9da3cd8b5d15a3204d1ec47a20;hp=3d3f321835499931963f16a9aab53298f317c6ec;hpb=2de8acfae59aced665e4c37ad0f7dcc2ed68818e;p=jalview.git diff --git a/src/jalview/schemes/GraduatedColor.java b/src/jalview/schemes/GraduatedColor.java index 3d3f321..a99a2f2 100644 --- a/src/jalview/schemes/GraduatedColor.java +++ b/src/jalview/schemes/GraduatedColor.java @@ -84,6 +84,7 @@ public class GraduatedColor thresholdState = oldcs.thresholdState; thrsh = oldcs.thrsh; autoScale = oldcs.autoScale; + colourByLabel = oldcs.colourByLabel; } /** * make a new gradient from an old one with a different scale range @@ -135,8 +136,38 @@ public class GraduatedColor return rtn; // ? tolow : !tolow; } } + /** + * default implementor of a getColourFromString method. + * TODO: abstract an interface enabling pluggable colour from string + */ + private UserColourScheme ucs = null; + private boolean colourByLabel=true; + /** + * + * @return true if colourByLabel style is set + */ + public boolean isColourByLabel() + { + return colourByLabel; + } + /** + * @param colourByLabel the colourByLabel to set + */ + public void setColourByLabel(boolean colourByLabel) + { + this.colourByLabel = colourByLabel; + } public Color findColor(SequenceFeature feature) - { + { + if (colourByLabel) + { + //TODO: allow user defined feature label colourschemes. Colour space is {type,regex,%anytype%}x{description string, regex, keyword} + if (ucs==null) + { + ucs = new UserColourScheme(); + } + return ucs.createColourFromName(feature.getDescription()); + } if (range==0.0) { return getMaxColor();