Features are an array, rendering is faster
[jalview.git] / src / jalview / appletgui / OverviewPanel.java
index 47c781b..8d8472e 100755 (executable)
@@ -57,8 +57,10 @@ public class OverviewPanel
     sr = new SequenceRenderer(av);\r
     sr.graphics = nullFrame.getGraphics();\r
     sr.renderGaps( false );\r
+    sr.forOverview = true;\r
     fr = new FeatureRenderer(av);\r
     fr.drawText = false;\r
+    fr.overview = true;\r
 \r
 \r
 \r
@@ -185,10 +187,9 @@ public class OverviewPanel
 \r
     if (av.showSequenceFeatures)\r
    {\r
-     fr.featuresDisplayed = ap.seqPanel.seqCanvas.getFeatureRenderer().\r
-         featuresDisplayed;\r
      fr.featureGroups = ap.seqPanel.seqCanvas.getFeatureRenderer().featureGroups;\r
      fr.featureColours = ap.seqPanel.seqCanvas.getFeatureRenderer().featureColours;\r
+     fr.sequenceFeatures = ap.seqPanel.seqCanvas.getFeatureRenderer().sequenceFeatures;\r
    }\r
 \r
 \r
@@ -237,12 +238,14 @@ public class OverviewPanel
     float sampleCol = (float) alwidth / (float) width;\r
     float sampleRow = (float) alheight / (float) sequencesHeight;\r
 \r
-    int lastcol=-1, lastrow=-1;\r
+    int lastcol=-1, lastrow=0;\r
     Color color = Color.yellow;\r
     int row, col;\r
-    for (col = 0; col < width; col++)\r
+    jalview.datamodel.SequenceI sequence;\r
+    for (row = 0; row < sequencesHeight; row++)\r
     {\r
-      for (row = 0; row < sequencesHeight; row++)\r
+      sequence = av.getAlignment().getSequenceAt(lastrow);\r
+      for (col = 0; col < width; col++)\r
       {\r
         if((int)(col*sampleCol) == lastcol && (int)(row*sampleRow)==lastrow)\r
         {\r
@@ -250,29 +253,18 @@ public class OverviewPanel
           continue;\r
         }\r
 \r
-        if (av.conservation != null)\r
-        {\r
-          mg.translate(col, sequencesHeight);\r
-          ap.annotationPanel.drawGraph(mg, av.conservation,\r
-                                       (int) (sampleCol) + 1,\r
-                                       graphHeight,\r
-                                       (int) (col * sampleCol),\r
-                                       (int) (col * sampleCol) + 1);\r
-          mg.translate( -col, -sequencesHeight);\r
-        }\r
-\r
         lastrow = (int)(row*sampleRow);\r
         lastcol = (int)(col*sampleCol);\r
 \r
         if(av.alignment.getSequenceAt(lastrow).getLength()>lastcol)\r
         {\r
-          color = sr.findSequenceColour(av.alignment.getSequenceAt(lastrow), lastcol);\r
 \r
+          color = sr.findSequenceColour(sequence, lastcol);\r
 \r
           if (av.showSequenceFeatures)\r
             color = fr.findFeatureColour(color,\r
-                                        av.alignment.getSequenceAt(lastrow),\r
-                                         lastcol);\r
+                                        sequence,\r
+                                        lastcol);\r
         }\r
 \r
         mg.setColor(color);\r
@@ -281,6 +273,24 @@ public class OverviewPanel
       }\r
     }\r
 \r
+    if (av.conservation != null)\r
+    {\r
+      for (col = 0; col < width; col++)\r
+      {\r
+        lastcol = (int) (col * sampleCol);\r
+        {\r
+          mg.translate(col, sequencesHeight);\r
+          ap.annotationPanel.drawGraph(mg, av.conservation,\r
+                                       (int) (sampleCol) + 1,\r
+                                       graphHeight,\r
+                                       (int) (col * sampleCol),\r
+                                       (int) (col * sampleCol) + 1);\r
+          mg.translate( -col, -sequencesHeight);\r
+        }\r
+      }\r
+    }\r
+\r
+\r
 \r
     System.gc();\r
 \r