Search in sources :

Example 36 with LLabel

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

the class CompoundGraphPostprocessor method copyLabelsBack.

/**
 * Copies the labels from the given hierarchy segment back to the original hierarchical edge.
 */
private static void copyLabelsBack(final LEdge hierarchySegment, final LEdge origEdge, final LGraph referenceGraph) {
    Iterator<LLabel> labelIterator = hierarchySegment.getLabels().listIterator();
    while (labelIterator.hasNext()) {
        LLabel currLabel = labelIterator.next();
        if (currLabel.getProperty(InternalProperties.ORIGINAL_LABEL_EDGE) != origEdge) {
            continue;
        }
        LGraphUtil.changeCoordSystem(currLabel.getPosition(), hierarchySegment.getSource().getNode().getGraph(), referenceGraph);
        labelIterator.remove();
        origEdge.getLabels().add(currLabel);
    }
}
Also used : LLabel(org.eclipse.elk.alg.layered.graph.LLabel)

Example 37 with LLabel

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

the class AbstractGraphPlacer method offsetGraph.

/**
 * Offsets the given graph by a given offset without moving its nodes to another graph. This
 * method can be called as many times as required on a given graph: it does not take the graph's
 * offset into account.
 *
 * @param graph the graph to offset.
 * @param offsetx x coordinate offset.
 * @param offsety y coordinate offset.
 */
protected void offsetGraph(final LGraph graph, final double offsetx, final double offsety) {
    KVector graphOffset = new KVector(offsetx, offsety);
    for (LNode node : graph.getLayerlessNodes()) {
        node.getPosition().add(graphOffset);
        for (LPort port : node.getPorts()) {
            for (LEdge edge : port.getOutgoingEdges()) {
                edge.getBendPoints().offset(graphOffset);
                KVectorChain junctionPoints = edge.getProperty(LayeredOptions.JUNCTION_POINTS);
                if (junctionPoints != null) {
                    junctionPoints.offset(graphOffset);
                }
                for (LLabel label : edge.getLabels()) {
                    label.getPosition().add(graphOffset);
                }
            }
        }
    }
}
Also used : LLabel(org.eclipse.elk.alg.layered.graph.LLabel) LEdge(org.eclipse.elk.alg.layered.graph.LEdge) KVectorChain(org.eclipse.elk.core.math.KVectorChain) LPort(org.eclipse.elk.alg.layered.graph.LPort) LNode(org.eclipse.elk.alg.layered.graph.LNode) KVector(org.eclipse.elk.core.math.KVector)

Example 38 with LLabel

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

the class SelfHyperLoopLabels method addLLabels.

// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// LLabel Access
/**
 * Adds the given collection of labels to this instance.
 */
public void addLLabels(final Collection<LLabel> newLLabels) {
    for (LLabel newLLabel : newLLabels) {
        lLabels.add(newLLabel);
        updateSize(newLLabel);
    }
}
Also used : LLabel(org.eclipse.elk.alg.layered.graph.LLabel)

Aggregations

LLabel (org.eclipse.elk.alg.layered.graph.LLabel)38 LPort (org.eclipse.elk.alg.layered.graph.LPort)20 LNode (org.eclipse.elk.alg.layered.graph.LNode)19 KVector (org.eclipse.elk.core.math.KVector)19 LEdge (org.eclipse.elk.alg.layered.graph.LEdge)14 KVectorChain (org.eclipse.elk.core.math.KVectorChain)8 PortSide (org.eclipse.elk.core.options.PortSide)5 List (java.util.List)4 ElkRectangle (org.eclipse.elk.core.math.ElkRectangle)4 ElkLabel (org.eclipse.elk.graph.ElkLabel)4 LabelCell (org.eclipse.elk.alg.common.nodespacing.cellsystem.LabelCell)3 LGraph (org.eclipse.elk.alg.layered.graph.LGraph)3 Layer (org.eclipse.elk.alg.layered.graph.Layer)3 EdgeLabelPlacement (org.eclipse.elk.core.options.EdgeLabelPlacement)3 Lists (com.google.common.collect.Lists)2 LMargin (org.eclipse.elk.alg.layered.graph.LMargin)2 InternalProperties (org.eclipse.elk.alg.layered.options.InternalProperties)2 LayeredOptions (org.eclipse.elk.alg.layered.options.LayeredOptions)2 Direction (org.eclipse.elk.core.options.Direction)2 PortConstraints (org.eclipse.elk.core.options.PortConstraints)2