Search in sources :

Example 96 with Layer

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

the class TestGraphCreator method getMoreComplexInLayerGraph.

/**
 * <pre>
 *      ____
 *    / |  |
 * *-+--|  |\
 *   | /|  |-+-*
 * *-++-|__| |
 *   ||      |
 *   || ___  |
 *   | \| | /
 * *-+--| |/
 * *-+--|_|
 *    \
 *     \
 *      *
 * .
 * </pre>
 *
 * Port order fixed.
 *
 * @return Graph of the form above.
 */
public LGraph getMoreComplexInLayerGraph() {
    Layer[] layers = makeLayers(3);
    LNode[] leftNodes = addNodesToLayer(4, layers[0]);
    LNode[] middleNodes = addNodesToLayer(3, layers[1]);
    LNode rightNode = addNodeToLayer(layers[2]);
    setFixedOrderConstraint(middleNodes[0]);
    setFixedOrderConstraint(middleNodes[1]);
    eastWestEdgeFromTo(leftNodes[1], middleNodes[0]);
    eastWestEdgeFromTo(leftNodes[3], middleNodes[1]);
    eastWestEdgeFromTo(leftNodes[2], middleNodes[1]);
    addInLayerEdge(middleNodes[0], middleNodes[1], PortSide.WEST);
    eastWestEdgeFromTo(leftNodes[0], middleNodes[0]);
    addInLayerEdge(middleNodes[0], middleNodes[2], PortSide.WEST);
    addInLayerEdge(middleNodes[0], middleNodes[1], PortSide.EAST);
    eastWestEdgeFromTo(middleNodes[0], rightNode);
    setUpIds();
    return graph;
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 97 with Layer

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

the class TestGraphCreator method getCrossFormedGraphConstraintsPreventAnySwitch.

/**
 * <pre>
 * this node must be.. -> *  *  <- and this node must be ...
 *                         \/
 *                         /\
 *    before this node -> *  *  <- before this node.
 * .
 * </pre>
 *
 * @return Graph of the form above.
 */
public LGraph getCrossFormedGraphConstraintsPreventAnySwitch() {
    Layer leftLayer = makeLayer(graph);
    Layer rightLayer = makeLayer(graph);
    LNode topLeft = addNodeToLayer(leftLayer);
    LNode bottomLeft = addNodeToLayer(leftLayer);
    LNode topRight = addNodeToLayer(rightLayer);
    LNode bottomRight = addNodeToLayer(rightLayer);
    eastWestEdgeFromTo(topLeft, bottomRight);
    eastWestEdgeFromTo(bottomLeft, topRight);
    setInLayerOrderConstraint(topRight, bottomRight);
    setInLayerOrderConstraint(topLeft, bottomLeft);
    setUpIds();
    return graph;
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 98 with Layer

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

the class TestGraphCreator method getFixedPortOrderGraph.

/**
 * <pre>
 * ____  *
 * |  |\/
 * |__|/\
 *       *
 * .
 * </pre>
 *
 * Port order fixed.
 *
 * @return Graph of the form above.
 */
public LGraph getFixedPortOrderGraph() {
    Layer leftLayer = makeLayer(graph);
    Layer rightLayer = makeLayer(graph);
    LNode leftNode = addNodeToLayer(leftLayer);
    leftNode.setProperty(LayeredOptions.PORT_CONSTRAINTS, PortConstraints.FIXED_ORDER);
    LNode rightTopNode = addNodeToLayer(rightLayer);
    LNode rightBottomNode = addNodeToLayer(rightLayer);
    eastWestEdgeFromTo(leftNode, rightBottomNode);
    eastWestEdgeFromTo(leftNode, rightTopNode);
    setUpIds();
    return graph;
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 99 with Layer

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

the class TestGraphCreator method getInLayerEdgesGraph.

/**
 * <pre>
 *   --*
 *   |
 * *-+-*-*
 *   |
 *   --*
 * .
 * </pre>
 *
 * @return graph of the form above
 */
public LGraph getInLayerEdgesGraph() {
    Layer leftLayer = makeLayer(graph);
    Layer middleLayer = makeLayer(graph);
    Layer rightLayer = makeLayer(graph);
    LNode leftNode = addNodeToLayer(leftLayer);
    LNode[] middleNodes = addNodesToLayer(3, middleLayer);
    LNode rightNode = addNodeToLayer(rightLayer);
    // add east side ports first to get expected port ordering
    eastWestEdgeFromTo(middleNodes[1], rightNode);
    eastWestEdgeFromTo(leftNode, middleNodes[1]);
    addInLayerEdge(middleNodes[0], middleNodes[2], PortSide.WEST);
    setUpIds();
    return graph;
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 100 with Layer

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

the class TestGraphCreator method getTwoNodesNoConnectionGraph.

/**
 * Creates two nodes with no connection between them.
 *
 * @return graph with two nodes with no connection between them.
 */
public LGraph getTwoNodesNoConnectionGraph() {
    Layer layer = makeLayer(graph);
    addNodeToLayer(layer);
    addNodeToLayer(layer);
    setUpIds();
    return graph;
}
Also used : 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