HIDDEN_COLOUR = hiddenCol;
}
+ @Override
+ /**
+ * for Test suite only.
+ */
+ public Color getBoxColour(ResidueShaderI shader, SequenceI seq, int i)
+ {
+ return new Color(getBoxColourInt(shader, seq, i));
+ }
+
public int getBoxColourInt(ResidueShaderI shader, SequenceI seq, int i)
{
char currentChar = seq.getCharAt(i);
return (isGap ? GAP_COLOUR : RESIDUE_COLOUR);
}
return (isGap && !shader.getColourScheme().hasGapColour() ? GAP_COLOUR
- : shader.findColour(currentChar, i, seq).getRGB());
+ : shader.findColourInt(currentChar, i, seq));
+ }
+
+ /**
+ * For test suite only.
+ */
+ @Override
+ public Color getResidueColour(boolean showBoxes, ResidueShaderI shader,
+ SequenceGroup[] allGroups, final SequenceI seq, int i,
+ FeatureColourFinder finder)
+ {
+ return new Color(getResidueColourInt(showBoxes, shader, allGroups, seq,
+ i, finder));
}
+ private boolean useCache = //
+ true // option to use cache
+ // false // option to not use cache
+ ;
+
public int getResidueColourInt(boolean showBoxes, ResidueShaderI shader,
SequenceGroup[] allGroups, final SequenceI seq, int i,
FeatureColourFinder finder)
{
- int c = seq.getColor(i);
+
+ int c = (useCache ? seq.getColor(i) : 0);
if (c != 0)
{
return c;
}
- int col = getResidueBoxColourInt(showBoxes, shader, allGroups, seq,
- i);
-
+ int col = getResidueBoxColourInt(showBoxes, shader, allGroups, seq, i);
// if there's a FeatureColourFinder we might override the residue colour
// here with feature colouring
- return seq.setColor(i,
- finder == null || finder.noFeaturesDisplayed() ? col
+ c = (finder == null || finder.noFeaturesDisplayed() ? col
: finder.findFeatureColourInt(col, seq, i));
+ return (useCache ? seq.setColor(i, c) : c);
+ }
+
+ /**
+ * For test suite only.
+ */
+ @Override
+ protected Color getResidueBoxColour(boolean showBoxes,
+ ResidueShaderI shader, SequenceGroup[] allGroups, SequenceI seq,
+ int i)
+ {
+ return new Color(
+ getResidueBoxColourInt(showBoxes, shader, allGroups, seq, i));
}
-
+
/**
* In the overview, the showBoxes setting is ignored, as the overview displays
* the colours regardless.