]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/TurnComponent.java
Fixed variable angle turns when they are not connected
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / scenegraph / TurnComponent.java
index 0e307a471eba496fbe1c93d5727b56cee1b5d4e8..a1374def587c857a3b0327cba4510891896838be 100644 (file)
@@ -70,7 +70,7 @@ public class TurnComponent extends PipelineComponent {
        @Override
        public void updateParameters() {
                super.updateParameters();
-               if (!isVariableAngle()) {
+               if (controlPoint.asFixedAngle()) {
                        Map<String,Object> calculated = getCalculatedParameters();
                        if (calculated.containsKey("length")) {
                                controlPoint.setLength((Double)calculated.get("length"));
@@ -81,12 +81,14 @@ public class TurnComponent extends PipelineComponent {
        
        @RelatedGetValue(Plant3D.URIs.HasTurnAngle)
        public Double getTurnAngle() {
+           if (!getControlPoint().asFixedAngle())
+               return null;
                return getControlPoint().getTurnAngle();
        }
        
        @RelatedSetValue(Plant3D.URIs.HasTurnAngle)
        public void setTurnAngle(Double a) {
-               if (!getControlPoint().isFixed())
+               if (!getControlPoint().asFixedAngle())
                        return;
                getControlPoint().setTurnAngle(a);            
        }
@@ -140,7 +142,7 @@ public class TurnComponent extends PipelineComponent {
        @RelatedGetValue(Plant3D.URIs.HasRotationAngle)
        @GetPropertyValue(name="Rotation Angle", value=Plant3D.URIs.HasRotationAngle, tabId = "Default")
        public Double getRotationAngle() {
-               if (!controlPoint.isFixed())
+               if (!controlPoint.asFixedAngle())
                        return null;
                Double d = controlPoint.getRotationAngle();
                if (d == null)
@@ -150,7 +152,7 @@ public class TurnComponent extends PipelineComponent {
        @RelatedSetValue(Plant3D.URIs.HasRotationAngle)
        @SetPropertyValue(value=Plant3D.URIs.HasRotationAngle)
        public void setRotationAngle(Double angle) {
-               if (!controlPoint.isFixed())
+               if (!controlPoint.asFixedAngle())
                        return;
                
                if (angle == null || Double.isInfinite(angle) || Double.isNaN(angle)) {
@@ -166,14 +168,14 @@ public class TurnComponent extends PipelineComponent {
        @RelatedGetValue(Plant3D.URIs.IsReversed)
        @GetPropertyValue(name="Reverse", value=Plant3D.URIs.IsReversed, tabId = "Default")
        public Boolean isReversed() {
-               if (!controlPoint.isFixed())
+               if (!controlPoint.asFixedAngle())
                        return null;
                Boolean d = controlPoint._getReversed();
                return d;
        }
        @RelatedSetValue(Plant3D.URIs.IsReversed)
        public void setReversed(Boolean reverse) {
-               if (!controlPoint.isFixed())
+               if (!controlPoint.asFixedAngle())
                        return;
                
                if (reverse == null) {