X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Fscenegraph%2Fcontrolpoint%2FControlPointFactory.java;h=ff49b93a74404adf1b5164e7bcbfb2a54ba00518;hb=8792531e8f0967aee36cdd405ec0cd3a34f9ab06;hp=71602dcc0ff163220a36b741a78ec9c4d082111d;hpb=3b5c59eca31e9db10c1a1dc6d244d6fd4f3578a2;p=simantics%2F3d.git diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/ControlPointFactory.java b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/ControlPointFactory.java index 71602dcc..ff49b93a 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/ControlPointFactory.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/scenegraph/controlpoint/ControlPointFactory.java @@ -11,7 +11,7 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.request.Read; import org.simantics.plant3d.ontology.Plant3D; import org.simantics.plant3d.scenegraph.PipelineComponent; -import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint.Type; +import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint.PointType; import org.simantics.plant3d.utils.Item; import org.simantics.plant3d.utils.P3DUtil; @@ -20,11 +20,11 @@ public class ControlPointFactory { private static Map cache = new HashMap(); - public static void preloadCache() throws Exception { - List items = P3DUtil.getEnds(); - items.addAll(P3DUtil.getInlines()); - items.addAll(P3DUtil.getNozzles()); - items.addAll(P3DUtil.getTurns()); + public static void preloadCache(String libUri) throws Exception { + List items = P3DUtil.getEnds(libUri); + items.addAll(P3DUtil.getInlines(libUri)); + items.addAll(P3DUtil.getNozzles(libUri)); + items.addAll(P3DUtil.getTurns(libUri)); for (Item item : items) { Instruction inst = createInstruction(item.getUri()); @@ -45,6 +45,7 @@ public class ControlPointFactory { PipeControlPoint pcp = new PipeControlPoint(component); pcp.setType(inst.type); pcp.setFixed(inst.fixed); + pcp.setMod(inst.mod); pcp.setRotate(inst.isRotate); pcp.setReverse(inst.isReverse); switch(inst.type) { @@ -58,10 +59,13 @@ public class ControlPointFactory { sub.parent = pcp; sub.setType(inst.type); sub.setFixed(inst.fixed); + sub.setMod(inst.mod); sub.setSub(true); sub.setDeletable(false); if (inst.isOffset) pcp.setOffset(0.0); + if (inst.isSizeChange) + pcp.setSizeChange(true); } break; @@ -74,8 +78,9 @@ public class ControlPointFactory { private static class Instruction { - Type type; + PointType type; boolean fixed; + boolean mod; boolean isOffset; boolean isSizeChange; boolean isRotate; @@ -95,19 +100,25 @@ public class ControlPointFactory { i.isSizeChange = false; i.isRotate = false; i.isReverse = false; - i.type = Type.INLINE; + i.type = PointType.INLINE; + i.mod = false; if (graph.isInheritedFrom(res, p3d.Nozzle)) { i.fixed = true; i.isOffset = false; i.isSizeChange = false; - i.type = Type.END; + i.type = PointType.END; } else if (graph.isInheritedFrom(res, p3d.InlineComponent)){ - i.type = Type.INLINE; + i.type = PointType.INLINE; if (graph.hasStatement(res,p3d.VariableLengthInlineComponent)) { i.fixed = false; } else if (graph.hasStatement(res,p3d.FixedLengthInlineComponent)) { i.fixed = true; + } else if (graph.hasStatement(res,p3d.AdjustableLengthInlineComponent)) { + i.fixed = true; + i.mod = true; + } else { + throw new DatabaseException("Inline component type " + res + " does not have length configuration."); } if (graph.hasStatement(res,p3d.SizeChangeComponent)) { @@ -126,15 +137,17 @@ public class ControlPointFactory { } } else if (graph.isInheritedFrom(res, p3d.TurnComponent)) { - i.type = Type.TURN; + i.type = PointType.TURN; if (graph.hasStatement(res,p3d.VariableAngleTurnComponent)) { i.fixed = false; } else if (graph.hasStatement(res,p3d.FixedAngleTurnComponent)) { i.fixed = true; + } else { + throw new DatabaseException("Turn component type " + res + " does not have angle configuration."); } } else if (graph.isInheritedFrom(res, p3d.EndComponent)) { i.fixed = false; - i.type = Type.END; + i.type = PointType.END; } else { return null; }