]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
Processing DB changes could leave control points unsynchronized 46/3646/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Fri, 29 Nov 2019 11:44:12 +0000 (13:44 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Fri, 29 Nov 2019 11:47:52 +0000 (11:47 +0000)
When processing DB changes, component connections could be created
before control points (especially Nozzle). This could cause a situation,
where components were connected, but control points were not.

gitlab #35

Change-Id: Ida35c3222dbc706c7cb0e481af41feeca0949809
(cherry picked from commit 944164586441e68cd62073de3995a2455be9680a)

org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/EndComponent.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/InlineComponent.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/Nozzle.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/TurnComponent.java

index 5df76c0f8e00561456cc4c44593caa43094d33b9..fbcc77641fc795094ec824262a344e50be7dc305 100644 (file)
@@ -26,6 +26,9 @@ public class EndComponent extends PipelineComponent {
        public void setType(String type) throws Exception {
                this.type = type;
                controlPoint = ControlPointFactory.create(this);
+               syncNext();
+        syncPrevious();
+        syncBranch0();
                
        }
        
index a94303efc4ec22d35bb952e872db8947a4446d41..ca4ba8367259dd75eb864a253c57056d4491539a 100644 (file)
@@ -36,6 +36,9 @@ public class InlineComponent extends PipelineComponent {
        public void setType(String type) throws Exception{
                this.type = type;
                controlPoint = ControlPointFactory.create(this);
+               syncNext();
+        syncPrevious();
+        syncBranch0();
                
        }
        
index 55773f0f6a682921b01feef89d0697e1ac7624c5..cbdecc1c09ea2250c4464c003220d3825e3097ea 100644 (file)
@@ -72,12 +72,12 @@ public class Nozzle extends PipelineComponent {
        private void _createCP() throws Exception{
                if (controlPoint != null)
                        return;
-               if (getPipeRun() != null) {
-                       controlPoint = ControlPointFactory.create(this);
-                       // TODO : these should not be needed.
-                       controlPoint.setDeletable(false);
-                       controlPoint.setFixed(true);
-               }
+               controlPoint = ControlPointFactory.create(this);
+               // TODO : these should not be needed.
+               controlPoint.setDeletable(false);
+               controlPoint.setFixed(true);
+               syncNext();
+        syncPrevious();
        }
        
        @RelatedSetObj(Plant3D.URIs.HasPipeRun)
index ad1c2b7a7d210e7c9fd83ae15aab4fa7f4555fb0..7726b203005611c05b89a739b634617018f79295 100644 (file)
@@ -145,8 +145,10 @@ public abstract class PipelineComponent extends GeometryNode {
        
        @RelatedSetObj(Plant3D.URIs.HasNext)
        public void setNext(PipelineComponent comp) {
-               if (next == comp)
+               if (next == comp) {
+                   syncNext();
                    return;
+               }
                if (this.next != null)
                    this.next._removeRef(this);
         _setNext(comp);
@@ -170,8 +172,10 @@ public abstract class PipelineComponent extends GeometryNode {
        
        @RelatedSetObj(Plant3D.URIs.HasPrevious)
        public void setPrevious(PipelineComponent comp) {
-               if (previous == comp)
+               if (previous == comp) {
+                   syncPrevious();
                        return;
+               }
                if (this.previous != null)
                        this.previous._removeRef(this);
                _setPrevious(comp);
@@ -196,8 +200,10 @@ public abstract class PipelineComponent extends GeometryNode {
        
        @RelatedSetObj(Plant3D.URIs.HasBranch0)
        public void setBranch0(PipelineComponent comp) {
-               if (branch0 == comp)
+               if (branch0 == comp) {
+                   syncBranch0();
                        return;
+               }
                if (this.branch0 != null)
                        this.branch0._removeRef(this);
                this.branch0 = comp;
@@ -305,7 +311,7 @@ public abstract class PipelineComponent extends GeometryNode {
        }
        
        boolean syncnext = false;
-       private void syncNext() {
+       protected void syncNext() {
                if (syncnext)
                        return;
                syncnext = _syncNext();
@@ -344,7 +350,7 @@ public abstract class PipelineComponent extends GeometryNode {
        }
        
        boolean syncprev = false;
-       private void syncPrevious() {
+       protected void syncPrevious() {
                if (syncprev)
                        return;
                syncprev = _syncPrevious();
@@ -381,7 +387,7 @@ public abstract class PipelineComponent extends GeometryNode {
        }
        
        boolean syncbr0 = false;
-       private void syncBranch0() {
+       protected void syncBranch0() {
                if (syncbr0)
                        return;
                syncbr0 = _syncBranch0();
index 1bf674410cbf1be7aaebc6fe20ad082b1cf06519..5c3a1e981ee16fd1bd07674b62df1e8b8a9aef95 100644 (file)
@@ -42,6 +42,9 @@ public class TurnComponent extends PipelineComponent {
        public void setType(String type) throws Exception{
                this.type = type;
                controlPoint = ControlPointFactory.create(this);
+               syncNext();
+        syncPrevious();
+        syncBranch0();
        }
        
        @Override