\r
import java.util.*;\r
\r
+import java.awt.image.*;\r
+\r
\r
/**\r
* DOCUMENT ME!\r
float transparency = 1.0f;\r
FontMetrics fm;\r
int charOffset;\r
+ boolean drawText = true;\r
\r
// The following vector holds the features which are\r
// to be added, in the correct order or rendering\r
}\r
\r
/**\r
+ * This is used by the Molecule Viewer to get the accurate colour\r
+ * of the rendered sequence\r
+ */\r
+ BufferedImage bi;\r
+ public Color findFeatureColour(Color initialCol, SequenceI seq, int i)\r
+ {\r
+ if(!av.showSequenceFeatures)\r
+ return initialCol;\r
+\r
+ if(bi==null)\r
+ bi = new BufferedImage(1,1,BufferedImage.TYPE_INT_RGB);\r
+\r
+ drawText = false;\r
+ bi.getGraphics().setColor(initialCol);\r
+ bi.getGraphics().fillRect(0, 0, 1, 1);\r
+ drawSequence(bi.getGraphics(), seq, i, i, 0, 0, 1, 1);\r
+ drawText = true;\r
+\r
+ return new Color(bi.getRGB(0, 0));\r
+ }\r
+\r
+\r
+ /**\r
* DOCUMENT ME!\r
*\r
* @param g DOCUMENT ME!\r
int start, int end, int x1, int y1, int width, int height)\r
{\r
\r
- if (seq.getDatasetSequence().getSequenceFeatures() == null)\r
+ if (seq.getDatasetSequence().getSequenceFeatures() == null\r
+ || seq.getDatasetSequence().getSequenceFeatures().size()==0)\r
return;\r
\r
fm = g.getFontMetrics();\r
\r
String type;\r
SequenceFeature sf;\r
- if (featuresDisplayed == null || featuresDisplayed.size()==0)\r
+ if (featuresDisplayed == null)\r
findAllFeatures();\r
\r
Enumeration e = featuresDisplayed.elements(), e2;\r
\r
g.fillRect( (i - start) * width, y1, width, height);\r
\r
- g.setColor(Color.white);\r
-\r
- charOffset = (width - fm.charWidth(s)) / 2;\r
- g.drawString(String.valueOf(s),\r
- charOffset + x1 + (width * (i - start)),\r
- (y1 + height) - height/5);//pady = height / 5;\r
+ if(drawText)\r
+ {\r
+ g.setColor(Color.white);\r
+ charOffset = (width - fm.charWidth(s)) / 2;\r
+ g.drawString(String.valueOf(s),\r
+ charOffset + x1 + (width * (i - start)),\r
+ (y1 + height) - height / 5); //pady = height / 5;\r
+ }\r
}\r
}\r
}\r
import jalview.schemes.*;\r
\r
import java.awt.*;\r
+import java.awt.image.BufferedImage;\r
\r
\r
/**\r
return resBoxColour;\r
}\r
\r
+ BufferedImage bi;\r
+ public Color findSequenceColour(Color initialCol, SequenceI seq, int i)\r
+ {\r
+ if (bi == null)\r
+ bi = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);\r
+\r
+ bi.getGraphics().setColor(initialCol);\r
+ bi.getGraphics().fillRect(0, 0, 1, 1);\r
+ allGroups = null;\r
+ graphics = bi.getGraphics();\r
+\r
+ drawBoxes(seq, i,i, 0, 0, 1,1);\r
+\r
+ return new Color(bi.getRGB(0, 0));\r
+ }\r
+\r
+\r
/**\r
* DOCUMENT ME!\r
*\r