Search in sources :

Example 16 with SelfHyperLoop

use of org.eclipse.elk.alg.layered.intermediate.loops.SelfHyperLoop in project elk by eclipse.

the class RoutingSlotAssigner method computeLoopActivity.

/**
 * Initializes {@link #slLoopActivityOverPorts}. Each loop is mapped to an array indexed by port indices indicating
 * whether the loop runs along the given port or not.
 */
private void computeLoopActivity(final SelfLoopHolder slHolder) {
    List<SelfHyperLoop> slLoops = slHolder.getSLHyperLoops();
    List<LPort> lPorts = slHolder.getLNode().getPorts();
    for (SelfHyperLoop slLoop : slLoops) {
        boolean[] loopActivity = new boolean[lPorts.size()];
        slLoopActivityOverPorts.put(slLoop, loopActivity);
        // Run from the loop's start port to the end port, possibly wrapping around, and set everything to true
        // along the way
        int lPortIdx = slLoop.getLeftmostPort().getLPort().id - 1;
        int lPortTargetIdx = slLoop.getRightmostPort().getLPort().id;
        while (lPortIdx != lPortTargetIdx) {
            lPortIdx = (lPortIdx + 1) % lPorts.size();
            loopActivity[lPortIdx] = true;
        }
    }
}
Also used : LPort(org.eclipse.elk.alg.layered.graph.LPort) SelfHyperLoop(org.eclipse.elk.alg.layered.intermediate.loops.SelfHyperLoop)

Example 17 with SelfHyperLoop

use of org.eclipse.elk.alg.layered.intermediate.loops.SelfHyperLoop in project elk by eclipse.

the class PortRestorer method processTwoSideOpposingLoops.

private void processTwoSideOpposingLoops() {
    for (SelfHyperLoop slLoop : slLoopsByType.get(SelfLoopType.TWO_SIDES_OPPOSING)) {
        // Sort the port sides such that they follow a clockwise order
        PortSide[] sides = sortedTwoSideLoopPortSides(slLoop);
        // We prepend to the start side's end area, and append to the target side's start area
        addToTargetArea(slLoop, sides[0], PortSideArea.END, AddMode.PREPEND);
        addToTargetArea(slLoop, sides[1], PortSideArea.START, AddMode.APPEND);
    }
}
Also used : PortSide(org.eclipse.elk.core.options.PortSide) SelfHyperLoop(org.eclipse.elk.alg.layered.intermediate.loops.SelfHyperLoop)

Example 18 with SelfHyperLoop

use of org.eclipse.elk.alg.layered.intermediate.loops.SelfHyperLoop in project elk by eclipse.

the class PortRestorer method processTwoSideCornerLoops.

// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Self Loop Placement (Two Sides)
private void processTwoSideCornerLoops() {
    for (SelfHyperLoop slLoop : slLoopsByType.get(SelfLoopType.TWO_SIDES_CORNER)) {
        // Sort the port sides such that they follow a clockwise order
        PortSide[] sides = sortedTwoSideLoopPortSides(slLoop);
        // Add the ports to their target area
        addToTargetArea(slLoop, sides[0], PortSideArea.END, AddMode.PREPEND);
        addToTargetArea(slLoop, sides[1], PortSideArea.START, AddMode.APPEND);
    }
}
Also used : PortSide(org.eclipse.elk.core.options.PortSide) SelfHyperLoop(org.eclipse.elk.alg.layered.intermediate.loops.SelfHyperLoop)

Aggregations

SelfHyperLoop (org.eclipse.elk.alg.layered.intermediate.loops.SelfHyperLoop)18 PortSide (org.eclipse.elk.core.options.PortSide)10 LPort (org.eclipse.elk.alg.layered.graph.LPort)6 ArrayList (java.util.ArrayList)4 SelfHyperLoopLabels (org.eclipse.elk.alg.layered.intermediate.loops.SelfHyperLoopLabels)4 SelfLoopPort (org.eclipse.elk.alg.layered.intermediate.loops.SelfLoopPort)4 KVector (org.eclipse.elk.core.math.KVector)3 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 SelfLoopHolder (org.eclipse.elk.alg.layered.intermediate.loops.SelfLoopHolder)2 InternalProperties (org.eclipse.elk.alg.layered.options.InternalProperties)2 HyperEdgeSegment (org.eclipse.elk.alg.layered.p5edges.orthogonal.HyperEdgeSegment)2 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 Queue (java.util.Queue)1 Set (java.util.Set)1 Stream (java.util.stream.Stream)1