From 6ddf8673fbc604be38a5dffe3b2540e92072f10e Mon Sep 17 00:00:00 2001 From: Soeren Domroes Date: Wed, 18 Oct 2023 17:15:50 +0200 Subject: [PATCH] layered: Correctly insert nodes during df model order layering. --- .../alg/layered/p2layers/DepthFirstModelOrderLayerer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/p2layers/DepthFirstModelOrderLayerer.java b/plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/p2layers/DepthFirstModelOrderLayerer.java index 9681ea945..ee2541798 100644 --- a/plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/p2layers/DepthFirstModelOrderLayerer.java +++ b/plugins/org.eclipse.elk.alg.layered/src/org/eclipse/elk/alg/layered/p2layers/DepthFirstModelOrderLayerer.java @@ -123,6 +123,9 @@ public void process(final LGraph thelayeredGraph, final IElkProgressMonitor moni if (!nodesToPlace.isEmpty()) { if (layerDiff > 0) { // Case some dependency to the existing graph was found add all nodes to their layers. + for (LNode toPlace : nodesToPlace) { + toPlace.id += maxLayer; + } placeNodesToPlace(); // Remove all nodes since they are now placed correctly. nodesToPlace.clear(); @@ -209,7 +212,7 @@ private boolean isConnectedToCurrentLayer(final LNode node) { boolean connectedViaLabelDummy; if (nodesToPlace.isEmpty()) { // Case the node to check already has a layer. - // TODO this may case an NPE if getLayer is null; + // This may case an NPE if getLayer is null; directlyConnected = edge.getSource().getNode().getType() == NodeType.NORMAL && edge.getSource().getNode().getLayer() != null && edge.getSource().getNode().getLayer().id == currentLayerId;