*/
package jalview.gui;
+import jalview.api.AlignViewportI;
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.renderer.ResidueShaderI;
import jalview.renderer.seqfeatures.FeatureColourFinder;
-import jalview.util.Comparison;
import java.awt.Color;
import java.awt.FontMetrics;
{
final static int CHAR_TO_UPPER = 'A' - 'a';
- AlignViewport av;
+ AlignViewportI av;
FontMetrics fm;
boolean renderGaps = true;
- SequenceGroup currentSequenceGroup = null;
-
SequenceGroup[] allGroups = null;
Color resBoxColour;
boolean monospacedFont;
- boolean forOverview = false;
-
/**
- * Creates a new SequenceRenderer object.
+ * Creates a new SequenceRenderer object
*
- * @param av
- * DOCUMENT ME!
+ * @param viewport
*/
- public SequenceRenderer(AlignViewport av)
+ public SequenceRenderer(AlignViewportI viewport)
{
- this.av = av;
+ this.av = viewport;
}
/**
this.renderGaps = renderGaps;
}
- @Override
- public Color getResidueBoxColour(SequenceI seq, int i)
+ protected Color getResidueBoxColour(SequenceI seq, int i)
{
// rate limiting step when rendering overview for lots of groups
allGroups = av.getAlignment().findAllGroups(seq);
- if (inCurrentSequenceGroup(i))
+ SequenceGroup currentSequenceGroup = inCurrentSequenceGroup(i);
+ if (currentSequenceGroup != null)
{
if (currentSequenceGroup.getDisplayBoxes())
{
public Color getResidueColour(final SequenceI seq, int position,
FeatureColourFinder finder)
{
- // TODO replace 8 or so code duplications with calls to this method
- // (refactored as needed)
Color col = getResidueBoxColour(seq, position);
if (finder != null)
*/
void getBoxColour(ResidueShaderI shader, SequenceI seq, int i)
{
- if (shader != null)
+ if (shader.getColourScheme() != null)
{
- resBoxColour = shader.findColour(seq.getCharAt(i),
- i, seq);
- }
- else if (forOverview && !Comparison.isGap(seq.getCharAt(i)))
- {
- resBoxColour = Color.lightGray;
+ resBoxColour = shader.findColour(seq.getCharAt(i), i, seq);
}
else
{
drawBoxes(seq, start, end, y1);
- if (av.validCharWidth)
+ if (av.isValidCharWidth())
{
drawText(seq, start, end, y1);
}
if (i < length)
{
- if (inCurrentSequenceGroup(i))
+ SequenceGroup currentSequenceGroup = inCurrentSequenceGroup(i);
+ if (currentSequenceGroup != null)
{
if (currentSequenceGroup.getDisplayBoxes())
{
boolean srep = av.isDisplayReferenceSeq();
boolean getboxColour = false;
boolean isarep = av.getAlignment().getSeqrep() == seq;
- boolean isgrep = currentSequenceGroup != null ? currentSequenceGroup
- .getSeqrep() == seq : false;
- char sr_c;
+
for (int i = start; i <= end; i++)
{
continue;
}
- if (inCurrentSequenceGroup(i))
+ SequenceGroup currentSequenceGroup = inCurrentSequenceGroup(i);
+ if (currentSequenceGroup != null)
{
if (!currentSequenceGroup.getDisplayText())
{
{
graphics.setColor(currentSequenceGroup.textColour);
}
+ boolean isgrep = currentSequenceGroup != null
+ ? currentSequenceGroup.getSeqrep() == seq : false;
if (!isarep && !isgrep
&& currentSequenceGroup.getShowNonconserved()) // todo
// optimize
*
* @return DOCUMENT ME!
*/
- boolean inCurrentSequenceGroup(int res)
+ SequenceGroup inCurrentSequenceGroup(int res)
{
if (allGroups == null)
{
- return false;
+ return null;
}
for (int i = 0; i < allGroups.length; i++)
if ((allGroups[i].getStartRes() <= res)
&& (allGroups[i].getEndRes() >= res))
{
- currentSequenceGroup = allGroups[i];
-
- return true;
+ return (allGroups[i]);
}
}
- return false;
+ return null;
}
/**