]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Take values from pipe run as defaults for reducers 66/4166/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Mon, 20 Apr 2020 09:53:18 +0000 (12:53 +0300)
committerReino Ruusu <reino.ruusu@semantum.fi>
Mon, 20 Apr 2020 09:53:18 +0000 (12:53 +0300)
gitlab #121

Change-Id: I641b4a0acb69bf3e381afdb6bb1aa22873ea4a79

org.simantics.plant3d/src/org/simantics/plant3d/dialog/ComponentSelectionDialog.java

index fc3f0cefc587f16e785a8973bfd2bd0fbc84e931..207f929e9cc24c55ab316b3b15faf3124148abf1 100644 (file)
@@ -42,6 +42,7 @@ import org.simantics.plant3d.ontology.Plant3D;
 import org.simantics.plant3d.scenegraph.EndComponent;
 import org.simantics.plant3d.scenegraph.InlineComponent;
 import org.simantics.plant3d.scenegraph.Nozzle;
+import org.simantics.plant3d.scenegraph.PipeRun;
 import org.simantics.plant3d.scenegraph.PipelineComponent;
 import org.simantics.plant3d.scenegraph.TurnComponent;
 import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint.PositionType;
@@ -139,6 +140,23 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange
                        insertPosition = PositionType.PREVIOUS;
        }
        
+       private void copyPipeRunParameters() {
+               PipeRun run = component.getPipeRun();
+               if (component.getNext() == null && component.getAlternativePipeRun() != null)
+                       run = component.getAlternativePipeRun();
+               
+               if (run == null)
+                       return;
+               
+               diameter = run.getPipeDiameter();
+               thickness = run.getPipeThickness();
+               turnRadius = run.getTurnRadius();
+               
+               diameterText.setText(Double.toString(diameter * lengthFactor));
+               thicknessText.setText(Double.toString(thickness * lengthFactor));
+               turnRadiusText.setText(Double.toString(turnRadius * lengthFactor));
+       }
+
        public void setLengthFactor(double lengthFactor) {
                this.lengthFactor = lengthFactor;
        }
@@ -319,6 +337,8 @@ public class ComponentSelectionDialog extends Dialog implements ISelectionChange
                diameterText.setEnabled(false);
                thicknessText.setEnabled(false);
 
+               copyPipeRunParameters();
+
                nameText.addKeyListener(new KeyAdapter() {
                        @Override
                        public void keyReleased(KeyEvent e) {