Skip to content

Commit

Permalink
add calculation of node micro layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddykasp committed Aug 28, 2024
1 parent 8410c2d commit 4de0be9
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2023 Kiel University and others.
* Copyright (c) 2023, 2024 Kiel University and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
Expand All @@ -11,6 +11,7 @@

import java.util.List;

import org.eclipse.elk.alg.common.NodeMicroLayout;
import org.eclipse.elk.alg.vertiflex.options.VertiFlexOptions;
import org.eclipse.elk.alg.vertiflex.p1yplacement.NodeYPlacerStrategy;
import org.eclipse.elk.alg.vertiflex.p2relative.RelativeXPlacerStrategy;
Expand Down Expand Up @@ -46,6 +47,12 @@ public void layout(final ElkNode graph, final IElkProgressMonitor progressMonito

nodeNodeSpacing = graph.getProperty(CoreOptions.SPACING_NODE_NODE);

// if requested, compute nodes's dimensions, place node labels, ports, port labels, etc.
if (!graph.getProperty(VertiFlexOptions.OMIT_NODE_MICRO_LAYOUT)) {
NodeMicroLayout.forGraph(graph)
.execute();
}

// pre calculate the root node and save it
ElkNode root = VertiFlexUtil.findRoot(graph);
graph.setProperty(InternalProperties.ROOT_NODE, root);
Expand All @@ -59,6 +66,9 @@ public void layout(final ElkNode graph, final IElkProgressMonitor progressMonito
if (numberOfParents > 1) {
throw new UnsupportedConfigurationException("The given graph is not an acyclic tree!");
}

// reset position
child.setLocation(0, 0);
}

// check that vertical constraints are ordered in valid manner i.e. children always have higher vertical
Expand Down

0 comments on commit 4de0be9

Please sign in to comment.