-/**
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
+ * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
package jalview.schemes;
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
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();