本文整理汇总了Java中eu.hansolo.medusa.Section.contains方法的典型用法代码示例。如果您正苦于以下问题:Java Section.contains方法的具体用法?Java Section.contains怎么用?Java Section.contains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eu.hansolo.medusa.Section
的用法示例。
在下文中一共展示了Section.contains方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setBar
import eu.hansolo.medusa.Section; //导入方法依赖的package包/类
private void setBar(final double VALUE) {
if (model.getMinValue() > 0) {
bar.setLength((model.getMinValue() - VALUE) * model.getAngleStep());
} else {
bar.setLength(-VALUE * model.getAngleStep());
}
if (model.getSectionsVisible() && !sections.isEmpty()) {
for (Section section : sections) {
if (section.contains(VALUE)) {
bar.setStroke(section.getColor());
break;
}
}
}
valueText.setText(String.format(model.getLocale(), formatString, VALUE));
valueText.setLayoutX((size - valueText.getLayoutBounds().getWidth()) * 0.5);
}
示例2: drawBackground
import eu.hansolo.medusa.Section; //导入方法依赖的package包/类
private void drawBackground() {
backgroundCtx.clearRect(0, 0, width, height);
backgroundCtx.setFill(barBackgroundColor);
int listSize = sections.size();
Section currentSection;
for (int i = 0 ; i < NO_OF_LEDS ; i++) {
if (sectionsVisible) {
double value = (i + 1) / stepSize;
for (int j = 0 ; j < listSize ; j++) {
currentSection = sections.get(j);
if (currentSection.contains(value)) {
backgroundCtx.setFill(currentSection.getColor().darker().darker());
break;
} else {
backgroundCtx.setFill(barBackgroundColor);
}
}
}
backgroundCtx.save();
backgroundCtx.setEffect(ledInnerShadow);
backgroundCtx.fillOval(ledBorder, height - ledSize - (i * (ledSpacer + ledSize)) - ledBorder, ledSize, ledSize);
backgroundCtx.restore();
}
}
示例3: setBarColor
import eu.hansolo.medusa.Section; //导入方法依赖的package包/类
private void setBarColor(final double VALUE) {
if (!gauge.getAreasVisible() && !gauge.isGradientBarEnabled()) {
bar.setFill(gauge.getBarColor());
} else if (gauge.isGradientBarEnabled() && gauge.getGradientBarStops().size() > 1) {
bar.setFill(gauge.getGradientLookup().getColorAt((VALUE - gauge.getMinValue()) / gauge.getRange()));
} else {
bar.setFill(gauge.getBarColor());
int listSize = areas.size();
for (int i = 0 ; i < listSize ; i++) {
Section area = areas.get(i);
if (area.contains(VALUE)) {
bar.setFill(area.getColor());
break;
}
}
}
}
示例4: setBarColor
import eu.hansolo.medusa.Section; //导入方法依赖的package包/类
private void setBarColor( final double VALUE ) {
if (!sectionsVisible && !colorGradientEnabled) {
bar.setStroke(gauge.getBarColor());
colorRing.setStroke(gauge.getBarColor());
} else if (colorGradientEnabled && noOfGradientStops > 1) {
Color dynamicColor = gauge.getGradientLookup().getColorAt((VALUE - minValue) / range);
bar.setStroke(dynamicColor);
colorRing.setStroke(dynamicColor);
} else {
bar.setStroke(gauge.getBarColor());
colorRing.setStroke(gauge.getBarColor());
for (Section section : sections) {
if (section.contains(VALUE)) {
bar.setStroke(section.getColor());
colorRing.setStroke(section.getColor());
break;
}
}
}
}
示例5: setBarColor
import eu.hansolo.medusa.Section; //导入方法依赖的package包/类
private void setBarColor(final double VALUE) {
if (!sectionsVisible && !colorGradientEnabled) {
dataBar.setFill(gauge.getBarColor());
} else if (colorGradientEnabled && noOfGradientStops > 1) {
dataBar.setFill(gauge.getGradientLookup().getColorAt((VALUE - minValue) / range));
} else {
dataBar.setFill(gauge.getBarColor());
for (Section section : sections) {
if (section.contains(VALUE)) {
dataBar.setFill(section.getColor());
break;
}
}
}
}
示例6: handleEvents
import eu.hansolo.medusa.Section; //导入方法依赖的package包/类
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("RECALC".equals(EVENT_TYPE)) {
angleRange = Helper.clamp(90.0, 180.0, gauge.getAngleRange());
startAngle = getStartAngle();
minValue = gauge.getMinValue();
range = gauge.getRange();
sections = gauge.getSections();
angleStep = angleRange / range;
redraw();
rotateNeedle(gauge.getCurrentValue());
} else if ("FINISHED".equals(EVENT_TYPE)) {
needleTooltip.setText(String.format(locale, formatString, gauge.getValue()));
double value = gauge.getValue();
if (gauge.isValueVisible()) {
Bounds bounds = pane.localToScreen(pane.getBoundsInLocal());
double xFactor = value > gauge.getRange() * 0.8 ? 0.0 : 0.25;
double tooltipAngle = value * angleStep;
double sinValue = Math.sin(Math.toRadians(180 + angleRange * 0.5 - tooltipAngle));
double cosValue = Math.cos(Math.toRadians(180 + angleRange * 0.5 - tooltipAngle));
double needleTipX = bounds.getMinX() + bounds.getWidth() * 0.5 + bounds.getHeight() * sinValue;
double needleTipY = bounds.getMinY() + bounds.getHeight() * 0.72 + bounds.getHeight() * cosValue;
needleTooltip.show(needle, needleTipX, needleTipY);
needleTooltip.setAnchorX(needleTooltip.getX() - needleTooltip.getWidth() * xFactor);
}
if (sections.isEmpty() || sectionsAlwaysVisible) return;
for (Section section : sections) {
if (section.contains(value)) {
barTooltip.setText(section.getText());
break;
}
}
} else if ("VISIBILITY".equals(EVENT_TYPE)) {
Helper.enableNode(titleText, !gauge.getTitle().isEmpty());
}
}
示例7: setBarColor
import eu.hansolo.medusa.Section; //导入方法依赖的package包/类
private void setBarColor(final double VALUE) {
if (!sectionsVisible && !colorGradientEnabled) {
bar.setStroke(barColor);
} else if (colorGradientEnabled && noOfGradientStops > 1) {
bar.setStroke(gauge.getGradientLookup().getColorAt((VALUE - minValue) / range));
} else {
bar.setStroke(barColor);
for (Section section : sections) {
if (section.contains(VALUE)) {
bar.setStroke(section.getColor());
break;
}
}
}
}
示例8: setBarColor
import eu.hansolo.medusa.Section; //导入方法依赖的package包/类
private void setBarColor(final double VALUE) {
Color color = barColor;
for(Section section : sections) {
if (section.contains(VALUE)) {
color = section.getColor();
break;
}
}
bar.setFill(color);
percentageText.setFill(color);
percentageUnitText.setFill(color);
}
示例9: setBarColor
import eu.hansolo.medusa.Section; //导入方法依赖的package包/类
private void setBarColor( final double VALUE ) {
if (!sectionsVisible && !colorGradientEnabled) {
bar.setStroke(gauge.getBarColor());
} else if (colorGradientEnabled && noOfGradientStops > 1) {
bar.setStroke(gauge.getGradientLookup().getColorAt((VALUE - minValue) / range));
} else {
bar.setStroke(gauge.getBarColor());
for (Section section : sections) {
if (section.contains(VALUE)) {
bar.setStroke(section.getColor());
break;
}
}
}
}
示例10: setBar
import eu.hansolo.medusa.Section; //导入方法依赖的package包/类
private void setBar(final double VALUE) {
barCtx.clearRect(0, 0, size, size);
barCtx.setLineCap(StrokeLineCap.BUTT);
barCtx.setStroke(barColor);
barCtx.setLineWidth(barWidth);
if (sectionsVisible) {
int listSize = sections.size();
for (int i = 0 ; i < listSize ;i++) {
Section section = sections.get(i);
if (section.contains(VALUE)) {
barCtx.setStroke(section.getColor());
break;
}
}
}
if (thresholdVisible && VALUE > gauge.getThreshold()) {
barCtx.setStroke(thresholdColor);
}
double v = (VALUE - minValue) * angleStep;
int minValueAngle = (int) (-minValue * angleStep);
if (!isStartFromZero) {
for (int i = 0; i < 280; i++) {
if (i % 10 == 0 && i < v) {
barCtx.strokeArc(barWidth * 0.5 + barWidth * 0.1, barWidth * 0.5 + barWidth * 0.1, size - barWidth - barWidth * 0.2, size - barWidth - barWidth * 0.2, (-i - 139), 9.2, ArcType.OPEN);
}
}
} else {
if (Double.compare(VALUE, 0) != 0) {
if (VALUE < 0) {
for (int i = Math.min(minValueAngle, 280) - 1; i >= 0; i--) {
if (i % 10 == 0 && i > v - 10) {
barCtx.strokeArc(barWidth * 0.5 + barWidth * 0.1, barWidth * 0.5 + barWidth * 0.1, size - barWidth - barWidth * 0.2, size - barWidth - barWidth * 0.2, (-i - 139), 9.2, ArcType.OPEN);
}
}
} else {
for (int i = Math.max(minValueAngle, 0) - 5; i < 280; i++) {
if (i % 10 == 0 && i < v) {
barCtx.strokeArc(barWidth * 0.5 + barWidth * 0.1, barWidth * 0.5 + barWidth * 0.1, size - barWidth - barWidth * 0.2, size - barWidth - barWidth * 0.2, (-i - 139), 9.2, ArcType.OPEN);
}
}
}
}
}
valueText.setText(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), VALUE));
valueText.setLayoutX(valueBkgText.getLayoutBounds().getMaxX() - valueText.getLayoutBounds().getWidth());
}
示例11: setBar
import eu.hansolo.medusa.Section; //导入方法依赖的package包/类
private void setBar(final double VALUE) {
barCtx.clearRect(0, 0, size, size);
barCtx.setLineCap(StrokeLineCap.BUTT);
barCtx.setStroke(barColor);
barCtx.setLineWidth(barWidth);
if (sectionsVisible) {
int listSize = sections.size();
for (int i = 0 ; i < listSize ;i++) {
Section section = sections.get(i);
if (section.contains(VALUE)) {
barCtx.setStroke(section.getColor());
break;
}
}
}
if (thresholdVisible && VALUE > gauge.getThreshold()) {
barCtx.setStroke(thresholdColor);
}
double v = (VALUE - minValue) * angleStep;
int minValueAngle = (int) (-minValue * angleStep);
if (!isStartFromZero) {
for (int i = 0; i < 300; i++) {
if (i % 6 == 0 && i < v) {
barCtx.strokeArc(barWidth * 0.5 + barWidth * 0.3, barWidth * 0.5 + barWidth * 0.3, size - barWidth - barWidth * 0.6, size - barWidth - barWidth * 0.6, (-i - 125), 4.6, ArcType.OPEN);
}
}
} else {
if (Double.compare(VALUE, 0) != 0) {
if (VALUE < 0) {
for (int i = Math.min(minValueAngle, 300) - 1; i >= 0; i--) {
if (i % 6 == 0 && i > v - 6) {
barCtx.strokeArc(barWidth * 0.5 + barWidth * 0.3, barWidth * 0.5 + barWidth * 0.3, size - barWidth - barWidth * 0.6, size - barWidth - barWidth * 0.6, (-i - 125), 4.6, ArcType.OPEN);
}
}
} else {
for (int i = Math.max(minValueAngle, 0) - 3; i < 300; i++) {
if (i % 6 == 0 && i < v) {
barCtx.strokeArc(barWidth * 0.5 + barWidth * 0.3, barWidth * 0.5 + barWidth * 0.3, size - barWidth - barWidth * 0.6, size - barWidth - barWidth * 0.6, (-i - 125), 4.6, ArcType.OPEN);
}
}
}
}
}
valueText.setText(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), VALUE));
valueText.setLayoutX(valueBkgText.getLayoutBounds().getMaxX() - valueText.getLayoutBounds().getWidth());
}
示例12: setBar
import eu.hansolo.medusa.Section; //导入方法依赖的package包/类
private void setBar( final double VALUE ) {
double barLength = 0;
double barStart = 0;
double min = gauge.getMinValue();
double max = gauge.getMaxValue();
double step = gauge.getAngleStep();
double clampedValue = Helper.clamp(min, max, VALUE);
if ( gauge.isStartFromZero() ) {
if ( ( VALUE > min || min < 0 ) && ( VALUE < max || max > 0 ) ) {
if ( max < 0 ) {
barStart = gauge.getStartAngle() + 90 - gauge.getAngleRange();
barLength = ( max - clampedValue ) * step;
} else if ( min > 0 ) {
barStart = gauge.getStartAngle() + 90;
barLength = ( min - clampedValue ) * step;
} else {
barStart = gauge.getStartAngle() + 90 + min * step;
barLength = - clampedValue * step;
}
}
} else {
barStart = gauge.getStartAngle() + 90;
barLength = ( min - clampedValue ) * step;
}
bar.setStartAngle(barStart);
bar.setLength(barLength);
if ( gauge.getSectionsVisible() && !sections.isEmpty() ) {
bar.setStroke(gauge.getBarColor());
for ( Section section : sections ) {
if ( section.contains(VALUE) ) {
bar.setStroke(section.getColor());
break;
}
}
}
valueText.setText(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), VALUE));
valueText.setLayoutX((size - valueText.getLayoutBounds().getWidth()) * 0.5);
}
示例13: getColorOfSection
import eu.hansolo.medusa.Section; //导入方法依赖的package包/类
public static final Color getColorOfSection(final List<Section> SECTIONS, final double VALUE, final Color DEFAULT_COLOR) {
for (Section section : SECTIONS) {
if (section.contains(VALUE)) return section.getColor();
}
return DEFAULT_COLOR;
}