From d515401dd50a89bb6f0f5c8d75e045a96db39f51 Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Mon, 9 Mar 2020 11:03:21 +0200 Subject: [PATCH] Add a wall thickness property to pipe runs. gitlab #104 Change-Id: Ib21da6f7aee8c2bb1aa74b9a43cdf72264e9f689 --- .../graph/plant3d.pgraph | 2 ++ .../simantics/plant3d/ontology/Plant3D.java | 6 ++++ .../plant3d/actions/AddComponentAction.java | 3 ++ .../dialog/ComponentSelectionDialog.java | 28 +++++++++++++++++-- .../simantics/plant3d/scenegraph/PipeRun.java | 20 +++++++++++-- .../controlpoint/PipeControlPoint.java | 1 + .../plant3d/utils/ComponentUtils.java | 10 +++++++ 7 files changed, 66 insertions(+), 4 deletions(-) diff --git a/org.simantics.plant3d.ontology/graph/plant3d.pgraph b/org.simantics.plant3d.ontology/graph/plant3d.pgraph index d6029cc6..1fe9540b 100644 --- a/org.simantics.plant3d.ontology/graph/plant3d.pgraph +++ b/org.simantics.plant3d.ontology/graph/plant3d.pgraph @@ -105,6 +105,8 @@ P3D.HasBranch9 { private double pipeDiameter = 0.1; + private double pipeThickness = 0.0; private double[] turnRadius = new double[] {0.2}; @Override @@ -97,13 +97,29 @@ public class PipeRun extends P3DParentNode { @RelatedSetValue(Plant3D.URIs.HasPipeDiameter) @SetPropertyValue(Plant3D.URIs.HasPipeDiameter) public void setPipeDiameter(double pipeDiameter) { - if (Objects.equals(this.pipeDiameter, pipeDiameter)) + if (this.pipeDiameter == pipeDiameter) return; this.pipeDiameter = pipeDiameter; firePropertyChanged(Plant3D.URIs.HasPipeDiameter); } + @RelatedGetValue(Plant3D.URIs.HasPipeThickness) + @GetPropertyValue(value=Plant3D.URIs.HasPipeThickness, name = "Wall Thickness") + public double getPipeThickness() { + return pipeThickness; + } + + @RelatedSetValue(Plant3D.URIs.HasPipeThickness) + @SetPropertyValue(Plant3D.URIs.HasPipeThickness) + public void setPipeThickness(double pipeThickness) { + if (this.pipeThickness == pipeThickness) + return; + + this.pipeThickness = pipeThickness; + firePropertyChanged(Plant3D.URIs.HasPipeThickness); + } + @RelatedElementsAdd(Plant3D.URIs.children) public void addChild(PipelineComponent node) { addNode(Plant3D.URIs.children,node); diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java index 8f1b9a88..08fa2622 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java @@ -1448,6 +1448,7 @@ public class PipeControlPoint extends G3DNode implements IP3DNode { PipeRun previousRun = previous.getPipeRun(); nextPipeRun.setPipeDiameter(previousRun.getPipeDiameter()); + nextPipeRun.setPipeThickness(previousRun.getPipeThickness()); nextPipeRun.setTurnRadiusArray(previousRun.getTurnRadiusArray()); PipelineComponent n = next.getPipelineComponent(); diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java b/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java index 2cef7060..6bbabe1e 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/utils/ComponentUtils.java @@ -281,6 +281,7 @@ public class ComponentUtils { // Reducer requires pipe specs public Double diameter; + public Double thickness; public Double turnRadius; // Variable length @@ -331,6 +332,14 @@ public class ComponentUtils { public void setDiameter(Double diameter) { this.diameter = diameter; } + + public double getThickness() { + return thickness; + } + + public void setThickness(double thickness) { + this.thickness = thickness; + } public Double getTurnRadius() { return turnRadius; @@ -537,6 +546,7 @@ public class ComponentUtils { String n = root.getUniqueName("PipeRun"); other.setName(n); other.setPipeDiameter(inst.diameter); + other.setPipeThickness(inst.thickness); other.setTurnRadius(inst.turnRadius); root.addChild(other); -- 2.47.1