]> gerrit.simantics Code Review - simantics/3d.git/blobdiff - org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java
Convert variable angle turn turn to fixed angle
[simantics/3d.git] / org.simantics.plant3d / src / org / simantics / plant3d / scenegraph / PipelineComponent.java
index c0feb668d183ff090dad98fa81ed844cce02ab0b..735916db6df2b31a0bae9bf7c880ce29c4d95194 100644 (file)
@@ -133,17 +133,20 @@ public abstract class PipelineComponent extends GeometryNode {
        @RelatedSetObj(Plant3D.URIs.HasNext)
        public void setNext(PipelineComponent comp) {
                if (next == comp)
-                       return;
+                   return;
                if (this.next != null)
-                       this.next._removeRef(this);
-               this.next = comp;
-               this.syncnext = false;
-               if (DEBUG) System.out.println(this + " next " + comp);
-               syncNext();
-               firePropertyChanged(Plant3D.URIs.HasNext);
-               if (comp != null)
-                       comp.sync();
-               
+                   this.next._removeRef(this);
+        _setNext(comp);
+        this.syncnext = false;
+        if (DEBUG) System.out.println(this + " next " + comp);
+        syncNext();
+        firePropertyChanged(Plant3D.URIs.HasNext);
+        if (comp != null)
+            comp.sync();
+       }
+       
+       protected void _setNext(PipelineComponent comp) {
+           this.next = comp;
        }
        
        
@@ -158,15 +161,19 @@ public abstract class PipelineComponent extends GeometryNode {
                        return;
                if (this.previous != null)
                        this.previous._removeRef(this);
-               this.previous = comp;
+               _setPrevious(comp);
                this.syncprev = false;
                if (DEBUG) System.out.println(this + " prev " + comp);
                syncPrevious();
                firePropertyChanged(Plant3D.URIs.HasPrevious);
                if (comp != null)
                        comp.sync();
-               
        }
+       
+       protected void _setPrevious(PipelineComponent comp) {
+        this.previous = comp;
+    }
+       
        private PipelineComponent branch0;
        
        @RelatedGetObj(Plant3D.URIs.HasBranch0)
@@ -264,13 +271,13 @@ public abstract class PipelineComponent extends GeometryNode {
        // Control point structure is left into illegal state.
        private void _removeRef(PipelineComponent comp) {
                if (next == comp) {
-                       next = null;
+                       _setNext(null);
                        syncnext = false;
                        if (DEBUG) System.out.println(this + " remove next " + comp);
                        firePropertyChanged(Plant3D.URIs.HasNext);
                        syncNext();
                } else if (previous == comp) {
-                       previous = null;
+                       _setPrevious(null);
                        syncprev = false;
                        if (DEBUG) System.out.println(this + " remove prev " + comp);
                        firePropertyChanged(Plant3D.URIs.HasPrevious);