JAL-2015 JAL-1956 rollout of FeatureColourI in place of
[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   void setGraduatedColour(boolean b);
18
19   /**
20    * Returns the feature colour (when isGraduatedColour answers false)
21    * 
22    * @return
23    */
24   Color getColour();
25
26   /**
27    * Returns the minimum colour (when isGraduatedColour answers true)
28    * 
29    * @return
30    */
31   Color getMinColour();
32
33   /**
34    * Returns the maximum colour (when isGraduatedColour answers true)
35    * 
36    * @return
37    */
38   Color getMaxColour();
39
40   /**
41    * Answers true if the feature has a single colour, i.e. if isColourByLabel()
42    * and isGraduatedColour() both answer false
43    * 
44    * @return
45    */
46   boolean isSimpleColour();
47
48   /**
49    * Answers true if the feature is coloured by label (description)
50    * 
51    * @return
52    */
53   boolean isColourByLabel();
54
55   void setColourByLabel(boolean b);
56
57   /**
58    * Answers true if the feature is coloured below a threshold value; only
59    * applicable when isGraduatedColour answers true
60    * 
61    * @return
62    */
63   boolean isBelowThreshold();
64
65   void setBelowThreshold(boolean b);
66
67   /**
68    * Answers true if the feature is coloured above a threshold value; only
69    * applicable when isGraduatedColour answers true
70    * 
71    * @return
72    */
73   boolean isAboveThreshold();
74
75   void setAboveThreshold(boolean b);
76
77   /**
78    * Answers true if the threshold is the minimum value (when
79    * isAboveThreshold()) or maximum value (when isBelowThreshold()) of the
80    * colour range; only applicable when isGraduatedColour and either
81    * isAboveThreshold() or isBelowThreshold() answers true
82    * 
83    * @return
84    */
85   boolean isThresholdMinMax();
86
87   void setThresholdMinMax(boolean b);
88
89   /**
90    * Returns the threshold value (if any), else zero
91    * 
92    * @return
93    */
94   float getThreshold();
95
96   void setThreshold(float f);
97
98   boolean isAutoScaled();
99
100   void setAutoScaled(boolean b);
101
102   /**
103    * Returns the maximum score of the graduated colour range
104    * 
105    * @return
106    */
107   float getMax();
108
109   /**
110    * Returns the minimum score of the graduated colour range
111    * 
112    * @return
113    */
114   float getMin();
115
116   /**
117    * Answers true if either isAboveThreshold or isBelowThreshold answers true
118    * 
119    * @return
120    */
121   boolean hasThreshold();
122
123   /**
124    * Returns the computed colour for the given sequence feature
125    * 
126    * @param feature
127    * @return
128    */
129   Color getColor(SequenceFeature feature);
130
131   /**
132    * Answers true if the feature has a simple colour, or is coloured by label,
133    * or has a graduated colour and the score of this feature instance is within
134    * the range to render (if any), i.e. does not lie below or above any
135    * threshold set.
136    * 
137    * @param feature
138    * @return
139    */
140   boolean isColored(SequenceFeature feature);
141
142   /**
143    * Update the min-max range for a graduated colour scheme
144    * 
145    * @param min
146    * @param max
147    */
148   void updateBounds(float min, float max);
149 }