X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.g3d%2Fsrc%2Forg%2Fsimantics%2Fg3d%2Fscenegraph%2FG3DNode.java;h=7b890b39b8ae16cdd85ad19f331fffb846b6c46e;hb=9f84331c9967c88e0e5550ce91f2b7e364a5cb6d;hp=c05269924534685fc0ef1992e1863bd4997a5b4a;hpb=289aaab900078ef56efc8779e4b15830e472149e;p=simantics%2F3d.git diff --git a/org.simantics.g3d/src/org/simantics/g3d/scenegraph/G3DNode.java b/org.simantics.g3d/src/org/simantics/g3d/scenegraph/G3DNode.java index c0526992..7b890b39 100644 --- a/org.simantics.g3d/src/org/simantics/g3d/scenegraph/G3DNode.java +++ b/org.simantics.g3d/src/org/simantics/g3d/scenegraph/G3DNode.java @@ -11,6 +11,8 @@ *******************************************************************************/ package org.simantics.g3d.scenegraph; +import java.util.Objects; + import javax.vecmath.Quat4d; import javax.vecmath.Vector3d; @@ -18,7 +20,6 @@ import org.simantics.g3d.ontology.G3D; import org.simantics.g3d.property.annotations.GetPropertyValue; import org.simantics.g3d.property.annotations.PropertyContributor; import org.simantics.g3d.property.annotations.SetPropertyValue; -import org.simantics.g3d.scenegraph.base.INode; import org.simantics.g3d.scenegraph.base.Node; import org.simantics.g3d.tools.NodeTools; import org.simantics.objmap.graph.annotations.RelatedGetValue; @@ -62,8 +63,11 @@ public class G3DNode extends Node implements IG3DNode { @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); } @@ -78,6 +82,9 @@ public class G3DNode extends Node implements IG3DNode { @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); @@ -90,6 +97,11 @@ public class G3DNode extends Node implements IG3DNode { setPosition(new Vector3d(arr)); } + public void _setPosition(Vector3d position) { + assert(position != null); + this.position = position; + } + @Override @GetPropertyValue(value = G3D.URIs.hasWorldPosition, tabId = "Transform", name = "World Position") public Vector3d getWorldPosition() { @@ -149,11 +161,9 @@ public class G3DNode extends Node implements IG3DNode { } @Override - public Object getAdapter(Class adapter) { - if (INode.class == adapter) - return this; - if (IG3DNode.class == adapter) - return this; + public C getAdapter(Class adapter) { + if (adapter.isInstance(this)) + return adapter.cast(this); return null; }