features = fr2
.findComplementFeaturesAtResidue(seq, pos);
for (SequenceFeature sf : features)
{
FeatureColourI fc = fr2.getFeatureStyle(sf.getType());
Color featureColour = fr2.getColor(sf, fc);
renderFeature(g, seq, column - 1, column - 1, featureColour,
start, end, y1, colourOnly);
drawnColour = featureColour;
}
}
}
if (transparency != 1.0f && g != null)
{
/*
* reset transparency
*/
Graphics2D g2 = (Graphics2D) g;
g2.setComposite(NO_TRANSPARENCY);
}
return drawnColour;
}
/**
* Called when alignment in associated view has new/modified features to
* discover and display.
*
*/
@Override
public void featuresAdded()
{
findAllFeatures();
}
/**
* Returns the sequence feature colour rendered at the given column position,
* or null if none found. The feature of highest render order (i.e. on top) is
* found, subject to both feature type and feature group being visible, and
* its colour returned. This method is suitable when no feature transparency
* applied (only the topmost visible feature colour is rendered).
*
* Note this method does not check for a gap in the column so would return the
* colour for features enclosing a gapped column. Check for gap before calling
* if different behaviour is wanted.
*
* @param seq
* @param column
* (1..)
* @return
*/
Color findFeatureColour(SequenceI seq, int column)
{
/*
* check for new feature added while processing
*/
updateFeatures();
/*
* show complement features on top (if configured to show them)
*/
if (av.isShowComplementFeatures())
{
AlignViewportI complement = av.getCodingComplement();
AlignFrame af = Desktop.getAlignFrameFor(complement);
FeatureRendererModel fr2 = af.getFeatureRenderer();
List features = fr2.findComplementFeaturesAtResidue(
seq, seq.findPosition(column - 1));
ReverseListIterator it = new ReverseListIterator<>(
features);
while (it.hasNext())
{
SequenceFeature sf = it.next();
if (!fr2.featureGroupNotShown(sf))
{
Color col = fr2.getColour(sf);
if (col != null)
{
return col;
}
}
}
}
/*
* inspect features in reverse renderOrder (the last in the array is
* displayed on top) until we find one that is rendered at the position
*/
for (int renderIndex = renderOrder.length
- 1; renderIndex >= 0; renderIndex--)
{
String type = renderOrder[renderIndex];
if (!showFeatureOfType(type))
{
continue;
}
List overlaps = seq.findFeatures(column, column,
type);
for (SequenceFeature sequenceFeature : overlaps)
{
if (!featureGroupNotShown(sequenceFeature))
{
Color col = getColour(sequenceFeature);
if (col != null)
{
return col;
}
}
}
}
/*
* no displayed feature found at position
*/
return null;
}
}