JAL-2574 preparation for Sequence.findFeatures(col1, col2)
[jalview.git] / src / jalview / renderer / seqfeatures / FeatureRenderer.java
index 5dce2b8..950d0cd 100644 (file)
@@ -302,23 +302,23 @@ public class FeatureRenderer extends FeatureRendererModel
 
       List<SequenceFeature> overlaps = seq.findFeatures(seqRange.start,
               seqRange.end, type);
-      for (SequenceFeature sequenceFeature : overlaps)
+      for (SequenceFeature sf : overlaps)
       {
         /*
          * a feature type may be flagged as shown but the group 
          * an instance of it belongs to may be hidden
          */
-        if (featureGroupNotShown(sequenceFeature))
+        if (featureGroupNotShown(sf))
         {
           continue;
         }
 
-        Color featureColour = getColour(sequenceFeature);
-        boolean isContactFeature = sequenceFeature.isContactFeature();
+        Color featureColour = getColour(sf);
+        boolean isContactFeature = sf.isContactFeature();
 
-        // todo overload findIndex using Location data
-        int featureStartCol = seq.findIndex(sequenceFeature.begin);
-        int featureEndCol = seq.findIndex(sequenceFeature.end);
+        int featureStartCol = seq.findIndex(sf.begin);
+        int featureEndCol = sf.begin == sf.end ? featureStartCol : seq
+                .findIndex(sf.end);
         if (isContactFeature)
         {
           boolean drawn = renderFeature(g, seq,
@@ -334,7 +334,7 @@ public class FeatureRenderer extends FeatureRendererModel
             drawnColour = featureColour;
           }
         }
-        else if (showFeature(sequenceFeature))
+        else if (showFeature(sf))
         {
           /*
            * showing feature score by height of colour