]> gerrit.simantics Code Review - simantics/3d.git/commitdiff
SCL bindings to some G3D and Plant3D Java classes 10/3110/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 15 Aug 2019 14:01:36 +0000 (17:01 +0300)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Thu, 15 Aug 2019 14:01:36 +0000 (17:01 +0300)
gitlab #28

Change-Id: Ide08db8b186645096e50739c6e49d65b2585d627

26 files changed:
org.simantics.g3d/scl/g3d/math/AxisAngle4d [new file with mode: 0644]
org.simantics.g3d/scl/g3d/math/MathTools.scl [new file with mode: 0644]
org.simantics.g3d/scl/g3d/math/Point3d.scl [new file with mode: 0644]
org.simantics.g3d/scl/g3d/math/Quat4d.scl [new file with mode: 0644]
org.simantics.g3d/scl/g3d/math/Tuple3d.scl [new file with mode: 0644]
org.simantics.g3d/scl/g3d/math/Vector3d.scl [new file with mode: 0644]
org.simantics.plant3d/scl/plant3d/scenegraph/EndComponent.scl [new file with mode: 0644]
org.simantics.plant3d/scl/plant3d/scenegraph/Equipment.scl [new file with mode: 0644]
org.simantics.plant3d/scl/plant3d/scenegraph/InlineComponent.scl [new file with mode: 0644]
org.simantics.plant3d/scl/plant3d/scenegraph/Nozzle.scl [new file with mode: 0644]
org.simantics.plant3d/scl/plant3d/scenegraph/P3DNode.scl [new file with mode: 0644]
org.simantics.plant3d/scl/plant3d/scenegraph/P3DParentNode.scl [new file with mode: 0644]
org.simantics.plant3d/scl/plant3d/scenegraph/PipeControlPoint.scl [new file with mode: 0644]
org.simantics.plant3d/scl/plant3d/scenegraph/PipeRun.scl [new file with mode: 0644]
org.simantics.plant3d/scl/plant3d/scenegraph/PipelineComponent.scl [new file with mode: 0644]
org.simantics.plant3d/scl/plant3d/scenegraph/Root.scl [new file with mode: 0644]
org.simantics.plant3d/scl/plant3d/scenegraph/TurnComponent.scl [new file with mode: 0644]
org.simantics.plant3d/scl/plant3d/utils/P3DUtil.scl [new file with mode: 0644]
org.simantics.plant3d/src/org/simantics/plant3d/actions/TranslateInlineAction.java
org.simantics.plant3d/src/org/simantics/plant3d/editor/Plant3DEditor.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/Equipment.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/InlineComponent.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/PipelineComponent.java
org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/TurnComponent.java
org.simantics.plant3d/src/org/simantics/plant3d/utils/Item.java
org.simantics.plant3d/src/org/simantics/plant3d/utils/P3DUtil.java

diff --git a/org.simantics.g3d/scl/g3d/math/AxisAngle4d b/org.simantics.g3d/scl/g3d/math/AxisAngle4d
new file mode 100644 (file)
index 0000000..ed15467
--- /dev/null
@@ -0,0 +1,20 @@
+import "./Tuple3d"
+
+importJava "javax.vecmath.AxisAngle4d" where
+  data AxisAngle4d
+  
+  @JavaName "<init>"
+  createAxisAngle4d -> Double -> Double -> Double -> Double -> AxisAngle4d
+  @JavaName "<init>"
+  createAxisAngle4d2 -> Tuple3d -> Double -> AxisAngle4d
+  @JavaName "<init>"
+  defaultAxisAngle4d -> AxisAngle4d
+  
+  getX :: AxisAngle4d -> Double
+  getY :: AxisAngle4d -> Double
+  getZ :: AxisAngle4d -> Double
+  getAngle :: AxisAngle4d -> Double
+  setX :: AxisAngle4d -> Double -> ()
+  setY :: AxisAngle4d -> Double -> ()
+  setZ :: AxisAngle4d -> Double -> ()
+  setAngle :: AxisAngle4d -> Double -> ()
\ No newline at end of file
diff --git a/org.simantics.g3d/scl/g3d/math/MathTools.scl b/org.simantics.g3d/scl/g3d/math/MathTools.scl
new file mode 100644 (file)
index 0000000..9f9d76f
--- /dev/null
@@ -0,0 +1,13 @@
+import "./Tuple3d" as T3
+
+importJava "org.simantics.g3d.math.MathTools" where
+
+    @JavaName equals
+    equalsd :: Double -> Double -> Boolean
+    @JavaName equals
+    equalst :: T3.Tuple3d -> T3.Tuple3d -> Boolean
+    
+    distance :: T3.Tuple3d -> T3.Tuple3d -> Double
+    distanceSquared :: T3.Tuple3d -> T3.Tuple3d -> Double
+    
+    isValid :: T3.Tuple3d -> Boolean 
\ No newline at end of file
diff --git a/org.simantics.g3d/scl/g3d/math/Point3d.scl b/org.simantics.g3d/scl/g3d/math/Point3d.scl
new file mode 100644 (file)
index 0000000..11012aa
--- /dev/null
@@ -0,0 +1,14 @@
+import "./Tuple3d"
+
+importJava "javax.vecmath.Point3d" where
+  data Point3d
+  
+  distance :: Point3d -> Point3d -> Double
+  distanceSquared :: Point3d -> Point3d -> Double
+  
+  @JavaName "<init>"
+  createPoint3d :: Double -> Double -> Double -> Point3d
+  @JavaName "<init>"
+  copyPoint3d :: Tuple3d -> Point3d
+  @JavaName "<init>"
+  defaultPoint3d :: Point3d
\ No newline at end of file
diff --git a/org.simantics.g3d/scl/g3d/math/Quat4d.scl b/org.simantics.g3d/scl/g3d/math/Quat4d.scl
new file mode 100644 (file)
index 0000000..a9910dc
--- /dev/null
@@ -0,0 +1,36 @@
+  
+importJava "javax.vecmath.Quat4d" where
+  data Quat4d
+  
+  @JavaName "<init>"
+  createQuat4d :: Double -> Double -> Double -> Double -> Quat4d
+  @JavaName "<init>"
+  copyQuat4d :: Quat4d -> Quat4d
+  @JavaName "<init>"
+  defaultQuat4d :: Quat4d
+  
+  getX :: Quat4d -> Double
+  getY :: Quat4d -> Double
+  getZ :: Quat4d -> Double
+  getW:: Quat4d -> Double
+  setX :: Quat4d -> Double -> ()
+  setY :: Quat4d -> Double -> ()
+  setZ :: Quat4d -> Double -> ()
+  setW :: Quat4d -> Double -> ()
+  
+  mul :: Quat4d -> Quat4d -> ()
+  @JavaName mul
+  mul2 :: Quat4d -> Quat4d -> Quat4d ->()
+  
+  mulInverse :: Quat4d -> Quat4d -> ()
+  @JavaName mulInverse
+  mulInverse2 :: Quat4d -> Quat4d -> Quat4d ->()
+  
+  inverse :: Quat4d -> ()
+  @JavaName inverse
+  inverse2 :: Quat4d -> Quat4d ->()
+  
+  normalize :: Quat4d -> ()
+  @JavaName normalize
+  normalize2 :: Quat4d -> Quat4d ->()
+  
\ No newline at end of file
diff --git a/org.simantics.g3d/scl/g3d/math/Tuple3d.scl b/org.simantics.g3d/scl/g3d/math/Tuple3d.scl
new file mode 100644 (file)
index 0000000..0126c41
--- /dev/null
@@ -0,0 +1,25 @@
+importJava "javax.vecmath.Tuple3d" where
+  data Tuple3d
+  
+  getX :: Tuple3d -> Double
+  getY :: Tuple3d -> Double
+  getZ :: Tuple3d -> Double
+  setX :: Tuple3d -> Double -> ()
+  setY :: Tuple3d -> Double -> ()
+  setZ :: Tuple3d -> Double -> ()
+  
+  add :: Tuple3d -> Tuple3d -> ()
+  @JavaName add
+  add2 :: Tuple3d -> Tuple3d -> Tuple3d -> ()
+  
+  sub :: Tuple3d -> Tuple3d -> ()
+  @JavaName sub
+  sub2 :: Tuple3d -> Tuple3d -> Tuple3d -> ()
+  
+  negate :: Tuple3d -> ()
+  @JavaName negate
+  negate2 :: Tuple3d -> Tuple3d -> ()
+  
+  scale :: Tuple3d -> Double -> ()
+  @JavaName scale
+  scale2 :: Tuple3d -> Double -> Tuple3d -> ()
\ No newline at end of file
diff --git a/org.simantics.g3d/scl/g3d/math/Vector3d.scl b/org.simantics.g3d/scl/g3d/math/Vector3d.scl
new file mode 100644 (file)
index 0000000..b2c9243
--- /dev/null
@@ -0,0 +1,24 @@
+import "./Tuple3d"
+
+importJava "javax.vecmath.Vector3d" where
+  data Vector3d
+  
+  cross :: Vector3d -> Vector3d -> Vector3d -> ()
+  
+  normalize :: Vector3d -> ()
+  @JavaName normalize
+  normalize_2 :: Vector3d -> Vector3d -> ()
+  
+  dot :: Vector3d -> Vector3d -> Double
+  
+  length :: Vector3d -> Double
+  lengthSquared :: Vector3d -> Double
+  
+  angle :: Vector3d -> Vector3d -> Double
+  
+  @JavaName "<init>"
+  createVector3d :: Double -> Double -> Double -> Vector3d
+  @JavaName "<init>"
+  copyVector3d :: Tuple3d -> Vector3d
+  @JavaName "<init>"
+  defaultVector3d :: Vector3d
\ No newline at end of file
diff --git a/org.simantics.plant3d/scl/plant3d/scenegraph/EndComponent.scl b/org.simantics.plant3d/scl/plant3d/scenegraph/EndComponent.scl
new file mode 100644 (file)
index 0000000..5a20dce
--- /dev/null
@@ -0,0 +1,9 @@
+import "./PipelineComponent"
+import "./PipeRun"
+
+importJava "org.simantics.plant3d.scenegraph.EndComponent" where
+  data EndComponent
+  
+  getType :: EndComponent -> String
+  getControlPoint :: EndComponent -> PipeControlPoint
+  getPipeRun :: EndComponent -> Maybe PipeRun
\ No newline at end of file
diff --git a/org.simantics.plant3d/scl/plant3d/scenegraph/Equipment.scl b/org.simantics.plant3d/scl/plant3d/scenegraph/Equipment.scl
new file mode 100644 (file)
index 0000000..ce1b3b7
--- /dev/null
@@ -0,0 +1,12 @@
+import "./Nozzle"
+
+importJava "org.simantics.plant3d.scenegraph.Equipment" where
+  data Equipment
+  
+  getType :: Equipment -> String
+  
+  addChild :: Equipment -> Nozzle -> ()
+  remChild :: Equipment -> Nozzle -> ()
+  getChild :: Equipment -> [Nozzle]
+  
+  numberOfFixedNozzles :: Equipment -> Integer
\ No newline at end of file
diff --git a/org.simantics.plant3d/scl/plant3d/scenegraph/InlineComponent.scl b/org.simantics.plant3d/scl/plant3d/scenegraph/InlineComponent.scl
new file mode 100644 (file)
index 0000000..1af26ab
--- /dev/null
@@ -0,0 +1,17 @@
+import "./PipelineComponent"
+import "./PipeRun"
+
+importJava "org.simantics.plant3d.scenegraph.InlineComponent" where
+  data InlineComponent
+  
+  getType :: InlineComponent -> String
+  getControlPoint :: InlineComponent -> PipeControlPoint
+  getPipeRun :: InlineComponent -> Maybe PipeRun
+  
+  isVariableLength :: InlineComponent -> Boolean
+  getRotationAngle :: InlineComponent -> Maybe Double
+  setRotationAngle :: InlineComponent -> Maybe Double -> ()
+  
+  isReversed :: InlineComponent -> Maybe Boolean
+  setReversed :: InlineComponent -> Maybe Boolean -> ()
+  
\ No newline at end of file
diff --git a/org.simantics.plant3d/scl/plant3d/scenegraph/Nozzle.scl b/org.simantics.plant3d/scl/plant3d/scenegraph/Nozzle.scl
new file mode 100644 (file)
index 0000000..702c4b0
--- /dev/null
@@ -0,0 +1,14 @@
+import "./PipelineComponent"
+import "./PipeRun"
+
+importJava "org.simantics.plant3d.scenegraph.Nozzle" where
+  data Nozzle
+  
+  getType :: Nozzle -> String
+  getControlPoint :: Nozzle -> PipeControlPoint
+  getPipeRun :: Nozzle -> Maybe PipeRun
+  
+  getNozzleId :: Nozzle -> Integer
+  isFixed :: Nozzle -> Boolean
+  isConnected :: Nozzle -> Boolean
+  
\ No newline at end of file
diff --git a/org.simantics.plant3d/scl/plant3d/scenegraph/P3DNode.scl b/org.simantics.plant3d/scl/plant3d/scenegraph/P3DNode.scl
new file mode 100644 (file)
index 0000000..1b30d88
--- /dev/null
@@ -0,0 +1,20 @@
+import "g3d/math/Vector3d"
+import "g3d/math/Quat4d"
+
+importJava "org.simantics.plant3d.scenegraph.P3DNode" where
+  data P3DNode
+  
+  getName :: P3DNode -> Maybe String
+  setName :: P3DNode -> String -> ()
+  
+  getOrientation :: P3DNode -> Quat4d
+  getPosition :: P3DNode -> Vector3d
+  
+  setOrientation :: P3DNode -> Quat4d -> ()
+  setPosition :: P3DNode -> Vector3d -> ()
+  
+  getWorldOrientation :: P3DNode -> Quat4d
+  getWorldPosition :: P3DNode -> Vector3d
+  
+  setWorldOrientation :: P3DNode -> Quat4d -> ()
+  setWorldPosition :: P3DNode -> Vector3d -> ()
\ No newline at end of file
diff --git a/org.simantics.plant3d/scl/plant3d/scenegraph/P3DParentNode.scl b/org.simantics.plant3d/scl/plant3d/scenegraph/P3DParentNode.scl
new file mode 100644 (file)
index 0000000..05e7c1f
--- /dev/null
@@ -0,0 +1,20 @@
+import "g3d/math/Vector3d"
+import "g3d/math/Quat4d"
+
+importJava "org.simantics.plant3d.scenegraph.P3DParentNode" where
+  data P3DParentNode
+  
+  getName :: P3DParentNode -> Maybe String
+  setName :: P3DParentNode -> String -> ()
+  
+  getOrientation :: P3DParentNode -> Quat4d
+  getPosition :: P3DParentNode -> Vector3d
+  
+  setOrientation :: P3DParentNode -> Quat4d -> ()
+  setPosition :: P3DParentNode -> Vector3d -> ()
+  
+  getWorldOrientation :: P3DParentNode -> Quat4d
+  getWorldPosition :: P3DParentNode -> Vector3d
+  
+  setWorldOrientation :: P3DParentNode -> Quat4d -> ()
+  setWorldPosition :: P3DParentNode -> Vector3d -> ()
\ No newline at end of file
diff --git a/org.simantics.plant3d/scl/plant3d/scenegraph/PipeControlPoint.scl b/org.simantics.plant3d/scl/plant3d/scenegraph/PipeControlPoint.scl
new file mode 100644 (file)
index 0000000..139597f
--- /dev/null
@@ -0,0 +1,2 @@
+
+
diff --git a/org.simantics.plant3d/scl/plant3d/scenegraph/PipeRun.scl b/org.simantics.plant3d/scl/plant3d/scenegraph/PipeRun.scl
new file mode 100644 (file)
index 0000000..2e56a0d
--- /dev/null
@@ -0,0 +1,4 @@
+import "g3d/math/Tuple3d"
+
+importJava "org.simantics.plant3d.scenegraph.PipeRun" where
+  data PipeRun
\ No newline at end of file
diff --git a/org.simantics.plant3d/scl/plant3d/scenegraph/PipelineComponent.scl b/org.simantics.plant3d/scl/plant3d/scenegraph/PipelineComponent.scl
new file mode 100644 (file)
index 0000000..94dc9a4
--- /dev/null
@@ -0,0 +1,54 @@
+import "g3d/math/Tuple3d"
+
+import "./PipeRun"
+
+importJava "org.simantics.plant3d.scenegraph.PipelineComponent" where
+  data PipelineComponent
+  
+  getPipeRun :: PipelineComponent -> PipeRun
+  setPipeRun :: PipelineComponent -> PipeRun -> ()
+  
+  getAlternativePipeRun :: PipelineComponent -> Maybe PipeRun
+  setAlternativePipeRun :: PipelineComponent -> PipeRun -> ()
+  
+  updateParameters :: PipelineComponent -> ()
+  
+  getNext :: PipelineComponent -> Maybe PipelineComponent
+  setNext :: PipelineComponent -> Maybe PipelineComponent -> ()
+  
+  getPrevious :: PipelineComponent -> Maybe PipelineComponent
+  setPrevious :: PipelineComponent -> Maybe PipelineComponent -> ()
+  
+  getBranch0 :: PipelineComponent -> Maybe PipelineComponent
+  setBranch0 :: PipelineComponent -> Maybe PipelineComponent -> ()
+  
+  getType :: PipelineComponent -> String
+  
+  //getControlPoint :: PipelineComponent -> PipeControlPoint
+  
+  remove :: PipelineComponent -> ()
+  
+  getFlowLength :: PipelineComponent -> Maybe Double
+  getEnds :: PipelineComponent -> Tuple3d -> Tuple3d -> ()
+  
+importJava "org.simantics.plant3d.scenegraph.PipeControlPoint$Type" where
+  data PointType
+  
+importJava "org.simantics.plant3d.scenegraph.PipeControlPoint.Direction" where
+  data Direction
+  
+importJava "org.simantics.plant3d.scenegraph.PipeControlPoint.PositionType" where
+  data PositionType
+
+importJava "org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint" where
+  data PipeControlPoint
+  
+  getPipelineComponent :: PipeControlPoint -> PipelineComponent
+  
+  //@JavaName getType
+  //getPointType :: PipeControlPoint -> PointType
+  
+  isFixed :: PipeControlPoint -> Boolean
+  
+  getSubPoint :: PipeControlPoint -> [PipeControlPoint]
+  getParentPoint :: PipeControlPoint -> Maybe PipeControlPoint
\ No newline at end of file
diff --git a/org.simantics.plant3d/scl/plant3d/scenegraph/Root.scl b/org.simantics.plant3d/scl/plant3d/scenegraph/Root.scl
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/org.simantics.plant3d/scl/plant3d/scenegraph/TurnComponent.scl b/org.simantics.plant3d/scl/plant3d/scenegraph/TurnComponent.scl
new file mode 100644 (file)
index 0000000..f6ed6cf
--- /dev/null
@@ -0,0 +1,21 @@
+import "./PipelineComponent"
+import "./PipeRun"
+
+import "g3d/math/Vector3d"
+
+importJava "org.simantics.plant3d.scenegraph.TurnComponent" where
+  data TurnComponent
+  
+  getType :: TurnComponent -> String
+  getControlPoint :: TurnComponent -> PipeControlPoint
+  getPipeRun :: TurnComponent -> Maybe PipeRun
+  
+  isVariableAngle :: TurnComponent -> Boolean
+  getTurnAngle :: TurnComponent -> Maybe Double
+  setTurnAngle :: TurnComponent -> Maybe Double -> ()
+  
+  getTurnAxis :: TurnComponent -> Vector3d
+  
+  getRotationAngle :: TurnComponent -> Maybe Double
+  setRotationAngle :: TurnComponent -> Maybe Double -> ()
+  
\ No newline at end of file
diff --git a/org.simantics.plant3d/scl/plant3d/utils/P3DUtil.scl b/org.simantics.plant3d/scl/plant3d/utils/P3DUtil.scl
new file mode 100644 (file)
index 0000000..1e73caf
--- /dev/null
@@ -0,0 +1,34 @@
+import "Simantics/DB"
+
+importJava "org.simantics.plant3d.utils.Item$Type" where
+    data ItemType
+    
+    EQUIPMENT :: ItemType
+    INLINE :: ItemType
+    TURN :: ItemType
+    END :: ItemType
+    NOZZLE :: ItemType
+    
+
+importJava "org.simantics.plant3d.utils.Item" where
+    data Item
+    
+    getUri :: Item -> String
+    getName :: Item -> String
+    getType :: Item -> ItemType
+    
+    isCode :: Item -> Boolean
+    isVariable :: Item -> Boolean
+    isSizeChange :: Item -> Boolean
+
+importJava "org.simantics.plant3d.utils.P3DUtil" where
+
+    getEquipments :: () -> [Item]
+    getNozzles :: () -> [Item]
+    getTurns :: () -> [Item]
+    getInlines :: () -> [Item]
+    getEnds :: () -> [Item]
+    filterUserComponents :: [Item] -> [Item]
+    
+    createModel :: String -> <WriteGraph> Resource
+
index 7ea42d597b3365ca4b3951fbab2c8b9b47120bfd..c8c862240e76659e1ce0c6a92c2b4d1181796efb 100644 (file)
@@ -55,8 +55,8 @@ public class TranslateInlineAction extends TranslateAction{
                                Point3d ne = new Point3d();
                                Point3d ps = new Point3d();
                                Point3d pe = new Point3d();
-                               next.getControlPointEnds(ns, ne);
-                               prev.getControlPointEnds(ps, pe);
+                               next.getEnds(ns, ne);
+                               prev.getEnds(ps, pe);
                                dir = comp.getControlPoint().getPathLegDirection(Direction.NEXT);
                                dir.normalize();
                                // We may have offsets in the path leg, hence we have to project the coordinates.
index 159a239d9ff649eb772517f2f2acaa220b16a23e..21b99bfb74f109b5b910e5d86c19bdf8deda9531 100644 (file)
@@ -158,39 +158,8 @@ public class Plant3DEditor extends ResourceEditorPart {
                                        // update control points.
                                        // TODO : this should be optimized.
                                        try {
-                                               for (INode node : rootNode.getChild()) {
-                                                       if (node instanceof PipeRun) {
-                                                               for (PipelineComponent pc : ((PipeRun) node).getChild())
-                                                                       pc.sync();
-                                                       } else if (node instanceof Equipment) {
-                                                               for (PipelineComponent pc : ((Equipment) node).getChild())
-                                                                       pc.sync();
-                                                       }
-                                               }
-                                               
-                                               for (INode node : rootNode.getChild()) {
-                                                       if (node instanceof PipeRun) {
-                                                               for (PipelineComponent pc : ((PipeRun) node).getChild())
-                                                                       pc.sync2();
-                                                       } else if (node instanceof Equipment) {
-                                                               for (PipelineComponent pc : ((Equipment) node).getChild())
-                                                                       pc.sync2();
-                                                       }
-                                               }
-                                               for (INode node : rootNode.getChild()) {
-                                                       if (node instanceof PipeRun) {
-                                                               PipingRules.validate((PipeRun)node);
-                                                       }
-                                               }
-                                               PipingRules.setEnabled(true);
-                                               for (INode node : rootNode.getChild()) {
-                                                       if (node instanceof PipeRun) {
-                                                               PipeRun run = (PipeRun)node;
-                                                               for (PipeControlPoint pcp : run.getControlPoints())
-                                                                       PipingRules.positionUpdate(pcp);
-                                                                       
-                                                       }
-                                               }
+                                           P3DUtil.finalizeDBLoad(rootNode);
+                                           
                                        } catch (Exception e) {
                                                throw new DatabaseException(e);
                                        }
index 27a76067be46d08f8db412f5dc61f2ef2229f170..6b17ef86648d6eb2100450a6ebbc07b4cc3737d9 100644 (file)
@@ -45,8 +45,12 @@ public class Equipment extends P3DParentGeometryNode<Nozzle> {
        
        @RelatedElementsAdd(Plant3D.URIs.HasNozzle)
        public void addChild(Nozzle node) {
+           Collection<Nozzle> children = getChild();
+           if (numberOfFixedNozzles() > 0 && children.size() >= numberOfFixedNozzles())
+               throw new RuntimeException("Equipment has already all fixed nozzles");
+           
                Set<Integer> ids = new HashSet<Integer>();
-               for (Nozzle n : getChild()) {
+               for (Nozzle n : children) {
                        ids.add(n.getNozzleId());
                }
                int newId = 0;
index 6590c73d2cc3f34de38a24c1fc1e835fc086d34f..61a4bcb26118977f9b38c5224a44b4c1d2de38b6 100644 (file)
@@ -94,7 +94,7 @@ public class InlineComponent extends PipelineComponent {
        }
        @RelatedSetValue(Plant3D.URIs.IsReversed)
        @SetPropertyValue(value=Plant3D.URIs.IsReversed)
-       public void setReverse(Boolean reverse) {
+       public void setReversed(Boolean reverse) {
                if (!controlPoint.isReverse())
                        return;
                
index f71dfed41a8e1e676842951bf4a5fc2c60084fcc..e200af6b2c852419ffbae9f3334ce2744cbf256b 100644 (file)
@@ -31,6 +31,10 @@ public abstract class PipelineComponent extends GeometryNode {
        private PipelineComponent next;
        private PipelineComponent previous;
        
+       public PipeRun getPipeRun() {
+        return pipeRun;
+    }
+       
        /**
         * Sets the pipe run.
         * 
@@ -370,10 +374,6 @@ public abstract class PipelineComponent extends GeometryNode {
                return Collections.EMPTY_MAP;
        }
        
-       public PipeRun getPipeRun() {
-               return pipeRun;
-       }
-       
        public abstract String getType();
        public abstract PipeControlPoint getControlPoint();
        
@@ -463,14 +463,8 @@ public abstract class PipelineComponent extends GeometryNode {
                }
        }
        
-       public void getControlPointEnds(Tuple3d p1, Tuple3d p2) {
+       public void getEnds(Tuple3d p1, Tuple3d p2) {
                getControlPoint().getControlPointEnds(p1, p2);
        }
        
-       public Vector3d getNormal() {
-               Vector3d v = new Vector3d();
-               MathTools.rotate(getWorldOrientation(), MathTools.Z_AXIS, v);
-               return v;
-       }
-       
 }
index 4f787b8c2a3f91b788d10e7c250c4812f04bdd71..e8779985ae6b44622b62dd166fb260d61200a376 100644 (file)
@@ -102,11 +102,6 @@ public class TurnComponent extends PipelineComponent {
                return getControlPoint().getTurnAxis();
        }
        
-       @Override
-       public Vector3d getNormal() {
-               return getTurnAxis();
-       }
-       
        @RelatedGetValue(Plant3D.URIs.HasRotationAngle)
     @GetPropertyValue(name="Rotation Angle", value=Plant3D.URIs.HasRotationAngle, tabId = "Default")
     public Double getRotationAngle() {
index 61ef6c9a68e7ae1288fb8856436f8a5c62e097dc..e1faef342b377138a3612a0a8faade7af17a1ecd 100644 (file)
@@ -40,8 +40,6 @@ public class Item {
                return code;
        }
 
-
-
        public void setCode(boolean code) {
                this.code = code;
        }
index e6e3385f3a2967aaee826a684136ac98be7dce50..7ba42b8f9d128d511973507595fee90d9a6d59fa 100644 (file)
@@ -11,10 +11,16 @@ import org.simantics.db.Resource;
 import org.simantics.db.WriteGraph;
 import org.simantics.db.exception.DatabaseException;
 import org.simantics.db.request.Read;
+import org.simantics.g3d.scenegraph.base.INode;
 import org.simantics.layer0.Layer0;
 import org.simantics.plant3d.ontology.Plant3D;
+import org.simantics.plant3d.scenegraph.Equipment;
+import org.simantics.plant3d.scenegraph.P3DRootNode;
+import org.simantics.plant3d.scenegraph.PipeRun;
+import org.simantics.plant3d.scenegraph.PipelineComponent;
+import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint;
+import org.simantics.plant3d.scenegraph.controlpoint.PipingRules;
 import org.simantics.plant3d.utils.Item.Type;
-import org.simantics.ui.SimanticsUI;
 
 public class P3DUtil {
        
@@ -175,5 +181,40 @@ public class P3DUtil {
                
                return model;
        }
+       
+       public static void finalizeDBLoad(P3DRootNode rootNode) throws Exception{
+           for (INode node : rootNode.getChild()) {
+            if (node instanceof PipeRun) {
+                for (PipelineComponent pc : ((PipeRun) node).getChild())
+                    pc.sync();
+            } else if (node instanceof Equipment) {
+                for (PipelineComponent pc : ((Equipment) node).getChild())
+                    pc.sync();
+            }
+        }
+        
+        for (INode node : rootNode.getChild()) {
+            if (node instanceof PipeRun) {
+                for (PipelineComponent pc : ((PipeRun) node).getChild())
+                    pc.sync2();
+            } else if (node instanceof Equipment) {
+                for (PipelineComponent pc : ((Equipment) node).getChild())
+                    pc.sync2();
+            }
+        }
+        for (INode node : rootNode.getChild()) {
+            if (node instanceof PipeRun) {
+                PipingRules.validate((PipeRun)node);
+            }
+        }
+        PipingRules.setEnabled(true);
+        for (INode node : rootNode.getChild()) {
+            if (node instanceof PipeRun) {
+                PipeRun run = (PipeRun)node;
+                for (PipeControlPoint pcp : run.getControlPoints())
+                    PipingRules.positionUpdate(pcp);        
+            }
+        }
+       }
 
 }