private static final AlphaComposite NO_TRANSPARENCY = AlphaComposite
.getInstance(AlphaComposite.SRC_OVER, 1.0f);
- protected SequenceI lastSeq;
-
- private volatile SequenceFeature[] lastSequenceFeatures;
-
- int sfSize;
-
/**
* Constructor given a viewport
*
g.setColor(featureColour);
- g.fillRect((i - start) * charWidth, y1, charWidth,
- charHeight);
+ g.fillRect((i - start) * charWidth, y1, charWidth, charHeight);
if (colourOnly || !validCharWidth)
{
g.setColor(Color.white);
int charOffset = (charWidth - fm.charWidth(s)) / 2;
- g.drawString(String.valueOf(s), charOffset
- + (charWidth * (i - start)), pady);
+ g.drawString(String.valueOf(s),
+ charOffset + (charWidth * (i - start)), pady);
}
return true;
}
g.setColor(Color.black);
int charOffset = (charWidth - fm.charWidth(s)) / 2;
- g.drawString(String.valueOf(s), charOffset
- + (charWidth * (i - start)), pady);
+ g.drawString(String.valueOf(s),
+ charOffset + (charWidth * (i - start)), pady);
}
return true;
}
}
SequenceFeature[] sequenceFeatures = seq.getSequenceFeatures();
- if (seq != lastSeq)
- {
- lastSeq = seq;
- lastSequenceFeatures = sequenceFeatures;
- if (lastSequenceFeatures != null)
- {
- sfSize = lastSequenceFeatures.length;
- }
- }
- else
- {
- if (lastSequenceFeatures != sequenceFeatures)
- {
- lastSequenceFeatures = sequenceFeatures;
- if (lastSequenceFeatures != null)
- {
- sfSize = lastSequenceFeatures.length;
- }
- }
- }
- if (lastSequenceFeatures == null || sfSize == 0)
+ if (sequenceFeatures == null || sequenceFeatures.length == 0)
{
return null;
}
- if (Comparison.isGap(lastSeq.getCharAt(column)))
+ if (Comparison.isGap(seq.getCharAt(column)))
{
- return Color.white;
+ /*
+ * returning null allows the colour scheme to provide gap colour
+ * - normally white, but can be customised otherwise
+ */
+ return null;
}
Color renderedColour = null;
* transparency case - draw all visible features in render order to
* build up a composite colour on the graphics context
*/
- renderedColour = drawSequence(g, lastSeq, column, column, 0, true);
+ renderedColour = drawSequence(g, seq, column, column, 0, true);
}
return renderedColour;
}
updateFeatures();
- if (lastSeq == null || seq != lastSeq
- || sequenceFeatures != lastSequenceFeatures)
- {
- lastSeq = seq;
- lastSequenceFeatures = sequenceFeatures;
- }
-
if (transparency != 1f && g != null)
{
Graphics2D g2 = (Graphics2D) g;
transparency));
}
- int startPos = lastSeq.findPosition(start);
- int endPos = lastSeq.findPosition(end);
+ int startPos = seq.findPosition(start);
+ int endPos = seq.findPosition(end);
- sfSize = lastSequenceFeatures.length;
+ int sfSize = sequenceFeatures.length;
Color drawnColour = null;
/*
// current feature to render
for (int sfindex = 0; sfindex < sfSize; sfindex++)
{
- final SequenceFeature sequenceFeature = lastSequenceFeatures[sfindex];
+ final SequenceFeature sequenceFeature = sequenceFeatures[sfindex];
if (!sequenceFeature.type.equals(type))
{
continue;
}
Color featureColour = getColour(sequenceFeature);
+ if (featureColour == null)
+ {
+ // score feature outwith threshold for colouring
+ continue;
+ }
+
boolean isContactFeature = sequenceFeature.isContactFeature();
if (isContactFeature)
drawnColour = featureColour;
}
}
- else if (showFeature(sequenceFeature))
+ else
{
if (av.isShowSequenceFeaturesHeight()
&& !Float.isNaN(sequenceFeature.score))
protected boolean featureGroupNotShown(
final SequenceFeature sequenceFeature)
{
- return featureGroups != null
- && sequenceFeature.featureGroup != null
+ return featureGroups != null && sequenceFeature.featureGroup != null
&& sequenceFeature.featureGroup.length() != 0
&& featureGroups.containsKey(sequenceFeature.featureGroup)
&& !featureGroups.get(sequenceFeature.featureGroup)
@Override
public void featuresAdded()
{
- lastSeq = null;
findAllFeatures();
}
{
return null;
}
-
+
/*
* check for new feature added while processing
*/
* 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--)
+ for (int renderIndex = renderOrder.length
+ - 1; renderIndex >= 0; renderIndex--)
{
String type = renderOrder[renderIndex];
if (!showFeatureOfType(type))
}
}
}
-
+
/*
* no displayed feature found at position
*/