From 31fd8b586a816e12d85f361b3fe2f6ebd52e427b Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Tue, 12 Nov 2019 15:34:48 +0200 Subject: [PATCH] Removing components left orphan piperuns in the plant gitlab #35 Change-Id: I428a58bf4e817816f2bb02d00186b41fa40a0527 --- .../plant3d/scenegraph/controlpoint/PipeControlPoint.java | 3 +++ .../plant3d/scenegraph/controlpoint/PipingRules.java | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java index 491a2733..20386b54 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java @@ -1079,6 +1079,7 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { if (currentNext == null && currentPrev == null) { removeComponent(); pipeRun.remChild(this); + checkRemove(pipeRun); return; } if (currentNext != null && currentPrev != null) { @@ -1350,6 +1351,8 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { pcp._remove(); // This call will recursively call also this method... return true; } + } else if (points.size() == 2) { + } return false; } diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java index 3094f7d2..3ab4cca4 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java @@ -1671,7 +1671,11 @@ public class PipingRules { pcps.add(points); PipeControlPoint pcp = points.get(points.size()-1); if (pcp.getChildPoints().size() > 0) { - pipeRun = pcp.getChildPoints().get(0).getPipeRun(); + PipeRun pipeRun2 = pcp.getChildPoints().get(0).getPipeRun(); + if (pipeRun == pipeRun2) + break; + else + pipeRun = pipeRun2; } else { break; } -- 2.47.1