X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Fscenegraph%2FTurnComponent.java;h=1bf674410cbf1be7aaebc6fe20ad082b1cf06519;hb=e96447c877fd9c3a4664c2593cfbae768d0c44d7;hp=3d5fb5bf7fc27130d078414dde5da2a72bbd17c9;hpb=f537452332e2b78352677bd50ac875aa536f0a1c;p=simantics%2F3d.git diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/TurnComponent.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/TurnComponent.java index 3d5fb5bf..1bf67441 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/TurnComponent.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/TurnComponent.java @@ -1,12 +1,17 @@ package org.simantics.plant3d.scenegraph; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.vecmath.Vector3d; import org.simantics.g3d.math.MathTools; +import org.simantics.g3d.property.annotations.GetComboProperty; +import org.simantics.g3d.property.annotations.GetComboPropertyValue; import org.simantics.g3d.property.annotations.GetPropertyValue; +import org.simantics.g3d.property.annotations.SetComboPropertyValue; import org.simantics.g3d.property.annotations.SetPropertyValue; import org.simantics.g3d.scenegraph.base.ParentNode; import org.simantics.g3d.tools.NodeTools; @@ -80,8 +85,12 @@ public class TurnComponent extends PipelineComponent { } } - @RelatedGetValue(Plant3D.URIs.HasTurnAngle) public Double getTurnAngle() { + return getControlPoint().getTurnAngle(); + } + + @RelatedGetValue(Plant3D.URIs.HasTurnAngle) + public Double _getTurnAngle() { if (!getControlPoint().asFixedAngle()) return null; return getControlPoint().getTurnAngle(); @@ -106,15 +115,14 @@ public class TurnComponent extends PipelineComponent { return getControlPoint().getTurnAxis(); } - @GetPropertyValue(name="Turn Radius", value="TurnRadius", tabId = "Default") - public Double getTurnRadius() { + public Double getTurnRadius() { if (turnRadiusIndex != null) return getPipeRun().getTurnRadiusArray()[turnRadiusIndex]; return getPipeRun().getTurnRadiusArray()[0]; } @RelatedGetValue(Plant3D.URIs.HasTurnRadiusIndex) - @GetPropertyValue(name="Turn Radius Index", value=Plant3D.URIs.HasTurnRadiusIndex, tabId = "Default") + @GetComboPropertyValue(name="Turn Radius", value=Plant3D.URIs.HasTurnRadiusIndex, tabId = "Default") public Integer getTurnRadiusIndex() { // TODO: For backwards compatibility, we do not accept null values. @@ -125,7 +133,7 @@ public class TurnComponent extends PipelineComponent { } @RelatedSetValue(Plant3D.URIs.HasTurnRadiusIndex) - @SetPropertyValue(value=Plant3D.URIs.HasTurnRadiusIndex) + @SetComboPropertyValue(value=Plant3D.URIs.HasTurnRadiusIndex) public void setTurnRadiusIndex(Integer turnRadiusIndex) { if (this.turnRadiusIndex == turnRadiusIndex) return; @@ -140,6 +148,15 @@ public class TurnComponent extends PipelineComponent { PipingRules.requestUpdate(getControlPoint()); } + @GetComboProperty(value=Plant3D.URIs.HasTurnRadiusIndex) + public List _getTurnRadii() { + List values = new ArrayList(); + for (double d : getPipeRun().getTurnRadiusArray()) + values.add(d); + return values; + } + + @RelatedGetValue(Plant3D.URIs.HasRotationAngle) @GetPropertyValue(name="Rotation Angle", value=Plant3D.URIs.HasRotationAngle, tabId = "Default") public Double getRotationAngle() {