Commit d226fa2b authored by Nico Mack's avatar Nico Mack

Added missing stepSize bootstrapping property

parent 7441654b
ABOVE_ELEMENT=above
AREA_NODE=area
ANGULAR_STEP_SIZE_NODE=angularStepSize
BACKGROUND_NODE=background
BELOW_ELEMENT=below
......
......@@ -27,6 +27,7 @@ public class CpsNamespace extends NLS {
private static final String BUNDLE_NAME = "CpsNamespace"; //$NON-NLS-1$
public static String ABOVE_ELEMENT;
public static String AREA_NODE;
public static String ANGULAR_STEP_SIZE_NODE;
public static String BACKGROUND_NODE;
......
......@@ -108,6 +108,7 @@ public class RotaryEncoder {
this.value = this.initialValue;
this.lowerBound = BootstrappingUtils.getContentAsDouble(rootNode, Externalization.LOWER_BOUND_NODE, BootstrappingUtils.OPTIONAL, 0d, context);
this.upperBound = BootstrappingUtils.getContentAsDouble(rootNode, Externalization.UPPER_BOUND_NODE, BootstrappingUtils.MANDATORY, null, context);;
this.stepSize = BootstrappingUtils.getContentAsDouble(rootNode, CpsNamespace.STEP_SIZE_NODE, BootstrappingUtils.OPTIONAL, 1d, context);
this.lowerStopAngle = BootstrappingUtils.getContentAsRadians(rootNode, CpsNamespace.LOWER_STOP_ANGLE_NODE, BootstrappingUtils.OPTIONAL, Double.NaN, context);
this.upperStopAngle = BootstrappingUtils.getContentAsRadians(rootNode, CpsNamespace.UPPER_STOP_ANGLE_NODE, BootstrappingUtils.OPTIONAL, Double.NaN, context);
this.multiTurn = BootstrappingUtils.getContentAsBoolean(rootNode, CpsNamespace.MULTITURN_NODE, BootstrappingUtils.OPTIONAL, Boolean.FALSE, context);
......@@ -133,6 +134,13 @@ public class RotaryEncoder {
// ***************************************************************************
// ---------------------------------------------------------------------------
public void setValue(double newValue) {
this.value = Math.max(this.lowerBound, newValue);
this.value = Math.min(this.upperBound, newValue);
}
// ---------------------------------------------------------------------------
public void setStopAngles(double lower, double upper) {
this.lowerStopAngle = Math.min(lower, upper);
this.upperStopAngle = Math.max(lower, upper);
......
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