X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.g3d%2Fsrc%2Forg%2Fsimantics%2Fg3d%2Fscenegraph%2Fstructural%2FG3DStructuralParentNode.java;h=569f0211fdbb5f597d8476ce465b864b8595f9f1;hb=9f84331c9967c88e0e5550ce91f2b7e364a5cb6d;hp=b94cee31b16e787a155f5c8dbdd954ed13f83ca0;hpb=289aaab900078ef56efc8779e4b15830e472149e;p=simantics%2F3d.git diff --git a/org.simantics.g3d/src/org/simantics/g3d/scenegraph/structural/G3DStructuralParentNode.java b/org.simantics.g3d/src/org/simantics/g3d/scenegraph/structural/G3DStructuralParentNode.java index b94cee31..569f0211 100644 --- a/org.simantics.g3d/src/org/simantics/g3d/scenegraph/structural/G3DStructuralParentNode.java +++ b/org.simantics.g3d/src/org/simantics/g3d/scenegraph/structural/G3DStructuralParentNode.java @@ -12,6 +12,7 @@ package org.simantics.g3d.scenegraph.structural; import java.util.Collection; +import java.util.Objects; import javax.vecmath.Quat4d; import javax.vecmath.Vector3d; @@ -21,7 +22,6 @@ import org.simantics.g3d.ontology.G3D; import org.simantics.g3d.property.annotations.GetPropertyValue; import org.simantics.g3d.property.annotations.SetPropertyValue; import org.simantics.g3d.scenegraph.IG3DNode; -import org.simantics.g3d.scenegraph.base.INode; import org.simantics.g3d.scenegraph.base.NodeException; import org.simantics.g3d.tools.NodeTools; import org.simantics.objmap.graph.annotations.RelatedGetValue; @@ -96,6 +96,9 @@ public abstract class G3DStructuralParentNode extends @Override @SetPropertyValue(G3D.URIs.hasPosition) public void setPosition(Vector3d position) { + if (Objects.equals(this.position, position)) + return; + this.position = position; firePropertyChanged(G3D.URIs.hasPosition); } @@ -103,6 +106,9 @@ public abstract class G3DStructuralParentNode extends @Override @SetPropertyValue(G3D.URIs.hasOrientation) public void setOrientation(Quat4d orientation) { + if (Objects.equals(this.orientation, orientation)) + return; + this.orientation = orientation; firePropertyChanged(G3D.URIs.hasOrientation); } @@ -168,15 +174,12 @@ public abstract class G3DStructuralParentNode extends protected Collection _getStrNodes(String id) { return getNodes(id+"/str"); } - - public Object getAdapter(Class adapter) { - if (INode.class == adapter) - return this; - if (IG3DNode.class == adapter) - return this; + + @Override + public U getAdapter(Class adapter) { + if (adapter.isInstance(this)) + return adapter.cast(this); return null; } - - }