]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java
Handle variable length components on offset path leg
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / scenegraph / controlpoint / PipeControlPoint.java
index b8198bda253fc0f57c6864e627f112df1f95780b..b14b298bcf26d0060ea91ec09521f740fc596b45 100644 (file)
@@ -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;
 
@@ -340,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) {
@@ -1018,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);
@@ -1059,6 +1081,7 @@ public class PipeControlPoint extends G3DNode implements IP3DNode {
                }
                PipelineComponent comp = component;
                component = null;
+               
                comp.remove();
        }
        
@@ -1076,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();
        }