Commit 6a2d3b84 authored by Nico Mack's avatar Nico Mack

Created dedicated Leader Corona.

parent edb136d8
ABOVE_ELEMENT=above
BACKGROUND_NODE=background
BELOW_ELEMENT=below
BLINK_ON_OUT_OF_RANGE_NODE=blinkOnOutOfRange
CAPPED_DISPLAY_NODE=cappedDisplay
COLOUR_SCALE_NODE=colourScale
DECIMALS_ATTRIBUTE=decimals
FACE_IS_TOUCHABLE_NODE=faceIsTouchable
FOREGROUND_NODE=foreground
ITEMS_VARIABLE_NODE=itemsVariable
HTML_TEMPLATE_NODE=htmlTemplate
LABEL_NODE=label
LABEL_ANGLE_NODE=labelAngle
LABEL_TRANSLATION_NODE=labelTranslation
LANDING_LINE_LENGTH_NODE=landingLineLength
LEADER_COLOUR_NODE=leaderColour
LEADER_LINE_LENGTH_NODE=leaderLineLength
LEADER_STROKE_WIDTH_NODE=leaderStrokeWidth
LOWER_BOUND_RADIUS_NODE=lowerBoundRadius
LOWER_BOUND_VARIABLE_NODE=lowerBoundVariable
LOWER_STOP_ANGLE_NODE=lowerStopAngle
......@@ -25,6 +31,7 @@ POSITIONS_NODE=positions
RANGE_SEPARATOR_ATTRIBUTE=rangeSeparator
REFERENCE_NODE=reference
RELATIVE_NODE=relative
ROTATION_NODE=rotation
SCALES_NODE=scales
SELECTED_ITEMS_VARIABLE_NODE=selectedItemsVariable
SELECTED_RADIUS_NODE=selectedRadius
......@@ -32,6 +39,7 @@ STEP_SIZE_NODE=stepSize
STRETCH_TO_FIT_NODE=stretchToFit
TRACK_ROTATION_CONTINUOUSLY_NODE=trackRotationContinuously
TRACK_TRANSLATION_CONTINUOUSLY_NODE=trackTranslationContinuously
TRANSLATION_NODE=translation
UPPER_BOUND_RADIUS_NODE=upperBoundRadius
UPPER_BOUND_VARIABLE_NODE=upperBoundVariable
UPPER_STOP_ANGLE_NODE=upperStopAngle
......
......@@ -27,12 +27,14 @@ public class CpsNamespace extends NLS {
private static final String BUNDLE_NAME = "CpsNamespace"; //$NON-NLS-1$
public static String ABOVE_ELEMENT;
public static String BACKGROUND_NODE;
public static String BELOW_ELEMENT;
public static String BLINK_ON_OUT_OF_RANGE_NODE;
public static String CAPPED_DISPLAY_NODE;
public static String COLOUR_SCALE_NODE;
public static String FACE_IS_TOUCHABLE_NODE;
public static String FOREGROUND_NODE;
public static String DECIMALS_ATTRIBUTE;
......@@ -44,6 +46,12 @@ public class CpsNamespace extends NLS {
public static String LABEL_ANGLE_NODE;
public static String LABEL_TRANSLATION_NODE;
public static String LANDING_LINE_LENGTH_NODE;
public static String LEADER_COLOUR_NODE;
public static String LEADER_LINE_LENGTH_NODE;
public static String LEADER_STROKE_WIDTH_NODE;
public static String LOWER_BOUND_RADIUS_NODE;
public static String LOWER_BOUND_VARIABLE_NODE;
public static String LOWER_STOP_ANGLE_NODE;
......@@ -61,6 +69,7 @@ public class CpsNamespace extends NLS {
public static String RANGE_SEPARATOR_ATTRIBUTE;
public static String REFERENCE_NODE;
public static String RELATIVE_NODE;
public static String ROTATION_NODE;
public static String SCALES_NODE;
......@@ -72,6 +81,7 @@ public class CpsNamespace extends NLS {
public static String TRACK_ROTATION_CONTINUOUSLY_NODE;
public static String TRACK_TRANSLATION_CONTINUOUSLY_NODE;
public static String TRANSLATION_NODE;
public static String UPPER_BOUND_RADIUS_NODE;
public static String UPPER_BOUND_VARIABLE_NODE;
......
......@@ -3,7 +3,6 @@ package lu.list.itis.dkd.tui.widget.corona;
import lu.list.itis.dkd.tui.cps.variable.NumericalVariable;
import lu.list.itis.dkd.tui.utility.AngleUtils;
import lu.list.itis.dkd.tui.utility.ColorPair;
import lu.list.itis.dkd.tui.utility.Leader;
import lu.list.itis.dkd.tui.utility.Point;
import lu.list.itis.dkd.tui.utility.VariableFormat;
import lu.list.itis.dkd.tui.widget.corona.builder.BaseArcGraphBuilder;
......@@ -38,7 +37,6 @@ import java.awt.geom.Rectangle2D;
// ***************************************************************************
public class ArcGraph extends ValueCorona {
// protected String title;
protected double innerRadius;
protected double outerRadius;
protected int startAngle;
......@@ -52,7 +50,6 @@ public class ArcGraph extends ValueCorona {
protected ColorPair strokeColour;
protected ColorPair labelColour;
protected ColorPair textColour;
protected ColorPair leaderColour;
protected ColorPair faceColour;
protected ColorPair bezelColour;
......@@ -62,9 +59,6 @@ public class ArcGraph extends ValueCorona {
protected Stroke borderStroke;
protected int strokeWidth;
protected int leaderLineLength;
protected int landingLineLength;
protected VariableFormat variableFormat;
protected int rampingTime;
......@@ -75,7 +69,6 @@ public class ArcGraph extends ValueCorona {
private Area face;
private String label;
private LineMetrics labelMetrics;
private Leader leader;
protected Timeline blinkingTimeline;
protected Timeline balisticTimeline;
......@@ -109,15 +102,12 @@ public class ArcGraph extends ValueCorona {
this.strokeColour = builder.strokeColour;
this.labelColour = builder.labelColour;
this.textColour = builder.textColour;
this.leaderColour = builder.leaderColour;
this.faceColour = builder.faceColour;
this.bezelColour = builder.bezelColour;
this.labelShape = builder.labelShape;
this.labelFormat = builder.labelFormat;
this.textFont = builder.textFont;
this.strokeWidth = builder.strokeWidth;
this.leaderLineLength = builder.leaderLineLength;
this.landingLineLength = builder.landingLineLength;
this.rampingTime = builder.rampingTime;
this.buildFromProperties();
......@@ -148,15 +138,12 @@ public class ArcGraph extends ValueCorona {
this.strokeColour = original.strokeColour;
this.labelColour = original.labelColour;
this.textColour = original.textColour;
this.leaderColour = original.leaderColour;
this.faceColour = original.faceColour;
this.bezelColour = original.bezelColour;
this.labelShape = original.labelShape;
this.labelFormat = original.labelFormat;
this.textFont = original.textFont;
this.strokeWidth = original.strokeWidth;
this.leaderLineLength = original.leaderLineLength;
this.landingLineLength = original.landingLineLength;
this.rampingTime = original.rampingTime;
this.buildFromProperties();
......@@ -210,12 +197,6 @@ public class ArcGraph extends ValueCorona {
borderStroke = (strokeWidth > 0) ? new BasicStroke(strokeWidth) : null;
if (leaderLineLength > 0) {
leader = new Leader(innerRadius, leaderLineLength, landingLineLength);
leader.setLabelShape(labelShape);
leader.setFont(textFont);
}
this.setInformation((relative) ? this.reference : this.variable.getValue());
}
......@@ -286,8 +267,6 @@ public class ArcGraph extends ValueCorona {
faceColour.setSwitched(selectIt);
if (bezelColour != null)
bezelColour.setSwitched(selectIt);
if (leaderColour != null)
leaderColour.setSwitched(selectIt);
}
}
......@@ -318,12 +297,6 @@ public class ArcGraph extends ValueCorona {
extend = arcSpan * normalizedValue;
}
if (leader != null) {
float leaderAngle = (float) -Math.toRadians(start + extend);
leader.updateLeader(leaderAngle);
}
if (blinkOnOutOfRange && reachedEndOfScale()) {
this.startBlinking();
} else {
......@@ -384,36 +357,22 @@ public class ArcGraph extends ValueCorona {
// Depending on whether we specified a leader or not, we're either
// painting the leader or the stationary graph label, but never both.
if ((leaderColour != null) && (this.leader != null)) {
// Paint the leader...
this.leader.setStrokeColour(leaderColour.getColor());
if (labelColour != null)
this.leader.setFillColour(labelColour.getColor());
if (textColour != null)
this.leader.setLabelColour(textColour.getColor());
this.leader.paint(localCanvas);
} else {
// Paint the stationary graph label
if ((labelShape != null) || (label.length() > 0)) {
Point labelOffset = this.getOffsetFromCenter();
translation.translate(labelOffset.x, labelOffset.y);
localCanvas.setTransform(translation);
}
if (labelShape != null) {
localCanvas.setPaint(labelColour.getColor());
localCanvas.fill(labelShape);
}
if ((labelShape != null) || (label.length() > 0)) {
Point labelOffset = this.getOffsetFromCenter();
translation.translate(labelOffset.x, labelOffset.y);
localCanvas.setTransform(translation);
}
if (textColour != null) {
localCanvas.setPaint(textColour.getColor());
localCanvas.setFont(textFont);
localCanvas.drawString(label, 5, (labelMetrics.getAscent() / 2));
}
if (labelShape != null) {
localCanvas.setPaint(labelColour.getColor());
localCanvas.fill(labelShape);
}
if (textColour != null) {
localCanvas.setPaint(textColour.getColor());
localCanvas.setFont(textFont);
localCanvas.drawString(label, 5, (labelMetrics.getAscent() / 2));
}
localCanvas.dispose();
}
......@@ -438,15 +397,8 @@ public class ArcGraph extends ValueCorona {
}
if (textFont != null) {
// StringBuilder labelBuilder = new StringBuilder(this.title).append(" "); //$NON-NLS-1$
// labelBuilder.append(this.variable.toString(this.cappedDisplay, true));
this.label = this.variableFormat.format(this.variable);
this.labelMetrics = textFont.getLineMetrics(this.label, new FontRenderContext(null, true, true));
if (leader != null) {
leader.setLabel(label);
}
}
}
}
......
......@@ -2,7 +2,6 @@ package lu.list.itis.dkd.tui.widget.corona;
import lu.list.itis.dkd.tui.utility.AngleUtils;
import lu.list.itis.dkd.tui.utility.ColorPair;
import lu.list.itis.dkd.tui.utility.Leader;
import lu.list.itis.dkd.tui.utility.ValueRange;
import lu.list.itis.dkd.tui.utility.VariableFormat;
import lu.list.itis.dkd.tui.widget.corona.builder.ArcRangeGraphBuilder;
......@@ -35,7 +34,6 @@ import java.awt.geom.Rectangle2D;
// ***************************************************************************
public class ArcRangeGraph extends ValueRangeCorona {
private String title;
private double innerRadius;
private double outerRadius;
private double startAngle;
......@@ -49,7 +47,6 @@ public class ArcRangeGraph extends ValueRangeCorona {
private ColorPair strokeColour;
private ColorPair labelColour;
private ColorPair textColour;
private ColorPair leaderColour;
private ColorPair faceColour;
private ColorPair bezelColour;
......@@ -59,21 +56,13 @@ public class ArcRangeGraph extends ValueRangeCorona {
private int strokeWidth;
private String labelFormat;
private int leaderLineLength;
private int landingLineLength;
private Area outerArea;
private Area innerArea;
private Area positiveArc;
private Area negativeArc;
private Area face;
private Leader lowerLeader;
private Leader upperLeader;
private VariableFormat variableFormat;
private String lowerValueLabel;
private String upperValueLabel;
protected Timeline blinkingTimeline;
protected Timeline balisticTimeline;
......@@ -81,8 +70,6 @@ public class ArcRangeGraph extends ValueRangeCorona {
private double shownUpperValue;
private double referenceAngle;
private double lowerAngle;
private double upperAngle;
// ***************************************************************************
......@@ -97,9 +84,6 @@ public class ArcRangeGraph extends ValueRangeCorona {
public ArcRangeGraph(ArcRangeGraphBuilder<?> builder) {
super(builder);
this.title = builder.title;
this.startAngle = builder.startAngle;
this.arcSpan = builder.arcSpan;
this.relative = builder.relative;
......@@ -113,14 +97,11 @@ public class ArcRangeGraph extends ValueRangeCorona {
this.strokeColour = builder.strokeColour;
this.labelColour = builder.labelColour;
this.textColour = builder.textColour;
this.leaderColour = builder.leaderColour;
this.faceColour = builder.faceColour;
this.bezelColour = builder.bezelColour;
this.labelShape = builder.labelShape;
this.textFont = builder.textFont;
this.strokeWidth = builder.strokeWidth;
this.landingLineLength = builder.landingLineLength;
this.leaderLineLength = builder.leaderLineLength;
this.labelFormat = builder.labelFormat;
this.buildFromProperties();
......@@ -151,14 +132,11 @@ public class ArcRangeGraph extends ValueRangeCorona {
this.strokeColour = original.strokeColour;
this.labelColour = original.labelColour;
this.textColour = original.textColour;
this.leaderColour = original.leaderColour;
this.faceColour = original.faceColour;
this.bezelColour = original.bezelColour;
this.labelShape = original.labelShape;
this.textFont = original.textFont;
this.strokeWidth = original.strokeWidth;
this.landingLineLength = original.landingLineLength;
this.leaderLineLength = original.leaderLineLength;
this.labelFormat = original.labelFormat;
this.buildFromProperties();
......@@ -213,14 +191,6 @@ public class ArcRangeGraph extends ValueRangeCorona {
range = (relative) ? new ValueRange<>(this.reference, this.reference)
: new ValueRange<>(this.lowerBoundVariable.getValue(), this.upperBoundVariable.getValue());
lowerLeader = new Leader(innerRadius, leaderLineLength, landingLineLength);
lowerLeader.setLabelShape(labelShape);
lowerLeader.setFont(textFont);
upperLeader = new Leader(innerRadius, leaderLineLength, landingLineLength);
upperLeader.setLabelShape(labelShape);
upperLeader.setFont(textFont);
this.setInformation(range);
}
......@@ -246,19 +216,6 @@ public class ArcRangeGraph extends ValueRangeCorona {
// ---------------------------------------------------------------------------
private void updateLeader() {
float lowerLeaderAngle = (float) -Math.toRadians(lowerAngle);
float upperLeaderAngle = (float) -Math.toRadians(upperAngle);
this.lowerLeader.updateLeader(lowerLeaderAngle);
this.lowerLeader.setLabel(lowerValueLabel);
this.upperLeader.updateLeader(upperLeaderAngle);
this.upperLeader.setLabel(upperValueLabel);
}
// ---------------------------------------------------------------------------
private synchronized void updateArcFromValues() {
if ((lowerBoundVariable == null) || (upperBoundVariable == null)) {
......@@ -273,8 +230,8 @@ public class ArcRangeGraph extends ValueRangeCorona {
double diameter = 2 * outerRadius;
this.lowerAngle = startAngle + (arcSpan * normalizedLowerValue);
this.upperAngle = startAngle + (arcSpan * normalizedUpperValue);
// this.lowerAngle = startAngle + (arcSpan * normalizedLowerValue);
// this.upperAngle = startAngle + (arcSpan * normalizedUpperValue);
if (relative) {
double normalizedReference = (reference - this.lowerBoundVariable.getMinValue()) / valueRange;
......@@ -321,8 +278,6 @@ public class ArcRangeGraph extends ValueRangeCorona {
outerArea.subtract(innerArea);
}
this.updateLeader();
if (blinkOnOutOfRange && ((shownUpperValue == this.upperBoundVariable.getMaxValue()) || (relative && (shownLowerValue == this.lowerBoundVariable.getMinValue()))))
this.startBlinking();
else
......@@ -350,8 +305,6 @@ public class ArcRangeGraph extends ValueRangeCorona {
labelColour.setSwitched(selectIt);
if (textColour != null)
textColour.setSwitched(selectIt);
if (leaderColour != null)
leaderColour.setSwitched(selectIt);
if (faceColour != null)
faceColour.setSwitched(selectIt);
if (bezelColour != null)
......@@ -425,25 +378,6 @@ public class ArcRangeGraph extends ValueRangeCorona {
if (this.opacity < 1.0f)
localCanvas.setComposite(AlphaComposite.SrcOver.derive(1.0f));
if (leaderColour != null) {
if (this.lowerLeader != null) {
this.lowerLeader.setStrokeColour(leaderColour.getColor());
if (labelColour != null)
this.lowerLeader.setFillColour(labelColour.getColor());
if (textColour != null)
this.lowerLeader.setLabelColour(textColour.getColor());
this.lowerLeader.paint(localCanvas);
}
if (this.upperLeader != null) {
this.upperLeader.setStrokeColour(leaderColour.getColor());
if (labelColour != null)
this.upperLeader.setFillColour(labelColour.getColor());
if (textColour != null)
this.upperLeader.setLabelColour(textColour.getColor());
this.upperLeader.paint(localCanvas);
}
}
localCanvas.dispose();
}
......@@ -459,9 +393,6 @@ public class ArcRangeGraph extends ValueRangeCorona {
double lowerBound = this.lowerBoundVariable.getValue();
double upperBound = this.upperBoundVariable.getValue();
this.lowerValueLabel = this.variableFormat.format(this.lowerBoundVariable);
this.upperValueLabel = this.variableFormat.format(this.upperBoundVariable);
if ((lowerBound == shownLowerValue) && (upperBound == shownUpperValue)) {
return;
}
......
......@@ -11,10 +11,19 @@
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package lu.list.itis.dkd.tui.utility;
package lu.list.itis.dkd.tui.widget.corona;
import lu.list.itis.dkd.tui.utility.AngleUtils;
import lu.list.itis.dkd.tui.utility.ColorPair;
import lu.list.itis.dkd.tui.utility.Point;
import lu.list.itis.dkd.tui.utility.PolarCoordinateHelper;
import lu.list.itis.dkd.tui.utility.ScreenCoordinates;
import lu.list.itis.dkd.tui.utility.VariableFormat;
import lu.list.itis.dkd.tui.widget.corona.builder.BaseLeaderBuilder;
import org.pushingpixels.trident.Timeline;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Shape;
......@@ -24,36 +33,55 @@ import java.awt.font.LineMetrics;
import java.awt.geom.AffineTransform;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
/**
* @author mack
* @since [major].[minor]
* @version [major].[minor].[micro]
* @author Nico Mack [nico.mack@list.lu]
* @since 1.6
* @version 1.0.0
*/
// ***************************************************************************
// * Class Definition and Members *
// ***************************************************************************
public class Leader {
public class Leader extends ValueCorona {
protected double innerRadius;
protected double startAngle;
protected double arcSpan;
protected double reference;
protected double leaderLineLength;
protected double landingLineLength;
protected int leaderStrokeWidth;
protected ColorPair leaderStrokeColour;
protected Shape labelShape;
protected ColorPair fillColour;
protected ColorPair strokeColour;
protected int strokeWidth;
protected Font labelFont;
protected ColorPair textColour;
protected String labelFormat;
protected boolean relative;
protected int rampingTime;
private double radialOffset;
private double leaderLineLength;
private double landingLineLength;
private Shape shape;
private Font labelFont;
private Color fillColour;
private Color strokeColour;
private Color labelColour;
private int strokeWidth;
private Stroke lineStroke;
private VariableFormat variableFormat;
private Stroke leaderStroke;
private Stroke borderStroke;
private Line2D.Double leaderLine;
private Line2D.Double landingLine;
private String labelText;
private LineMetrics labelMetrics;
private Shape labelShape;
private Point labelPosition;
private Timeline balisticTimeline;
private double normalizedValue;
// ***************************************************************************
// * Constants *
......@@ -61,68 +89,71 @@ public class Leader {
private static final Point ZERO_ORIGIN = new Point(0, 0, 0, ScreenCoordinates.class);
private static final String NORMALIZED_VALUE_PROPERTY = "normalizedValue"; //$NON-NLS-1$
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Constructor(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
public Leader(double radialOffset, double leaderLineLength, double landingLineLength) {
this.radialOffset = radialOffset;
this.leaderLineLength = leaderLineLength;
this.landingLineLength = landingLineLength;
this.strokeWidth = 1;
this.lineStroke = new BasicStroke(strokeWidth);
this.strokeColour = Color.WHITE;
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
// ***************************************************************************
// ---------------------------------------------------------------------------
public Leader(BaseLeaderBuilder<?> builder) {
super(builder);
this.innerRadius = builder.innerRadius;
this.startAngle = builder.startAngle;
this.arcSpan = builder.arcSpan;
this.reference = builder.reference;
public void setFont(Font font) {
this.labelFont = font;
}
this.leaderLineLength = builder.leaderLineLength;
this.landingLineLength = builder.landingLineLength;
this.leaderStrokeWidth = builder.leaderStrokeWidth;
this.leaderStrokeColour = builder.leaderColour;
// ---------------------------------------------------------------------------
this.labelShape = builder.labelShape;
this.fillColour = builder.fillColour;
this.strokeColour = builder.strokeColour;
this.strokeWidth = builder.strokeWidth;
public void setLabelShape(Shape shape) {
this.shape = shape;
}
this.labelFont = builder.labelFont;
this.textColour = builder.textColour;
this.labelFormat = builder.labelFormat;
// ---------------------------------------------------------------------------
this.relative = builder.relative;
this.rampingTime = builder.rampingTime;
public void setFillColour(Color colour) {
this.fillColour = colour;
this.buildFromProperties();
}
// ---------------------------------------------------------------------------
public void setStrokeColour(Color colour) {
this.strokeColour = colour;
}
// ***************************************************************************
// * Primitive(s) *
// ***************************************************************************
// ---------------------------------------------------------------------------
public void setStrokeWidth(int width) {
this.strokeWidth = width;
this.lineStroke = new BasicStroke(this.strokeWidth);
}
private void buildFromProperties() {
// ---------------------------------------------------------------------------
// TODO Legacy Angle conversion. Should be removed sooner or later for
// compliance with Tulip Reference system.
startAngle = AngleUtils.TWO_PI - startAngle;
arcSpan = -arcSpan;
public void setLabelColour(Color colour) {
this.labelColour = colour;
if ((this.labelFormat != null) && (!this.labelFormat.isEmpty())) {
this.variableFormat = new VariableFormat(this.labelFormat);
} else {
this.variableFormat = new VariableFormat("d f u"); //$NON-NLS-1$
}
borderStroke = (strokeWidth > 0) ? new BasicStroke(strokeWidth) : null;
leaderStroke = (leaderStrokeWidth > 0) ? new BasicStroke(leaderStrokeWidth) : null;
this.setInformation((relative) ? this.reference : this.variable.getValue());
}
// ---------------------------------------------------------------------------
public void updateLeader(float leaderAngle) {
private void updateLeader(float leaderAngle) {
float inner = (float) radialOffset;
float outer = (float) (radialOffset + leaderLineLength);
float inner = (float) innerRadius;
float outer = (float) (innerRadius + leaderLineLength);
// Build Leader Line using polar coordinates
......@@ -144,46 +175,131 @@ public class Leader {
end.x += (flipped) ? -landingLineLength : landingLineLength;
landingLine = new Line2D.Double(new Point2D.Double(start.x, start.y), new Point2D.Double(end.x, end.y));
}
if (shape != null) {
end.x += (flipped) ? -shape.getBounds2D().getWidth() : 0;
if (labelShape != null) {
Rectangle2D bounds = labelShape.getBounds2D();
double originOffset = (bounds.getX() < 0) ? -bounds.getX() : 0;
end.x += (flipped) ? -labelShape.getBounds2D().getWidth() : 0;
AffineTransform labelTransform = AffineTransform.getTranslateInstance(end.x, end.y);
labelShape = labelTransform.createTransformedShape(shape);
labelTransform.translate(originOffset, 0);
shape = labelTransform.createTransformedShape(labelShape);
labelPosition = new Point(end.x, end.y, 0, ScreenCoordinates.class);
}
}
// ---------------------------------------------------------------------------
// ***************************************************************************
// * Class Body *
// ***************************************************************************
// ---------------------------------------------------------------------------
@Override
public void setSelected(boolean selectIt) {
super.setSelected(selectIt);
if (!relative) {
fillColour.setSwitched(selectIt);
strokeColour.setSwitched(selectIt);
textColour.setSwitched(selectIt);
leaderStrokeColour.setSwitched(selectIt);
}
}
// ---------------------------------------------------------------------------
public void switchColours(boolean isBelow) {
if (relative) {
fillColour.setSwitched(isBelow);
strokeColour.setSwitched(isBelow);
textColour.setSwitched(isBelow);
leaderStrokeColour.setSwitched(isBelow);
}
}
// ---------------------------------------------------------------------------
public void setNormalizedValue(double value) {
normalizedValue = value;
if (variable != null) {
double extend = 0;
double start = 0;
double normalizedReference = this.variable.getNormalizedValueOf(reference);
if (relative) {
start = startAngle + (arcSpan * normalizedReference);
extend = arcSpan * (normalizedValue - normalizedReference);
switchColours(normalizedValue <= normalizedReference);
} else {
start = startAngle;
extend = arcSpan * normalizedValue;