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 * Returns the 'no value' colour (used when a feature lacks score, or the
60 * attribute, being used for colouring)
67 * Answers true if the feature has a single colour, i.e. if isColourByLabel()
68 * and isGraduatedColour() both answer false
72 boolean isSimpleColour();
75 * Answers true if the feature is coloured by label (description) or by text
76 * value of an attribute
80 boolean isColourByLabel();
82 void setColourByLabel(boolean b);
85 * Answers true if the feature is coloured below a threshold value; only
86 * applicable when isGraduatedColour answers true
90 boolean isBelowThreshold();
92 void setBelowThreshold(boolean b);
95 * Answers true if the feature is coloured above a threshold value; only
96 * applicable when isGraduatedColour answers true
100 boolean isAboveThreshold();
102 void setAboveThreshold(boolean b);
105 * Returns the threshold value (if any), else zero
109 float getThreshold();
111 void setThreshold(float f);
114 * Answers true if the colour varies between the actual minimum and maximum
115 * score values of the feature, or false if between absolute minimum and
116 * maximum values (or if not a graduated colour).
120 boolean isAutoScaled();
122 void setAutoScaled(boolean b);
125 * Returns the maximum score of the graduated colour range
132 * Returns the minimum score of the graduated colour range
139 * Answers true if either isAboveThreshold or isBelowThreshold answers true
143 boolean hasThreshold();
146 * Returns the computed colour for the given sequence feature. Answers null if
147 * the score of this feature instance is outside the range to render (if any),
148 * i.e. lies below or above a configured threshold.
153 Color getColor(SequenceFeature feature);
156 * Update the min-max range for a graduated colour scheme. Note that the
157 * colour scheme may be configured to colour by feature score, or a
158 * (numeric-valued) attribute - the caller should ensure that the correct
159 * range is being set.
164 void updateBounds(float min, float max);
167 * Returns the colour in Jalview features file format
171 String toJalviewFormat(String featureType);
174 * Answers true if colour is by attribute text or numerical value
178 boolean isColourByAttribute();
181 * Answers the name of the attribute (and optional sub-attribute...) used for
182 * colouring if any, or null
186 String[] getAttributeName();
189 * Sets the name of the attribute (and optional sub-attribute...) used for
190 * colouring if any, or null to remove this property
194 void setAttributeName(String... name);
197 * Answers true if colour has a threshold set, and the feature score (or other
198 * attribute selected for colouring) is outwith the threshold.
200 * Answers false if not a graduated colour, or no threshold is set, or value
201 * is not outwith the threshold, or value is null or non-numeric.
206 boolean isOutwithThreshold(SequenceFeature sf);
209 * Answers a human-readable text description of the colour, suitable for
210 * display as a tooltip, possibly internationalised for the user's locale.
214 String getDescription();