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;
private static Map<String,Instruction> cache = new HashMap<String, Instruction>();
- public static void preloadCache() throws Exception {
- List<Item> items = P3DUtil.getEnds();
- items.addAll(P3DUtil.getInlines());
- items.addAll(P3DUtil.getNozzles());
- items.addAll(P3DUtil.getTurns());
+ public static void preloadCache(String libUri) throws Exception {
+ List<Item> 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());
pcp.setType(inst.type);
pcp.setFixed(inst.fixed);
pcp.setRotate(inst.isRotate);
+ pcp.setReverse(inst.isReverse);
switch(inst.type) {
case END:
sub.setFixed(inst.fixed);
sub.setSub(true);
sub.setDeletable(false);
-// pcp.setOffset(0.0);
if (inst.isOffset)
pcp.setOffset(0.0);
+ if (inst.isSizeChange)
+ pcp.setSizeChange(true);
}
break;
private static class Instruction {
- Type type;
+ PointType type;
boolean fixed;
boolean isOffset;
boolean isSizeChange;
boolean isRotate;
+ boolean isReverse;
}
i.isOffset = false;
i.isSizeChange = false;
i.isRotate = false;
- i.type = Type.INLINE;
+ i.isReverse = false;
+ i.type = PointType.INLINE;
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.isRotate = true;
}
+ if (graph.hasStatement(res,p3d.ReverseComponent)) {
+ i.isReverse = true;
+ }
+
} 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)) {
}
} else if (graph.isInheritedFrom(res, p3d.EndComponent)) {
i.fixed = false;
- i.type = Type.END;
+ i.type = PointType.END;
} else {
return null;
}