From: gmungoc Date: Sun, 14 Jul 2019 14:14:23 +0000 (+0100) Subject: JAL-3364 initial version of export split frame X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=5321ea8cd291cb631b903a3860476f0430e2fe5a JAL-3364 initial version of export split frame --- diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 92b9a50..b554343 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -1151,7 +1151,7 @@ public class AlignmentPanel extends GAlignmentPanel implements void makeAlignmentImage(jalview.util.ImageMaker.TYPE type, File file) { - int boarderBottomOffset = 5; + int borderBottomOffset = 5; long pSessionId = System.currentTimeMillis(); headless = (System.getProperty("java.awt.headless") != null && System.getProperty("java.awt.headless").equals("true")); @@ -1166,7 +1166,9 @@ public class AlignmentPanel extends GAlignmentPanel implements } try { - AlignmentDimension aDimension = getAlignmentDimension(); + // todo splitFrame a parameter (optional menu item choice) + boolean splitFrame = av.getCodingComplement() != null; + AlignmentDimension aDimension = getAlignmentDimension(splitFrame); try { jalview.util.ImageMaker im; @@ -1188,30 +1190,48 @@ public class AlignmentPanel extends GAlignmentPanel implements } im = new jalview.util.ImageMaker(this, type, imageAction, - aDimension.getWidth(), - aDimension.getHeight() + boarderBottomOffset, file, + aDimension.width, aDimension.height + borderBottomOffset, + file, imageTitle, alignFrame, pSessionId, headless); Graphics graphics = im.getGraphics(); - if (av.getWrapAlignment()) + if (graphics != null) { - if (graphics != null) + if (av.getWrapAlignment()) { - printWrappedAlignment(aDimension.getWidth(), - aDimension.getHeight() + boarderBottomOffset, 0, + printWrappedAlignment(aDimension.width, + aDimension.height + borderBottomOffset, 0, graphics); - im.writeImage(); } - } - else - { - if (graphics != null) + else { - printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0, + printUnwrapped(aDimension.width, aDimension.height, 0, graphics, graphics); - im.writeImage(); } - } + if (splitFrame) + { + /* + * append coding complement image + * todo: always top frame first! + */ + int h = getAlignmentDimension(false).height; + graphics.translate(0, h); + AlignmentPanel comp = ((AlignViewport) av.getCodingComplement()) + .getAlignPanel(); + if (av.getCodingComplement().getWrapAlignment()) + { + comp.printWrappedAlignment(aDimension.width, + aDimension.height + borderBottomOffset, 0, graphics); + } + else + { + comp.printUnwrapped(aDimension.width, aDimension.height, 0, + graphics, graphics); + } + } + + im.writeImage(); + } } catch (OutOfMemoryError err) { // Be noisy here. @@ -1229,7 +1249,55 @@ public class AlignmentPanel extends GAlignmentPanel implements } } - public AlignmentDimension getAlignmentDimension() + /** + * Computes and answers the width and height of the alignment in pixels, + * including + *