X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FSeqCanvas.java;h=eaa3a501251888160f22220e98b25ebb348ba858;hb=ad15cff29620f960119f80176f1fd443da9f6763;hp=c7a82326607d81b6e4ffdf6fee738fa46f6080d0;hpb=b81d4d7d46ea8b1c89df086fb847baab6b69d427;p=jalview.git diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index c7a8232..eaa3a50 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -1,25 +1,35 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.appletgui; -import java.awt.*; +import jalview.datamodel.AlignmentI; +import jalview.datamodel.SearchResults; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; -import jalview.datamodel.*; +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Panel; public class SeqCanvas extends Panel { @@ -348,7 +358,7 @@ public class SeqCanvas extends Panel String mask = "0"; int maxWidth = 0; int tmp; - AlignmentI alignment=av.getAlignment(); + AlignmentI alignment = av.getAlignment(); for (int i = 0; i < alignment.getHeight(); i++) { tmp = alignment.getSequenceAt(i).getEnd(); @@ -507,49 +517,52 @@ public class SeqCanvas extends Panel void drawPanel(Graphics g1, int startRes, int endRes, int startSeq, int endSeq, int offset) { + + if (!av.hasHiddenColumns()) { draw(g1, startRes, endRes, startSeq, endSeq, offset); } else { - java.util.Vector regions = av.getColumnSelection().getHiddenColumns(); int screenY = 0; int blockStart = startRes; int blockEnd = endRes; - for (int i = 0; i < regions.size(); i++) + if (av.hasHiddenColumns()) { - int[] region = (int[]) regions.elementAt(i); - int hideStart = region[0]; - int hideEnd = region[1]; - - if (hideStart <= blockStart) + for (int[] region : av.getColumnSelection().getHiddenColumns()) { - blockStart += (hideEnd - hideStart) + 1; - continue; - } + int hideStart = region[0]; + int hideEnd = region[1]; + + if (hideStart <= blockStart) + { + blockStart += (hideEnd - hideStart) + 1; + continue; + } - blockEnd = hideStart - 1; + blockEnd = hideStart - 1; - g1.translate(screenY * av.charWidth, 0); + g1.translate(screenY * av.charWidth, 0); - draw(g1, blockStart, blockEnd, startSeq, endSeq, offset); + draw(g1, blockStart, blockEnd, startSeq, endSeq, offset); - if (av.getShowHiddenMarkers()) - { - g1.setColor(Color.blue); - g1.drawLine((blockEnd - blockStart + 1) * av.charWidth - 1, - 0 + offset, (blockEnd - blockStart + 1) * av.charWidth - - 1, (endSeq - startSeq) * av.charHeight + offset); - } + if (av.getShowHiddenMarkers()) + { + g1.setColor(Color.blue); + g1.drawLine((blockEnd - blockStart + 1) * av.charWidth - 1, + 0 + offset, (blockEnd - blockStart + 1) * av.charWidth + - 1, (endSeq - startSeq) * av.charHeight + + offset); + } - g1.translate(-screenY * av.charWidth, 0); - screenY += blockEnd - blockStart + 1; - blockStart = hideEnd + 1; + g1.translate(-screenY * av.charWidth, 0); + screenY += blockEnd - blockStart + 1; + blockStart = hideEnd + 1; + } } - if (screenY <= (endRes - startRes)) { blockEnd = blockStart + (endRes - startRes) - screenY; @@ -586,7 +599,7 @@ public class SeqCanvas extends Panel sr.drawSequence(nextSeq, av.getAlignment().findAllGroups(nextSeq), startRes, endRes, offset + ((i - startSeq) * av.charHeight)); - if (av.showSequenceFeatures) + if (av.isShowSequenceFeatures()) { fr.drawSequence(g, nextSeq, startRes, endRes, offset + ((i - startSeq) * av.charHeight)); @@ -643,7 +656,7 @@ public class SeqCanvas extends Panel if ((group == null) && (av.getAlignment().getGroups().size() > 0)) { - group = (SequenceGroup) av.getAlignment().getGroups().get(0); + group = av.getAlignment().getGroups().get(0); groupIndex = 0; } @@ -675,7 +688,8 @@ public class SeqCanvas extends Panel { if ((bottom == -1) && (i >= alHeight || !group.getSequences(null) - .contains(av.getAlignment().getSequenceAt(i + 1)))) + .contains( + av.getAlignment().getSequenceAt(i + 1)))) { bottom = sy + av.charHeight; } @@ -799,8 +813,8 @@ public class SeqCanvas extends Panel break; } - group = (SequenceGroup) av.getAlignment().getGroups().get( - groupIndex); + group = av.getAlignment().getGroups() + .get(groupIndex); } while (groupIndex < av.getAlignment().getGroups().size()); }