2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import jalview.datamodel.SequenceFeature;
25 import java.awt.Color;
27 public interface FeatureColourI
31 * Answers true when the feature colour varies across the score range
35 boolean isGraduatedColour();
38 * Returns the feature colour (when isGraduatedColour answers false)
45 * Returns the minimum colour (when isGraduatedColour answers true)
52 * Returns the maximum colour (when isGraduatedColour answers true)
59 * Answers true if the feature has a single colour, i.e. if isColourByLabel()
60 * and isGraduatedColour() both answer false
64 boolean isSimpleColour();
67 * Answers true if the feature is coloured by label (description)
71 boolean isColourByLabel();
73 void setColourByLabel(boolean b);
76 * Answers true if the feature is coloured below a threshold value; only
77 * applicable when isGraduatedColour answers true
81 boolean isBelowThreshold();
83 void setBelowThreshold(boolean b);
86 * Answers true if the feature is coloured above a threshold value; only
87 * applicable when isGraduatedColour answers true
91 boolean isAboveThreshold();
93 void setAboveThreshold(boolean b);
96 * Answers true if the threshold is the minimum value (when
97 * isAboveThreshold()) or maximum value (when isBelowThreshold()) of the
98 * colour range; only applicable when isGraduatedColour and either
99 * isAboveThreshold() or isBelowThreshold() answers true
103 boolean isThresholdMinMax();
105 void setThresholdMinMax(boolean b);
108 * Returns the threshold value (if any), else zero
112 float getThreshold();
114 void setThreshold(float f);
117 * Answers true if the colour varies between the actual minimum and maximum
118 * score values of the feature, or false if between absolute minimum and
119 * maximum values (or if not a graduated colour).
123 boolean isAutoScaled();
125 void setAutoScaled(boolean b);
128 * Returns the maximum score of the graduated colour range
135 * Returns the minimum score of the graduated colour range
142 * Answers true if either isAboveThreshold or isBelowThreshold answers true
146 boolean hasThreshold();
149 * Returns the computed colour for the given sequence feature
154 Color getColor(SequenceFeature feature);
157 * Answers true if the feature has a simple colour, or is coloured by label,
158 * or has a graduated colour and the score of this feature instance is within
159 * the range to render (if any), i.e. does not lie below or above any
165 boolean isColored(SequenceFeature feature);
168 * Update the min-max range for a graduated colour scheme
173 void updateBounds(float min, float max);
176 * Returns the colour in Jalview features file format
180 String toJalviewFormat(String featureType);