]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.g3d.csg/src/org/simantics/g3d/csg/scenegraph2/CSGparentNode.java
Remove listener calls when property values not updated.
[simantics/3d.git] / org.simantics.g3d.csg / src / org / simantics / g3d / csg / scenegraph2 / CSGparentNode.java
index 6f83fdbfc095f4cc362d94647b69f9b75e81dadb..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);
@@ -313,7 +320,7 @@ public abstract class CSGparentNode extends ParentNode<ICSGnode> implements ICSG
        }
 
        @Override
-       public Object getAdapter(Class adapter) {
+       public <C> C getAdapter(Class<C> adapter) {
                return null;
        }
 }