*/
package jalview.gui;
+import jalview.api.ColorI;
import jalview.api.FeatureRenderer;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
+import jalview.schemes.Colour;
import jalview.schemes.ColourSchemeI;
+import jalview.util.ColorUtils;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics;
-/**
- * DOCUMENT ME!
- *
- * @author $author$
- * @version $Revision$
- */
public class SequenceRenderer implements jalview.api.SequenceRenderer
{
final static int CHAR_TO_UPPER = 'A' - 'a';
}
@Override
- public Color getResidueBoxColour(SequenceI seq, int i)
+ public ColorI getResidueBoxColour(SequenceI seq, int i)
{
+ // rate limiting step when rendering overview for lots of groups
allGroups = av.getAlignment().findAllGroups(seq);
if (inCurrentSequenceGroup(i))
getBoxColour(av.getGlobalColourScheme(), seq, i);
}
- return resBoxColour;
+ return new Colour(resBoxColour);
}
/**
* @return
*/
@Override
- public Color getResidueColour(final SequenceI seq, int position,
+ public ColorI getResidueColour(final SequenceI seq, int position,
FeatureRenderer fr)
{
// TODO replace 8 or so code duplications with calls to this method
// (refactored as needed)
- Color col = getResidueBoxColour(seq, position);
+ ColorI col = getResidueBoxColour(seq, position);
if (fr != null)
{
{
end = seq.getLength() - 1;
}
- graphics.setColor(av.getTextColour());
+ graphics.setColor(ColorUtils.getColor(av.getTextColour()));
if (monospacedFont && av.getShowText() && allGroups.length == 0
&& !av.getColourText() && av.getThresholdTextColour() == 0)
for (int i = start; i <= end; i++)
{
- graphics.setColor(av.getTextColour());
+ graphics.setColor(ColorUtils.getColor(av.getTextColour()));
getboxColour = false;
s = seq.getCharAt(i);
if (resBoxColour.getRed() + resBoxColour.getBlue()
+ resBoxColour.getGreen() < currentSequenceGroup.thresholdTextColour)
{
- graphics.setColor(currentSequenceGroup.textColour2);
+ graphics.setColor(ColorUtils.getColor(currentSequenceGroup.textColour2));
}
}
}
else
{
- graphics.setColor(currentSequenceGroup.textColour);
+ graphics.setColor(ColorUtils.getColor(currentSequenceGroup.textColour));
}
if (!isarep && !isgrep
&& currentSequenceGroup.getShowNonconserved()) // todo
if (resBoxColour.getRed() + resBoxColour.getBlue()
+ resBoxColour.getGreen() < av.getThresholdTextColour())
{
- graphics.setColor(av.getTextColour2());
+ graphics.setColor(ColorUtils.getColor(av.getTextColour2()));
}
}
if (!isarep && av.getShowUnconserved())
{
- s = getDisplayChar(srep, i, s, '.', currentSequenceGroup);
+ s = getDisplayChar(srep, i, s, '.', null);
}
.getCharAt(position) : av.getAlignment().getSeqrep()
.getCharAt(position)))
: (currentGroup != null && currentGroup.getConsensus() != null
- && position >= currentGroup.getStartRes() && position <= currentGroup
- .getEndRes()) ? currentGroup.getConsensus().annotations[position].displayCharacter
+ && position >= currentGroup.getStartRes()
+ && position <= currentGroup.getEndRes() && currentGroup
+ .getConsensus().annotations.length > position) ? currentGroup
+ .getConsensus().annotations[position].displayCharacter
.charAt(0)
: av.getAlignmentConsensusAnnotation().annotations[position].displayCharacter
.charAt(0);