From: Jim Procter Date: Mon, 5 Jun 2017 20:49:14 +0000 (+0100) Subject: JAL-2590 patch for rendering eggnog trees with polytomies (also see X-Git-Tag: Release_2_10_2~3^2~24^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=61e0e9704ff9fafba47480445fd5a38b82024b0d;p=jalview.git JAL-2590 patch for rendering eggnog trees with polytomies (also see --- 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);