]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/InlineComponent.java
Update offset values to reflect changes in pipe run parameters
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / scenegraph / InlineComponent.java
index aa51073a5a0f9665748d887b05a928118b061bce..695f1fa698e040b657655e8ddf67b62b687695d5 100644 (file)
@@ -36,6 +36,9 @@ public class InlineComponent extends PipelineComponent {
        public void setType(String type) throws Exception{
                this.type = type;
                controlPoint = ControlPointFactory.create(this);
+               syncNext();
+        syncPrevious();
+        syncBranch0();
                
        }
        
@@ -86,12 +89,8 @@ public class InlineComponent extends PipelineComponent {
                if (controlPoint.getRotationAngle() != null && Math.abs(controlPoint.getRotationAngle()-angle) < MathTools.NEAR_ZERO)
                        return;
                controlPoint.setRotationAngle(angle);
-               try {
-                       PipingRules.requestUpdate(getControlPoint());
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }       
+               PipingRules.requestUpdate(getControlPoint());
+
        }
        
        @RelatedGetValue(Plant3D.URIs.IsReversed)
@@ -112,12 +111,7 @@ public class InlineComponent extends PipelineComponent {
                        return;
                }
                controlPoint.setReversed(reverse);
-               try {
-                       PipingRules.requestUpdate(getControlPoint());
-               } catch (Exception e) {
-                       // TODO Auto-generated catch block
-                       e.printStackTrace();
-               }       
+               PipingRules.requestUpdate(getControlPoint());
        }
        
        @Override
@@ -163,7 +157,7 @@ public class InlineComponent extends PipelineComponent {
        
        private void updateOffset() {
                if (!componentCalculatedOffset && getControlPoint().isOffset()) {
-                       getControlPoint().setOffset(getPipeRun().getPipeDiameter()*0.5 - getAlternativePipeRun().getPipeDiameter()*0.5);
+                       getControlPoint().setOffset(getPipeRun().getInsideDiameter()*0.5 - getAlternativePipeRun().getInsideDiameter()*0.5);
                }
        }
 
@@ -180,6 +174,7 @@ public class InlineComponent extends PipelineComponent {
                                        map.put("radius2", pipeRun2.getPipeDiameter() * 0.5);
                                }
                                if (controlPoint.isOffset() && !componentCalculatedOffset) {
+                                       updateOffset();
                                        map.put("offset", controlPoint.getOffset());
                                }
                        }