From: Marko Luukkainen Date: Mon, 4 Nov 2019 17:31:38 +0000 (+0200) Subject: Allow pipe routing to bypass locked variable angle routing direction X-Git-Tag: v1.43.0~149 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=6c6d0cb80842d02907aef57297978b49510999cb;p=simantics%2F3d.git Allow pipe routing to bypass locked variable angle routing direction gitlab #46 Change-Id: Id51a13a6011427c2e05e34ec23ae237bb356708b --- diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/actions/RoutePipeAction.java b/org.simantics.plant3d/src/org/simantics/plant3d/actions/RoutePipeAction.java index dac9d2c1..7cc13cd4 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/actions/RoutePipeAction.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/actions/RoutePipeAction.java @@ -51,6 +51,7 @@ public class RoutePipeAction extends vtkSwtAction { }; LockType lock = LockType.NONE; + boolean lockForced; private double BRANCH_SNAP_DISTANCE = 0.05; private double NOZZLE_SNAP_DISTANCE = 0.05; @@ -176,7 +177,7 @@ public class RoutePipeAction extends vtkSwtAction { public boolean keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) panel.useDefaultAction(); - if (lock != LockType.CUSTOM) { + if (lock != LockType.CUSTOM || !lockForced) { if ((e.getModifiersEx() & KeyEvent.SHIFT_DOWN_MASK) > 0) { if (e.getKeyCode() == KeyEvent.VK_X) { if (lock != LockType.XY && lock != LockType.XZ) { @@ -224,10 +225,18 @@ public class RoutePipeAction extends vtkSwtAction { else setLockType(LockType.NONE, false); } + if (e.getKeyCode() == KeyEvent.VK_L && direction != null) { + if (lock != LockType.CUSTOM) + setLockType(LockType.CUSTOM, false); + else + setLockType(LockType.NONE, false); + } } } if (e.getKeyCode() == KeyEvent.VK_C) { useDefault = !useDefault; + if (useDefault) + setInfoText("Rotating camera"); System.out.println("UseDefault " + useDefault); } @@ -310,14 +319,17 @@ public class RoutePipeAction extends vtkSwtAction { if (startComponent instanceof Nozzle) { direction = startComponent.getControlPoint().getDirectedControlPointDirection(); lock = LockType.CUSTOM; + lockForced = true; } else if (startComponent instanceof PipelineComponent){ if (startComponent instanceof InlineComponent) { direction = startComponent.getControlPoint().getPathLegDirection(reversed ? Direction.PREVIOUS : Direction.NEXT); lock = LockType.CUSTOM; + lockForced = true; if (((InlineComponent) startComponent).isVariableLength()) { startWithTurn = true; direction = null; lock = LockType.NONE; + lockForced = false; } Vector3d v = new Vector3d(); if (!reversed) { @@ -329,9 +341,11 @@ public class RoutePipeAction extends vtkSwtAction { if (start.asFixedAngle()) { direction = startComponent.getControlPoint().getPathLegDirection(reversed ? Direction.PREVIOUS : Direction.NEXT); lock = LockType.CUSTOM; + lockForced = start.isFixedAngle(); } else { direction = null; lock = LockType.NONE; + lockForced = false; } } else if (startComponent instanceof EndComponent) { throw new Exception("Not supported"); @@ -466,7 +480,7 @@ public class RoutePipeAction extends vtkSwtAction { } private void setLockType(LockType type, boolean force) { - if (force || lock != LockType.CUSTOM) { + if (force || (lock != LockType.CUSTOM || !lockForced) ) { lock = type; switch (lock) {