From a60f1abcef2946fa46750089a4a8e3e797a95891 Mon Sep 17 00:00:00 2001 From: Max Kasperowski Date: Wed, 28 Feb 2024 14:57:09 +0100 Subject: [PATCH] Support for topdown scale factor property (#173) * topdown layout scaling info elk-client communication * routes no layout edges correctly when crossing 1 hierarchy level Signed-off-by: Max Kasperowski --------- Signed-off-by: Max Kasperowski Co-authored-by: Niklas Rentz --- .../cs/kieler/klighd/lsp/TopDownPreservedProperties.java | 2 +- .../macrolayout/KlighdDiagramLayoutConnector.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/TopDownPreservedProperties.java b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/TopDownPreservedProperties.java index a8788453e..e6f8b57a6 100644 --- a/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/TopDownPreservedProperties.java +++ b/plugins/de.cau.cs.kieler.klighd.lsp/src/de/cau/cs/kieler/klighd/lsp/TopDownPreservedProperties.java @@ -31,7 +31,7 @@ public class TopDownPreservedProperties implements IPreservedProperties { */ @Override public List> getProperties() { - return Arrays.asList(/*CoreOptions.TOP_DOWN_LAYOUT_RENDER_SCALE*/); + return Arrays.asList(CoreOptions.TOPDOWN_SCALE_FACTOR); } } diff --git a/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/internal/macrolayout/KlighdDiagramLayoutConnector.java b/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/internal/macrolayout/KlighdDiagramLayoutConnector.java index 077b07c98..eae0affb3 100644 --- a/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/internal/macrolayout/KlighdDiagramLayoutConnector.java +++ b/plugins/de.cau.cs.kieler.klighd/src/de/cau/cs/kieler/klighd/internal/macrolayout/KlighdDiagramLayoutConnector.java @@ -1216,7 +1216,9 @@ private void handleExcludedEdge(final KEdge edge) { -sourceNode.getInsets().getTop()); } } else { - sourcePoint.add(sourceNode.getXpos(), sourceNode.getYpos()); + // TODO: this probably only works for edges crossing at most one hierarchy level + sourcePoint.add(sourceNode.getXpos() * sourceNode.getProperty(CoreOptions.TOPDOWN_SCALE_FACTOR), + sourceNode.getYpos() * sourceNode.getProperty(CoreOptions.TOPDOWN_SCALE_FACTOR)); } KPoint sourceKPoint = edge.getSourcePoint(); @@ -1228,7 +1230,9 @@ private void handleExcludedEdge(final KEdge edge) { // determine the target point final KVector targetPoint = toElementBorder(targetNode, targetPort, sourceNode, sourcePort); - targetPoint.add(targetNode.getXpos(), targetNode.getYpos()); + // TODO: this probably only works for edges crossing at most one hierarchy level + targetPoint.add(targetNode.getXpos() * targetNode.getParent().getProperty(CoreOptions.TOPDOWN_SCALE_FACTOR), + targetNode.getYpos() * targetNode.getParent().getProperty(CoreOptions.TOPDOWN_SCALE_FACTOR)); if (targetInSource) { KGraphUtil.toAbsolute(targetPoint, targetNode.getParent()); KGraphUtil.toRelative(targetPoint, sourceNode);