/** * * @param line1 * @param x1 * @param y1 * @param line2 * @param x2 * @param y2 * @return Returns a <code>PolyLine</code> */ protected PolyLine bridge(PolyLine line1, double x1, double y1, PolyLine line2, double x2, double y2) { double dy, dx, s; PolyLine r; dx = x2 + line2.dx - x1; if (line2.dx == 0) { dy = line2.dy; } else { s = dx * line2.dy; dy = s / line2.dx; } r = new PolyLine(dx, dy, line2.link); line1.link = new PolyLine(0, y2 + line2.dy - dy - y1, r); return r; }
/** * Attaches the specified tree node in a parent-child relationship taking * into account node shape * * @param t * the internal tree node */ protected void attachParent(CompactTreeNode t, double h) { final double x; double y1; final double y2; x = nodeDistance + levelDistance; y2 = (h - t.width) / 2 - nodeDistance; y1 = y2 + t.width + 2 * nodeDistance - h; t.child.offsetX = x + t.height; t.child.offsetY = y1; t.contour.upperHead = new PolyLine(t.height, 0, new PolyLine(x, y1, t.contour.upperHead)); t.contour.lowerHead = new PolyLine(t.height, 0, new PolyLine(x, y2, t.contour.lowerHead)); }
/** * Laids out a tree node as a leaf, taking into account node shape * * @param t * the node to be laid out */ protected void layoutLeaf(CompactTreeNode t) { t.contour.upperTail = new PolyLine(t.height + 2 * nodeDistance, 0, null); t.contour.upperHead = t.contour.upperTail; t.contour.lowerTail = new PolyLine(0, -t.width - 2 * nodeDistance, null); t.contour.lowerHead = new PolyLine(t.height + 2 * nodeDistance, 0, t.contour.lowerTail); }