use of org.eclipse.elk.alg.layered.options.LayeredOptions in project elk by eclipse.
the class PlainLayoutTest method testPlainLayout.
/**
* Test a plain Java layout on a hierarchical graph using the ELK Layered algorithm.
*/
@Test
public void testPlainLayout() {
// create a hierarchical KGraph for layout
ElkNode parentNode = GraphTestUtils.createHierarchicalGraph();
// configure every hierarchical node to use ELK Layered (which would also be the default)
getAllElkNodes(parentNode).forEachRemaining(node -> {
if (!node.getChildren().isEmpty()) {
node.setProperty(CoreOptions.ALGORITHM, LayeredOptions.ALGORITHM_ID);
}
});
// create a progress monitor
IElkProgressMonitor progressMonitor = new BasicProgressMonitor();
// initialize the meta data service with ELK Layered's meta data
LayoutMetaDataService service = LayoutMetaDataService.getInstance();
service.registerLayoutMetaDataProviders(new LayeredOptions());
// instantiate a recursive graph layout engine and execute layout
RecursiveGraphLayoutEngine layoutEngine = new RecursiveGraphLayoutEngine();
layoutEngine.layout(parentNode, progressMonitor);
// output layout information
printLayoutInfo(parentNode, progressMonitor);
}
Aggregations