]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Remove listener calls when property values not updated. 08/3908/2
authorReino Ruusu <reino.ruusu@semantum.fi>
Mon, 24 Feb 2020 18:40:36 +0000 (20:40 +0200)
committerReino Ruusu <reino.ruusu@semantum.fi>
Wed, 26 Feb 2020 12:38:30 +0000 (14:38 +0200)
gitlab #90

Change-Id: Ic3e4097cc19fb9ebd295052f9a5f0c57ad39328a

27 files changed:
org.simantics.g3d.csg/.classpath
org.simantics.g3d.csg/META-INF/MANIFEST.MF
org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/BarrelNode.java
org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/BoxNode.java
org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/CSGnode.java
org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/CSGparentNode.java
org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/ConeNode.java
org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/CylinderNode.java
org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/EllipticCylinderNode.java
org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/RectangularSolidNode.java
org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/RegularPrismNode.java
org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/SphereNode.java
org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/TorusNode.java
org.simantics.g3d/src/org/simantics/g3d/scenegraph/G3DNode.java
org.simantics.g3d/src/org/simantics/g3d/scenegraph/structural/ComponentNode.java
org.simantics.g3d/src/org/simantics/g3d/scenegraph/structural/G3DComponentNode.java
org.simantics.g3d/src/org/simantics/g3d/scenegraph/structural/G3DStructuralParentNode.java
org.simantics.g3d/src/org/simantics/g3d/scenegraph/structural/StructuralParentNode.java
org.simantics.plant3d/META-INF/MANIFEST.MF
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/GeometryComponent.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/Nozzle.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/P3DNode.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/P3DParentNode.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipeRun.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipeControlPoint.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/PipingRules.java

index b862a296d38fe04269faeee6c9d77d11ff77380d..5e4f6d9ca4fb209ecb24f05b098dec961aee287b 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <classpath>\r
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
-       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
        <classpathentry kind="src" path="src"/>\r
+       <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
        <classpathentry kind="output" path="bin"/>\r
 </classpath>\r
index 1680ff0f50de3ca0b8ad3b33ed66588115175c3e..46700b064ae5d76c1fca1197e0b843393a85b877 100644 (file)
@@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.core.runtime,
  org.simantics.g3d.vtk;bundle-version="1.0.0",
  org.simantics.browsing.ui.common;bundle-version="1.1.0",
  org.simantics.objmap2;bundle-version="1.0.0",
- org.simantics.opencascade.vtk;bundle-version="1.0.0"
+ org.simantics.opencascade.vtk;bundle-version="1.0.0",
+ org.slf4j.api
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
 Export-Package: org.simantics.g3d.csg.handler,
index 0a417f3ba7984b05ff096ae4a12ab1810a1d94a8..5e0d5c0bc1273b23cd8e46eb5601835ce79a46a1 100644 (file)
@@ -40,6 +40,8 @@ public class BarrelNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasMinorRadius)\r
        @SetPropertyValue(CSG.URIs.HasMinorRadius)\r
        public void setR1(double r1) {\r
+               if (this.r1 == r1)\r
+                       return;\r
                this.r1 = r1;\r
                firePropertyChanged(CSG.URIs.HasMinorRadius);\r
        }\r
@@ -47,6 +49,8 @@ public class BarrelNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasMajorRadius)\r
        @SetPropertyValue(CSG.URIs.HasMajorRadius)\r
        public void setR2(double r2) {\r
+               if (this.r2 == r2)\r
+                       return;\r
                this.r2 = r2;\r
                firePropertyChanged(CSG.URIs.HasMajorRadius);\r
        }\r
@@ -54,6 +58,8 @@ public class BarrelNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasHeight)\r
        @SetPropertyValue(CSG.URIs.HasHeight)\r
        public void setH(double h) {\r
+               if (this.h == h)\r
+                       return;\r
                this.h = h;\r
                firePropertyChanged(CSG.URIs.HasHeight);\r
        }\r
index a2e0145fd2b31ca3f080705e5fd76cfda6300eae..ea950eeb80ca68181ee87099d5732d41b45098e0 100644 (file)
@@ -34,6 +34,8 @@ public class BoxNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasXAxisSize)\r
        @SetPropertyValue(CSG.URIs.HasXAxisSize)\r
        public void setSX(double d) {\r
+               if (this.sx == d)\r
+                       return;\r
                this.sx = d;\r
                firePropertyChanged(CSG.URIs.HasXAxisSize);\r
        }\r
@@ -41,6 +43,8 @@ public class BoxNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasYAxisSize)\r
        @SetPropertyValue(CSG.URIs.HasYAxisSize)\r
        public void setSY(double d) {\r
+               if (this.sy == d)\r
+                       return;\r
                this.sy = d;\r
                firePropertyChanged(CSG.URIs.HasYAxisSize);\r
        }\r
@@ -48,6 +52,8 @@ public class BoxNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasZAxisSize)\r
        @SetPropertyValue(CSG.URIs.HasZAxisSize)\r
        public void setSZ(double d) {\r
+               if (this.sz == d)\r
+                       return;\r
                this.sz = d;\r
                firePropertyChanged(CSG.URIs.HasZAxisSize);\r
        }\r
index 68c1c015f2f1d67c610f858efb54ca44c26f2636..a30bb5401881d93b2c2be6a80c14ca945725ca4f 100644 (file)
@@ -48,7 +48,7 @@ public abstract class CSGnode extends G3DNode implements ICSGnode {
        @RelatedSetValue(Layer0.URIs.HasName)
        @SetPropertyValue(Layer0.URIs.HasName)
        public void setName(String name) {
-               if (name == null)
+               if (name == null || name.equals(this.name))
                        return;
                this.name = name;
                firePropertyChanged(Layer0.URIs.HasName);
index 087ec522468a2f13e3a9354f0f09a246ee61aff8..46610414f8c6ab4a061f6a08ab54ffab60caf870 100644 (file)
@@ -13,6 +13,7 @@ package org.simantics.g3d.csg.scenegraph2;
 
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Objects;
 
 import javax.vecmath.AxisAngle4d;
 import javax.vecmath.Quat4d;
@@ -56,7 +57,7 @@ public abstract class CSGparentNode extends ParentNode<ICSGnode> implements ICSG
        @RelatedSetValue(Layer0.URIs.HasName)
        @SetPropertyValue(Layer0.URIs.HasName)
        public void setName(String name) {
-               if (name == null)
+               if (name == null || name.equals(this.name))
                        return;
                this.name = name;
                firePropertyChanged(Layer0.URIs.HasName);
@@ -181,6 +182,9 @@ public abstract class CSGparentNode extends ParentNode<ICSGnode> implements ICSG
        @SetPropertyValue(G3D.URIs.hasOrientation)
        public void setOrientation(Quat4d orientation) {
                assert(orientation != null);
+               if (Objects.equals(this.orientation, orientation))
+                       return;
+               
                this.orientation = orientation;
                
                firePropertyChanged(G3D.URIs.hasOrientation);
@@ -190,6 +194,9 @@ public abstract class CSGparentNode extends ParentNode<ICSGnode> implements ICSG
        @SetPropertyValue(G3D.URIs.hasPosition)
        public void setPosition(Vector3d position) {
                assert(position != null);
+               if (Objects.equals(this.position, position))
+                       return;
+               
                this.position = position;
                
                firePropertyChanged(G3D.URIs.hasPosition);
index 6c8c218a4aa377edca0c419c644efe1c70ce48d0..1b14a4058c04653e2df14389920702dcaf49e916 100644 (file)
@@ -31,6 +31,8 @@ public class ConeNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasBottomRadius)\r
        @SetPropertyValue(CSG.URIs.HasBottomRadius)\r
        public void setR1(double r1) {\r
+               if (this.r1 == r1)\r
+                       return;\r
                this.r1 = r1;\r
                firePropertyChanged(CSG.URIs.HasBottomRadius);\r
        }\r
@@ -38,6 +40,8 @@ public class ConeNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasTopRadius)\r
        @SetPropertyValue(CSG.URIs.HasTopRadius)\r
        public void setR2(double r2) {\r
+               if (this.r2 == r2)\r
+                       return;\r
                this.r2 = r2;\r
                firePropertyChanged(CSG.URIs.HasTopRadius);\r
        }\r
index a715eb4cdc4818012bfc88c2cb39384bf5103252..cf2e0183269c280c39b1a452547985d24c578ca0 100644 (file)
@@ -11,6 +11,8 @@
  *******************************************************************************/\r
 package org.simantics.g3d.csg.scenegraph2;\r
 \r
+import java.util.Objects;\r
+\r
 import org.jcae.opencascade.jni.TopoDS_Shape;\r
 import org.simantics.g3d.csg.ontology.CSG;\r
 import org.simantics.g3d.property.annotations.GetPropertyValue;\r
@@ -29,6 +31,8 @@ public class CylinderNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasRadius)\r
        @SetPropertyValue(CSG.URIs.HasRadius)\r
        public void setR(double r) {\r
+               if (this.r == r)\r
+                       return;\r
                this.r = r;\r
                firePropertyChanged(CSG.URIs.HasRadius);\r
        }\r
@@ -36,6 +40,8 @@ public class CylinderNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasHeight)\r
        @SetPropertyValue(CSG.URIs.HasHeight)\r
        public void setH(double h) {\r
+               if (this.h == h)\r
+                       return;\r
                this.h = h;\r
                firePropertyChanged(CSG.URIs.HasHeight);\r
        }\r
index 8c99638d1e48cf635568b54992eef2b7beeacc29..e4030728621fa0b7b5613e4b2b709614f4e7b0d9 100644 (file)
@@ -30,6 +30,8 @@ public class EllipticCylinderNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasMinorRadius)\r
        @SetPropertyValue(CSG.URIs.HasMinorRadius)\r
        public void setR1(double r1) {\r
+               if (this.r1 == r1)\r
+                       return;\r
                this.r1 = r1;\r
                firePropertyChanged(CSG.URIs.HasMinorRadius);\r
        }\r
@@ -37,6 +39,8 @@ public class EllipticCylinderNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasMajorRadius)\r
        @SetPropertyValue(CSG.URIs.HasMajorRadius)\r
        public void setR2(double r2) {\r
+               if (this.r2 == r2)\r
+                       return;\r
                this.r2 = r2;\r
                firePropertyChanged(CSG.URIs.HasMajorRadius);\r
        }\r
@@ -44,6 +48,8 @@ public class EllipticCylinderNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasHeight)\r
        @SetPropertyValue(CSG.URIs.HasHeight)\r
        public void setH(double h) {\r
+               if (this.h == h)\r
+                       return;\r
                this.h = h;\r
                firePropertyChanged(CSG.URIs.HasHeight);\r
        }\r
index 562b810f08b549be5a8af54dc0af3dfb152651f4..01aaf2cddd5d5880b688cda4d345971239fdf770 100644 (file)
@@ -38,6 +38,8 @@ public class RectangularSolidNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasXAxisMinimumSize)\r
        @SetPropertyValue(CSG.URIs.HasXAxisMinimumSize)\r
        public void setX1(double d) {\r
+               if (this.x1 == d)\r
+                       return;\r
                this.x1 = d;\r
                firePropertyChanged(CSG.URIs.HasXAxisMinimumSize);\r
        }\r
@@ -45,6 +47,8 @@ public class RectangularSolidNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasXAxisMaximumSize)\r
        @SetPropertyValue(CSG.URIs.HasXAxisMaximumSize)\r
        public void setX2(double d) {\r
+               if (this.x2 == d)\r
+                       return;\r
                this.x2 = d;\r
                firePropertyChanged(CSG.URIs.HasXAxisMaximumSize);\r
        }\r
@@ -52,6 +56,8 @@ public class RectangularSolidNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasYAxisSize)\r
        @SetPropertyValue(CSG.URIs.HasYAxisSize)\r
        public void setSY(double d) {\r
+               if (this.y == d)\r
+                       return;\r
                this.y = d;\r
                firePropertyChanged(CSG.URIs.HasYAxisSize);\r
        }\r
@@ -59,6 +65,8 @@ public class RectangularSolidNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasZAxisMinimumSize)\r
        @SetPropertyValue(CSG.URIs.HasZAxisMinimumSize)\r
        public void setZ1(double d) {\r
+               if (this.z1 == d)\r
+                       return;\r
                this.z1 = d;\r
                firePropertyChanged(CSG.URIs.HasZAxisMinimumSize);\r
        }\r
@@ -66,6 +74,8 @@ public class RectangularSolidNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasZAxisMaximumSize)\r
        @SetPropertyValue(CSG.URIs.HasZAxisMaximumSize)\r
        public void setZ2(double d) {\r
+               if (this.z2 == d)\r
+                       return;\r
                this.z2 = d;\r
                firePropertyChanged(CSG.URIs.HasZAxisMaximumSize);\r
        }\r
index 6f959d31d0eb9d15100271d0ee4bf379432cba65..3d52b602ffb1b936498880618a639ae50ad17c24 100644 (file)
@@ -30,6 +30,8 @@ public class RegularPrismNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasRadius)\r
        @SetPropertyValue(CSG.URIs.HasRadius)\r
        public void setR(double r) {\r
+               if (this.r == r)\r
+                       return;\r
                this.r = r;\r
                firePropertyChanged(CSG.URIs.HasRadius);\r
        }\r
@@ -38,6 +40,8 @@ public class RegularPrismNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasHeight)\r
        @SetPropertyValue(CSG.URIs.HasHeight)\r
        public void setH(double h) {\r
+               if (this.h == h)\r
+                       return;\r
                this.h = h;\r
                firePropertyChanged(CSG.URIs.HasHeight);\r
        }\r
@@ -47,6 +51,8 @@ public class RegularPrismNode extends CSGnode {
        public void setN(int n) {\r
                if (n < 3)\r
                        n = 3;\r
+               if (this.n == n)\r
+                       return;\r
                this.n = n;\r
                firePropertyChanged(CSG.URIs.HasCorners);\r
        }\r
index 03a9a248feaf6f859e6f9a436f19954489d8a2a3..e71632da03ad86ca5a6312dc00783bf33a88bcaa 100644 (file)
@@ -28,6 +28,8 @@ public class SphereNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasRadius)\r
        @SetPropertyValue(CSG.URIs.HasRadius)\r
        public void setR(double r) {\r
+               if (this.r == r)\r
+                       return;\r
                this.r = r;\r
                firePropertyChanged(CSG.URIs.HasRadius);\r
        }\r
index e7794e86d92401ba78124ce68c0fa82bfcadfe8d..9b92854ebd07a1f21d43e1d087b2da128f46ba95 100644 (file)
@@ -30,6 +30,8 @@ public class TorusNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasMinorRadius)\r
        @SetPropertyValue(CSG.URIs.HasMinorRadius)\r
        public void setR1(double r1) {\r
+               if (this.r1 == r1)\r
+                       return;\r
                this.r1 = r1;\r
                firePropertyChanged(CSG.URIs.HasMinorRadius);\r
        }\r
@@ -37,6 +39,8 @@ public class TorusNode extends CSGnode {
        @RelatedSetValue(CSG.URIs.HasMajorRadius)\r
        @SetPropertyValue(CSG.URIs.HasMajorRadius)\r
        public void setR2(double r2) {\r
+               if (this.r2 == r2)\r
+                       return;\r
                this.r2 = r2;\r
                firePropertyChanged(CSG.URIs.HasMajorRadius);\r
        }\r
index c955dc6a3d21642bc23b4ff5b3f4420f177b74bd..7b890b39b8ae16cdd85ad19f331fffb846b6c46e 100644 (file)
@@ -11,6 +11,8 @@
  *******************************************************************************/\r
 package org.simantics.g3d.scenegraph;\r
 \r
+import java.util.Objects;\r
+\r
 import javax.vecmath.Quat4d;\r
 import javax.vecmath.Vector3d;\r
 \r
@@ -61,8 +63,11 @@ public class G3DNode extends Node implements IG3DNode {
        @SetPropertyValue(G3D.URIs.hasOrientation)\r
        public void setOrientation(Quat4d orientation) {\r
                assert(orientation != null);\r
+               if (Objects.equals(this.orientation, orientation))\r
+                       return;\r
+\r
                this.orientation = orientation;\r
-               \r
+                       \r
                firePropertyChanged(G3D.URIs.hasOrientation);\r
        }\r
        \r
@@ -77,6 +82,9 @@ public class G3DNode extends Node implements IG3DNode {
        @SetPropertyValue(G3D.URIs.hasPosition)\r
        public void setPosition(Vector3d position) {\r
                assert(position != null);\r
+               if (Objects.equals(this.position, position))\r
+                       return;\r
+               \r
                this.position = position;\r
                \r
                firePropertyChanged(G3D.URIs.hasPosition);\r
@@ -89,6 +97,11 @@ public class G3DNode extends Node implements IG3DNode {
                setPosition(new Vector3d(arr));\r
        }\r
        \r
+       public void _setPosition(Vector3d position) {\r
+               assert(position != null);\r
+               this.position = position;\r
+       }\r
+       \r
        @Override\r
        @GetPropertyValue(value = G3D.URIs.hasWorldPosition, tabId = "Transform", name = "World Position")\r
        public Vector3d getWorldPosition() {\r
index 13ac2f523129356f9a12d659c6564ee7b2a33b08..332d3cdf1e346ec02ec52511186a2b6803bd0c9f 100644 (file)
@@ -15,6 +15,7 @@ import java.util.ArrayList;
 import java.util.Collection;\r
 import java.util.Collections;\r
 import java.util.List;\r
+import java.util.Objects;\r
 \r
 import org.simantics.g3d.ontology.G3D;\r
 import org.simantics.g3d.property.annotations.GetPropertyValue;\r
@@ -41,7 +42,7 @@ public abstract class ComponentNode<T extends Connection<T,T2>, T2 extends IComp
        @RelatedSetValue(Layer0.URIs.HasName)\r
        @SetPropertyValue(Layer0.URIs.HasName)\r
        public void setName(String name) {\r
-               if (name == null)\r
+               if (name == null || Objects.equals(this.name, name))\r
                        return;\r
                this.name = name;\r
                firePropertyChanged(Layer0.URIs.HasName);\r
@@ -96,8 +97,8 @@ public abstract class ComponentNode<T extends Connection<T,T2>, T2 extends IComp
        \r
        @Override\r
        public void addPublishedBy(IStructuralNode node) {\r
-               publisher.add(node);\r
-               firePropertyChanged(G3D.URIs.publishes);\r
+               if (publisher.add(node))\r
+                       firePropertyChanged(G3D.URIs.publishes);\r
        }\r
        \r
        @Override\r
index 692913656bde8c3e9c05ea547803dc6c9e2c7736..9ebd8c885a9e47ce8304eb228d4066dd0b2a3605 100644 (file)
@@ -41,7 +41,7 @@ public abstract class G3DComponentNode<T extends Connection<T,T2>, T2 extends IC
        @RelatedSetValue(Layer0.URIs.HasName)\r
        @SetPropertyValue(Layer0.URIs.HasName)\r
        public void setName(String name) {\r
-               if (name == null)\r
+               if (name == null || name.equals(this.name))\r
                        return;\r
                this.name = name;\r
                firePropertyChanged(Layer0.URIs.HasName);\r
@@ -96,8 +96,8 @@ public abstract class G3DComponentNode<T extends Connection<T,T2>, T2 extends IC
        \r
        @Override\r
        public void addPublishedBy(IStructuralNode node) {\r
-               publisher.add(node);\r
-               firePropertyChanged(G3D.URIs.publishes);\r
+               if (publisher.add(node))\r
+                       firePropertyChanged(G3D.URIs.publishes);\r
        }\r
        \r
        @Override\r
index 073ef79d49b2b6c89f9f6ad3182a6f7959915753..569f0211fdbb5f597d8476ce465b864b8595f9f1 100644 (file)
@@ -12,6 +12,7 @@
 package org.simantics.g3d.scenegraph.structural;\r
 \r
 import java.util.Collection;\r
+import java.util.Objects;\r
 \r
 import javax.vecmath.Quat4d;\r
 import javax.vecmath.Vector3d;\r
@@ -95,6 +96,9 @@ public abstract class G3DStructuralParentNode<T extends IStructuralNode> extends
        @Override\r
        @SetPropertyValue(G3D.URIs.hasPosition)\r
        public void setPosition(Vector3d position) {\r
+               if (Objects.equals(this.position, position))\r
+                       return;\r
+               \r
                this.position = position;\r
                firePropertyChanged(G3D.URIs.hasPosition);\r
        }\r
@@ -102,6 +106,9 @@ public abstract class G3DStructuralParentNode<T extends IStructuralNode> extends
        @Override\r
        @SetPropertyValue(G3D.URIs.hasOrientation)\r
        public void setOrientation(Quat4d orientation) {\r
+               if (Objects.equals(this.orientation, orientation))\r
+                       return;\r
+               \r
                this.orientation = orientation;\r
                firePropertyChanged(G3D.URIs.hasOrientation);\r
        }\r
index 1ae000969cfe2f4f1830f38b78220a0055b83db5..032ba98169981d6673c9ac6b50c1ae5e394ced85 100644 (file)
@@ -38,7 +38,7 @@ public abstract class StructuralParentNode<T extends IStructuralNode> extends Pa
        @RelatedSetValue(Layer0.URIs.HasName)\r
        @SetPropertyValue(Layer0.URIs.HasName)\r
        public void setName(String name) {\r
-               if (name == null)\r
+               if (name == null || name.equals(this.name))\r
                        return;\r
                this.name = name;\r
                firePropertyChanged(Layer0.URIs.HasName);\r
@@ -84,8 +84,8 @@ public abstract class StructuralParentNode<T extends IStructuralNode> extends Pa
        \r
        @Override\r
        public void addPublishedBy(IStructuralNode node) {\r
-               publisher.add(node);\r
-               firePropertyChanged(G3D.URIs.publishes);\r
+               if (publisher.add(node))\r
+                       firePropertyChanged(G3D.URIs.publishes);\r
        }\r
        \r
        @Override\r
index aa6bfd98bae944347ed7c19f75c16b1a22ea8041..4d63758ed670d33e66e24b5a78e2b8b93a445620 100644 (file)
@@ -33,7 +33,8 @@ Require-Bundle: org.eclipse.core.runtime,
  org.simantics.browsing.ui.platform;bundle-version="1.1.0",
  org.simantics.structural.ui;bundle-version="1.1.1",
  org.simantics.g3d.csg;bundle-version="1.0.0",
- org.simantics.utils.thread.swt;bundle-version="1.1.0"
+ org.simantics.utils.thread.swt;bundle-version="1.1.0",
+ org.slf4j.api
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
 Export-Package: org.simantics.plant3d.actions,
@@ -50,4 +51,3 @@ Export-Package: org.simantics.plant3d.actions,
  org.simantics.plant3d.scl,
  org.simantics.plant3d.utils
 Automatic-Module-Name: org.simantics.plant3d
-Import-Package: org.slf4j
index 6c6c1b66a7f555b4097197a6473c6312b258abce..c784b4113f8ebd650f878245a8c9dd45ebd8ebb8 100644 (file)
@@ -7,6 +7,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 
 import org.jcae.opencascade.jni.TopoDS_Shape;
@@ -133,7 +134,7 @@ public class GeometryComponent {
                for (String id : parameters.keySet()) {
                        Object currentValue = currentParameters.get(id);
                        Object newValue = parameters.get(id);
-                       if (currentValue == newValue)
+                       if (Objects.equals(currentValue, newValue))
                                continue;
                        if (newValue == null) {
                            continue;
index cbdecc1c09ea2250c4464c003220d3825e3097ea..61ac722c9fb15637f63bfdd9d21db834bc4cdafd 100644 (file)
@@ -83,6 +83,9 @@ public class Nozzle extends PipelineComponent {
        @RelatedSetObj(Plant3D.URIs.HasPipeRun)
        @Override
        public void setPipeRun(PipeRun pipeRun) {
+               if (this.getPipeRun() == pipeRun)
+                       return;
+               
                super.setPipeRun(pipeRun);
                try {
                        _createCP();
index 84e1535eb34a0da6efda65d83f80dd380cb3de3f..14ffcf530f5b1f6fa9ee92a5dee3951a1664be58 100644 (file)
@@ -1,5 +1,7 @@
 package org.simantics.plant3d.scenegraph;
 
+import java.util.Objects;
+
 import org.simantics.g3d.property.annotations.GetPropertyValue;
 import org.simantics.g3d.property.annotations.SetPropertyValue;
 import org.simantics.g3d.scenegraph.G3DNode;
@@ -20,9 +22,11 @@ public abstract class P3DNode extends G3DNode implements IP3DVisualNode {
        @RelatedSetValue(Layer0.URIs.HasName)
        @SetPropertyValue(Layer0.URIs.HasName)
        public void setName(String name) {
-               if (name == null)
+               if (name == null || Objects.equals(this.name, name))
                        return;
+               
                this.name = name;
+               
                firePropertyChanged(Layer0.URIs.HasName);
        }
        
index 2be491834d086e48ca23097bae41cf96c059dda7..d7f6749e53fcb4dacbdd1dc50da03a0f47b40125 100644 (file)
@@ -1,6 +1,7 @@
 package org.simantics.plant3d.scenegraph;
 
 import java.util.HashSet;
+import java.util.Objects;
 import java.util.Set;
 
 import javax.vecmath.Quat4d;
@@ -35,7 +36,7 @@ public abstract class P3DParentNode<T extends IP3DNode> extends ParentNode<T> im
        @RelatedSetValue(Layer0.URIs.HasName)
        @SetPropertyValue(Layer0.URIs.HasName)
        public void setName(String name) {
-               if (name == null)
+               if (name == null || name.equals(this.name))
                        return;
                this.name = name;
                firePropertyChanged(Layer0.URIs.HasName);
@@ -80,6 +81,9 @@ public abstract class P3DParentNode<T extends IP3DNode> extends ParentNode<T> im
        @SetPropertyValue(G3D.URIs.hasOrientation)
        public void setOrientation(Quat4d orientation) {
                assert(orientation != null);
+               if (Objects.equals(this.orientation, orientation))
+                       return;
+               
                this.orientation = orientation;
                
                firePropertyChanged(G3D.URIs.hasOrientation);
@@ -89,6 +93,9 @@ public abstract class P3DParentNode<T extends IP3DNode> extends ParentNode<T> im
        @SetPropertyValue(G3D.URIs.hasPosition)
        public void setPosition(Vector3d position) {
                assert(position != null);
+               if (Objects.equals(this.position, position))
+                       return;
+               
                this.position = position;
                
                firePropertyChanged(G3D.URIs.hasPosition);
index 1d199f53f2ec604737d798a3ec074e7978bda485..86f649aa136e49b6d0f7ac00cf956fb7de9e4392 100644 (file)
@@ -1,12 +1,14 @@
 package org.simantics.plant3d.scenegraph;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 import org.simantics.g3d.math.MathTools;
 import org.simantics.g3d.property.annotations.GetPropertyValue;
@@ -64,6 +66,8 @@ public class PipeRun extends P3DParentNode<IP3DNode> {
        @RelatedSetValue(Plant3D.URIs.HasTurnRadius)
        @SetPropertyValue(Plant3D.URIs.HasTurnRadius)
        public void setTurnRadius(double turnRadius) {
+               if (this.turnRadius[0] == turnRadius)
+                       return;
                this.turnRadius[0] = turnRadius;
                firePropertyChanged(Plant3D.URIs.HasTurnRadius);
                firePropertyChanged(Plant3D.URIs.HasTurnRadiusArray);
@@ -78,7 +82,7 @@ public class PipeRun extends P3DParentNode<IP3DNode> {
     @RelatedSetValue(Plant3D.URIs.HasTurnRadiusArray)
     @SetPropertyValue(Plant3D.URIs.HasTurnRadiusArray)
     public void setTurnRadiusArray(double[] turnRadiusArray) {
-        if (turnRadiusArray == null || turnRadiusArray.length == 0)
+        if (turnRadiusArray == null || turnRadiusArray.length == 0 || Arrays.equals(this.turnRadius, turnRadiusArray))
             return;
         this.turnRadius = turnRadiusArray;
         firePropertyChanged(Plant3D.URIs.HasTurnRadiusArray);
@@ -93,7 +97,10 @@ public class PipeRun extends P3DParentNode<IP3DNode> {
        @RelatedSetValue(Plant3D.URIs.HasPipeDiameter)
        @SetPropertyValue(Plant3D.URIs.HasPipeDiameter)
        public void setPipeDiameter(double pipeDiameter) {
-               this.pipeDiameter = pipeDiameter;       
+               if (Objects.equals(this.pipeDiameter, pipeDiameter))
+                       return;
+               
+               this.pipeDiameter = pipeDiameter;
                firePropertyChanged(Plant3D.URIs.HasPipeDiameter);
        }
        
index d3ded1efe7b0fe1217fd706844555ea219b4a8ea..f0621fdd2ce7f76dad1490963b62ba73583065a1 100644 (file)
@@ -4,6 +4,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Objects;
 
 import javax.vecmath.Quat4d;
 import javax.vecmath.Tuple3d;
@@ -728,12 +729,9 @@ public abstract class PipelineComponent extends GeometryNode {
         * @param error
         */
        public void setError(String error) {
-           if (this.error == null) {
-               if (error == null)
-                   return;
-           } else if (this.error.equals(error))
+           if (Objects.equals(this.error,  error))
                return;
-           this.error = error;         
+           this.error = error;
            firePropertyChanged("error");
        }
 }
index 9e9beb9c37711e63012c006b4221839de8cfb819..8f1b9a88bb6b7bf72ea20f866453deea1b76cc2b 100644 (file)
@@ -4,6 +4,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
+import java.util.Objects;
 
 import javax.vecmath.AxisAngle4d;
 import javax.vecmath.Matrix3d;
@@ -379,9 +380,10 @@ public class PipeControlPoint extends G3DNode implements IP3DNode {
        }
 
        public void setLength(double l) {
-               if (Double.isInfinite(l) || Double.isNaN(l)) {
+               if (this.length == l)
+                       return;
+               if (Double.isInfinite(l) || Double.isNaN(l))
                        return;
-               }
                if (Math.abs(this.length-l) < MathTools.NEAR_ZERO)
                        return;
                this.length = l;
@@ -429,6 +431,8 @@ public class PipeControlPoint extends G3DNode implements IP3DNode {
                }
                if (this.turnAngle != null && Math.abs(this.turnAngle-turnAngle) < MathTools.NEAR_ZERO)
                        return;
+               if (Objects.equals(this.turnAngle, turnAngle))
+                       return;
                this.turnAngle = turnAngle;
                firePropertyChanged("turnAngle");
        }
@@ -446,6 +450,8 @@ public class PipeControlPoint extends G3DNode implements IP3DNode {
                }
                if (this.offset != null && Math.abs(this.offset-offset) < MathTools.NEAR_ZERO)
                        return;
+               if (Objects.equals(this.offset, offset))
+                       return;
                this.offset = offset;
                firePropertyChanged("offset");
        }
@@ -456,11 +462,15 @@ public class PipeControlPoint extends G3DNode implements IP3DNode {
                }
                if (this.rotationAngle != null && Math.abs(this.rotationAngle-rotationAngle) < MathTools.NEAR_ZERO)
                        return;
+               if (Objects.equals(rotationAngle, rotationAngle))
+                       return;
                this.rotationAngle = rotationAngle;
                firePropertyChanged("rotationAngle");
        }
 
        public void setReversed(Boolean reversed) {
+               if (this.reversed == reversed)
+                       return;
                this.reversed = reversed;
                firePropertyChanged("reversed");
        }
@@ -1603,7 +1613,7 @@ public class PipeControlPoint extends G3DNode implements IP3DNode {
                        component._setWorldPosition(getWorldPosition());
                updateSubPoint();
        }
-
+       
        private void updateSubPoint() {
                if (isOffset()) {
                        if (next == null && previous == null) {
index 2c77c2bfbc9f24f1b9bb5fe89ca37dcb3ca894c1..e8729872d53a0b863cf40e45049b1eefd7fdad96 100644 (file)
@@ -1370,7 +1370,7 @@ public class PipingRules {
                    while (iter > 0) {
                        Vector3d tp = new Vector3d(dir);
                        tp.scaleAdd(curr, dp);
-                       tcp.setPosition(tp);
+                       tcp._setPosition(tp); // no firing of listeners here
                            if (other == ne) {
                                dir2 = pathLegDirection(tcp);
                            } else {
@@ -1390,7 +1390,7 @@ public class PipingRules {
                    }
            }
            finally {
-               tcp.setPosition(tp0);
+               tcp._setPosition(tp0); // return the original value
            }
            return curr;
        }