Skip to content

Commit

Permalink
Nodes define their own width and height even in case no approximator …
Browse files Browse the repository at this point in the history
…is set(#1097)
  • Loading branch information
Eddykasp authored Dec 11, 2024
1 parent 83f94c8 commit 5999901
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,10 @@ protected List<ElkEdge> layoutRecursively(final ElkNode layoutNode, final TestCo
// that have been set for nodes containing further children
if (childNode.getChildren().size() != 0) {
childNode.setDimensions(
layoutNode.getProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_WIDTH),
layoutNode.getProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_WIDTH) /
layoutNode.getProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_ASPECT_RATIO));
childNode.getProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_WIDTH),
childNode.getProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_WIDTH) /
childNode.getProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_ASPECT_RATIO)
);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public void testTwoLevelLayoutHorizontalScaling() {
toplevel.setProperty(CoreOptions.PADDING, new ElkPadding());
toplevel.setProperty(CoreOptions.SPACING_NODE_NODE, 0.0);
// set size of node so that children will be scaled down
graph.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_WIDTH, 20.0);
graph.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_ASPECT_RATIO, 0.4);
toplevel.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_WIDTH, 20.0);
toplevel.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_ASPECT_RATIO, 0.4);

ElkNode child1 = ElkGraphUtil.createNode(toplevel);
child1.setProperty(CoreOptions.TOPDOWN_LAYOUT, true);
Expand Down Expand Up @@ -106,8 +106,8 @@ public void testTwoLevelLayoutVerticalScaling() {
toplevel.setProperty(CoreOptions.PADDING, new ElkPadding());
toplevel.setProperty(CoreOptions.SPACING_NODE_NODE, 0.0);
// set size of node so that children will be scaled down
graph.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_WIDTH, 40.0);
graph.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_ASPECT_RATIO, 1.33333);
toplevel.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_WIDTH, 40.0);
toplevel.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_ASPECT_RATIO, 1.33333);

ElkNode child1 = ElkGraphUtil.createNode(toplevel);
child1.setProperty(CoreOptions.TOPDOWN_LAYOUT, true);
Expand Down Expand Up @@ -161,8 +161,8 @@ public void testScaleCap() {
toplevel.setProperty(CoreOptions.PADDING, new ElkPadding());
toplevel.setProperty(CoreOptions.SPACING_NODE_NODE, 0.0);
// set size of node so that children will be scaled down
graph.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_WIDTH, 300.0);
graph.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_ASPECT_RATIO, 1.0);
toplevel.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_WIDTH, 300.0);
toplevel.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_ASPECT_RATIO, 1.0);

ElkNode child1 = ElkGraphUtil.createNode(toplevel);
child1.setProperty(CoreOptions.TOPDOWN_LAYOUT, true);
Expand Down Expand Up @@ -215,8 +215,8 @@ public void testScaleCapBounded() {
toplevel.setProperty(CoreOptions.PADDING, new ElkPadding());
toplevel.setProperty(CoreOptions.SPACING_NODE_NODE, 0.0);
// set size of node so that children will be scaled down
graph.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_WIDTH, 300.0);
graph.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_ASPECT_RATIO, 1.0);
toplevel.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_WIDTH, 300.0);
toplevel.setProperty(CoreOptions.TOPDOWN_HIERARCHICAL_NODE_ASPECT_RATIO, 1.0);

ElkNode child1 = ElkGraphUtil.createNode(toplevel);
child1.setProperty(CoreOptions.TOPDOWN_LAYOUT, true);
Expand Down

0 comments on commit 5999901

Please sign in to comment.