git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0b71927
)
JAL-3364 revisions to split frame image export
author
gmungoc
<g.m.carstairs@dundee.ac.uk>
Tue, 30 Jul 2019 11:15:24 +0000
(12:15 +0100)
committer
gmungoc
<g.m.carstairs@dundee.ac.uk>
Tue, 30 Jul 2019 11:15:24 +0000
(12:15 +0100)
src/jalview/gui/AlignmentPanel.java
patch
|
blob
|
history
src/jalview/gui/SeqCanvas.java
patch
|
blob
|
history
src/jalview/renderer/AnnotationRenderer.java
patch
|
blob
|
history
src/jalview/util/ImageMaker.java
patch
|
blob
|
history
diff --git
a/src/jalview/gui/AlignmentPanel.java
b/src/jalview/gui/AlignmentPanel.java
index
5c0d3a1
..
3c86653
100644
(file)
--- a/
src/jalview/gui/AlignmentPanel.java
+++ b/
src/jalview/gui/AlignmentPanel.java
@@
-970,7
+970,8
@@
public class AlignmentPanel extends GAlignmentPanel implements
if (av.isShowAnnotation())
{
if (av.isShowAnnotation())
{
- pagesHigh += getAnnotationPanel().adjustPanelHeight() + 3;
+ pagesHigh += getAnnotationPanel().adjustPanelHeight()
+ + SeqCanvas.SEQS_ANNOTATION_GAP;
}
pagesHigh /= pageHeight;
}
pagesHigh /= pageHeight;
@@
-979,7
+980,7
@@
public class AlignmentPanel extends GAlignmentPanel implements
{
return Printable.NO_SUCH_PAGE;
}
{
return Printable.NO_SUCH_PAGE;
}
- final int alignmentDrawnHeight = (endSeq - startSeq) * charHeight + 3;
+ final int alignmentDrawnHeight = (endSeq - startSeq + 1) * charHeight;
/*
* draw the Scale at horizontal offset, then reset to top left (0, 0)
/*
* draw the Scale at horizontal offset, then reset to top left (0, 0)
@@
-1020,24
+1021,33
@@
public class AlignmentPanel extends GAlignmentPanel implements
* then reset to (0, scale height)
*/
int offset = getAlabels().getScrollOffset();
* then reset to (0, scale height)
*/
int offset = getAlabels().getScrollOffset();
+ int yShift = alignmentDrawnHeight + SeqCanvas.SEQS_ANNOTATION_GAP;
idGraphics.translate(0, -offset);
idGraphics.translate(0, -offset);
- idGraphics.translate(0, alignmentDrawnHeight);
+ idGraphics.translate(0, yShift);
getAlabels().drawComponent(idGraphics, idWidth);
getAlabels().drawComponent(idGraphics, idWidth);
- idGraphics.translate(0, -alignmentDrawnHeight);
+ idGraphics.translate(0, -yShift);
/*
* draw the annotations starting at
* (idOffset, alignmentHeight) from (0, scaleHeight)
*/
alignmentGraphics.translate(alignmentGraphicsOffset,
/*
* draw the annotations starting at
* (idOffset, alignmentHeight) from (0, scaleHeight)
*/
alignmentGraphics.translate(alignmentGraphicsOffset,
- alignmentDrawnHeight);
+ yShift);
getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av,
alignmentGraphics, -1, startRes, endRes + 1);
/*
getAnnotationPanel().renderer.drawComponent(getAnnotationPanel(), av,
alignmentGraphics, -1, startRes, endRes + 1);
/*
- * reset to left margin
+ * reset to left margin below annotation
*/
*/
- alignmentGraphics.translate(-alignmentGraphicsOffset, 0);
+ int justDrawn = getAnnotationPanel().renderer.getLastDrawnHeight();
+ alignmentGraphics.translate(-alignmentGraphicsOffset, justDrawn);
+ }
+ else
+ {
+ /*
+ * shift graphics to position after drawn sequences
+ */
+ alignmentGraphics.translate(0, alignmentDrawnHeight);
}
return Printable.PAGE_EXISTS;
}
return Printable.PAGE_EXISTS;
@@
-1244,10
+1254,7
@@
public class AlignmentPanel extends GAlignmentPanel implements
/*
* append coding complement image
*/
/*
* append coding complement image
*/
- /*
- * to debug location of next write to Graphics
- */
- // graphics.setColor(Color.red);
+ // to debug location of next write to Graphics:
// graphics.drawString("Hello world", 0, 0);
if (av.getCodingComplement().getWrapAlignment())
{
// graphics.drawString("Hello world", 0, 0);
if (av.getCodingComplement().getWrapAlignment())
{
@@
-1281,7
+1288,7
@@
public class AlignmentPanel extends GAlignmentPanel implements
* <ul>
* <li>sequence ids</li>
* <li>scale above, left or right if shown</li>
* <ul>
* <li>sequence ids</li>
* <li>scale above, left or right if shown</li>
- * <li>sequences</li>
+ * <li>sequence rows, plus one spacer line</li>
* <li>annotations, if shown</li>
* </ul>
* The alignment may be in wrapped or unwrapped mode.
* <li>annotations, if shown</li>
* </ul>
* The alignment may be in wrapped or unwrapped mode.
diff --git
a/src/jalview/gui/SeqCanvas.java
b/src/jalview/gui/SeqCanvas.java
index
8a587ea
..
5f67cb5
100755
(executable)
--- a/
src/jalview/gui/SeqCanvas.java
+++ b/
src/jalview/gui/SeqCanvas.java
@@
-450,16
+450,17
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
}
/**
}
/**
- * Draw a wrapped alignment panel for printing
+ * Draws a wrapped alignment panel for printing. After drawing, the graphics
+ * origin is shifted down by the height of the image drawn.
*
* @param g
*
* @param g
- * Graphics object to draw with
+ * Graphics object to draw with
* @param canvasWidth
* @param canvasWidth
- * width of drawing area
+ * width of drawing area
* @param canvasHeight
* @param canvasHeight
- * height of drawing area
+ * height of drawing area
* @param startRes
* @param startRes
- * start residue of print area
+ * start residue of print area
*/
public void drawWrappedPanelForPrinting(Graphics g, int canvasWidth,
int canvasHeight, int startRes)
*/
public void drawWrappedPanelForPrinting(Graphics g, int canvasWidth,
int canvasHeight, int startRes)
@@
-704,11
+705,7
@@
public class SeqCanvas extends JComponent implements ViewportListenerI
// the Printable page which we need to account for here
Shape clip = g.getClip();
// the Printable page which we need to account for here
Shape clip = g.getClip();
- if (clip == null)
- {
- // g.setClip(0, 0, viewportWidth * charWidth, canvasHeight);
- }
- else
+ if (clip != null)
{
g.setClip(0, (int) clip.getBounds().getY(),
viewportWidth * charWidth, (int) clip.getBounds().getHeight());
{
g.setClip(0, (int) clip.getBounds().getY(),
viewportWidth * charWidth, (int) clip.getBounds().getHeight());
diff --git
a/src/jalview/renderer/AnnotationRenderer.java
b/src/jalview/renderer/AnnotationRenderer.java
index
0a4c2d5
..
dcf2f20
100644
(file)
--- a/
src/jalview/renderer/AnnotationRenderer.java
+++ b/
src/jalview/renderer/AnnotationRenderer.java
@@
-419,6
+419,8
@@
public class AnnotationRenderer
boolean rna = false;
boolean rna = false;
+ private int lastDrawnHeight;
+
/**
* Render the annotation rows associated with an alignment.
*
/**
* Render the annotation rows associated with an alignment.
*
@@
-1093,14
+1095,22
@@
public class AnnotationRenderer
System.err.println("Annotation Rendering time:"
+ (System.currentTimeMillis() - stime));
}
System.err.println("Annotation Rendering time:"
+ (System.currentTimeMillis() - stime));
}
- if (!av.getWrapAlignment())
- {
- g.translate(0, y);
- }
+ lastDrawnHeight = y;
return !usedFaded;
}
return !usedFaded;
}
+ /**
+ * Answers the height in pixels of what was drawn on the graphics in the last
+ * call to {@code drawComponent}
+ *
+ * @return
+ */
+ public int getLastDrawnHeight()
+ {
+ return lastDrawnHeight;
+ }
+
public static final Color GLYPHLINE_COLOR = Color.gray;
public static final Color SHEET_COLOUR = Color.green;
public static final Color GLYPHLINE_COLOR = Color.gray;
public static final Color SHEET_COLOUR = Color.green;
diff --git
a/src/jalview/util/ImageMaker.java
b/src/jalview/util/ImageMaker.java
index
099bcee
..
4438de4
100755
(executable)
--- a/
src/jalview/util/ImageMaker.java
+++ b/
src/jalview/util/ImageMaker.java
@@
-20,6
+20,7
@@
*/
package jalview.util;
*/
package jalview.util;
+import jalview.bin.Cache;
import jalview.bin.Jalview;
import jalview.gui.EPSOptions;
import jalview.gui.IProgressIndicator;
import jalview.bin.Jalview;
import jalview.gui.EPSOptions;
import jalview.gui.IProgressIndicator;
@@
-60,8
+61,6
@@
public class ImageMaker
EpsGraphics2D pg;
EpsGraphics2D pg;
- SVGGraphics2D g2;
-
Graphics graphics;
FileOutputStream out;
Graphics graphics;
FileOutputStream out;
@@
-291,15
+290,13
@@
public class ImageMaker
void setupSVG(int width, int height, String title)
{
void setupSVG(int width, int height, String title)
{
+ Graphics2D svgGraphics = new SVGGraphics2D(width, height);
- g2 = new SVGGraphics2D(width, height);
- Graphics2D ig2 = g2;
-
- String renderStyle = jalview.bin.Cache.getDefault("SVG_RENDERING",
+ String renderStyle = Cache.getDefault("SVG_RENDERING",
"Prompt each time");
// If we need to prompt, and if the GUI is visible then
"Prompt each time");
// If we need to prompt, and if the GUI is visible then
- // Prompt for EPS rendering style
+ // Prompt for SVG rendering style
if (renderStyle.equalsIgnoreCase("Prompt each time")
&& !(System.getProperty("java.awt.headless") != null && System
.getProperty("java.awt.headless").equals("true")))
if (renderStyle.equalsIgnoreCase("Prompt each time")
&& !(System.getProperty("java.awt.headless") != null && System
.getProperty("java.awt.headless").equals("true")))
@@
-317,13
+314,13
@@
public class ImageMaker
if (renderStyle.equalsIgnoreCase("Lineart"))
{
if (renderStyle.equalsIgnoreCase("Lineart"))
{
- ig2.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
+ svgGraphics.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE,
SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
}
setProgressMessage(MessageManager
.formatMessage("status.export_complete", type.getName()));
SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
}
setProgressMessage(MessageManager
.formatMessage("status.export_complete", type.getName()));
- graphics = g2;
+ graphics = svgGraphics;
}
static JalviewFileChooser getPNGChooser()
}
static JalviewFileChooser getPNGChooser()