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