From: amwaterhouse Date: Mon, 30 Jan 2006 14:45:10 +0000 (+0000) Subject: Allow features in overview window X-Git-Tag: Root_VamJalview_2_07b+~213 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;ds=inline;h=bc156d3f5e5184da7d103658603bb3b1a831aee1;p=jalview.git Allow features in overview window --- diff --git a/src/jalview/appletgui/FeatureRenderer.java b/src/jalview/appletgui/FeatureRenderer.java index 4a97e43..048df28 100755 --- a/src/jalview/appletgui/FeatureRenderer.java +++ b/src/jalview/appletgui/FeatureRenderer.java @@ -24,7 +24,6 @@ import java.awt.*; import java.util.*; - /** * DOCUMENT ME! * @@ -36,7 +35,6 @@ public class FeatureRenderer AlignViewport av; SequenceGroup currentSequenceGroup = null; SequenceGroup[] allGroups = null; - Color resBoxColour; Graphics graphics; float transparency = .4f; @@ -44,6 +42,8 @@ public class FeatureRenderer // to be added, in the correct order or rendering Vector featuresDisplayed; + Color currentColour = null; + /** * Creates a new FeatureRenderer object. * @@ -59,7 +59,7 @@ public class FeatureRenderer } -boolean highlightTransparent = true; + boolean highlightTransparent = true; /** * DOCUMENT ME! * @@ -73,7 +73,7 @@ boolean highlightTransparent = true; * @param width DOCUMENT ME! * @param height DOCUMENT ME! */ - public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg, + public void drawSequence(Graphics g, SequenceI seq, int start, int end, int x1, int y1, int width, int height) { @@ -141,7 +141,8 @@ boolean highlightTransparent = true; if (fstart == fend) { - g.setColor(getColour(type)); + currentColour = getColour(type); + g.setColor(currentColour); g.fillRoundRect((fstart - start) * width, y1, width, height, 4, 4); g.setColor(Color.white); @@ -164,8 +165,9 @@ boolean highlightTransparent = true; { continue; } + currentColour = getColour(type); + g.setColor(currentColour); - g.setColor(getColour(type)); g.fillRect((i - start) * width, y1, width, height); g.setColor(Color.white); @@ -187,6 +189,25 @@ boolean highlightTransparent = true; } } + + Image offscreen; + Frame nullframe; + public Color findFeatureColour(Color initialCol, SequenceI seq, int i) + { + currentColour = initialCol; + if(offscreen == null) + { + nullframe = new Frame(); + nullframe.addNotify(); + offscreen = nullframe.createImage(1, 1); + } + + drawSequence(offscreen.getGraphics(), seq, i, i, 0, 0, 1, 1); + return currentColour; + } + + + public Color getColour(String featureType) { return (Color)featureColours.get(featureType); diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index c5789fe..9c3e908 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -40,7 +40,7 @@ public class OverviewPanel // Can set different properties in this seqCanvas than // main visible SeqCanvas SequenceRenderer sr; - //FeatureRenderer fr; + FeatureRenderer fr; Frame nullFrame; @@ -57,10 +57,9 @@ public class OverviewPanel sr = new SequenceRenderer(av); sr.graphics = nullFrame.getGraphics(); sr.renderGaps( false ); - //fr = new FeatureRenderer(av); - //fr.transparency = ap.seqPanel.seqCanvas.getFeatureRenderer().transparency; - //fr.featuresDisplayed = ap.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed; - + fr = new FeatureRenderer(av); + fr.transparency = ap.seqPanel.seqCanvas.getFeatureRenderer().transparency; + fr.featuresDisplayed = ap.seqPanel.seqCanvas.getFeatureRenderer().featuresDisplayed; // scale the initial size of overviewpanel to shape of alignment @@ -245,7 +244,16 @@ public class OverviewPanel lastrow = (int)(row*sampleRow); lastcol = (int)(col*sampleCol); - color = sr.findSequenceColour(av.alignment.getSequenceAt(lastrow), lastcol); + if(av.alignment.getSequenceAt(lastrow).getLength()>lastcol) + { + color = sr.findSequenceColour(av.alignment.getSequenceAt(lastrow), lastcol); + + if (av.showSequenceFeatures) + color = fr.findFeatureColour(color, + av.alignment.getSequenceAt(lastrow), + lastcol); + } + mg.setColor(color); mg.fillRect(col,row,1,1);