Package eu.hansolo.enzo.common

Examples of eu.hansolo.enzo.common.Section


    private AnimationTimer timer;

    @Override public void init() {
        thermoMeter = SimpleGaugeBuilder.create()
                                        .prefSize(400, 400)
                                        .sections(new Section(0, 16.66666, "0"),
                                                  new Section(16.66666, 33.33333, "1"),
                                                  new Section(33.33333, 50.0, "2"),
                                                  new Section(50.0, 66.66666, "3"),
                                                  new Section(66.66666, 83.33333, "4"),
                                                  new Section(83.33333, 100.0, "5"))
                                        .title("Temperature")
                                        .unit("C")                                                                             
                                        .value(20)                                       
                                        .styleClass(SimpleGauge.STYLE_CLASS_GREEN_TO_RED_6)
                                        .build();
        wattMeter = SimpleGaugeBuilder.create()
                                      .prefSize(400, 400)
                                      .sections(new Section(0, 16.66666, "0"),
                                                new Section(16.66666, 33.33333, "1"),
                                                new Section(33.33333, 50.0, "2"),
                                                new Section(50.0, 66.66666, "3"),
                                                new Section(66.66666, 83.33333, "4"),
                                                new Section(83.33333, 100.0, "5"))
                                      .unit("W")
                                      .measuredRangeVisible(true)
                                      .rangeFill(Color.rgb(0, 0, 200, 0.5))                                     
                                      .styleClass(SimpleGauge.STYLE_CLASS_GREEN_TO_DARKGREEN_6)
                                      .build();
        energyMeter = SimpleGaugeBuilder.create()
                                        .prefSize(400, 400)                                       
                                        .sections(new Section(0, 10, "A++"),
                                                  new Section(10, 20, "A+"),
                                                  new Section(20, 30, "A"),
                                                  new Section(30, 40, "B"),
                                                  new Section(40, 50, "C"),
                                                  new Section(50, 60, "D"),
                                                  new Section(60, 70, "E"),
                                                  new Section(70, 80, "F"),
                                                  new Section(80, 90, "G"),
                                                  new Section(90, 100, "H"))                                                 
                                        .sectionTextVisible(true)
                                        .unit("W")
                                        .styleClass(SimpleGauge.STYLE_CLASS_GREEN_TO_RED_10)
                                        .build();
View Full Code Here


                              .startAngle(330)
                              .angleRange(300)
                              .minValue(0)
                              .maxValue(100)
                              .sectionsVisible(true)
                              .sections(new Section(0, 60),
                                        new Section(60, 80),
                                        new Section(80, 100))
                              .areas(new Section(75, 100))
                              .majorTickSpace(20)
                              .plainValue(false)
                              .tickLabelOrientation(Gauge.TickLabelOrientation.HORIZONTAL)
                              .threshold(70)
                              .thresholdVisible(true)
View Full Code Here

        series.getData().add(new XYChart.Data("17:00", 30.05));
        series.getData().add(new XYChart.Data("18:00", 31.25));

        chart = new SimpleLineChart();
        chart.setSections(new Section[]{
            new Section(0, 10),
            new Section(10, 15),
            new Section(15, 25),
            new Section(25, 30),
            new Section(30, 40)
        });
        chart.getStyleClass().addAll(SimpleLineChart.STYLE_CLASS_BLUE_TO_RED_5);
        chart.setSectionRangeVisible(true);
        chart.setUnit("°C");
        chart.setSeries(series);
View Full Code Here

        final double MAX_VALUE = getSkinnable().getMaxValue();
        final double OFFSET = 90 - getSkinnable().getStartAngle();
       
        IntStream.range(0, getSkinnable().getAreas().size()).parallel().forEachOrdered(
            i -> {
                final Section AREA = getSkinnable().getAreas().get(i);
                final double AREA_START_ANGLE;
                if (Double.compare(AREA.getStart(), MAX_VALUE) <= 0 && Double.compare(AREA.getStop(), MIN_VALUE) >= 0) {
                    if (AREA.getStart() < MIN_VALUE && AREA.getStop() < MAX_VALUE) {
                        AREA_START_ANGLE = MIN_VALUE * angleStep;
                    } else {
                        AREA_START_ANGLE = (AREA.getStart() - MIN_VALUE) * angleStep;
                    }
                    final double AREA_ANGLE_EXTEND;
                    if (AREA.getStop() > MAX_VALUE) {
                        AREA_ANGLE_EXTEND = MAX_VALUE * angleStep;
                    } else {
                        AREA_ANGLE_EXTEND = (AREA.getStop() - AREA.getStart()) * angleStep;
                    }

                    CTX.save();
                    switch(i) {
                        case 0: CTX.setFill(getSkinnable().getAreaFill0()); break;
View Full Code Here

        final double MAX_VALUE = getSkinnable().getMaxValue();
        final double OFFSET = 90 - getSkinnable().getStartAngle();

        IntStream.range(0, getSkinnable().getSections().size()).parallel().forEachOrdered(
            i -> {
                final Section SECTION = getSkinnable().getSections().get(i);               
                final double SECTION_START_ANGLE;
                if (Double.compare(SECTION.getStart(), MAX_VALUE) <= 0 && Double.compare(SECTION.getStop(), MIN_VALUE) >= 0) {
                    if (SECTION.getStart() < MIN_VALUE && SECTION.getStop() < MAX_VALUE) {
                        SECTION_START_ANGLE = MIN_VALUE * angleStep;
                    } else {
                        SECTION_START_ANGLE = (SECTION.getStart() - MIN_VALUE) * angleStep;
                    }
                    final double SECTION_ANGLE_EXTEND;
                    if (SECTION.getStop() > MAX_VALUE) {
                        SECTION_ANGLE_EXTEND = MAX_VALUE * angleStep;
                    } else {
                        SECTION_ANGLE_EXTEND = (SECTION.getStop() - SECTION.getStart()) * angleStep;
                    }

                    CTX.save();
                    switch(i) {
                        case 0: CTX.setStroke(getSkinnable().getSectionFill0()); break;
View Full Code Here

        final double SECTIONS_SIZE   = size - (size * 0.03);
        angleStep                    = getSkinnable().getAngleRange() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
        double sinValue;
        double cosValue;
        for (int i = 0 ; i < NO_OF_SECTIONS ; i++) {
            final Section SECTION = getSkinnable().getSections().get(i);
            final double SECTION_START_ANGLE;
            if (SECTION.getStart() > MAX_VALUE || SECTION.getStop() < MIN_VALUE) continue;

            if (SECTION.getStart() < MIN_VALUE && SECTION.getStop() < MAX_VALUE) {
                SECTION_START_ANGLE = MIN_VALUE * angleStep;
            } else {
                SECTION_START_ANGLE = (SECTION.getStart() - MIN_VALUE) * angleStep;
            }
            final double SECTION_ANGLE_EXTEND;
            if (SECTION.getStop() > MAX_VALUE) {
                SECTION_ANGLE_EXTEND = MAX_VALUE * angleStep;
            } else {
                SECTION_ANGLE_EXTEND = (SECTION.getStop() - SECTION.getStart()) * angleStep;
            }
            sectionsCtx.save();
            switch(i) {
                case 0: sectionsCtx.setFill(getSkinnable().getSectionFill0()); break;
                case 1: sectionsCtx.setFill(getSkinnable().getSectionFill1()); break;
                case 2: sectionsCtx.setFill(getSkinnable().getSectionFill2()); break;
                case 3: sectionsCtx.setFill(getSkinnable().getSectionFill3()); break;
                case 4: sectionsCtx.setFill(getSkinnable().getSectionFill4()); break;
                case 5: sectionsCtx.setFill(getSkinnable().getSectionFill5()); break;
                case 6: sectionsCtx.setFill(getSkinnable().getSectionFill6()); break;
                case 7: sectionsCtx.setFill(getSkinnable().getSectionFill7()); break;
                case 8: sectionsCtx.setFill(getSkinnable().getSectionFill8()); break;
                case 9: sectionsCtx.setFill(getSkinnable().getSectionFill9()); break;
            }
            sectionsCtx.fillArc(SECTIONS_OFFSET, SECTIONS_OFFSET, SECTIONS_SIZE, SECTIONS_SIZE, (OFFSET - SECTION_START_ANGLE), -SECTION_ANGLE_EXTEND, ArcType.ROUND);

            // Draw Section Text
            if (getSkinnable().isSectionTextVisible()) {
                sinValue = -Math.sin(Math.toRadians(OFFSET - 90 - SECTION_START_ANGLE - SECTION_ANGLE_EXTEND * 0.5));
                cosValue = -Math.cos(Math.toRadians(OFFSET - 90 - SECTION_START_ANGLE - SECTION_ANGLE_EXTEND * 0.5));
                Point2D textPoint = new Point2D(size * 0.5 + size * 0.365 * sinValue, size * 0.5 + size * 0.365 * cosValue);
                if (getSkinnable().isCustomFontEnabled()) {
                    sectionsCtx.setFont(Font.font(getSkinnable().getCustomFont().getFamily(), FontWeight.NORMAL, 0.08 * size));
                } else {                   
                    sectionsCtx.setFont(Fonts.robotoMedium(0.08 * size));
                }
                sectionsCtx.setTextAlign(TextAlignment.CENTER);
                sectionsCtx.setTextBaseline(VPos.CENTER);
                sectionsCtx.setFill(getSkinnable().getSectionTextColor());
                sectionsCtx.fillText(SECTION.getText(), textPoint.getX(), textPoint.getY());
            }

            // Draw Section Icon
            if (size > 0) {
                if (getSkinnable().isSectionIconVisible() && !getSkinnable().isSectionTextVisible()) {
                    if (null != SECTION.getImage()) {
                        Image icon = SECTION.getImage();
                        sinValue = -Math.sin(Math.toRadians(OFFSET - 90 - SECTION_START_ANGLE - SECTION_ANGLE_EXTEND * 0.5));
                        cosValue = -Math.cos(Math.toRadians(OFFSET - 90 - SECTION_START_ANGLE - SECTION_ANGLE_EXTEND * 0.5));
                        Point2D iconPoint = new Point2D(size * 0.5 + size * 0.365 * sinValue, size * 0.5 + size * 0.365 * cosValue);
                        sectionsCtx.drawImage(icon, iconPoint.getX() - size * 0.06, iconPoint.getY() - size * 0.06, size * 0.12, size * 0.12);
                    }
View Full Code Here

        final double MAX_VALUE = getSkinnable().getMaxValue();
        final double OFFSET = 90 - getSkinnable().getStartAngle();

        IntStream.range(0, getSkinnable().getSections().size()).parallel().forEachOrdered(
            i -> {
                final Section SECTION = getSkinnable().getSections().get(i);
                final double SECTION_START_ANGLE;
                if (Double.compare(SECTION.getStart(), MAX_VALUE) <= 0 && Double.compare(SECTION.getStop(), MIN_VALUE) >= 0) {
                    if (SECTION.getStart() < MIN_VALUE && SECTION.getStop() < MAX_VALUE) {
                        SECTION_START_ANGLE = MIN_VALUE * angleStep;
                    } else {
                        SECTION_START_ANGLE = (SECTION.getStart() - MIN_VALUE) * angleStep;
                    }
                    final double SECTION_ANGLE_EXTEND;
                    if (SECTION.getStop() > MAX_VALUE) {
                        SECTION_ANGLE_EXTEND = MAX_VALUE * angleStep;
                    } else {
                        SECTION_ANGLE_EXTEND = (SECTION.getStop() - SECTION.getStart()) * angleStep;
                    }

                    CTX.save();
                    switch(i) {
                        case 0: CTX.setStroke(getSkinnable().getSectionFill0()); break;
View Full Code Here

TOP

Related Classes of eu.hansolo.enzo.common.Section

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.