X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Fscenegraph%2Fcontrolpoint%2FPipingRules.java;h=6c121d80857da7b7c920c37f73d774b14d191b62;hb=9070983be64f9f107e0a6388549aad475fcd9d76;hp=854b265d3a09e7c00ae370a5c93460a4b99ef020;hpb=53d55c24c779745f188bdb18d32f71d20acb61b2;p=simantics%2F3d.git 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 854b265d..6c121d80 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 @@ -51,6 +51,8 @@ public class PipingRules { private static Object ruleMutex = new Object(); public static void requestUpdate(PipeControlPoint pcp) { + if (!PipingRules.enabled) + return; if (DEBUG) System.out.println("PipingRules request " + pcp); synchronized (updateMutex) { if (!requestUpdates.contains(pcp)) @@ -59,6 +61,9 @@ public class PipingRules { } public static boolean update() throws Exception { + if (!PipingRules.enabled) + return false; + if (requestUpdates.size() == 0) return false; @@ -304,6 +309,10 @@ public class PipingRules { else if (us.end.equals(updated)) lengthChange = PathLegUpdateType.PREV; } + if (us == null) { + System.out.println("Null update struct " + start); + return; + } updatePathLeg(us, lengthChange); } @@ -316,6 +325,10 @@ public class PipingRules { // else if (us.end.equals(updated)) // lengthChange = PathLegUpdateType.PREV; // } + if (us == null) { + System.out.println("Null update struct " + start); + return; + } updatePathLeg(us, lengthChange); } @@ -882,14 +895,15 @@ public class PipingRules { if (other.isVariableAngle()) { // TODO calculate needed space from next run end. - if (mu[0] < 1.0) { + double space = spaceForTurn(other); + if (mu[0] < space) { if (dcpStart) { closest.set(u.startPoint); } else { closest.set(u.endPoint); } Vector3d v = new Vector3d(directedDirection); - v.scale(spaceForTurn(other)); + v.scale(space); closest.add(v); } @@ -1628,8 +1642,9 @@ public class PipingRules { PipeControlPoint pcp = pipeRun.getControlPoints().iterator().next(); while (pcp.getPrevious() != null) { PipeControlPoint prev = pcp.getPrevious(); - if (prev.getPipeRun() != pipeRun) - break; + if (prev.getPipeRun() != pipeRun && prev.getPipeRun() != null) { // bypass possible corruption + break; + } pcp = prev; } if (pcp.isDualSub()) { @@ -1799,11 +1814,19 @@ public class PipingRules { } List runPcps = getControlPoints(pipeRun); if (runPcps.size() != count) { - System.out.println("Run " + pipeRun.getName() + " contains unconnected control points"); + System.out.println("Run " + pipeRun.getName() + " contains unconnected control points, found " + runPcps.size() + " connected, " + pcps.size() + " total."); + for (PipeControlPoint pcp : pcps) { + if (!runPcps.contains(pcp)) { + System.out.println("Unconnected " + pcp + " " + pcp.getPipelineComponent()); + } + } } for (PipeControlPoint pcp : pcps) { + if (pcp.getPipeRun() == null) { + System.out.println("PipeRun ref missing " + pcp + " " + pcp.getPipelineComponent()); + } if (!pcp.isDirected() && pcp.getNext() == null && pcp.getPrevious() == null) - System.out.println("Orphan undirected " + pcp); + System.out.println("Orphan undirected " + pcp + " " + pcp.getPipelineComponent()); } for (PipeControlPoint pcp : pcps) { if (pcp.getParentPoint() == null) {