*/
package jalview.schemes;
+import jalview.api.FeatureColourI;
import jalview.datamodel.SequenceFeature;
import java.awt.Color;
thrsh = oldcs.thrsh;
autoScale = oldcs.autoScale;
colourByLabel = oldcs.colourByLabel;
+ colourAlternately = oldcs.colourAlternately;
}
/**
updateBounds(min, max);
}
+ public GraduatedColor(FeatureColourI col)
+ {
+ setColourByLabel(col.isColourByLabel());
+ }
+
public Color getMinColor()
{
return new Color(lr, lg, lb);
public boolean isColored(SequenceFeature feature)
{
float val = feature.getScore();
- if (val == Float.NaN)
+ if (Float.isNaN(val))
{
return true;
}
{
return true;
}
- if (this.thrsh == Float.NaN)
+ if (Float.isNaN(this.thrsh))
{
return true;
}
private boolean colourByLabel = false;
+ private boolean colourAlternately = false;
+
/**
*
* @return true if colourByLabel style is set
}
return ucs.createColourFromName(feature.getDescription());
}
+ if (colourAlternately)
+ {
+ int minOrMax = feature.getFeatureNumber() % 2;
+ return minOrMax == 0 ? new Color(lr, lg, lb) : new Color(lr + dr, lg
+ + dg, lb + db);
+ }
if (range == 0.0)
{
return getMaxColor();
}
float scr = feature.getScore();
- if (scr == Float.NaN)
+ if (Float.isNaN(scr))
{
return getMinColor();
}
tolow = false;
}
}
+
+ public boolean isColourAlternately()
+ {
+ return colourAlternately;
+ }
+
+ public void setColourAlternately(boolean colourAlternately)
+ {
+ this.colourAlternately = colourAlternately;
+ }
}