import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
import jalview.util.Comparison;
+import jalview.util.ReverseListIterator;
import jalview.viewmodel.seqfeatures.FeatureRendererModel;
import java.awt.AlphaComposite;
for (int pos = visiblePositions.start; pos <= visiblePositions.end; pos++)
{
int column = seq.findIndex(pos);
- // TODO ensure these are in complement's render order (last on top)
List<SequenceFeature> features = fr2
.findComplementFeaturesAtResidue(seq, pos);
for (SequenceFeature sf : features)
List<SequenceFeature> features = fr2.findComplementFeaturesAtResidue(
seq, seq.findPosition(column));
// todo: ensure ordered by feature render order
- for (SequenceFeature sf : features)
+ ReverseListIterator<SequenceFeature> it = new ReverseListIterator<>(
+ features);
+ while (it.hasNext())
{
+ SequenceFeature sf = it.next();
if (!fr2.featureGroupNotShown(sf))
{
Color col = fr2.getColour(sf);
/**
* Answers a (possibly empty) list of features in this alignment at a position
* (or range) which is mappable from the given sequence residue position in a
- * mapped alignment.
+ * mapped alignment. Features are returned in render order of feature type (on
+ * top last), with order within feature type undefined.
*
* @param sequence
* @param pos
public List<SequenceFeature> findComplementFeaturesAtResidue(SequenceI sequence, int pos)
{
SequenceI ds = sequence.getDatasetSequence();
- List<SequenceFeature> result = new ArrayList<>();
+ List<SequenceFeature> found = new ArrayList<>();
List<AlignedCodonFrame> mappings = this.av.getAlignment()
.getCodonFrame(sequence);
match.getSequence(), fromRes, toRes);
for (SequenceFeature sf : fs)
{
- if (!result.contains(sf))
+ if (!found.contains(sf))
+ {
+ found.add(sf);
+ }
+ }
+ }
+ }
+ /*
+ * sort by renderorder, inefficiently
+ */
+ List<SequenceFeature> result = new ArrayList<>();
+ for (String type : renderOrder)
+ {
+ for (SequenceFeature sf : found)
+ {
+ if (type.equals(sf.getType()))
+ {
+ result.add(sf);
+ if (result.size() == found.size())
{
- result.add(sf);
+ return result;
}
}
}