/** * Starts the actual compact tree layout algorithm * at the given node. */ protected void layout(TreeNode node) { if (node != null) { TreeNode child = node.child; while (child != null) { layout(child); child = child.next; } if (node.child != null) { attachParent(node, join(node)); } else { layoutLeaf(node); } } }
/** * */ protected void layoutLeaf(TreeNode node) { double dist = 2 * nodeDistance; node.contour.upperTail = createLine(node.height + dist, 0, null); node.contour.upperHead = node.contour.upperTail; node.contour.lowerTail = createLine(0, -node.width - dist, null); node.contour.lowerHead = createLine(node.height + dist, 0, node.contour.lowerTail); }
/** * */ protected mxRectangle horizontalLayout(TreeNode node, double x0, double y0, mxRectangle bounds) { node.x += x0 + node.offsetX; node.y += y0 + node.offsetY; bounds = apply(node, bounds); TreeNode child = node.child; if (child != null) { bounds = horizontalLayout(child, node.x, node.y, bounds); double siblingOffset = node.y + child.offsetY; TreeNode s = child.next; while (s != null) { bounds = horizontalLayout(s, node.x + child.offsetX, siblingOffset, bounds); siblingOffset += s.offsetY; s = s.next; } } return bounds; }
List<Object> roots = findTreeRoots(parent, invert); if (!isVertexIgnored(roots.get(i)) && graph.getEdges(roots.get(i), null, invert, !invert, false).length > 0) TreeNode node = dfs(root, parent, null); layout(node); mxRectangle g = getVertexBounds(root); bounds = horizontalLayout(node, x0, y0, null); bounds = verticalLayout(node, null, x0, y0, null); moveNode(node, dx, dy); adjustParents(); localEdgeProcessing(node);
if (cell != null && !visited.contains(cell) && !isVertexIgnored(cell)) node = createNode(cell); if (!isEdgeIgnored(edge)) setEdgePoints(edge, null); setEdgeStyleEnabled(edge, false); setEdgePoints(edge, null); .getVisibleTerminal(invert) : view .getVisibleTerminal(edge, invert); TreeNode tmp = dfs(target, parent, visited);
layout.setLevelDistance(40); layout.setNodeDistance(30); layout.setEdgeRouting(false); layout.setUseBoundingBox(false); layout.execute(graph.getDefaultParent());
/** * */ protected mxRectangle verticalLayout(TreeNode node, Object parent, double x0, double y0, mxRectangle bounds) { node.x += x0 + node.offsetY; node.y += y0 + node.offsetX; bounds = apply(node, bounds); TreeNode child = node.child; if (child != null) { bounds = verticalLayout(child, node, node.x, node.y, bounds); double siblingOffset = node.x + child.offsetY; TreeNode s = child.next; while (s != null) { bounds = verticalLayout(s, node, siblingOffset, node.y + child.offsetX, bounds); siblingOffset += s.offsetY; s = s.next; } } return bounds; }
public void execute(Object parent) { super.execute(parent); execute(parent, null); }
/** * Adjust parent cells whose child geometries have changed. The default * implementation adjusts the group to just fit around the children with * a padding. */ protected void adjustParents() { arrangeGroups(mxUtils.sortCells(this.parentsChanged, true).toArray(), groupPadding); }
List<Object> roots = findTreeRoots(parent, invert); if (!isVertexIgnored(roots.get(i)) && graph.getEdges(roots.get(i), null, invert, !invert, false).length > 0) TreeNode node = dfs(root, parent, null); layout(node); mxRectangle g = getVertexBounds(root); bounds = horizontalLayout(node, x0, y0, null); bounds = verticalLayout(node, null, x0, y0, null); moveNode(node, dx, dy); adjustParents(); localEdgeProcessing(node);
if (cell != null && !visited.contains(cell) && !isVertexIgnored(cell)) node = createNode(cell); if (!isEdgeIgnored(edge)) setEdgePoints(edge, null); setEdgeStyleEnabled(edge, false); setEdgePoints(edge, null); .getVisibleTerminal(invert) : view .getVisibleTerminal(edge, invert); TreeNode tmp = dfs(target, parent, visited);
/** * */ protected mxRectangle horizontalLayout(TreeNode node, double x0, double y0, mxRectangle bounds) { node.x += x0 + node.offsetX; node.y += y0 + node.offsetY; bounds = apply(node, bounds); TreeNode child = node.child; if (child != null) { bounds = horizontalLayout(child, node.x, node.y, bounds); double siblingOffset = node.y + child.offsetY; TreeNode s = child.next; while (s != null) { bounds = horizontalLayout(s, node.x + child.offsetX, siblingOffset, bounds); siblingOffset += s.offsetY; s = s.next; } } return bounds; }
/** * */ protected mxRectangle verticalLayout(TreeNode node, Object parent, double x0, double y0, mxRectangle bounds) { node.x += x0 + node.offsetY; node.y += y0 + node.offsetX; bounds = apply(node, bounds); TreeNode child = node.child; if (child != null) { bounds = verticalLayout(child, node, node.x, node.y, bounds); double siblingOffset = node.x + child.offsetY; TreeNode s = child.next; while (s != null) { bounds = verticalLayout(s, node, siblingOffset, node.y + child.offsetX, bounds); siblingOffset += s.offsetY; s = s.next; } } return bounds; }
public void execute(Object parent) { super.execute(parent); execute(parent, null); }
/** * Adjust parent cells whose child geometries have changed. The default * implementation adjusts the group to just fit around the children with * a padding. */ protected void adjustParents() { arrangeGroups(mxUtils.sortCells(this.parentsChanged, true).toArray(), groupPadding); }
/** * Starts the actual compact tree layout algorithm * at the given node. */ protected void layout(TreeNode node) { if (node != null) { TreeNode child = node.child; while (child != null) { layout(child); child = child.next; } if (node.child != null) { attachParent(node, join(node)); } else { layoutLeaf(node); } } }