import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
- import java.awt.image.BufferedImage;
+import java.util.List;
public class FeatureRenderer extends FeatureRendererModel
{
transparency));
}
- if (!offscreenRender)
- {
- spos = lastSeq.findPosition(start);
- epos = lastSeq.findPosition(end);
- }
+ int startPos = seq.findPosition(start);
+ int endPos = seq.findPosition(end);
+
- int sfSize = sequenceFeatures.length;
+ Color drawnColour = null;
- sfSize = lastSequenceFeatures.length;
+ /*
+ * iterate over features in ordering of their rendering (last is on top)
+ */
for (int renderIndex = 0; renderIndex < renderOrder.length; renderIndex++)
{
String type = renderOrder[renderIndex];
continue;
}
-- // loop through all features in sequence to find
-- // current feature to render
- // for (sfindex = 0; sfindex < sfSize; sfindex++)
- // {
- // final SequenceFeature sequenceFeature = lastSequenceFeatures[sfindex];
- int from = offscreenRender ? start : spos;
- int to = offscreenRender ? start : epos;
- List<SequenceFeature> overlaps = seq.findFeatures(type, from, to);
- for (int sfindex = 0; sfindex < sfSize; sfindex++)
++ List<SequenceFeature> overlaps = seq.findFeatures(type, startPos, endPos);
+ for (SequenceFeature sequenceFeature : overlaps)
{
- if (!sequenceFeature.type.equals(type))
- {
- continue;
- }
-
- if (featureGroupNotShown(sequenceFeature))
- {
- continue;
- }
-
- final SequenceFeature sequenceFeature = sequenceFeatures[sfindex];
- if (!sequenceFeature.type.equals(type))
- {
- continue;
- }
-
/*
- * check feature overlaps the visible part of the alignment,
- * unless doing offscreenRender (to the Overview window or a
- * structure viewer) which is not limited
+ * a feature type may be flagged as shown but the group
+ * an instance of it belongs to may be hidden
*/
- if (!offscreenRender
- && (sequenceFeature.getBegin() > epos || sequenceFeature
- .getEnd() < spos))
+ if (featureGroupNotShown(sequenceFeature))
{
continue;
}
}
else if (showFeature(sequenceFeature))
{
- if (av_isShowSeqFeatureHeight
++ /*
++ * showing feature score by height of colour
++ * is not implemented as a selectable option
++ *
+ if (av.isShowSequenceFeaturesHeight()
&& !Float.isNaN(sequenceFeature.score))
{
- renderScoreFeature(g, seq,
+ boolean drawn = renderScoreFeature(g, seq,
seq.findIndex(sequenceFeature.begin) - 1,
- seq.findIndex(sequenceFeature.end) - 1,
- featureColour, start, end, y1,
- normaliseScore(sequenceFeature));
+ seq.findIndex(sequenceFeature.end) - 1, featureColour,
+ start, end, y1, normaliseScore(sequenceFeature),
+ colourOnly);
+ if (drawn)
+ {
+ drawnColour = featureColour;
+ }
}
else
{
- renderFeature(g, seq, seq.findIndex(sequenceFeature.begin) - 1,
- seq.findIndex(sequenceFeature.end) - 1,
- featureColour, start, end, y1);
- }
++ */
+ boolean drawn = renderFeature(g, seq,
+ seq.findIndex(sequenceFeature.begin) - 1,
+ seq.findIndex(sequenceFeature.end) - 1, featureColour,
+ start, end, y1, colourOnly);
+ if (drawn)
+ {
+ drawnColour = featureColour;
+ }
- }
++ /*}*/
}
}
}