X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAlignmentPanel.java;h=e61b042728f4735e45ab91592db20f2ae4817703;hb=b2b7e99113e1f0962140fc72d989cc826799a2d4;hp=65546556e218a42f45c4c4bb2f7bc80d46cf1294;hpb=608282e79f4dd02c92565235b7946265bdca847d;p=jalview.git diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 6554655..e61b042 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -25,7 +25,7 @@ import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; import jalview.bin.Cache; import jalview.datamodel.AlignmentI; -import jalview.datamodel.SearchResults; +import jalview.datamodel.SearchResultsI; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; @@ -297,7 +297,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * Highlight the given results on the alignment. * */ - public void highlightSearchResults(SearchResults results) + public void highlightSearchResults(SearchResultsI results) { scrollToPosition(results); getSeqPanel().seqCanvas.highlightSearchResults(results); @@ -309,7 +309,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * * @param results */ - public boolean scrollToPosition(SearchResults results) + public boolean scrollToPosition(SearchResultsI results) { return scrollToPosition(results, 0, true, false); } @@ -322,7 +322,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * @param redrawOverview * @return */ - public boolean scrollToPosition(SearchResults searchResults, + public boolean scrollToPosition(SearchResultsI searchResults, boolean redrawOverview) { return scrollToPosition(searchResults, 0, redrawOverview, false); @@ -342,7 +342,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * if true, try to centre the search results horizontally in the view * @return false if results were not found */ - public boolean scrollToPosition(SearchResults results, + public boolean scrollToPosition(SearchResultsI results, int verticalOffset, boolean redrawOverview, boolean centre) { int startv, endv, starts, ends; @@ -1062,7 +1062,7 @@ public class AlignmentPanel extends GAlignmentPanel implements + 3; /* - * draw the Scale at horizontal offset, then reset to origin + * draw the Scale at horizontal offset, then reset to top left (0, 0) */ alignmentGraphics.translate(alignmentGraphicsOffset, 0); getScalePanel().drawScale(alignmentGraphics, startRes, endRes, @@ -1071,7 +1071,7 @@ public class AlignmentPanel extends GAlignmentPanel implements /* * Draw the sequence ids, offset for scale height, - * then reset to origin + * then reset to top left (0, 0) */ idGraphics.translate(0, scaleHeight); idGraphics.setFont(getIdPanel().getIdCanvas().getIdfont()); @@ -1122,7 +1122,7 @@ public class AlignmentPanel extends GAlignmentPanel implements /* * draw the sequences, offset for scale height, and id width (if using a - * single graphics context), then reset to origin + scale height + * single graphics context), then reset to (0, scale height) */ alignmentGraphics.translate(alignmentGraphicsOffset, scaleHeight); getSeqPanel().seqCanvas.drawPanel(alignmentGraphics, startRes, endRes, @@ -1132,16 +1132,19 @@ public class AlignmentPanel extends GAlignmentPanel implements if (av.isShowAnnotation() && (endSeq == alignmentHeight)) { /* - * draw annotation labels, offset for current scroll position - * then reset to origin + scale height + * draw annotation labels; drawComponent() translates by + * getScrollOffset(), so compensate for that first; + * then reset to (0, scale height) */ - int offset = -getAlabels().getScrollOffset(); - idGraphics.translate(0, offset + alignmentDrawnHeight); + int offset = getAlabels().getScrollOffset(); + idGraphics.translate(0, -offset); + idGraphics.translate(0, alignmentDrawnHeight); getAlabels().drawComponent(idGraphics, idWidth); - idGraphics.translate(0, -offset - alignmentDrawnHeight); + idGraphics.translate(0, -alignmentDrawnHeight); /* - * draw the annotations + * draw the annotations starting at + * (idOffset, alignmentHeight) from (0, scaleHeight) */ alignmentGraphics.translate(alignmentGraphicsOffset, alignmentDrawnHeight); getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av, @@ -1296,8 +1299,8 @@ public class AlignmentPanel extends GAlignmentPanel implements if (onscreen || (idwidth = Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH")) == null) { - return (getIdPanel().getWidth() > 0 ? getIdPanel().getWidth() - : calculateIdWidth().width + 4); + int w = getIdPanel().getWidth(); + return (w > 0 ? w : calculateIdWidth().width + 4); } return idwidth.intValue() + 4; } @@ -1445,7 +1448,7 @@ public class AlignmentPanel extends GAlignmentPanel implements public void makePNGImageMap(File imgMapFile, String imageName) { - // /////ONLY WORKS WITH NONE WRAPPED ALIGNMENTS + // /////ONLY WORKS WITH NON WRAPPED ALIGNMENTS // //////////////////////////////////////////// int idWidth = getVisibleIdWidth(false); FontMetrics fm = getFontMetrics(av.getFont()); @@ -1459,7 +1462,6 @@ public class AlignmentPanel extends GAlignmentPanel implements { int s, sSize = av.getAlignment().getHeight(), res, alwidth = av .getAlignment().getWidth(), g, gSize, f, fSize, sy; - StringBuffer text = new StringBuffer(); PrintWriter out = new PrintWriter(new FileWriter(imgMapFile)); out.println(jalview.io.HTMLOutput.getImageMapHTML()); out.println(" res) { - text.append("
" + groups[g].getName() + ""); + text.append("
").append(groups[g].getName()) + .append(""); } } @@ -1518,12 +1522,13 @@ public class AlignmentPanel extends GAlignmentPanel implements { if (text.length() < 1) { - text.append("= seq.findPosition(res))) { - if (features[f].getType().equals("disulfide bond")) + if (features[f].isContactFeature()) { if (features[f].getBegin() == seq.findPosition(res) || features[f].getEnd() == seq .findPosition(res)) { - text.append("
disulfide bond " - + features[f].getBegin() + ":" - + features[f].getEnd()); + text.append("
").append(features[f].getType()) + .append(" ").append(features[f].getBegin()) + .append(":").append(features[f].getEnd()); } } else @@ -1551,13 +1556,13 @@ public class AlignmentPanel extends GAlignmentPanel implements && !features[f].getType().equals( features[f].getDescription())) { - text.append(" " + features[f].getDescription()); + text.append(" ").append(features[f].getDescription()); } if (features[f].getValue("status") != null) { - text.append(" (" + features[f].getValue("status") - + ")"); + text.append(" (").append(features[f].getValue("status")) + .append(")"); } } } @@ -1822,14 +1827,14 @@ public class AlignmentPanel extends GAlignmentPanel implements * @param verticalOffset * the number of visible sequences to show above the mapped region */ - public void scrollToCentre(SearchResults sr, int verticalOffset) + public void scrollToCentre(SearchResultsI sr, int verticalOffset) { /* * To avoid jumpy vertical scrolling (if some sequences are gapped or not * mapped), we can make the scroll-to location a sequence above the one * actually mapped. */ - SequenceI mappedTo = sr.getResultSequence(0); + SequenceI mappedTo = sr.getResults().get(0).getSequence(); List seqs = av.getAlignment().getSequences(); /*