Search in sources :

Example 26 with Layer

use of org.eclipse.elk.alg.layered.graph.Layer in project elk by eclipse.

the class TestGraphCreator method twoEdgesIntoSamePortResolvesCrossingWhenSwitched.

/**
 * <pre>
 * *  *
 *  \/
 *  /\
 * *--*<- Into same port
 * </pre>
 *
 * .
 *
 * @return Graph of the form above.
 */
public LGraph twoEdgesIntoSamePortResolvesCrossingWhenSwitched() {
    Layer leftLayer = makeLayer();
    Layer rightLayer = makeLayer();
    LNode topLeft = addNodeToLayer(leftLayer);
    LNode bottomLeft = addNodeToLayer(leftLayer);
    LNode topRight = addNodeToLayer(rightLayer);
    LNode bottomRight = addNodeToLayer(rightLayer);
    LPort topLeftPort = addPortOnSide(topLeft, PortSide.EAST);
    LPort bottomLeftPort = addPortOnSide(bottomLeft, PortSide.EAST);
    LPort bottomRightPort = addPortOnSide(bottomRight, PortSide.WEST);
    addEdgeBetweenPorts(topLeftPort, bottomRightPort);
    addEdgeBetweenPorts(bottomLeftPort, bottomRightPort);
    eastWestEdgeFromTo(bottomLeft, topRight);
    setUpIds();
    return graph;
}
Also used : LPort(org.eclipse.elk.alg.layered.graph.LPort) LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 27 with Layer

use of org.eclipse.elk.alg.layered.graph.Layer in project elk by eclipse.

the class InLayerEdgeTestGraphCreator method getInLayerOneLayerNoCrossings.

/**
 * <pre>
 * |---*
 * |
 * | --*
 * | |
 * | --*
 *  \
 *   \
 *    \
 *     *
 * .
 * </pre>
 *
 * @return Graph of the form above.
 */
public LGraph getInLayerOneLayerNoCrossings() {
    Layer layer = makeLayer(getGraph());
    LNode[] nodes = addNodesToLayer(4, layer);
    addInLayerEdge(nodes[0], nodes[3], PortSide.WEST);
    addInLayerEdge(nodes[1], nodes[2], PortSide.WEST);
    return getGraph();
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 28 with Layer

use of org.eclipse.elk.alg.layered.graph.Layer in project elk by eclipse.

the class InLayerEdgeTestGraphCreator method getInLayerEdgesWithFixedPortOrderAndNormalEdgeCrossings.

/**
 * <pre>
 *       ___
 *    ---| |
 *    |  | |  <- switch this
 * ---+--|_|
 * |  |
 * *--|--*  <- with this
 *    |
 *    ---*
 * .
 * </pre>
 *
 * With fixed Port PortOrder.
 *
 * @return Graph of the form above.
 */
public LGraph getInLayerEdgesWithFixedPortOrderAndNormalEdgeCrossings() {
    Layer[] layer = makeLayers(2);
    LNode leftNode = addNodeToLayer(layer[0]);
    LNode[] rightNodes = addNodesToLayer(3, layer[1]);
    setFixedOrderConstraint(rightNodes[0]);
    eastWestEdgeFromTo(leftNode, rightNodes[0]);
    addInLayerEdge(rightNodes[0], rightNodes[2], PortSide.WEST);
    eastWestEdgeFromTo(leftNode, rightNodes[1]);
    return getGraph();
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 29 with Layer

use of org.eclipse.elk.alg.layered.graph.Layer in project elk by eclipse.

the class InLayerEdgeTestGraphCreator method getOneLayerWithInLayerCrossings.

/**
 * <pre>
 *   --*
 *   |
 *   |/*
 *  /|
 * | --*
 *  \
 *   \
 *    \
 *     *
 * .
 * </pre>
 *
 * @return Graph of the form above.
 */
public LGraph getOneLayerWithInLayerCrossings() {
    Layer layer = makeLayer(getGraph());
    LNode[] nodes = addNodesToLayer(4, layer);
    addInLayerEdge(nodes[0], nodes[2], PortSide.WEST);
    addInLayerEdge(nodes[1], nodes[3], PortSide.WEST);
    return getGraph();
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 30 with Layer

use of org.eclipse.elk.alg.layered.graph.Layer in project elk by eclipse.

the class InLayerEdgeTestGraphCreator method getInLayerEdgesDownwardGraphNoFixedOrder.

/**
 * <pre>
 *
 *   --*
 *   | ____
 *   |/|  |
 *   /\|  |
 *   | |  |
 * *-+-|__|
 *   |
 *    \
 *     *
 * .
 * </pre>
 *
 * Port order not fixed.
 *
 * @return Graph of the form above.
 */
public LGraph getInLayerEdgesDownwardGraphNoFixedOrder() {
    Layer[] layers = makeLayers(2);
    LNode leftNode = addNodeToLayer(layers[0]);
    LNode[] rightNodes = addNodesToLayer(3, layers[1]);
    eastWestEdgeFromTo(leftNode, rightNodes[1]);
    addInLayerEdge(rightNodes[0], rightNodes[1], PortSide.WEST);
    addInLayerEdge(rightNodes[1], rightNodes[2], PortSide.WEST);
    return getGraph();
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Aggregations

Layer (org.eclipse.elk.alg.layered.graph.Layer)209 LNode (org.eclipse.elk.alg.layered.graph.LNode)185 LPort (org.eclipse.elk.alg.layered.graph.LPort)64 LEdge (org.eclipse.elk.alg.layered.graph.LEdge)40 LGraph (org.eclipse.elk.alg.layered.graph.LGraph)36 Test (org.junit.Test)25 TestAfterProcessor (org.eclipse.elk.alg.test.framework.annotations.TestAfterProcessor)13 KVector (org.eclipse.elk.core.math.KVector)12 List (java.util.List)9 NodeType (org.eclipse.elk.alg.layered.graph.LNode.NodeType)6 InternalProperties (org.eclipse.elk.alg.layered.options.InternalProperties)6 LLabel (org.eclipse.elk.alg.layered.graph.LLabel)5 LayeredOptions (org.eclipse.elk.alg.layered.options.LayeredOptions)5 IElkProgressMonitor (org.eclipse.elk.core.util.IElkProgressMonitor)5 BPInfo (org.eclipse.elk.alg.layered.intermediate.wrapping.BreakingPointInserter.BPInfo)4 GraphInfoHolder (org.eclipse.elk.alg.layered.p3order.GraphInfoHolder)4 ILayoutProcessor (org.eclipse.elk.core.alg.ILayoutProcessor)4 PortSide (org.eclipse.elk.core.options.PortSide)4 Pair (org.eclipse.elk.core.util.Pair)4 ArrayList (java.util.ArrayList)3