From: Reino Ruusu Date: Mon, 9 Mar 2020 09:03:21 +0000 (+0200) Subject: Add a wall thickness property to pipe runs. X-Git-Tag: v1.43.0~44 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F76%2F3976%2F1;p=simantics%2F3d.git Add a wall thickness property to pipe runs. gitlab #104 Change-Id: Ib21da6f7aee8c2bb1aa74b9a43cdf72264e9f689 --- 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);