public static PipelineComponent addComponent(P3DRootNode root, PipelineComponent component, InsertInstruction inst) throws Exception {
PipelineComponent newComponent = ComponentUtils.createComponent(root, inst.typeUri);
- if (inst.name != null)
- newComponent.setName(inst.name);
-
PipeControlPoint newPcp = newComponent.getControlPoint();
PipeControlPoint toPcp = component.getControlPoint();
} else if (toPcp.isDirected()) {
dir = new Vector3d(toPcp.getDirection(Direction.NEXT));
+ if (position == PositionType.PREVIOUS)
+ dir.negate();
pos = new Vector3d(toPcp.getWorldPosition());
} else if (toPcp.isTurn() && toPcp.asFixedAngle()) {
dir = new Vector3d(toPcp.getDirection(position == PositionType.NEXT ? Direction.NEXT : Direction.PREVIOUS));
}
}
- String name = component.getPipeRun().getUniqueName(typeName);
- newComponent.setName(name);
+ if (inst.name != null) {
+ newComponent.setName(inst.name);
+ } else {
+ String name = component.getPipeRun().getUniqueName(typeName);
+ newComponent.setName(name);
+ }
pipeRun.addChild(newComponent);
if (newPcp.isSizeChange())
} else if (newComponent instanceof TurnComponent) {
TurnComponent turnComponent = (TurnComponent)newComponent;
if (turnComponent.isVariableAngle()) {
- newPcp.setTurnAngle(inst.angle);
+ newPcp.setTurnAngle(Math.toRadians(inst.angle));
newComponent.setParameter("turnAngle", inst.angle);
}
if (inst.rotationAngle != null)