JAL-2438 removed (non-functional) lastSeq, lastSequenceFeatures
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 21 Mar 2017 10:22:57 +0000 (10:22 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Tue, 21 Mar 2017 10:22:57 +0000 (10:22 +0000)
src/jalview/appletgui/FeatureRenderer.java
src/jalview/gui/FeatureRenderer.java
src/jalview/renderer/seqfeatures/FeatureRenderer.java

index 67ca8e9..b88a1dc 100644 (file)
@@ -377,9 +377,6 @@ public class FeatureRenderer extends
 
     if (dialog.accept)
     {
-      // This ensures that the last sequence
-      // is refreshed and new features are rendered
-      lastSeq = null;
       lastFeatureAdded = name.getText().trim();
       lastFeatureGroupAdded = source.getText().trim();
       lastDescriptionAdded = description.getText().replace('\n', ' ');
index 86b8eba..f519f99 100644 (file)
@@ -337,9 +337,6 @@ public class FeatureRenderer extends
 
     if (reply == JvOptionPane.OK_OPTION && name.getText().length() > 0)
     {
-      // This ensures that the last sequence
-      // is refreshed and new features are rendered
-      lastSeq = null;
       lastFeatureAdded = name.getText().trim();
       lastFeatureGroupAdded = source.getText().trim();
       lastDescriptionAdded = description.getText().replaceAll("\n", " ");
index 02cfd05..72ac2c8 100644 (file)
@@ -37,12 +37,6 @@ public class FeatureRenderer extends FeatureRendererModel
   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
    * 
@@ -221,33 +215,13 @@ public class FeatureRenderer extends FeatureRendererModel
     }
 
     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;
     }
@@ -266,7 +240,7 @@ public class FeatureRenderer extends FeatureRendererModel
        * 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;
   }
@@ -303,13 +277,6 @@ public class FeatureRenderer extends FeatureRendererModel
 
     updateFeatures();
 
-    if (lastSeq == null || seq != lastSeq
-            || sequenceFeatures != lastSequenceFeatures)
-    {
-      lastSeq = seq;
-      lastSequenceFeatures = sequenceFeatures;
-    }
-
     if (transparency != 1f && g != null)
     {
       Graphics2D g2 = (Graphics2D) g;
@@ -317,10 +284,10 @@ public class FeatureRenderer extends FeatureRendererModel
               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;
 
     /*
@@ -338,7 +305,7 @@ public class FeatureRenderer extends FeatureRendererModel
       // 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;
@@ -449,7 +416,6 @@ public class FeatureRenderer extends FeatureRendererModel
   @Override
   public void featuresAdded()
   {
-    lastSeq = null;
     findAllFeatures();
   }