X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FSequenceRenderer.java;h=5c3ee125fe87197e2d8847b43436d569cebbdd89;hb=017eb4e099ff9c7c8982886ece642da1cecb1061;hp=0c1bfdc7b13e4bd4c8975ca794f653f220e2d58e;hpb=e3e1a1e33aa59fd2648b466aae2b965b9bca3fbb;p=jalview.git diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 0c1bfdc..5c3ee12 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -2,13 +2,27 @@ package jalview.gui; import jalview.datamodel.*; import jalview.schemes.*; - import java.awt.*; import java.util.*; public class SequenceRenderer implements RendererI { + AlignViewport av; FontMetrics fm; + boolean renderGaps = true; + SequenceGroup currentSequenceGroup = null; + Color color; + + public SequenceRenderer(AlignViewport av) + { + this.av = av; + } + + + public void renderGaps(boolean b) + { + renderGaps = b; + } public Color getResidueBoxColour(ColourSchemeI cs, SequenceI seq, int i) { @@ -20,21 +34,18 @@ public class SequenceRenderer implements RendererI return c; } + public void drawSequence(Graphics g,SequenceI seq,SequenceGroup sg, int start, int end, int x1, int y1, int width, int height, Vector pid, int seqnum) + { + currentSequenceGroup = sg; - public void drawSequence(Graphics g,ColourSchemeI cs,SequenceI seq,int start, int end, int x1, int y1, double width, int height,boolean showScores, boolean displayBoxes, boolean displayText, boolean colourText,Vector freq, int seqnum) { - + drawBoxes(g, seq, start, end, x1, y1, (int) width, height, pid); - if (displayBoxes) - drawBoxes(g,cs,seq,start,end,x1,y1,(int)width, height,freq); + fm = g.getFontMetrics(); + drawText(g,seq,start,end,x1,y1,(int)width,height); - if (displayText) - { - fm = g.getFontMetrics(); - drawText(g,cs,colourText,seq,start,end,x1,y1,(int)width,height); - } } - public void drawBoxes(Graphics g,ColourSchemeI cs, SequenceI seq,int start, int end, int x1, int y1, int width, int height,Vector freq) { + public void drawBoxes(Graphics g, SequenceI seq,int start, int end, int x1, int y1, int width, int height,Vector freq) { int i = start; int length = seq.getLength(); @@ -45,8 +56,18 @@ public class SequenceRenderer implements RendererI // int threshold = 80; - while (i <= end && i < length) { - Color c = getResidueBoxColour(cs,seq,i); + while (i <= end && i < length) + { + color = color.white; + + if(inCurrentSequenceGroup(i)) + { + if( currentSequenceGroup.getDisplayBoxes()) + color = getResidueBoxColour(currentSequenceGroup.cs, seq, i); + } + else if(av.getShowBoxes()) + color = getResidueBoxColour(av.getGlobalColourScheme(), seq, i); + // Hashtable hash = (Hashtable)freq.elementAt(i-start); // String s = (String)hash.get("maxResidue"); @@ -76,12 +97,12 @@ public class SequenceRenderer implements RendererI } }*/ - if (c != currentColor || c != null) + if (color != currentColor || color != null) { g.fillRect(x1+width*(curStart-start),y1,curWidth,height); - currentColor = c; - g.setColor(c); + currentColor = color; + g.setColor(color); curStart = i; curWidth = width; @@ -94,7 +115,7 @@ public class SequenceRenderer implements RendererI g.fillRect(x1+width*(curStart-start),y1,curWidth,height); } - public void drawText(Graphics g, ColourSchemeI cs, boolean colText, SequenceI seq,int start, int end, int x1, int y1, int width, int height) + public void drawText(Graphics g, SequenceI seq,int start, int end, int x1, int y1, int width, int height) { int pady = height/5; int charOffset=0; @@ -104,24 +125,67 @@ public class SequenceRenderer implements RendererI // Need to find the sequence position here. for (int i = start; i <= end; i++) { - if (i < end && i < seq.getLength()) - s = seq.getSequence().charAt(i); - else if(i=res)?true:false; + } + public void drawHighlightedText(Graphics g, SequenceI seq,int start, int end, int x1, int y1, int width, int height) + { + int pady = height/5; + int charOffset=0; + g.setColor(Color.BLACK); + g.fillRect(x1,y1,width*(end-start+1),height); + g.setColor(Color.white); + char s='~'; + // Need to find the sequence position here. + for (int i = start; i <= end; i++) + { + if(i