Search in sources :

Example 16 with InnerShadow

use of javafx.scene.effect.InnerShadow in project Board-Instrumentation-Framework by intel.

the class DoubleRadialGaugeSkin method initGraphics.

private void initGraphics() {
    background = new Region();
    background.getStyleClass().setAll("background");
    ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D();
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 8, 0d, 0d, 0d);
    glow = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getLedColorOne(), 20, 0d, 0d, 0d);
    glow.setInput(innerShadow);
    ledFrameOne = new Region();
    ledFrameOne.getStyleClass().setAll("led-frame");
    ledMainOne = new Region();
    ledMainOne.getStyleClass().setAll("led-main-one");
    ledMainOne.setStyle("-led-color-one: " + (colorToCss(getSkinnable().getLedColorOne())) + ";");
    ledHlOne = new Region();
    ledHlOne.getStyleClass().setAll("led-hl");
    ledFrameTwo = new Region();
    ledFrameTwo.getStyleClass().setAll("led-frame");
    ledMainTwo = new Region();
    ledMainTwo.getStyleClass().setAll("led-main-two");
    ledMainTwo.setStyle("-led-color-two: " + (colorToCss(getSkinnable().getLedColorTwo())) + ";");
    ledHlTwo = new Region();
    ledHlTwo.getStyleClass().setAll("led-hl");
    angleStepOne = getSkinnable().getAngleRangeOne() / (getSkinnable().getMaxValueOne() - getSkinnable().getMinValueOne());
    double targetAngleOne = 180 - getSkinnable().getStartAngleOne() + (getSkinnable().getValueOne() - getSkinnable().getMinValueOne()) * angleStepOne;
    targetAngleOne = clamp(180 - getSkinnable().getStartAngleOne(), 180 - getSkinnable().getStartAngleOne() + getSkinnable().getAngleRangeOne(), targetAngleOne);
    needleOneRotate = new Rotate(targetAngleOne);
    needleOne = new Region();
    needleOne.getStyleClass().setAll(DoubleRadialGauge.STYLE_CLASS_NEEDLE_ONE_STANDARD);
    needleOne.getTransforms().setAll(needleOneRotate);
    needleOneHighlight = new Region();
    needleOneHighlight.setMouseTransparent(true);
    needleOneHighlight.getStyleClass().setAll("needle-highlight");
    needleOneHighlight.getTransforms().setAll(needleOneRotate);
    angleStepTwo = -getSkinnable().getAngleRangeTwo() / (getSkinnable().getMaxValueTwo() - getSkinnable().getMinValueTwo());
    double targetAngleTwo = 180 - getSkinnable().getStartAngleTwo() + (getSkinnable().getValueTwo() - getSkinnable().getMinValueTwo()) * angleStepTwo;
    targetAngleTwo = clamp(180 - getSkinnable().getStartAngleTwo() - getSkinnable().getAngleRangeTwo(), 180 - getSkinnable().getStartAngleTwo(), targetAngleTwo);
    needleTwoRotate = new Rotate(targetAngleTwo);
    needleTwo = new Region();
    needleTwo.getStyleClass().setAll(DoubleRadialGauge.STYLE_CLASS_NEEDLE_TWO_STANDARD);
    needleTwo.getTransforms().setAll(needleTwoRotate);
    needleTwoHighlight = new Region();
    needleTwoHighlight.setMouseTransparent(true);
    needleTwoHighlight.getStyleClass().setAll("needle-highlight");
    needleTwoHighlight.getTransforms().setAll(needleTwoRotate);
    knob = new Region();
    knob.setPickOnBounds(false);
    knob.getStyleClass().setAll("knob");
    dropShadow = new DropShadow();
    dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
    dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
    dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);
    shadowGroup = new Group(needleOne, needleOneHighlight, needleTwo, needleTwoHighlight, knob);
    shadowGroup.setEffect(getSkinnable().isDropShadowEnabled() ? dropShadow : null);
    titleTextOne = new Text(getSkinnable().getTitleOne());
    titleTextOne.setTextOrigin(VPos.CENTER);
    titleTextOne.getStyleClass().setAll("title");
    unitTextOne = new Text(getSkinnable().getUnitOne());
    unitTextOne.setMouseTransparent(true);
    unitTextOne.setTextOrigin(VPos.CENTER);
    unitTextOne.getStyleClass().setAll("unit");
    valueTextOne = new Text(String.format(Locale.US, "%." + getSkinnable().getDecimalsOne() + "f", getSkinnable().getValueOne()));
    valueTextOne.setMouseTransparent(true);
    valueTextOne.setTextOrigin(VPos.CENTER);
    valueTextOne.getStyleClass().setAll("value");
    titleTextTwo = new Text(getSkinnable().getTitleTwo());
    titleTextTwo.setTextOrigin(VPos.CENTER);
    titleTextTwo.getStyleClass().setAll("title");
    unitTextTwo = new Text(getSkinnable().getUnitTwo());
    unitTextTwo.setMouseTransparent(true);
    unitTextTwo.setTextOrigin(VPos.CENTER);
    unitTextTwo.getStyleClass().setAll("unit");
    valueTextTwo = new Text(String.format(Locale.US, "%." + getSkinnable().getDecimalsTwo() + "f", getSkinnable().getValueTwo()));
    valueTextTwo.setMouseTransparent(true);
    valueTextTwo.setTextOrigin(VPos.CENTER);
    valueTextTwo.getStyleClass().setAll("value");
    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(background, ticksAndSectionsCanvas, titleTextOne, titleTextTwo, ledFrameOne, ledMainOne, ledHlOne, ledFrameTwo, ledMainTwo, ledHlTwo, unitTextOne, valueTextOne, unitTextTwo, valueTextTwo, shadowGroup);
    getChildren().setAll(pane);
}
Also used : Group(javafx.scene.Group) Rotate(javafx.scene.transform.Rotate) InnerShadow(javafx.scene.effect.InnerShadow) Canvas(javafx.scene.canvas.Canvas) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane) DropShadow(javafx.scene.effect.DropShadow)

Example 17 with InnerShadow

use of javafx.scene.effect.InnerShadow in project Board-Instrumentation-Framework by intel.

the class GaugeSkin method initGraphics.

private void initGraphics() {
    valueBlendBottomShadow = new DropShadow();
    valueBlendBottomShadow.setBlurType(BlurType.TWO_PASS_BOX);
    valueBlendBottomShadow.setColor(Color.rgb(255, 255, 255, 0.5));
    valueBlendBottomShadow.setOffsetX(0);
    valueBlendBottomShadow.setOffsetY(0.005 * PREFERRED_WIDTH);
    valueBlendBottomShadow.setRadius(0);
    valueBlendTopShadow = new InnerShadow();
    valueBlendTopShadow.setBlurType(BlurType.TWO_PASS_BOX);
    valueBlendTopShadow.setColor(Color.rgb(0, 0, 0, 0.7));
    valueBlendTopShadow.setOffsetX(0);
    valueBlendTopShadow.setOffsetY(0.005 * PREFERRED_WIDTH);
    valueBlendTopShadow.setRadius(0.005 * PREFERRED_WIDTH);
    valueBlend = new Blend();
    valueBlend.setMode(BlendMode.MULTIPLY);
    valueBlend.setBottomInput(valueBlendBottomShadow);
    valueBlend.setTopInput(valueBlendTopShadow);
    background = new Region();
    background.getStyleClass().setAll("background");
    ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D();
    histogram = new Path();
    histogram.setFillRule(FillRule.NON_ZERO);
    histogram.getStyleClass().add("histogram-fill");
    minMeasuredValue = new Region();
    minMeasuredValue.getStyleClass().setAll("min-measured-value");
    minMeasuredValueRotate = new Rotate(180 - getSkinnable().getStartAngle() + (getSkinnable().getValue() - getSkinnable().getMinValue()) * angleStep);
    minMeasuredValue.getTransforms().setAll(minMeasuredValueRotate);
    minMeasuredValue.setOpacity(getSkinnable().isMinMeasuredValueVisible() ? 1 : 0);
    minMeasuredValue.setManaged(getSkinnable().isMinMeasuredValueVisible());
    maxMeasuredValue = new Region();
    maxMeasuredValue.getStyleClass().setAll("max-measured-value");
    maxMeasuredValueRotate = new Rotate(180 - getSkinnable().getStartAngle() + (getSkinnable().getValue() - getSkinnable().getMinValue()) * angleStep);
    maxMeasuredValue.getTransforms().setAll(maxMeasuredValueRotate);
    maxMeasuredValue.setOpacity(getSkinnable().isMaxMeasuredValueVisible() ? 1 : 0);
    maxMeasuredValue.setManaged(getSkinnable().isMaxMeasuredValueVisible());
    threshold = new Region();
    threshold.getStyleClass().setAll("threshold");
    thresholdRotate = new Rotate(180 - getSkinnable().getStartAngle() - getSkinnable().getMinValue() * angleStep);
    threshold.getTransforms().setAll(thresholdRotate);
    threshold.setOpacity(getSkinnable().isThresholdVisible() ? 1 : 0);
    threshold.setManaged(getSkinnable().isThresholdVisible());
    thresholdExceeded = false;
    // Set initial value
    angleStep = getSkinnable().getAngleRange() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
    double targetAngle = 180 - getSkinnable().getStartAngle() + (getSkinnable().getValue() - getSkinnable().getMinValue()) * angleStep;
    targetAngle = clamp(180 - getSkinnable().getStartAngle(), 180 - getSkinnable().getStartAngle() + getSkinnable().getAngleRange(), targetAngle);
    needle = new Region();
    needle.getStyleClass().setAll(Gauge.STYLE_CLASS_NEEDLE_STANDARD);
    needleRotate = new Rotate(180 - getSkinnable().getStartAngle());
    needleRotate.setAngle(targetAngle);
    needle.getTransforms().setAll(needleRotate);
    needleHighlight = new Region();
    needleHighlight.setMouseTransparent(true);
    needleHighlight.getStyleClass().setAll("needle-highlight");
    needleHighlight.getTransforms().setAll(needleRotate);
    knob = new Region();
    knob.setPickOnBounds(false);
    knob.getStyleClass().setAll("knob");
    dropShadow = new DropShadow();
    dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
    dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
    dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);
    // , knob);
    shadowGroup = new Group(needle, needleHighlight);
    shadowGroup.setEffect(getSkinnable().isDropShadowEnabled() ? dropShadow : null);
    titleText = new Text(getSkinnable().getTitle());
    titleText.setTextOrigin(VPos.CENTER);
    titleText.getStyleClass().setAll("title");
    unitText = new Text(getSkinnable().getUnit());
    unitText.setMouseTransparent(true);
    unitText.setTextOrigin(VPos.CENTER);
    unitText.getStyleClass().setAll("unit");
    valueText = new Text(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getValue()));
    valueText.setMouseTransparent(true);
    valueText.setTextOrigin(VPos.CENTER);
    valueText.getStyleClass().setAll("value");
    valueText.setEffect(getSkinnable().isPlainValue() ? null : valueBlend);
    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(background, histogram, ticksAndSectionsCanvas, minMeasuredValue, maxMeasuredValue, threshold, titleText, shadowGroup, knob, unitText, valueText);
    pane.getChildren().addAll(getSkinnable().getMarkers().keySet());
    getChildren().setAll(pane);
}
Also used : Path(javafx.scene.shape.Path) Group(javafx.scene.Group) Rotate(javafx.scene.transform.Rotate) InnerShadow(javafx.scene.effect.InnerShadow) Blend(javafx.scene.effect.Blend) Canvas(javafx.scene.canvas.Canvas) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane) DropShadow(javafx.scene.effect.DropShadow)

Example 18 with InnerShadow

use of javafx.scene.effect.InnerShadow in project Board-Instrumentation-Framework by intel.

the class LinearSkin method initGraphics.

private void initGraphics() {
    background = new Region();
    background.getStyleClass().setAll("background");
    barBackground = new Region();
    barBackground.getStyleClass().setAll("bar-background");
    barBackgroundBorderStart1 = new MoveTo();
    barBackgroundBorderStop1 = new LineTo();
    barBackgroundBorderStart2 = new MoveTo();
    barBackgroundBorderStop2 = new LineTo();
    barBackgroundBorder = new Path(barBackgroundBorderStart1, barBackgroundBorderStop1, barBackgroundBorderStart2, barBackgroundBorderStop2);
    barBackgroundBorder.getStyleClass().setAll("bar-background-border");
    ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D();
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 8, 0d, 0d, 0d);
    glow = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getLedColor(), 20, 0d, 0d, 0d);
    glow.setInput(innerShadow);
    ledFrame = new Region();
    ledFrame.getStyleClass().setAll("led-frame");
    ledMain = new Region();
    ledMain.getStyleClass().setAll("led-main");
    ledMain.setStyle("-led-color: " + (colorToCss(getSkinnable().getLedColor())) + ";");
    ledHl = new Region();
    ledHl.getStyleClass().setAll("led-hl");
    bar = new Region();
    bar.getStyleClass().setAll("bar");
    foreground = new Region();
    foreground.getStyleClass().setAll("foreground");
    titleText = new Text(getSkinnable().getTitle());
    titleText.getStyleClass().setAll("title");
    unitText = new Text(getSkinnable().getUnit());
    unitText.getStyleClass().setAll("unit");
    lcdText = new Label(getSkinnable().getNumberFormat().format(getSkinnable().getValue()));
    lcdText.getStyleClass().setAll("lcd-text");
    pane = new Pane();
    pane.getChildren().setAll(background, barBackground, barBackgroundBorder, ticksAndSectionsCanvas, titleText, unitText, lcdText, ledFrame, ledMain, ledHl, bar, foreground);
    getChildren().setAll(pane);
    resize();
}
Also used : Path(javafx.scene.shape.Path) MoveTo(javafx.scene.shape.MoveTo) LineTo(javafx.scene.shape.LineTo) InnerShadow(javafx.scene.effect.InnerShadow) Canvas(javafx.scene.canvas.Canvas) Label(javafx.scene.control.Label) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane) DropShadow(javafx.scene.effect.DropShadow)

Example 19 with InnerShadow

use of javafx.scene.effect.InnerShadow in project Board-Instrumentation-Framework by intel.

the class RadialBargraphSkin method initGraphics.

private void initGraphics() {
    // "OpenSans"
    Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.06 * PREFERRED_HEIGHT));
    barColor = getSkinnable().getBarColor();
    barGradient = new ConicalGradient(new Stop(0.0, Color.TRANSPARENT), new Stop(1.0, Color.TRANSPARENT));
    valueBlendBottomShadow = new DropShadow();
    valueBlendBottomShadow.setBlurType(BlurType.TWO_PASS_BOX);
    valueBlendBottomShadow.setColor(Color.rgb(255, 255, 255, 0.5));
    valueBlendBottomShadow.setOffsetX(0);
    valueBlendBottomShadow.setOffsetY(0.005 * PREFERRED_WIDTH);
    valueBlendBottomShadow.setRadius(0);
    valueBlendTopShadow = new InnerShadow();
    valueBlendTopShadow.setBlurType(BlurType.TWO_PASS_BOX);
    valueBlendTopShadow.setColor(Color.rgb(0, 0, 0, 0.7));
    valueBlendTopShadow.setOffsetX(0);
    valueBlendTopShadow.setOffsetY(0.005 * PREFERRED_WIDTH);
    valueBlendTopShadow.setRadius(0.005 * PREFERRED_WIDTH);
    blend = new Blend();
    blend.setMode(BlendMode.MULTIPLY);
    blend.setBottomInput(valueBlendBottomShadow);
    blend.setTopInput(valueBlendTopShadow);
    background = new Region();
    background.getStyleClass().setAll("background");
    ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D();
    minMeasuredValue = new Region();
    minMeasuredValue.getStyleClass().setAll("min-measured-value");
    minMeasuredValueRotate = new Rotate(180 - getSkinnable().getStartAngle());
    minMeasuredValue.getTransforms().setAll(minMeasuredValueRotate);
    minMeasuredValue.setOpacity(getSkinnable().isMinMeasuredValueVisible() ? 1 : 0);
    minMeasuredValue.setManaged(getSkinnable().isMinMeasuredValueVisible());
    maxMeasuredValue = new Region();
    maxMeasuredValue.getStyleClass().setAll("max-measured-value");
    maxMeasuredValueRotate = new Rotate(180 - getSkinnable().getStartAngle());
    maxMeasuredValue.getTransforms().setAll(maxMeasuredValueRotate);
    maxMeasuredValue.setOpacity(getSkinnable().isMaxMeasuredValueVisible() ? 1 : 0);
    maxMeasuredValue.setManaged(getSkinnable().isMaxMeasuredValueVisible());
    threshold = new Region();
    threshold.getStyleClass().setAll("threshold");
    thresholdRotate = new Rotate(180 - getSkinnable().getStartAngle());
    threshold.getTransforms().setAll(thresholdRotate);
    threshold.setOpacity(getSkinnable().isThresholdVisible() ? 1 : 0);
    threshold.setManaged(getSkinnable().isThresholdVisible());
    thresholdExceeded = false;
    bar = new Arc();
    bar.setType(ArcType.ROUND);
    bar.setCenterX(PREFERRED_WIDTH * 0.5);
    bar.setCenterY(PREFERRED_HEIGHT * 0.5);
    bar.setRadiusX(PREFERRED_WIDTH * 0.5 - 4);
    bar.setRadiusY(PREFERRED_HEIGHT * 0.5 - 4);
    bar.setStartAngle(getSkinnable().getStartAngle() - 90);
    bar.setLength(0);
    bar.setStrokeType(StrokeType.CENTERED);
    bar.setStroke(null);
    bar.setFill(new RadialGradient(0, 0, PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.45, false, CycleMethod.NO_CYCLE, new Stop(0.0, barColor), // -5 for on the barColorHue)
    new Stop(0.76, barColor.deriveColor(-5, 1, 1, 1)), new Stop(0.79, barColor), new Stop(0.97, barColor), // -5 for on the barColorHue)
    new Stop(1.0, barColor.deriveColor(-5, 1, 1, 1))));
    knob = new Region();
    knob.setPickOnBounds(false);
    knob.getStyleClass().setAll("knob");
    dropShadow = new DropShadow();
    dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
    dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
    dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
    dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);
    title = new Text(getSkinnable().getTitle());
    title.setMouseTransparent(true);
    title.setTextOrigin(VPos.CENTER);
    title.getStyleClass().setAll("title");
    title.setEffect(getSkinnable().isPlainValue() ? null : blend);
    unit = new Text(getSkinnable().getUnit());
    unit.setMouseTransparent(true);
    unit.setTextOrigin(VPos.CENTER);
    unit.getStyleClass().setAll("unit");
    unit.setEffect(getSkinnable().isPlainValue() ? null : blend);
    value = new Text();
    value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getValue()));
    value.setMouseTransparent(true);
    value.setTextOrigin(VPos.CENTER);
    value.getStyleClass().setAll("value");
    value.setEffect(getSkinnable().isPlainValue() ? null : blend);
    // Set initial value
    double range = (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
    double angleRange = getSkinnable().getAngleRange();
    angleStep = angleRange / range;
    double targetAngle = getSkinnable().getValue() * angleStep;
    angle.set(targetAngle);
    double currentValue = angle.get() / angleStep;
    value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", currentValue));
    value.setTranslateX((size - value.getLayoutBounds().getWidth()) * 0.5);
    bar.setLength(-currentValue * angleStep);
    // Add all nodes
    pane = new Pane();
    pane.getChildren().setAll(background, bar, ticksAndSectionsCanvas, minMeasuredValue, maxMeasuredValue, threshold, knob, title, unit, value);
    pane.getChildren().addAll(getSkinnable().getMarkers().keySet());
    getChildren().setAll(pane);
}
Also used : ConicalGradient(eu.hansolo.enzo.common.ConicalGradient) Rotate(javafx.scene.transform.Rotate) Stop(javafx.scene.paint.Stop) InnerShadow(javafx.scene.effect.InnerShadow) Blend(javafx.scene.effect.Blend) Canvas(javafx.scene.canvas.Canvas) RadialGradient(javafx.scene.paint.RadialGradient) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane) DropShadow(javafx.scene.effect.DropShadow) Arc(javafx.scene.shape.Arc) Region(javafx.scene.layout.Region)

Example 20 with InnerShadow

use of javafx.scene.effect.InnerShadow in project Board-Instrumentation-Framework by intel.

the class RadialSkin method initGraphics.

private void initGraphics() {
    background = new Region();
    background.getStyleClass().setAll("background");
    ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D();
    innerShadow = new InnerShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 8, 0d, 0d, 0d);
    glow = new DropShadow(BlurType.TWO_PASS_BOX, getSkinnable().getLedColor(), 20, 0d, 0d, 0d);
    glow.setInput(innerShadow);
    ledFrame = new Region();
    ledFrame.getStyleClass().setAll("led-frame");
    ledMain = new Region();
    ledMain.getStyleClass().setAll("led-main");
    ledMain.setStyle("-led-color: " + (colorToCss(getSkinnable().getLedColor())) + ";");
    ledHl = new Region();
    ledHl.getStyleClass().setAll("led-hl");
    titleText = new Text(getSkinnable().getTitle());
    titleText.getStyleClass().setAll("title");
    unitText = new Text(getSkinnable().getUnit());
    unitText.getStyleClass().setAll("unit");
    lcdText = new Label(getSkinnable().getNumberFormat().format(getSkinnable().getValue()));
    lcdText.getStyleClass().setAll("lcd-text");
    angleStep = getSkinnable().getAngleRange() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
    double targetAngle = 180 - getSkinnable().getStartAngle() + (getSkinnable().getValue() - getSkinnable().getMinValue()) * angleStep;
    targetAngle = getSkinnable().clamp(180 - getSkinnable().getStartAngle(), 180 - getSkinnable().getStartAngle() + getSkinnable().getAngleRange(), targetAngle);
    needle = new Region();
    needle.getStyleClass().setAll("needle");
    needleRotate = new Rotate(180 - getSkinnable().getStartAngle());
    needleRotate.setAngle(targetAngle);
    needle.getTransforms().setAll(needleRotate);
    needleColorBlock = new Region();
    needleColorBlock.getStyleClass().setAll("needle-color-block");
    needleColorBlock.setStyle("-needle-color: " + (colorToCss(getSkinnable().getNeedleColor())) + ";");
    needleColorBlockRotate = new Rotate(180 - getSkinnable().getStartAngle());
    needleColorBlock.getTransforms().setAll(needleColorBlockRotate);
    minPost = new Region();
    minPost.getStyleClass().setAll("post");
    maxPost = new Region();
    maxPost.getStyleClass().setAll("post");
    knob = new Region();
    knob.getStyleClass().setAll("knob");
    shadowGroup = new Group(needle, minPost, maxPost, knob);
    dropShadow = new DropShadow(BlurType.TWO_PASS_BOX, Color.rgb(0, 0, 0, 0.65), 2.5, 0, 0, 2.5);
    shadowGroup.setEffect(dropShadow);
    foreground = new Region();
    foreground.getStyleClass().setAll("foreground");
    pane = new Pane();
    pane.getChildren().setAll(background, ticksAndSectionsCanvas, unitText, titleText, ledFrame, ledMain, ledHl, lcdText, shadowGroup, needleColorBlock, foreground);
    getChildren().setAll(pane);
    resize();
}
Also used : Group(javafx.scene.Group) Rotate(javafx.scene.transform.Rotate) InnerShadow(javafx.scene.effect.InnerShadow) Canvas(javafx.scene.canvas.Canvas) Label(javafx.scene.control.Label) Region(javafx.scene.layout.Region) Text(javafx.scene.text.Text) Pane(javafx.scene.layout.Pane) DropShadow(javafx.scene.effect.DropShadow)

Aggregations

InnerShadow (javafx.scene.effect.InnerShadow)23 DropShadow (javafx.scene.effect.DropShadow)17 Region (javafx.scene.layout.Region)17 Pane (javafx.scene.layout.Pane)13 Text (javafx.scene.text.Text)13 Canvas (javafx.scene.canvas.Canvas)9 Group (javafx.scene.Group)8 Rotate (javafx.scene.transform.Rotate)7 Stop (javafx.scene.paint.Stop)6 LinearGradient (javafx.scene.paint.LinearGradient)5 Color (javafx.scene.paint.Color)4 RadialGradient (javafx.scene.paint.RadialGradient)4 Label (javafx.scene.control.Label)3 Path (javafx.scene.shape.Path)3 Rectangle (javafx.scene.shape.Rectangle)3 Blend (javafx.scene.effect.Blend)2 ImageView (javafx.scene.image.ImageView)2 Arc (javafx.scene.shape.Arc)2 Circle (javafx.scene.shape.Circle)2 LineTo (javafx.scene.shape.LineTo)2