public void applyTo(javafx.scene.shape.CubicCurveTo x) {
   super.applyTo(x);
   int set = __set;
   if ((set & (1 << 0)) != 0) x.setControlX1(this.controlX1);
   if ((set & (1 << 1)) != 0) x.setControlX2(this.controlX2);
   if ((set & (1 << 2)) != 0) x.setControlY1(this.controlY1);
   if ((set & (1 << 3)) != 0) x.setControlY2(this.controlY2);
   if ((set & (1 << 4)) != 0) x.setX(this.x);
   if ((set & (1 << 5)) != 0) x.setY(this.y);
 }
Пример #2
0
  private void resize() {
    width =
        getSkinnable().getWidth()
            - getSkinnable().getInsets().getLeft()
            - getSkinnable().getInsets().getRight();
    height =
        getSkinnable().getHeight()
            - getSkinnable().getInsets().getTop()
            - getSkinnable().getInsets().getBottom();

    if (ASPECT_RATIO * width > height) {
      width = 1 / (ASPECT_RATIO / height);
    } else if (1 / (ASPECT_RATIO / height) > width) {
      height = ASPECT_RATIO * width;
    }

    if (width > 0 && height > 0) {
      double centerX = width * 0.5;
      double centerY = height * 0.85;
      double barRadius = height * 0.54210526;
      double barWidth = width * 0.28472222;

      pane.setMaxSize(width, height);
      pane.relocate(
          (getSkinnable().getWidth() - width) * 0.5, (getSkinnable().getHeight() - height) * 0.5);

      barBackground.setCenterX(centerX);
      barBackground.setCenterY(centerY);
      barBackground.setRadiusX(barRadius);
      barBackground.setRadiusY(barRadius);
      barBackground.setStrokeWidth(barWidth);
      barBackground.setStartAngle(angleRange * 0.5 + 90);
      barBackground.setLength(-angleRange);

      if (sectionsVisible && sectionsAlwaysVisible) {
        sectionLayer.setPrefSize(width, height);
        drawSections();
      }

      bar.setCenterX(centerX);
      bar.setCenterY(centerY);
      bar.setRadiusX(barRadius);
      bar.setRadiusY(barRadius);
      bar.setStrokeWidth(barWidth);
      bar.setStartAngle(angleRange * 0.5 + 90);
      bar.setLength(-(getSkinnable().getCurrentValue() - minValue) * angleStep);

      double needleWidth = height * 0.13157895;
      double needleHeight = height * 0.91315789;

      needle.setCache(true);

      needleMoveTo1.setX(0.0);
      needleMoveTo1.setY(0.927953890489914 * needleHeight);

      needleCubicCurveTo2.setControlX1(0);
      needleCubicCurveTo2.setControlY1(0.968299711815562 * needleHeight);
      needleCubicCurveTo2.setControlX2(0.22 * needleWidth);
      needleCubicCurveTo2.setControlY2(needleHeight);
      needleCubicCurveTo2.setX(0.5 * needleWidth);
      needleCubicCurveTo2.setY(needleHeight);

      needleCubicCurveTo3.setControlX1(0.78 * needleWidth);
      needleCubicCurveTo3.setControlY1(needleHeight);
      needleCubicCurveTo3.setControlX2(needleWidth);
      needleCubicCurveTo3.setControlY2(0.968299711815562 * needleHeight);
      needleCubicCurveTo3.setX(needleWidth);
      needleCubicCurveTo3.setY(0.927953890489914 * needleHeight);

      needleCubicCurveTo4.setControlX1(needleWidth);
      needleCubicCurveTo4.setControlY1(0.92507204610951 * needleHeight);
      needleCubicCurveTo4.setControlX2(0.6 * needleWidth);
      needleCubicCurveTo4.setControlY2(0.0144092219020173 * needleHeight);
      needleCubicCurveTo4.setX(0.6 * needleWidth);
      needleCubicCurveTo4.setY(0.0144092219020173 * needleHeight);

      needleCubicCurveTo5.setControlX1(0.6 * needleWidth);
      needleCubicCurveTo5.setControlY1(0.0144092219020173 * needleHeight);
      needleCubicCurveTo5.setControlX2(0.58 * needleWidth);
      needleCubicCurveTo5.setControlY2(0);
      needleCubicCurveTo5.setX(0.5 * needleWidth);
      needleCubicCurveTo5.setY(0);

      needleCubicCurveTo6.setControlX1(0.42 * needleWidth);
      needleCubicCurveTo6.setControlY1(0);
      needleCubicCurveTo6.setControlX2(0.4 * needleWidth);
      needleCubicCurveTo6.setControlY2(0.0144092219020173 * needleHeight);
      needleCubicCurveTo6.setX(0.4 * needleWidth);
      needleCubicCurveTo6.setY(0.0144092219020173 * needleHeight);

      needleCubicCurveTo7.setControlX1(0.4 * needleWidth);
      needleCubicCurveTo7.setControlY1(0.0144092219020173 * needleHeight);
      needleCubicCurveTo7.setControlX2(0);
      needleCubicCurveTo7.setControlY2(0.92507204610951 * needleHeight);
      needleCubicCurveTo7.setX(0);
      needleCubicCurveTo7.setY(0.927953890489914 * needleHeight);

      needle.setCache(true);
      needle.setCacheHint(CacheHint.ROTATE);

      needle.relocate(
          (width - needle.getLayoutBounds().getWidth()) * 0.5,
          centerY
              - needle.getLayoutBounds().getHeight()
              + needle.getLayoutBounds().getWidth() * 0.5);
      needleRotate.setPivotX(needle.getLayoutBounds().getWidth() * 0.5);
      needleRotate.setPivotY(
          needle.getLayoutBounds().getHeight() - needle.getLayoutBounds().getWidth() * 0.5);

      resizeStaticText();
    }
  }