]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Updates elbows when turn radius is changed in pipe run 59/3959/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Mon, 2 Mar 2020 11:48:00 +0000 (13:48 +0200)
committerReino Ruusu <reino.ruusu@semantum.fi>
Mon, 2 Mar 2020 11:48:00 +0000 (13:48 +0200)
gitlab #95

Change-Id: I9174814d63382f0035cd4705b3d8eb28982de573

org.simantics.plant3d/src/org/simantics/plant3d/editor/P3DNodeMap.java

index 08ce5a07bc4f4adbc54687540de0a810ed768a01..00118cfd842441568b8bc85dd6cf83364d0a5bcb 100644 (file)
@@ -76,8 +76,14 @@ public class P3DNodeMap extends AbstractVTKNodeMap<Resource,INode> {
                                }
                        }
                } else if (n instanceof PipeRun) {
-                       // FIXME: may require rule based update!
                        PipeRun run = (PipeRun)n;
+                       
+                       // Check for change to turn radii and update turn components
+                       if (ids.contains(Plant3D.URIs.HasTurnRadiusArray) ||
+                               ids.contains(Plant3D.URIs.HasTurnRadius)) {
+                               requestTurnUpdates(run);
+                       }
+                       
                        Set<String> ids2 = new HashSet<String>();
                        ids2.add(Plant3D.URIs.hasGeometry);
                        for (PipeControlPoint pcp : run.getControlPoints()) {
@@ -97,6 +103,13 @@ public class P3DNodeMap extends AbstractVTKNodeMap<Resource,INode> {
                }
        }
        
+       private void requestTurnUpdates(PipeRun run) {
+               for (PipeControlPoint pcp : run.getControlPoints()) {
+                       if (pcp.isTurn())
+                               PipingRules.requestUpdate(pcp);
+               }
+       }
+       
        private void updateTransform(IP3DNode node) {
                if (DEBUG) System.out.println("P3DNodeMap update Transform " + debugString(node));