Commit fb7319e9 authored by Nico Mack's avatar Nico Mack

Added angularStepSize property

parent 2f438900
ABOVE_ELEMENT=above
ANGULAR_STEP_SIZE_NODE=angularStepSize
BACKGROUND_NODE=background
BELOW_ELEMENT=below
BLINK_ON_OUT_OF_RANGE_NODE=blinkOnOutOfRange
......
......@@ -27,6 +27,8 @@ public class CpsNamespace extends NLS {
private static final String BUNDLE_NAME = "CpsNamespace"; //$NON-NLS-1$
public static String ABOVE_ELEMENT;
public static String ANGULAR_STEP_SIZE_NODE;
public static String BACKGROUND_NODE;
public static String BELOW_ELEMENT;
public static String BLINK_ON_OUT_OF_RANGE_NODE;
......
......@@ -50,6 +50,7 @@ public class PositionWidget extends PointingWidget implements InformationProvide
protected boolean trackRotationContinuously;
protected boolean trackTranslationContinuously;
protected double stepSize;
protected double angularStepSize;
// ***************************************************************************
// * Constants *
......@@ -80,6 +81,7 @@ public class PositionWidget extends PointingWidget implements InformationProvide
this.trackRotationContinuously = builder.trackRotationContinuously;
this.trackTranslationContinuously = builder.trackTranslationContinuously;
this.stepSize = builder.stepSize;
this.angularStepSize = builder.angularStepSize;
}
// ---------------------------------------------------------------------------
......@@ -114,7 +116,12 @@ public class PositionWidget extends PointingWidget implements InformationProvide
if (modifyValueOnRotation && (!continuous || trackRotationContinuously)) {
newPosition.setRotationDirection(convertDirection(direction));
doUpdate |= true;
if (!Double.isNaN(this.angularStepSize)) {
double rotation = Math.abs(position.getAngle() - newPosition.getAngle());
doUpdate |= (rotation >= this.angularStepSize);
} else {
doUpdate |= true;
}
}
if (modifyValueOnTranslation && (!continuous || trackTranslationContinuously)) {
......
......@@ -33,6 +33,7 @@ public abstract class BasePositionWidgetBuilder<B extends BasePositionWidgetBuil
public boolean trackRotationContinuously;
public boolean trackTranslationContinuously;
public double stepSize;
public double angularStepSize;
// ***************************************************************************
// * Constants *
......@@ -44,7 +45,8 @@ public abstract class BasePositionWidgetBuilder<B extends BasePositionWidgetBuil
// ***************************************************************************
// ---------------------------------------------------------------------------
protected BasePositionWidgetBuilder() {}
protected BasePositionWidgetBuilder() {
}
// ---------------------------------------------------------------------------
......@@ -73,6 +75,7 @@ public abstract class BasePositionWidgetBuilder<B extends BasePositionWidgetBuil
this.trackRotationContinuously = BootstrappingUtils.getContentAsBoolean(rootElement, CpsNamespace.TRACK_ROTATION_CONTINUOUSLY_NODE, BootstrappingUtils.OPTIONAL, false, context);
this.trackTranslationContinuously = BootstrappingUtils.getContentAsBoolean(rootElement, CpsNamespace.TRACK_TRANSLATION_CONTINUOUSLY_NODE, BootstrappingUtils.OPTIONAL, false, context);
this.stepSize = BootstrappingUtils.getContentAsDouble(rootElement, CpsNamespace.STEP_SIZE_NODE, BootstrappingUtils.OPTIONAL, Double.NaN, context);
this.angularStepSize = BootstrappingUtils.getContentAsRadians(rootElement, CpsNamespace.ANGULAR_STEP_SIZE_NODE, BootstrappingUtils.OPTIONAL, Double.NaN, context);
}
// ---------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment