use of eu.hansolo.enzo.common.Section in project Board-Instrumentation-Framework by intel.
the class DoubleRadialGaugeSkin method drawSections.
private final void drawSections(final GraphicsContext CTX) {
final double xy = (size - 0.83425 * size) / 2;
final double wh = size * 0.83425;
final double MIN_VALUE_ONE = getSkinnable().getMinValueOne();
final double MAX_VALUE_ONE = getSkinnable().getMaxValueOne();
final double OFFSET_ONE = 90 - getSkinnable().getStartAngleOne();
IntStream.range(0, getSkinnable().getSectionsOne().size()).parallel().forEachOrdered(i -> {
final Section SECTION = getSkinnable().getSectionsOne().get(i);
final double SECTION_START_ANGLE;
if (Double.compare(SECTION.getStart(), MAX_VALUE_ONE) <= 0 && Double.compare(SECTION.getStop(), MIN_VALUE_ONE) >= 0) {
if (SECTION.getStart() < MIN_VALUE_ONE && SECTION.getStop() < MAX_VALUE_ONE) {
SECTION_START_ANGLE = MIN_VALUE_ONE * angleStepOne;
} else {
SECTION_START_ANGLE = (SECTION.getStart() - MIN_VALUE_ONE) * angleStepOne;
}
final double SECTION_ANGLE_EXTEND;
if (SECTION.getStop() > MAX_VALUE_ONE) {
SECTION_ANGLE_EXTEND = (MAX_VALUE_ONE - SECTION.getStart()) * angleStepOne;
} else {
SECTION_ANGLE_EXTEND = (SECTION.getStop() - SECTION.getStart()) * angleStepOne;
}
CTX.save();
switch(i) {
case 0:
CTX.setStroke(getSkinnable().getSectionFill0One());
break;
case 1:
CTX.setStroke(getSkinnable().getSectionFill1One());
break;
case 2:
CTX.setStroke(getSkinnable().getSectionFill2One());
break;
case 3:
CTX.setStroke(getSkinnable().getSectionFill3One());
break;
case 4:
CTX.setStroke(getSkinnable().getSectionFill4One());
break;
}
CTX.setLineWidth(size * 0.0415);
CTX.setLineCap(StrokeLineCap.BUTT);
CTX.strokeArc(xy, xy, wh, wh, -(OFFSET_ONE + SECTION_START_ANGLE), -SECTION_ANGLE_EXTEND, ArcType.OPEN);
CTX.restore();
}
});
final double MIN_VALUE_TWO = getSkinnable().getMinValueTwo();
final double MAX_VALUE_TWO = getSkinnable().getMaxValueTwo();
final double OFFSET_TWO = 90 - getSkinnable().getStartAngleTwo();
IntStream.range(0, getSkinnable().getSectionsTwo().size()).parallel().forEachOrdered(i -> {
final Section SECTION = getSkinnable().getSectionsTwo().get(i);
final double SECTION_START_ANGLE;
if (Double.compare(SECTION.getStart(), MAX_VALUE_TWO) <= 0 && Double.compare(SECTION.getStop(), MIN_VALUE_TWO) >= 0) {
if (SECTION.getStart() < MIN_VALUE_TWO && SECTION.getStop() < MAX_VALUE_TWO) {
SECTION_START_ANGLE = MIN_VALUE_TWO * angleStepTwo;
} else {
SECTION_START_ANGLE = (SECTION.getStart() - MIN_VALUE_TWO) * angleStepTwo;
}
final double SECTION_ANGLE_EXTEND;
if (SECTION.getStop() > MAX_VALUE_TWO) {
SECTION_ANGLE_EXTEND = (MAX_VALUE_TWO - SECTION.getStart()) * angleStepTwo;
} else {
SECTION_ANGLE_EXTEND = (SECTION.getStop() - SECTION.getStart()) * angleStepTwo;
}
CTX.save();
switch(i) {
case 0:
CTX.setStroke(getSkinnable().getSectionFill0Two());
break;
case 1:
CTX.setStroke(getSkinnable().getSectionFill1Two());
break;
case 2:
CTX.setStroke(getSkinnable().getSectionFill2Two());
break;
case 3:
CTX.setStroke(getSkinnable().getSectionFill3Two());
break;
case 4:
CTX.setStroke(getSkinnable().getSectionFill4Two());
break;
}
CTX.setLineWidth(size * 0.0415);
CTX.setLineCap(StrokeLineCap.BUTT);
CTX.strokeArc(xy, xy, wh, wh, -(OFFSET_TWO + SECTION_START_ANGLE), -SECTION_ANGLE_EXTEND, ArcType.OPEN);
CTX.restore();
}
});
}
use of eu.hansolo.enzo.common.Section in project Board-Instrumentation-Framework by intel.
the class GaugeSkin method drawAreas.
private final void drawAreas(final GraphicsContext CTX) {
final double xy = (size - 0.7916 * size) / 2;
final double wh = size * 0.7916;
final double MIN_VALUE = getSkinnable().getMinValue();
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 - AREA.getStart()) * angleStep;
} else {
AREA_ANGLE_EXTEND = (AREA.getStop() - AREA.getStart()) * angleStep;
}
CTX.save();
switch(i) {
case 0:
CTX.setFill(getSkinnable().getAreaFill0());
break;
case 1:
CTX.setFill(getSkinnable().getAreaFill1());
break;
case 2:
CTX.setFill(getSkinnable().getAreaFill2());
break;
case 3:
CTX.setFill(getSkinnable().getAreaFill3());
break;
case 4:
CTX.setFill(getSkinnable().getAreaFill4());
break;
case 5:
CTX.setFill(getSkinnable().getAreaFill5());
break;
case 6:
CTX.setFill(getSkinnable().getAreaFill6());
break;
case 7:
CTX.setFill(getSkinnable().getAreaFill7());
break;
case 8:
CTX.setFill(getSkinnable().getAreaFill8());
break;
case 9:
CTX.setFill(getSkinnable().getAreaFill9());
break;
}
CTX.fillArc(xy, xy, wh, wh, -(OFFSET + AREA_START_ANGLE), -AREA_ANGLE_EXTEND, ArcType.ROUND);
CTX.restore();
}
});
}
use of eu.hansolo.enzo.common.Section in project Board-Instrumentation-Framework by intel.
the class GaugeSkin method drawSections.
private final void drawSections(final GraphicsContext CTX) {
final double xy = (size - 0.83 * size) / 2;
final double wh = size * 0.83;
final double MIN_VALUE = getSkinnable().getMinValue();
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 - SECTION.getStart()) * angleStep;
} else {
SECTION_ANGLE_EXTEND = (SECTION.getStop() - SECTION.getStart()) * angleStep;
}
CTX.save();
switch(i) {
case 0:
CTX.setStroke(getSkinnable().getSectionFill0());
break;
case 1:
CTX.setStroke(getSkinnable().getSectionFill1());
break;
case 2:
CTX.setStroke(getSkinnable().getSectionFill2());
break;
case 3:
CTX.setStroke(getSkinnable().getSectionFill3());
break;
case 4:
CTX.setStroke(getSkinnable().getSectionFill4());
break;
case 5:
CTX.setStroke(getSkinnable().getSectionFill5());
break;
case 6:
CTX.setStroke(getSkinnable().getSectionFill6());
break;
case 7:
CTX.setStroke(getSkinnable().getSectionFill7());
break;
case 8:
CTX.setStroke(getSkinnable().getSectionFill8());
break;
case 9:
CTX.setStroke(getSkinnable().getSectionFill9());
break;
}
CTX.setLineWidth(size * 0.037);
CTX.setLineCap(StrokeLineCap.BUTT);
CTX.strokeArc(xy, xy, wh, wh, -(OFFSET + SECTION_START_ANGLE), -SECTION_ANGLE_EXTEND, ArcType.OPEN);
CTX.restore();
}
});
}
use of eu.hansolo.enzo.common.Section in project Board-Instrumentation-Framework by intel.
the class RadialGaugeSkin method drawSections.
private final void drawSections(final GraphicsContext CTX) {
final double xy = (size - 0.83425 * size) / 2;
final double wh = size * 0.83425;
final double MIN_VALUE = getSkinnable().getMinValue();
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 - SECTION.getStart()) * angleStep;
} else {
SECTION_ANGLE_EXTEND = (SECTION.getStop() - SECTION.getStart()) * angleStep;
}
CTX.save();
switch(i) {
case 0:
CTX.setStroke(getSkinnable().getSectionFill0());
break;
case 1:
CTX.setStroke(getSkinnable().getSectionFill1());
break;
case 2:
CTX.setStroke(getSkinnable().getSectionFill2());
break;
case 3:
CTX.setStroke(getSkinnable().getSectionFill3());
break;
case 4:
CTX.setStroke(getSkinnable().getSectionFill4());
break;
case 5:
CTX.setStroke(getSkinnable().getSectionFill5());
break;
case 6:
CTX.setStroke(getSkinnable().getSectionFill6());
break;
case 7:
CTX.setStroke(getSkinnable().getSectionFill7());
break;
case 8:
CTX.setStroke(getSkinnable().getSectionFill8());
break;
case 9:
CTX.setStroke(getSkinnable().getSectionFill9());
break;
}
CTX.setLineWidth(size * 0.0415);
CTX.setLineCap(StrokeLineCap.BUTT);
CTX.strokeArc(xy, xy, wh, wh, -(OFFSET + SECTION_START_ANGLE), -SECTION_ANGLE_EXTEND, ArcType.OPEN);
CTX.restore();
}
});
}
use of eu.hansolo.enzo.common.Section in project Board-Instrumentation-Framework by intel.
the class RadialSkin method drawSections.
private final void drawSections(final GraphicsContext CTX) {
final double xy = (size - 0.75 * size) / 2;
final double wh = size * 0.75;
final double MIN_VALUE = getSkinnable().getMinValue();
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 - SECTION.getStart()) * angleStep;
} else {
SECTION_ANGLE_EXTEND = (SECTION.getStop() - SECTION.getStart()) * angleStep;
}
CTX.save();
switch(i) {
case 0:
CTX.setStroke(getSkinnable().getSectionFill0());
break;
case 1:
CTX.setStroke(getSkinnable().getSectionFill1());
break;
case 2:
CTX.setStroke(getSkinnable().getSectionFill2());
break;
case 3:
CTX.setStroke(getSkinnable().getSectionFill3());
break;
case 4:
CTX.setStroke(getSkinnable().getSectionFill4());
break;
case 5:
CTX.setStroke(getSkinnable().getSectionFill5());
break;
case 6:
CTX.setStroke(getSkinnable().getSectionFill6());
break;
case 7:
CTX.setStroke(getSkinnable().getSectionFill7());
break;
case 8:
CTX.setStroke(getSkinnable().getSectionFill8());
break;
case 9:
CTX.setStroke(getSkinnable().getSectionFill9());
break;
}
CTX.setLineWidth(size * 0.037);
CTX.setLineCap(StrokeLineCap.BUTT);
CTX.strokeArc(xy, xy, wh, wh, -(OFFSET + SECTION_START_ANGLE), -SECTION_ANGLE_EXTEND, ArcType.OPEN);
CTX.restore();
}
});
}
Aggregations