Package javafx.scene.shape

Examples of javafx.scene.shape.Shape


     * Creates the bolt that hold the indicator in place
     *
     * @return the indicator bolt
     */
    protected Shape createIndicatorBolt() {
    final Shape indicatorBolt = new Circle(centerX, centerY, dialCenterOuterRadius);
//      createSproket(centerX, centerY, 24, dialCenterOuterRadius / 1.1d,
//        dialCenterOuterRadius, angleStart, dialCenterFillProperty);
    indicatorBolt.setCache(true);
    indicatorBolt.setCacheHint(CacheHint.SPEED);
    Bindings.bindBidirectional(indicatorBolt.fillProperty(), dialCenterFillProperty);
    Bindings.bindBidirectional(indicatorBolt.opacityProperty(), dialCenterOpacityProperty);
    return indicatorBolt;
    }
View Full Code Here


   * @return the completed knob
   */
    protected Group createKnob(final Shape indicatorShape, final Node dialNode) {
    final Lighting lighting = createLighting();
    lighting.setSurfaceScale(5d * sizeScale);
    final Shape indicatorBolt = createIndicatorBolt();
    indicatorBolt.setEffect(lighting);
   
      final Group handShapeGroup = new Group();
      handShapeGroup.setCache(true);
      handShapeGroup.setCacheHint(CacheHint.ROTATE);
    handShapeGroup.getChildren().addAll(dialNode, indicatorBolt, indicatorShape);
View Full Code Here

     */
    protected Group createKnobSurface(final double startAngle, final double centerX,
        final double centerY, final double radiusX, final double radiusY,
        final Color... colors) {
      Group group = new Group();
      final Shape background = new Ellipse(centerX, centerY, radiusX, radiusY);
      background.setFill(new RadialGradient(0, 0, this.centerX, this.centerY,
        Math.max(radiusX, radiusY), false, CycleMethod.NO_CYCLE,
        new Stop(0, Color.BLACK), new Stop(0.95d, Color.DARKGRAY.darker()),
        new Stop(0.97d, Color.GRAY.brighter())));
      group.getChildren().add(background);
      double startRadians = startAngle * 2d * Math.PI;
 
View Full Code Here

  /**
   * Creates the required children
   */
  protected final void createChildren() {
    // create basic gauge shapes
    final Shape gaugeCenter = createBackground(outerRadius, innerRadius, centerGaugeFillProperty,
        outerRimFillProperty, outerRimEffectFillProperty);
    final Group gaugeParent = createParent(gaugeCenter);

    // add tick marks
    addTickMarks(gaugeParent, true, false);
    // add display that will show the current tick value
    final double tickValueHeight = 20d * sizeScale;
    final Node tickValueDisplay = this.indicatorType == IndicatorType.KNOB ? null :
      createTickValueDisplay(tickValueHeight, tickValueDisplayFillProperty, tickValueDisplayTextFillProperty);
    final Node tickValueDisplay2 = this.indicatorType == IndicatorType.KNOB ? null :
      createTickValueDisplay2(tickValueHeight, tickValueDisplayFillProperty, tickValueDisplayTextFillProperty);
   
    // create intensity indicators that will indicate when values are moderate, medium, or intense
    final Group intensityIndicator = createIntensityIndicator();
   
    // create highlight
    final double highlightAngle = 270d; //isCircular() ? 270d : getGeometricCenterAngle();
    final Shape highlight = this.indicatorType == IndicatorType.KNOB ? null : createHighlight(0, 0, highlightAngle);
   
    // create indicator/hand
    final Group indicator = createIndicator(gaugeParent, indicatorPointDistance,
        indicatorFillProperty, indicatorOpacityProperty);
   
View Full Code Here

          Number oldValue, Number newValue) {
        val.setText(getTickValueLabel(false));//newValue.doubleValue()));
      }
    });
    final double rimThickness = outerRadius - innerRadius;
    Shape border;
    if (isCircular()) {
      final Rectangle rec = new Rectangle(outerRadius, height);
      rec.setArcHeight(5d);
      rec.setArcWidth(5d);
      rec.setTranslateY(5d);
      border = rec;
      val.setTranslateY(rec.getHeight() / 2d);
      valContainer.setTranslateX(centerX - rec.getWidth() / 2d);
      valContainer.setTranslateY(centerY + rec.getHeight());
    } else {
      // create the background border for the tick mark value
      final double width = outerRadius - rimThickness;
      final double offsetY = centerY + rimThickness;
      // TODO : replace square root with proper angle offset
      final double offsetX = centerX + dialCenterBackgroundRadius - Math.sqrt(offsetY);
      // rotate value text so that it is never upside down
      final double angle = -getGeometericStartAngle();
      if (Math.abs(angle) > 90d && Math.abs(angle) < 270d) {
        val.setRotate(180d);
      }
      final Circle dialCutout = new Circle(centerX, centerY, innerRadius);
      final Circle gaugeCutout = new Circle(centerX, centerY, dialCenterBackgroundRadius
          + rimThickness);
      // create the border rectangle
      final Polygon rec = new Polygon(centerX, offsetY, centerX + width, offsetY,
          centerX + width, offsetY + height, centerX, offsetY + height);
      // carve out outer rim rectangle edge
      final Shape recArc = Shape.intersect(rec, dialCutout);
      // carve out inner dial rectangle edge
      border = Shape.subtract(recArc, gaugeCutout);

      border.setTranslateX(offsetX);
      border.setTranslateY(offsetY);
View Full Code Here

    // create the opposing background border
    final double offsetX = centerX - innerRadius;
    final double offsetY = centerY + rimRadius;
    final Polygon rec2 = new Polygon(centerX, offsetY, offsetX, offsetY,
        offsetX, offsetY + height, centerX, offsetY + height);
    final Shape recArc2 = Shape.intersect(rec2, dialCutout);
    final Shape border2 = Shape.subtract(recArc2, gaugeCutout);
   
    border2.setTranslateX(offsetX);
    border2.setTranslateY(offsetY);
    double angle2 = 180d - getGeometericEndAngle();
   
    valContainer.getTransforms().add(new Rotate(angle2, centerX, centerY));
    Bindings.bindBidirectional(border2.fillProperty(), backgroundFillProperty);
    border2.setStroke(Color.GRAY);
    border2.setStrokeWidth(1d);
    valContainer.getChildren().add(border2);
    return valContainer;
  }
View Full Code Here

      final Arc acg = new Arc(centerX, centerY, radius, radius,
          angleStart, angleLength);
      acg.setType(ArcType.ROUND);
      acg.setCache(true);
      acg.setCacheHint(CacheHint.QUALITY);
      final Shape acf = new Circle(centerX, centerY, dialCenterBackgroundRadius);
      acf.setCache(true);
      final Shape cg = Shape.union(acg, acf);
      cg.setCache(true);
      cg.setEffect(effect);
      addRimStroke(cg, rimStrokeFillProperty);
      Bindings.bindBidirectional(cg.fillProperty(), centerGaugeFillProperty);
      return cg;
    }
  }
View Full Code Here

    shape1.setFill(Color.GREEN);
    final Arc shape2 = new Arc(centerX, centerY, arcRadius, arcRadius, angleStart, adjAngleLength);
    shape2.setType(ArcType.ROUND);
    shape2.setFill(Color.WHITE);
   
    final Shape highlight = Shape.intersect(shape1, shape2);
   
    highlight.setCache(true);
    highlight.setCacheHint(CacheHint.SPEED);
    highlight.setOpacity(0.07d);
    highlightFillProperty.set(new LinearGradient(cx, cy, centerX, centerY,
        false, CycleMethod.NO_CYCLE, new Stop(0.8d, Color.WHITE),
        new Stop(1d, Color.TRANSPARENT)));
    Bindings.bindBidirectional(highlight.fillProperty(), highlightFillProperty);
    return highlight;
  }
View Full Code Here

    final double iy = centerY - (indicatorHeight / 2);
   
    // indicator shape
    final Rotate indicatorRotate = new Rotate(this.angleProperty.get(), centerX, centerY);
    Bindings.bindBidirectional(indicatorRotate.angleProperty(), this.angleProperty);
    Shape indicatorShape;
    if (indicatorType == IndicatorType.KNOB) {
      indicatorShape = createIndicatorShape(indicatorType, ix, iy, indicatorWidth - pointDistance,
          indicatorHeight - pointDistance, pointDistance,
          centerX, centerY, fillProperty);
      final double knobSurfaceRadius = indicatorWidth - pointDistance * 2d;
        final Group knobSurface = createKnobSurface(0, centerX, centerY,
            knobSurfaceRadius, knobSurfaceRadius, DEFAULT_KNOB_SURFACE_COLORS);
        final Group indicatorShapeGroup = createKnob(indicatorShape, knobSurface);
      indicatorShapeGroup.getTransforms().addAll(indicatorRotate);     
      indicatorBase.getChildren().add(indicatorShapeGroup);
    } else {
      indicatorShape = createIndicatorShape(indicatorType, ix, iy, indicatorWidth,
          indicatorHeight, pointDistance, centerX, centerY, fillProperty);
      indicatorShape.getTransforms().addAll(indicatorRotate);
      indicatorBase.getChildren().add(indicatorShape);
    }
   
    final Lighting lighting = createLighting();
    if (indicatorType == IndicatorType.KNOB) {
      lighting.setSpecularConstant(0.4d);
      lighting.setSpecularExponent(40d);
      lighting.setDiffuseConstant(1.7d);
    }
    indicatorBase.setEffect(lighting);
   
    indicator.getChildren().add(indicatorBase);
   
    // create/add the bolt that holds the indicator in place
    if (indicatorType != IndicatorType.KNOB) {
      final Shape indicatorBolt = createIndicatorBolt();
      indicator.getChildren().add(indicatorBolt);
      indicatorBolt.setEffect(lighting);
    }
    return indicator;
  }
View Full Code Here

  protected final Group addTickMarks(final Group parent, final boolean addMajorTickLabel,
      final boolean addMinorTickLabel) {
    final Group tickGroup = new Group();
    tickGroup.setCache(true);
    tickGroup.setCacheHint(CacheHint.ROTATE);
    Shape tick;
    // all tick marks will have the same starting coordinates- only the angle will be adjusted
    final double tx = tickMarkDefaultX();
    final double ty = tickMarkDefaultY();
    final int numOfTotalMinorTicks = getNumberOfMinorTicks();
    int i;
View Full Code Here

TOP

Related Classes of javafx.scene.shape.Shape

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.