]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Previous change caused ClassCastExceptions. 33/3533/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Fri, 15 Nov 2019 15:32:41 +0000 (17:32 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Fri, 15 Nov 2019 15:32:41 +0000 (17:32 +0200)
gitlab #26

Change-Id: I018a488b099be724828f636fe91e6d1e2903f3dc

org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java

index 50ede807e6dac4039e2aee555174a088df24c80a..939d1551a5343e20526b9db50e0ad87039a43dc8 100644 (file)
@@ -408,12 +408,18 @@ public class ComponentUtils {
 
                        pipeRun.addChild(newComponent);
 
-                       if (newComponent instanceof InlineComponent && ((InlineComponent)newComponent).isVariableLength() ||((InlineComponent)newComponent).isModifialble()) {
-                               newPcp.setLength(inst.length);
-                               newComponent.setParameter("length", inst.length);
-                       } else if (newComponent instanceof TurnComponent && ((TurnComponent)newComponent).isVariableAngle()) {
-                               newPcp.setTurnAngle(inst.angle);
-                               newComponent.setParameter("turnAngle", inst.angle);
+                       if (newComponent instanceof InlineComponent) {
+                           InlineComponent inlineComponent = (InlineComponent)newComponent;
+                           if (inlineComponent.isVariableLength()|| inlineComponent.isModifialble()) {
+                               newPcp.setLength(inst.length);
+                               newComponent.setParameter("length", inst.length);
+                           }
+                       } else if (newComponent instanceof TurnComponent) {
+                           TurnComponent turnComponent = (TurnComponent)newComponent;
+                           if  (turnComponent.isVariableAngle()) {
+                               newPcp.setTurnAngle(inst.angle);
+                               newComponent.setParameter("turnAngle", inst.angle);
+                           }
                        }
                        
                        newComponent.updateParameters();