X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Fscenegraph%2Fcontrolpoint%2FPipeControlPoint.java;h=b14b298bcf26d0060ea91ec09521f740fc596b45;hb=refs%2Fchanges%2F29%2F3029%2F1;hp=b822b2f3535ebf0c85f6302e9fb53706e0902234;hpb=676ff0ba1dd085f94377675f77f2af2566ab56b8;p=simantics%2F3d.git 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 b822b2f3..b14b298b 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 @@ -1,6 +1,7 @@ package org.simantics.plant3d.scenegraph.controlpoint; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -303,9 +304,11 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { } public Vector3d getSizeChangeOffsetVector(Vector3d dir) { + Quat4d q; if (rotationAngle == null) - rotationAngle = 0.0; - Quat4d q = getControlPointOrientationQuat(dir, rotationAngle); + q = getControlPointOrientationQuat(dir, 0.0); + else + q = getControlPointOrientationQuat(dir, rotationAngle); Vector3d v = new Vector3d(0.0,offset,0.0); Vector3d offset = new Vector3d(); MathTools.rotate(q, v, offset); @@ -313,9 +316,11 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { } public Vector3d getSizeChangeOffsetVector() { + Quat4d q; if (rotationAngle == null) - rotationAngle = 0.0; - Quat4d q = getControlPointOrientationQuat(rotationAngle); + q = getControlPointOrientationQuat(0.0); + else + q = getControlPointOrientationQuat(rotationAngle); Vector3d v = new Vector3d(0.0,offset,0.0); Vector3d offset = new Vector3d(); MathTools.rotate(q, v, offset); @@ -336,6 +341,18 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { return previous.toString(); } + @GetPropertyValue(name="Sub",tabId="Debug",value="sub") + private String getSubString() { + if (children.size() == 0) + return ""; + return Arrays.toString(children.toArray()); + } + + @GetPropertyValue(name="Type",tabId="Debug",value="type") + public String getTypeString() { + return type.name(); + } + public Quat4d getControlPointOrientationQuat(double angle) { if (turnAxis == null) { @@ -1014,6 +1031,15 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { p1.remChild(ocp); p2.remChild(sccp); + // TODO : now we assume that this is size change, and we do + if (ocp.next != null) + ocp.next.setPrevious(null); + if (ocp.previous != null) + ocp.previous.setNext(null); + if (sccp.next != null) + sccp.next.setPrevious(null); + if (sccp.previous != null) + sccp.previous.setNext(null); ocp.setNext(null); ocp.setPrevious(null); sccp.setNext(null); @@ -1055,6 +1081,7 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { } PipelineComponent comp = component; component = null; + comp.remove(); } @@ -1072,11 +1099,11 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { public void setPosition(Vector3d position) { if (MathTools.equals(position, getPosition())) return; + if (Double.isNaN(position.x) || Double.isNaN(position.y) || Double.isNaN(position.z)) + throw new IllegalArgumentException("NaN is not supported"); super.setPosition(position); if (getParentPoint() == null && component != null) component._setWorldPosition(getWorldPosition()); - if (isDualSub()) - System.out.println(); updateSubPoint(); }