X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FSequenceRenderer.java;h=57cd0fc93c2b0aaa5188066818cf668517c49d69;hb=0705a85fe0a3d391e5aba360340a0c342c898366;hp=81daef79b7122b9b1a00e0f8b9b1bb830cff41fd;hpb=4377073e4bb83612169bf0565e1561b872b069e6;p=jalview.git diff --git a/src/jalview/gui/SequenceRenderer.java b/src/jalview/gui/SequenceRenderer.java index 81daef7..57cd0fc 100755 --- a/src/jalview/gui/SequenceRenderer.java +++ b/src/jalview/gui/SequenceRenderer.java @@ -24,7 +24,6 @@ import jalview.schemes.*; import java.awt.*; - /** * DOCUMENT ME! * @@ -61,22 +60,27 @@ public class SequenceRenderer renderGaps = b; } - /** - * DOCUMENT ME! - * - * @param cs DOCUMENT ME! - * @param seq DOCUMENT ME! - * @param i DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Color getResidueBoxColour(ColourSchemeI cs, SequenceI seq, int i) + + public Color getResidueBoxColour(SequenceI seq, int i) { - getBoxColour(cs, seq, i); + allGroups = av.alignment.findAllGroups(seq); - return resBoxColour; + if (inCurrentSequenceGroup(i)) + { + if (currentSequenceGroup.getDisplayBoxes()) + { + getBoxColour(currentSequenceGroup.cs, seq, i); + } + } + else if (av.getShowBoxes()) + { + getBoxColour(av.globalColourScheme, seq, i); + } + + return resBoxColour; } + /** * DOCUMENT ME! * @@ -133,61 +137,62 @@ public class SequenceRenderer * @param width DOCUMENT ME! * @param height DOCUMENT ME! */ - public void drawBoxes(SequenceI seq, int start, int end, int x1, int y1, + public synchronized void drawBoxes(SequenceI seq, int start, int end, int x1, int y1, int width, int height) { - int i = start; - int length = seq.getLength(); + int i = start; + int length = seq.getLength(); - int curStart = -1; - int curWidth = width; + int curStart = -1; + int curWidth = width; - Color tempColour = null; + Color tempColour = null; - while (i <= end) - { - resBoxColour = Color.white; + while (i <= end) + { + resBoxColour = Color.white; - if (i < length) + if (i < length) + { + if (inCurrentSequenceGroup(i)) { - if (inCurrentSequenceGroup(i)) + if (currentSequenceGroup.getDisplayBoxes()) { - if (currentSequenceGroup.getDisplayBoxes()) - { - getBoxColour(currentSequenceGroup.cs, seq, i); - } + getBoxColour(currentSequenceGroup.cs, seq, i); } - else if (av.getShowBoxes()) - { - getBoxColour(av.getGlobalColourScheme(), seq, i); - } - + } + else if (av.getShowBoxes()) + { + getBoxColour(av.globalColourScheme, seq, i); } - if (resBoxColour != tempColour) - { - if (tempColour != null) - { - graphics.fillRect(x1 + (width * (curStart - start)), y1, - curWidth, height); - } + } - graphics.setColor(resBoxColour); + if (resBoxColour != tempColour) + { + if (tempColour != null) + { + graphics.fillRect(x1 + (width * (curStart - start)), y1, + curWidth, height); + } - curStart = i; - curWidth = width; - tempColour = resBoxColour; - } - else - { - curWidth += width; - } + graphics.setColor(resBoxColour); - i++; - } + curStart = i; + curWidth = width; + tempColour = resBoxColour; + } + else + { + curWidth += width; + } + + i++; + } + + graphics.fillRect(x1 + (width * (curStart - start)), y1, curWidth, + height); - graphics.fillRect(x1 + (width * (curStart - start)), y1, curWidth, - height); } /** @@ -208,6 +213,7 @@ public class SequenceRenderer int charOffset = 0; char s; + // Need to find the sequence position here. String sequence = seq.getSequence(); @@ -247,7 +253,7 @@ public class SequenceRenderer if (av.getColourText()) { - getBoxColour(av.getGlobalColourScheme(), seq, i); + getBoxColour(av.globalColourScheme, seq, i); if (av.getShowBoxes()) { @@ -262,7 +268,8 @@ public class SequenceRenderer charOffset = (width - fm.charWidth(s)) / 2; graphics.drawString(String.valueOf(s), - charOffset + x1 + (width * (i - start)), (y1 + height) - pady); + charOffset + x1 + (int)(width * (i - start)), (y1 + height) - pady); + } }