Search in sources :

Example 1 with LayeredLayoutProvider

use of org.eclipse.elk.alg.layered.LayeredLayoutProvider in project elk by eclipse.

the class AllowNonFlowPortsToSwitchSidesTest method setUp.

@Before
public void setUp() {
    PlainJavaInitialization.initializePlainJavaLayout();
    layeredLayout = new LayeredLayoutProvider();
}
Also used : LayeredLayoutProvider(org.eclipse.elk.alg.layered.LayeredLayoutProvider) Before(org.junit.Before)

Example 2 with LayeredLayoutProvider

use of org.eclipse.elk.alg.layered.LayeredLayoutProvider in project elk by eclipse.

the class DirectLayoutTest method testELKLayered.

/**
 * Test a plain Java layout using the ELK Layered algorithm.
 */
@Test
public void testELKLayered() {
    // create a KGraph for layout
    ElkNode parentNode = GraphTestUtils.createSimpleGraph();
    // add layout options to the elements of the graph
    addLayeredOptions(parentNode);
    // create a progress monitor
    IElkProgressMonitor progressMonitor = new BasicProgressMonitor();
    // create the layout provider
    AbstractLayoutProvider layoutProvider = new LayeredLayoutProvider();
    layoutProvider.initialize(null);
    // perform layout on the created graph
    layoutProvider.layout(parentNode, progressMonitor);
    // execute a trivial junit test
    for (ElkNode child : parentNode.getChildren()) {
        if (child.getX() <= 0 || child.getY() <= 0) {
            Assert.fail("Not all node coordinates have been set properly.");
        }
    }
    // output layout information
    printLayoutInfo(parentNode, progressMonitor);
}
Also used : ElkNode(org.eclipse.elk.graph.ElkNode) IElkProgressMonitor(org.eclipse.elk.core.util.IElkProgressMonitor) BasicProgressMonitor(org.eclipse.elk.core.util.BasicProgressMonitor) LayeredLayoutProvider(org.eclipse.elk.alg.layered.LayeredLayoutProvider) AbstractLayoutProvider(org.eclipse.elk.core.AbstractLayoutProvider) Test(org.junit.Test)

Aggregations

LayeredLayoutProvider (org.eclipse.elk.alg.layered.LayeredLayoutProvider)2 AbstractLayoutProvider (org.eclipse.elk.core.AbstractLayoutProvider)1 BasicProgressMonitor (org.eclipse.elk.core.util.BasicProgressMonitor)1 IElkProgressMonitor (org.eclipse.elk.core.util.IElkProgressMonitor)1 ElkNode (org.eclipse.elk.graph.ElkNode)1 Before (org.junit.Before)1 Test (org.junit.Test)1