]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java
Fixed variable angle turns when they are not connected
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / scenegraph / controlpoint / PipingRules.java
index 727cf1a882e8d513fa1ab583ef2584a692054954..393dc85e1ab005bae0e56c515e5ebc238cc99835 100644 (file)
@@ -461,7 +461,7 @@ public class PipingRules {
        private static boolean asDirected(PipeControlPoint pcp, Direction direction) {
                if (pcp.isDirected())
                        return true;
-               if (pcp.isTurn() && pcp.isFixed()) {
+               if (pcp.asFixedAngle()) {
                        if (!pcp._getReversed())
                                return direction == Direction.NEXT;
                        else
@@ -498,7 +498,7 @@ public class PipingRules {
                if (DEBUG)
                        System.out.println("PipingRules.updateFreePipeRun " + u + " " + lengthChange);
                checkExpandPathLeg(u, lengthChange);
-               if (u.start.isInline() || u.end.isInline() || u.start.isFixed() || u.end.isFixed())
+               if (u.start.isInline() || u.end.isInline() || u.start.asFixedAngle()|| u.end.asFixedAngle())
                        processPathLeg(u, true, false);
        }
 
@@ -873,7 +873,7 @@ public class PipingRules {
                double distance = t.length();
                boolean aligned = (distance < ALLOWED_OFFSET);
                if (aligned) {
-                       if (u.start.isInline() || u.end.isInline() || u.start.isFixed() || u.end.isFixed())
+                       if (u.start.isInline() || u.end.isInline() || u.start.asFixedAngle() || u.end.asFixedAngle())
                                processPathLeg(u, true, false);
                        checkExpandPathLeg(u, lengthChange, inlineEnd);
                        
@@ -1486,24 +1486,9 @@ public class PipingRules {
        private static void updateEndComponentControlPoint(PipeControlPoint ecp, Vector3d start, Vector3d end) throws Exception {
                if (DEBUG)
                        System.out.println("PipingRules.updateEndComponentControlPoint() " + ecp);
-               // PipeControlPoint next = ecp.getNext();
-               // PipeControlPoint prev = ecp.getPrevious();
-               // if (next != null) {
-               // end = G3DTools.getPoint(next.getLocalPosition());
-               // start = G3DTools.getPoint(ecp.getLocalPosition());
-               // } else if (prev != null) {
-               // end = G3DTools.getPoint(ecp.getLocalPosition());
-               // start = G3DTools.getPoint(prev.getLocalPosition());
-               // } else {
-               // // TODO : warning?
-               // return;
-               // }
-               // Vector3d dir = new Vector3d (end);
-               // dir.sub(start);
-               // dir.normalize();
-               // G3DTools.setTuple(ecp.getDirection(), dir);
-               if (!ecp.isFixed())
-                       updateControlPointOrientation(ecp);
+               //FIXME : end control point cannot be fixed!
+               //if (!ecp.isFixed())
+               updateControlPointOrientation(ecp);
 
                for (PipeControlPoint pcp : ecp.getSubPoint()) {
                        // TODO update position
@@ -1564,7 +1549,7 @@ public class PipingRules {
                        }
                }
                
-               if (!tcp.isFixed()) {
+               if (!tcp.asFixedAngle()) {
                        
                        
                        if (next == null || prev == null) {
@@ -1768,7 +1753,8 @@ public class PipingRules {
                                }
                                
                        }
-                       if (current.isTurn() && current.isFixed()) {
+                       //if (current.isTurn() && current.isFixed()) {
+                       if (current.asFixedAngle()) {
                                current.setReversed(!current._getReversed());
                        }
                        if (current.isInline() && current.isReverse()) {
@@ -1856,8 +1842,8 @@ public class PipingRules {
        }
        
        public static void splitVariableLengthComponent(PipelineComponent newComponent, InlineComponent splittingComponent, boolean assignPos) throws Exception{
-               assert(!splittingComponent.getControlPoint().isFixed());
-               assert(!(newComponent instanceof  InlineComponent && !newComponent.getControlPoint().isFixed()));
+               assert(!splittingComponent.getControlPoint().isFixedLength());
+               assert(!(newComponent instanceof  InlineComponent && !newComponent.getControlPoint().isFixedLength()));
                PipeControlPoint newCP = newComponent.getControlPoint();
                PipeControlPoint splittingCP = splittingComponent.getControlPoint();
                PipeControlPoint nextCP = splittingCP.getNext();