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"));
}
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;
}
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.
}
}
- public AlignmentDimension getAlignmentDimension()
+ /**
+ * Computes and answers the width and height of the alignment in pixels,
+ * including
+ * <ul>
+ * <li>sequence ids</li>
+ * <li>scale above, left or right if shown</li>
+ * <li>sequences</li>
+ * <li>annotations, if shown</li> The alignment may be in wrapped or unwrapped
+ * mode.
+ * <ul>
+ *
+ * @param splitFrame
+ * if true, the combined dimensions of a split frame view
+ * are computed: the sum of the two alignments' heights, and
+ * the larger of their widths. Any additional height (e.g.
+ * for frame titles) should be added separately.
+ * @return
+ */
+ public AlignmentDimension getAlignmentDimension(boolean splitFrame)
+ {
+ AlignmentDimension d1 = getAlignmentDimension();
+ if (!splitFrame)
+ {
+ return d1;
+ }
+ AlignmentPanel comp = ((AlignViewport) av.getCodingComplement())
+ .getAlignPanel();
+ AlignmentDimension d2 = comp.getAlignmentDimension();
+
+ int h = d1.height + d2.height;
+ int w = Math.max(d1.width, d2.width);
+
+ return new AlignmentDimension(w, h);
+ }
+
+ /**
+ * Computes and answers the width and height of the alignment in pixels,
+ * including
+ * <ul>
+ * <li>sequence ids</li>
+ * <li>scale above, left or right if shown</li>
+ * <li>sequences</li>
+ * <li>annotations, if shown</li> The alignment may be in wrapped or unwrapped
+ * mode.
+ * <ul>
+ *
+ * @return
+ */
+ AlignmentDimension getAlignmentDimension()
{
int maxwidth = av.getAlignment().getVisibleWidth();
{
height += getAnnotationPanel().adjustPanelHeight() + 3;
}
- return new AlignmentDimension(width, height);
+ return new AlignmentDimension(width, height);
}
/**
setProgressMessage(null);
setProgressMessage(MessageManager.formatMessage(
"status.exporting_alignment_as_x_file", "HTML"));
- AlignmentDimension aDimension = ap.getAlignmentDimension();
+ AlignmentDimension aDimension = ap.getAlignmentDimension(false);
SVGGraphics2D idPanelGraphics = new SVGGraphics2D(
- aDimension.getWidth(), aDimension.getHeight());
+ aDimension.width, aDimension.height);
SVGGraphics2D alignPanelGraphics = new SVGGraphics2D(
- aDimension.getWidth(), aDimension.getHeight());
+ aDimension.width, aDimension.height);
String renderStyle = jalview.bin.Cache.getDefault("HTML_RENDERING",
"Prompt each time");
}
if (ap.av.getWrapAlignment())
{
- printWrapped(aDimension.getWidth(), aDimension.getHeight(), 0,
+ printWrapped(aDimension.width, aDimension.height, 0,
alignPanelGraphics);
}
else
{
- printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0,
+ printUnwrapped(aDimension.width, aDimension.height, 0,
idPanelGraphics, alignPanelGraphics);
}