--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+import "g3d/math/Tuple3d"
+
+importJava "org.simantics.plant3d.scenegraph.PipeRun" where
+ data PipeRun
\ No newline at end of file
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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
+
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.
// 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);
}
@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;
}
@RelatedSetValue(Plant3D.URIs.IsReversed)
@SetPropertyValue(value=Plant3D.URIs.IsReversed)
- public void setReverse(Boolean reverse) {
+ public void setReversed(Boolean reverse) {
if (!controlPoint.isReverse())
return;
private PipelineComponent next;
private PipelineComponent previous;
+ public PipeRun getPipeRun() {
+ return pipeRun;
+ }
+
/**
* Sets the pipe run.
*
return Collections.EMPTY_MAP;
}
- public PipeRun getPipeRun() {
- return pipeRun;
- }
-
public abstract String getType();
public abstract PipeControlPoint getControlPoint();
}
}
- 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;
- }
-
}
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() {
return code;
}
-
-
public void setCode(boolean code) {
this.code = code;
}
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 {
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);
+ }
+ }
+ }
}