Merge branch 'develop' into features/JAL-1956_featureStyles
[jalview.git] / src / jalview / api / FeatureColourI.java
1 package jalview.api;
2
3 import jalview.datamodel.SequenceFeature;
4
5 import java.awt.Color;
6
7 public interface FeatureColourI
8 {
9
10   /**
11    * Answers true when the feature colour varies across the score range
12    * 
13    * @return
14    */
15   boolean isGraduatedColour();
16
17   /**
18    * Returns the feature colour (when isGraduatedColour answers false)
19    * 
20    * @return
21    */
22   Color getColour();
23
24   /**
25    * Returns the minimum colour (when isGraduatedColour answers true)
26    * 
27    * @return
28    */
29   Color getMinColour();
30
31   /**
32    * Returns the maximum colour (when isGraduatedColour answers true)
33    * 
34    * @return
35    */
36   Color getMaxColour();
37
38   /**
39    * Answers true if the feature has a single colour, i.e. if isColourByLabel()
40    * and isGraduatedColour() both answer false
41    * 
42    * @return
43    */
44   boolean isSimpleColour();
45
46   /**
47    * Answers true if the feature is coloured by label (description)
48    * 
49    * @return
50    */
51   boolean isColourByLabel();
52
53   void setColourByLabel(boolean b);
54
55   /**
56    * Answers true if the feature is coloured below a threshold value; only
57    * applicable when isGraduatedColour answers true
58    * 
59    * @return
60    */
61   boolean isBelowThreshold();
62
63   void setBelowThreshold(boolean b);
64
65   /**
66    * Answers true if the feature is coloured above a threshold value; only
67    * applicable when isGraduatedColour answers true
68    * 
69    * @return
70    */
71   boolean isAboveThreshold();
72
73   void setAboveThreshold(boolean b);
74
75   /**
76    * Answers true if the threshold is the minimum value (when
77    * isAboveThreshold()) or maximum value (when isBelowThreshold()) of the
78    * colour range; only applicable when isGraduatedColour and either
79    * isAboveThreshold() or isBelowThreshold() answers true
80    * 
81    * @return
82    */
83   boolean isThresholdMinMax();
84
85   void setThresholdMinMax(boolean b);
86
87   /**
88    * Returns the threshold value (if any), else zero
89    * 
90    * @return
91    */
92   float getThreshold();
93
94   void setThreshold(float f);
95
96   /**
97    * Answers true if the colour varies between the actual minimum and maximum
98    * score values of the feature, or false if between absolute minimum and
99    * maximum values (or if not a graduated colour).
100    * 
101    * @return
102    */
103   boolean isAutoScaled();
104
105   void setAutoScaled(boolean b);
106
107   /**
108    * Returns the maximum score of the graduated colour range
109    * 
110    * @return
111    */
112   float getMax();
113
114   /**
115    * Returns the minimum score of the graduated colour range
116    * 
117    * @return
118    */
119   float getMin();
120
121   /**
122    * Answers true if either isAboveThreshold or isBelowThreshold answers true
123    * 
124    * @return
125    */
126   boolean hasThreshold();
127
128   /**
129    * Returns the computed colour for the given sequence feature
130    * 
131    * @param feature
132    * @return
133    */
134   Color getColor(SequenceFeature feature);
135
136   /**
137    * Answers true if the feature has a simple colour, or is coloured by label,
138    * or has a graduated colour and the score of this feature instance is within
139    * the range to render (if any), i.e. does not lie below or above any
140    * threshold set.
141    * 
142    * @param feature
143    * @return
144    */
145   boolean isColored(SequenceFeature feature);
146
147   /**
148    * Update the min-max range for a graduated colour scheme
149    * 
150    * @param min
151    * @param max
152    */
153   void updateBounds(float min, float max);
154
155   /**
156    * Returns the colour in Jalview features file format
157    * 
158    * @return
159    */
160   String toJalviewFormat(String featureType);
161 }