From 61e0e9704ff9fafba47480445fd5a38b82024b0d Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 5 Jun 2017 21:49:14 +0100 Subject: [PATCH] JAL-2590 patch for rendering eggnog trees with polytomies (also see --- src/jalview/appletgui/TreeCanvas.java | 7 ++++--- src/jalview/gui/TreeCanvas.java | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/jalview/appletgui/TreeCanvas.java b/src/jalview/appletgui/TreeCanvas.java index 48e9d64..272a2b3 100755 --- a/src/jalview/appletgui/TreeCanvas.java +++ b/src/jalview/appletgui/TreeCanvas.java @@ -261,10 +261,11 @@ public class TreeCanvas extends Panel implements MouseListener, g.fillRect(xend - 2, ypos - 2, 4, 4); } - int ystart = (int) (((SequenceNode) node.left()).ycount * chunk) - + offy; - int yend = (int) (((SequenceNode) node.right()).ycount * chunk) + int ystart = (int) (node.left() == null ? 0 : (((SequenceNode) node + .left()).ycount * chunk)) + offy; + int yend = (int) (node.right() == null ? 0 : (((SequenceNode) node + .right()).ycount * chunk)) + offy; Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5); nodeHash.put(node, pos); diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index 3494fb8..e60ac8e 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -332,9 +332,10 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, g.fillRect(xend - 2, ypos - 2, 4, 4); } - int ystart = (int) (((SequenceNode) node.left()).ycount * chunk) - + offy; - int yend = (int) (((SequenceNode) node.right()).ycount * chunk) + int ystart = (node.left() == null ? 0 : (int) (((SequenceNode) node + .left()).ycount * chunk)) + offy; + int yend = (node.right() == null ? 0 : (int) (((SequenceNode) node + .right()).ycount * chunk)) + offy; Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5); -- 1.7.10.2