use of org.eclipse.elk.alg.layered.compaction.recthull.Point in project elk by eclipse.
the class ComponentsCompactor method componentHullPoints.
private Hullpoints componentHullPoints(final LGraph graph) {
final Hullpoints pts = new Hullpoints();
for (LNode n : graph.getLayerlessNodes()) {
if (n.getType() == NodeType.EXTERNAL_PORT) {
continue;
}
// Note that labels of nodes are already part of a node's margins
// the same is true for ports and their labels
addLGraphElementBounds(pts, n, new KVector());
// add bend points of the edges
for (LEdge edge : n.getOutgoingEdges()) {
if (isExternalEdge(edge)) {
continue;
}
for (KVector bp : edge.getBendPoints()) {
KVector absolute = bp;
pts.add(new Point(absolute.x, absolute.y));
}
}
}
return pts;
}
use of org.eclipse.elk.alg.layered.compaction.recthull.Point in project elk by eclipse.
the class ComponentsCompactor method addLGraphElementBounds.
private void addLGraphElementBounds(final List<Point> pts, final LShape element, final KVector offset) {
// extract the relevant margins object.
// there's LayoutOptions.MARGINS as well,
// however, this is only used outside of elk layered.
LMargin margins = null;
if (element instanceof LNode) {
margins = ((LNode) element).getMargin();
} else if (element instanceof LPort) {
margins = ((LPort) element).getMargin();
} else if (element instanceof LLabel) {
margins = new LMargin();
}
// add bounding box of the node
pts.add(new Point(element.getPosition().x - margins.left + offset.x, element.getPosition().y - margins.top + offset.y));
pts.add(new Point(element.getPosition().x - margins.left + offset.x, element.getPosition().y + element.getSize().y + margins.bottom + offset.y));
pts.add(new Point(element.getPosition().x + element.getSize().x + margins.right + offset.x, element.getPosition().y - margins.top + offset.y));
pts.add(new Point(element.getPosition().x + element.getSize().x + margins.right + offset.x, element.getPosition().y + element.getSize().y + margins.bottom + offset.y));
}
Aggregations