}
}
+ @Override
+ public void resetColors()
+ {
+ for (int i = getHeight(); --i >= 0;)
+ {
+ sequences.get(i).resetColors();
+ }
+ }
+
}
* @return new HiddenColumns for new alignment view, with insertions into
* profileseq marked as hidden.
*/
+
public HiddenColumns propagateInsertions(SequenceI profileseq,
AlignmentView input);
+ /**
+ * Removes all colors assigned to sequences, forcing them to be be
+ * recalculated
+ */
+ void resetColors();
}
*/
private int changeCount;
+ /*
+ * cached rgb colours for each position of the aligned sequence (column)
+ */
+ private int[] argb;
+
/**
* Creates a new Sequence object.
*
@Override
public void sequenceChanged()
{
+ resetColors();
changeCount++;
}
return getFeatures().hasFeatures(type);
}
+ @Override
+ public int getColor(int i)
+ {
+ return argb == null ? 0 : argb[i];
+ }
+
+ @Override
+ public int setColor(int i, int rgb)
+ {
+ if (argb == null)
+ {
+ argb = new int[this.sequence.length];
+ }
+ return (argb[i] = rgb);
+ }
+
+ @Override
+ public void resetColors()
+ {
+ argb = null;
+ }
+
}
*/
public boolean hasFeatures(String type);
+ /**
+ * Returns the rgb value of the colour at position i, or 0 if not known
+ *
+ * @param i
+ * @return
+ */
+ public int getColor(int i);
+
+ /**
+ * Sets the rgb value of the colour at position i
+ *
+ * @param i
+ * @param rgb
+ * @return
+ */
+ public int setColor(int i, int rgb);
+
+ /**
+ * Clears any cached colours
+ */
+ public void resetColors();
+
}
// abstracted
if (enableIfNecessary)
{
+ alignPanel.getAlignment().resetColors();
viewport.setShowSequenceFeatures(true);
showSeqFeatures.setSelected(true);
}
av.isShowAutocalculatedAbove());
sorter.sort(getAlignment().getAlignmentAnnotation(),
av.getSortAnnotationsBy());
+ getAlignment().resetColors();
repaint();
if (updateStructures)
}
if (updateOverview)
{
-
if (overviewPanel != null)
{
overviewPanel.updateOverviewImage();
SequenceGroup[] allGroups, final SequenceI seq, int i,
FeatureColourFinder finder)
{
+ int c = seq.getColor(i);
+ if (c != 0)
+ {
+ return c;
+ }
+
int col = getResidueBoxColourInt(showBoxes, shader, allGroups, seq, i);
// if there's a FeatureColourFinder we might override the residue colour
// here with feature colouring
col = finder == null || finder.noFeaturesDisplayed() ? col
: finder.findFeatureColourInt(col, seq, i);
+ seq.setColor(i, col);
return col;
}
fr.findAllFeatures(true);
av.setShowSequenceFeatures(true);
fr.setColour("Pfam", new FeatureColour(Color.yellow));
+ seq1.resetColors();
assertEquals(or.getColumnColourFromSequence(null, seq1, 0),
Color.yellow.getRGB());
// don't show sequence features
av.setShowSequenceFeatures(false);
+ seq1.resetColors();
assertEquals(or.getColumnColourFromSequence(null, seq1, 0),
Color.magenta.getRGB());
}