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);
}
}
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);
}
}
}
}
}
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);
}
}
Aggregations