Commit fb7319e9 authored by Nico Mack's avatar Nico Mack

Added angularStepSize property

parent 2f438900
ABOVE_ELEMENT=above ABOVE_ELEMENT=above
ANGULAR_STEP_SIZE_NODE=angularStepSize
BACKGROUND_NODE=background BACKGROUND_NODE=background
BELOW_ELEMENT=below BELOW_ELEMENT=below
BLINK_ON_OUT_OF_RANGE_NODE=blinkOnOutOfRange BLINK_ON_OUT_OF_RANGE_NODE=blinkOnOutOfRange
......
...@@ -27,6 +27,8 @@ public class CpsNamespace extends NLS { ...@@ -27,6 +27,8 @@ public class CpsNamespace extends NLS {
private static final String BUNDLE_NAME = "CpsNamespace"; //$NON-NLS-1$ private static final String BUNDLE_NAME = "CpsNamespace"; //$NON-NLS-1$
public static String ABOVE_ELEMENT; public static String ABOVE_ELEMENT;
public static String ANGULAR_STEP_SIZE_NODE;
public static String BACKGROUND_NODE; public static String BACKGROUND_NODE;
public static String BELOW_ELEMENT; public static String BELOW_ELEMENT;
public static String BLINK_ON_OUT_OF_RANGE_NODE; public static String BLINK_ON_OUT_OF_RANGE_NODE;
......
...@@ -50,6 +50,7 @@ public class PositionWidget extends PointingWidget implements InformationProvide ...@@ -50,6 +50,7 @@ public class PositionWidget extends PointingWidget implements InformationProvide
protected boolean trackRotationContinuously; protected boolean trackRotationContinuously;
protected boolean trackTranslationContinuously; protected boolean trackTranslationContinuously;
protected double stepSize; protected double stepSize;
protected double angularStepSize;
// *************************************************************************** // ***************************************************************************
// * Constants * // * Constants *
...@@ -80,6 +81,7 @@ public class PositionWidget extends PointingWidget implements InformationProvide ...@@ -80,6 +81,7 @@ public class PositionWidget extends PointingWidget implements InformationProvide
this.trackRotationContinuously = builder.trackRotationContinuously; this.trackRotationContinuously = builder.trackRotationContinuously;
this.trackTranslationContinuously = builder.trackTranslationContinuously; this.trackTranslationContinuously = builder.trackTranslationContinuously;
this.stepSize = builder.stepSize; this.stepSize = builder.stepSize;
this.angularStepSize = builder.angularStepSize;
} }
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
...@@ -114,8 +116,13 @@ public class PositionWidget extends PointingWidget implements InformationProvide ...@@ -114,8 +116,13 @@ public class PositionWidget extends PointingWidget implements InformationProvide
if (modifyValueOnRotation && (!continuous || trackRotationContinuously)) { if (modifyValueOnRotation && (!continuous || trackRotationContinuously)) {
newPosition.setRotationDirection(convertDirection(direction)); newPosition.setRotationDirection(convertDirection(direction));
if (!Double.isNaN(this.angularStepSize)) {
double rotation = Math.abs(position.getAngle() - newPosition.getAngle());
doUpdate |= (rotation >= this.angularStepSize);
} else {
doUpdate |= true; doUpdate |= true;
} }
}
if (modifyValueOnTranslation && (!continuous || trackTranslationContinuously)) { if (modifyValueOnTranslation && (!continuous || trackTranslationContinuously)) {
if (!Double.isNaN(this.stepSize)) { if (!Double.isNaN(this.stepSize)) {
......
...@@ -33,6 +33,7 @@ public abstract class BasePositionWidgetBuilder<B extends BasePositionWidgetBuil ...@@ -33,6 +33,7 @@ public abstract class BasePositionWidgetBuilder<B extends BasePositionWidgetBuil
public boolean trackRotationContinuously; public boolean trackRotationContinuously;
public boolean trackTranslationContinuously; public boolean trackTranslationContinuously;
public double stepSize; public double stepSize;
public double angularStepSize;
// *************************************************************************** // ***************************************************************************
// * Constants * // * Constants *
...@@ -44,7 +45,8 @@ public abstract class BasePositionWidgetBuilder<B extends BasePositionWidgetBuil ...@@ -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 ...@@ -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.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.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.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