Commit bbb85f28 authored by Nico Mack's avatar Nico Mack

Added optional minimumRange property

parent f5b4032a
......@@ -21,8 +21,7 @@ LOWER_STOP_ANGLE_NODE=lowerStopAngle
MAPPING_NODE=mapping
MAPPINGS_NODE=mappings
MAINTAIN_ASPECT_RATIO_NODE=maintainAspectRatio
MAXIMUM_VALUE_NODE=maximumValue
MINIMUM_VALUE_NODE=minimumValue
MINIMUM_RANGE_NODE=minimumRange
MODIFY_VALUE_ON_ROTATION_NODE=modifyValueOnRotation
MODIFY_VALUE_ON_TRANSLATION_NODE=modifyValueOnTranslation
MULTITURN_NODE=multiTurn
......
......@@ -58,8 +58,7 @@ public class CpsNamespace extends NLS {
public static String MAPPING_NODE;
public static String MAPPINGS_NODE;
public static String MAINTAIN_ASPECT_RATIO_NODE;
public static String MAXIMUM_VALUE_NODE;
public static String MINIMUM_VALUE_NODE;
public static String MINIMUM_RANGE_NODE;
public static String MODIFY_VALUE_ON_ROTATION_NODE;
public static String MODIFY_VALUE_ON_TRANSLATION_NODE;
public static String MULTITURN_NODE;
......
......@@ -397,8 +397,19 @@ public class ArcRangeGraph extends ValueRangeCorona {
return;
}
if (this.rampingTime > 0) {
double lower = Math.min(lowerBound, upperBound);
upperBound = Math.max(lowerBound, upperBound);
lowerBound = lower;
if (Math.abs(lowerBound - upperBound) < this.minimumRange) {
if (lowerBound == shownLowerValue) {
upperBound = lowerBound + this.minimumRange;
} else {
lowerBound = upperBound - this.minimumRange;
}
}
if (this.rampingTime > 0) {
if ((balisticTimeline != null) && (!balisticTimeline.isDone()))
balisticTimeline.cancel();
......
......@@ -489,28 +489,29 @@ public class CoxcombRangeSlice extends ValueRangeCorona {
if (this.opacity < 1.0f)
localCanvas.setComposite(AlphaComposite.SrcOver.derive(this.opacity));
if ((face != null) && (faceColour != null)) {
localCanvas.setPaint(faceColour.getColor());
localCanvas.fill(face);
}
if ((face != null) && (bezelColour != null)) {
localCanvas.setPaint(bezelColour.getColor());
if (borderStroke != null)
localCanvas.setStroke(borderStroke);
localCanvas.draw(face);
}
if (borderStroke != null)
localCanvas.setStroke(borderStroke);
if ((slice != null) && (fillColour != null)) {
localCanvas.setPaint(fillColour.getColor());
localCanvas.fill(slice);
if (face != null) {
if (faceColour != null) {
localCanvas.setPaint(faceColour.getColor());
localCanvas.fill(face);
}
if (bezelColour != null) {
localCanvas.setPaint(bezelColour.getColor());
localCanvas.draw(face);
}
}
if ((slice != null) && (strokeColour != null)) {
localCanvas.setPaint(strokeColour.getColor());
if (borderStroke != null)
localCanvas.setStroke(borderStroke);
localCanvas.draw(slice);
if (slice != null) {
if (fillColour != null) {
localCanvas.setPaint(fillColour.getColor());
localCanvas.fill(slice);
}
if (strokeColour != null) {
localCanvas.setPaint(strokeColour.getColor());
localCanvas.draw(slice);
}
}
if (this.opacity < 1.0f)
......@@ -599,6 +600,18 @@ public class CoxcombRangeSlice extends ValueRangeCorona {
return;
}
double lower = Math.min(lowerBound, upperBound);
upperBound = Math.max(lowerBound, upperBound);
lowerBound = lower;
if (Math.abs(lowerBound - upperBound) < this.minimumRange) {
if (lowerBound == shownLowerValue) {
upperBound = lowerBound + this.minimumRange;
} else {
lowerBound = upperBound - this.minimumRange;
}
}
if (this.rampingTime > 0) {
if ((balisticTimeline != null) && (!balisticTimeline.isDone()))
......
......@@ -31,6 +31,7 @@ import java.util.Map;
public class ValueRangeCorona extends SelectableCorona implements InformationReceiver<ValueRange<?>>, VariableBased {
protected NumericalVariable lowerBoundVariable;
protected NumericalVariable upperBoundVariable;
protected double minimumRange;
// ***************************************************************************
// * Constants *
......@@ -48,6 +49,7 @@ public class ValueRangeCorona extends SelectableCorona implements InformationRec
super(builder);
this.lowerBoundVariable = builder.lowerBoundVariable;
this.upperBoundVariable = builder.upperBoundVariable;
this.minimumRange = builder.minimumRange;
}
// ---------------------------------------------------------------------------
......@@ -56,6 +58,7 @@ public class ValueRangeCorona extends SelectableCorona implements InformationRec
super(original);
this.lowerBoundVariable = (original.lowerBoundVariable != null) ? original.lowerBoundVariable.clone() : null;
this.upperBoundVariable = (original.upperBoundVariable != null) ? original.upperBoundVariable.clone() : null;
this.minimumRange = original.minimumRange;
}
// ---------------------------------------------------------------------------
......
......@@ -3,6 +3,7 @@ package lu.list.itis.dkd.tui.widget.corona.builder;
import lu.list.itis.dkd.dbc.annotation.Nullable;
import lu.list.itis.dkd.tui.bootstrapping.BootstrapCallback;
import lu.list.itis.dkd.tui.bootstrapping.BootstrapContext;
import lu.list.itis.dkd.tui.bootstrapping.BootstrappingUtils;
import lu.list.itis.dkd.tui.bootstrapping.VariableBootstrapper;
import lu.list.itis.dkd.tui.cps.variable.NumericalVariable;
import lu.list.itis.dkd.tui.exception.BuildException;
......@@ -27,6 +28,7 @@ import org.jdom2.Element;
public abstract class BaseValueRangeCoronaBuilder<B extends BaseValueRangeCoronaBuilder<B>> extends BaseSelectableCoronaBuilder<B> {
public NumericalVariable lowerBoundVariable;
public NumericalVariable upperBoundVariable;
public double minimumRange;
// ***************************************************************************
// * Constants *
......@@ -68,6 +70,7 @@ public abstract class BaseValueRangeCoronaBuilder<B extends BaseValueRangeCorona
lowerBoundVariable = (NumericalVariable) VariableBootstrapper.buildVariableFromElement(variablesElement.getChild(CpsNamespace.LOWER_BOUND_VARIABLE_NODE), context, callback);
upperBoundVariable = (NumericalVariable) VariableBootstrapper.buildVariableFromElement(variablesElement.getChild(CpsNamespace.UPPER_BOUND_VARIABLE_NODE), context, callback);
}
minimumRange = BootstrappingUtils.getContentAsDouble(rootElement, CpsNamespace.MINIMUM_RANGE_NODE, BootstrappingUtils.OPTIONAL, 0d, 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