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