Allow features in overview window
[jalview.git] / src / jalview / appletgui / FeatureRenderer.java
index 4a97e43..048df28 100755 (executable)
@@ -24,7 +24,6 @@ import java.awt.*;
 \r
 import java.util.*;\r
 \r
-\r
 /**\r
  * DOCUMENT ME!\r
  *\r
@@ -36,7 +35,6 @@ public class FeatureRenderer
     AlignViewport av;\r
     SequenceGroup currentSequenceGroup = null;\r
     SequenceGroup[] allGroups = null;\r
-    Color resBoxColour;\r
     Graphics graphics;\r
     float transparency = .4f;\r
 \r
@@ -44,6 +42,8 @@ public class FeatureRenderer
     // to be added, in the correct order or rendering\r
     Vector featuresDisplayed;\r
 \r
+    Color currentColour = null;\r
+\r
     /**\r
      * Creates a new FeatureRenderer object.\r
      *\r
@@ -59,7 +59,7 @@ public class FeatureRenderer
 \r
     }\r
 \r
-boolean highlightTransparent = true;\r
+    boolean highlightTransparent = true;\r
     /**\r
      * DOCUMENT ME!\r
      *\r
@@ -73,7 +73,7 @@ boolean highlightTransparent = true;
      * @param width DOCUMENT ME!\r
      * @param height DOCUMENT ME!\r
      */\r
-    public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
+    public void drawSequence(Graphics g, SequenceI seq,\r
         int start, int end, int x1, int y1, int width, int height)\r
     {\r
 \r
@@ -141,7 +141,8 @@ boolean highlightTransparent = true;
 \r
                 if (fstart == fend)\r
                 {\r
-                    g.setColor(getColour(type));\r
+                    currentColour = getColour(type);\r
+                    g.setColor(currentColour);\r
                     g.fillRoundRect((fstart - start) * width, y1, width,\r
                         height, 4, 4);\r
                     g.setColor(Color.white);\r
@@ -164,8 +165,9 @@ boolean highlightTransparent = true;
                         {\r
                             continue;\r
                         }\r
+                        currentColour = getColour(type);\r
+                        g.setColor(currentColour);\r
 \r
-                        g.setColor(getColour(type));\r
                         g.fillRect((i - start) * width, y1, width, height);\r
 \r
                         g.setColor(Color.white);\r
@@ -187,6 +189,25 @@ boolean highlightTransparent = true;
           }\r
     }\r
 \r
+\r
+    Image offscreen;\r
+    Frame nullframe;\r
+    public Color findFeatureColour(Color initialCol, SequenceI seq, int i)\r
+    {\r
+      currentColour = initialCol;\r
+      if(offscreen == null)\r
+      {\r
+        nullframe = new Frame();\r
+        nullframe.addNotify();\r
+        offscreen = nullframe.createImage(1, 1);\r
+      }\r
+\r
+      drawSequence(offscreen.getGraphics(), seq, i, i, 0, 0, 1, 1);\r
+      return currentColour;\r
+    }\r
+\r
+\r
+\r
     public Color getColour(String featureType)\r
     {\r
       return (Color)featureColours.get(featureType);\r