X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fschemes%2FFeatureColour.java;h=dbe4901c90a507c48ec0854ff1bca9c6573f41d6;hb=06ce849ffedc7ab10a3c54cda96b9a7dec58c136;hp=bdc70c94718da9e0b5bb0f861c7895c8b339d14e;hpb=579d3d1bccf00ce126ab3574758c6558b1bc3367;p=jalview.git diff --git a/src/jalview/schemes/FeatureColour.java b/src/jalview/schemes/FeatureColour.java index bdc70c9..dbe4901 100644 --- a/src/jalview/schemes/FeatureColour.java +++ b/src/jalview/schemes/FeatureColour.java @@ -1,7 +1,28 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview 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 3 + * of the License, or (at your option) any later version. + * + * Jalview 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 Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.schemes; import jalview.api.FeatureColourI; import jalview.datamodel.SequenceFeature; +import jalview.util.ColorUtils; import jalview.util.Format; import java.awt.Color; @@ -101,7 +122,7 @@ public class FeatureColour implements FeatureColourI /* * only a simple colour specification - parse it */ - Color colour = UserColourScheme.getColourFromString(descriptor); + Color colour = ColorUtils.parseColourString(descriptor); if (colour == null) { throw new IllegalArgumentException("Invalid colour descriptor: " @@ -192,9 +213,9 @@ public class FeatureColour implements FeatureColourI FeatureColour featureColour; try { - featureColour = new FeatureColour( - new UserColourScheme(mincol).findColour('A'), - new UserColourScheme(maxcol).findColour('A'), min, max); + Color minColour = ColorUtils.parseColourString(mincol); + Color maxColour = ColorUtils.parseColourString(maxcol); + featureColour = new FeatureColour(minColour, maxColour, min, max); featureColour.setColourByLabel(labelColour); featureColour.setAutoScaled(autoScaled); // add in any additional parameters @@ -286,6 +307,14 @@ public class FeatureColour implements FeatureColourI */ public FeatureColour(Color low, Color high, float min, float max) { + if (low == null) + { + low = Color.white; + } + if (high == null) + { + high = Color.black; + } graduatedColour = true; colour = null; minColour = low; @@ -336,9 +365,10 @@ public class FeatureColour implements FeatureColourI setAutoScaled(fc.isAutoScaled()); setColourByLabel(fc.isColourByLabel()); } - + /** * Copy constructor with new min/max ranges + * * @param fc * @param min * @param max @@ -406,6 +436,7 @@ public class FeatureColour implements FeatureColourI setGraduatedColour(false); } } + @Override public boolean isBelowThreshold() { @@ -511,7 +542,7 @@ public class FeatureColour implements FeatureColourI { if (isColourByLabel()) { - return UserColourScheme + return ColorUtils .createColourFromName(feature.getDescription()); } @@ -543,7 +574,8 @@ public class FeatureColour implements FeatureColourI { scl = 1f; } - return new Color(minRed + scl * deltaRed, minGreen + scl * deltaGreen, minBlue + scl * deltaBlue); + return new Color(minRed + scl * deltaRed, minGreen + scl * deltaGreen, + minBlue + scl * deltaBlue); } /**