JAL-3706 handle virtual feature extending to unmapped stop codon
[jalview.git] / src / jalview / io / SequenceAnnotationReport.java
index 27c1652..8b1f7ff 100644 (file)
@@ -120,21 +120,11 @@ public class SequenceAnnotationReport
     }
   };
 
-  private boolean forTooltip;
-
   /**
-   * Constructor given a flag which affects behaviour
-   * <ul>
-   * <li>if true, generates feature details suitable to show in a tooltip</li>
-   * <li>if false, generates feature details in a form suitable for the sequence
-   * details report</li>
-   * </ul>
-   * 
-   * @param isForTooltip
+   * Constructor
    */
   public SequenceAnnotationReport(boolean isForTooltip)
   {
-    this.forTooltip = isForTooltip;
     if (linkImageURL == null)
     {
       linkImageURL = getClass().getResource("/images/link.gif").toString();
@@ -210,41 +200,32 @@ public class SequenceAnnotationReport
      * if this is a virtual features, convert begin/end to the
      * coordinates of the sequence it is mapped to
      */
-    int[] beginRange = null;
-    int[] endRange = null;
+    int[] localRange = null;
     if (mf != null)
     {
-      beginRange = mf.getMappedPositions(begin, begin);
-      endRange = mf.getMappedPositions(end, end);
-      if (beginRange == null || endRange == null)
+      localRange = mf.getMappedPositions(begin, end);
+      if (localRange == null)
       {
         // something went wrong
         return false;
       }
-      begin = beginRange[0];
-      end = endRange[endRange.length - 1];
+      begin = localRange[0];
+      end = localRange[localRange.length - 1];
     }
 
     StringBuilder sb = new StringBuilder();
     if (feature.isContactFeature())
     {
       /*
-       * include if rpos is at start or end position of [mapped] feature
+       * contact features are rendered slightly differently; note the check for
+       * 'start or end position only' was applied earlier when finding features
        */
-      boolean showContact = (mf == null) && (rpos == begin || rpos == end);
-      boolean showMappedContact = (mf != null) && ((rpos >= beginRange[0]
-              && rpos <= beginRange[beginRange.length - 1])
-              || (rpos >= endRange[0]
-                      && rpos <= endRange[endRange.length - 1]));
-      if (showContact || showMappedContact)
+      if (sb0.length() > 6)
       {
-        if (sb0.length() > 6)
-        {
-          sb.append("<br/>");
-        }
-        sb.append(feature.getType()).append(" ").append(begin).append(":")
-                .append(end);
+        sb.append("<br/>");
       }
+      sb.append(feature.getType()).append(" ").append(begin).append(":")
+              .append(end);
       return appendText(sb0, sb, maxlength);
     }