Java 类javafx.scene.shape.Arc 实例源码

项目:marathonv5    文件:ArcSample.java   
public ArcSample() {
    super(180,90);
    // Simple red filled arc
    Arc arc1 = new Arc(45,60,45,45,40,100);
    arc1.setFill(Color.RED);
    // Blue stroked arc
    Arc arc2 = new Arc(155,60,45,45,40,100);
    arc2.setStroke(Color.DODGERBLUE);
    arc2.setFill(null);
    // Create a group to show all the arcs);
    getChildren().add(new Group(arc1,arc2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Arc 1 Fill", arc1.fillProperty()),
            new SimplePropertySheet.PropDesc("Arc 1 Start Angle", arc1.startAngleProperty(), 0d, 360d),
            new SimplePropertySheet.PropDesc("Arc 1 Length", arc1.lengthProperty(), 0d, 360d),
            new SimplePropertySheet.PropDesc("Arc 2 Stroke", arc2.strokeProperty()),
            new SimplePropertySheet.PropDesc("Arc 2 Stroke Width", arc2.strokeWidthProperty(), 1d, 5d),
            new SimplePropertySheet.PropDesc("Arc 2 Radius X", arc2.radiusXProperty(), 0d, 50d),
            new SimplePropertySheet.PropDesc("Arc 2 Radius Y", arc2.radiusYProperty(), 0d, 50d)
    );
    // END REMOVE ME
}
项目:marathonv5    文件:ArcSample.java   
public ArcSample() {
    super(180,90);
    // Simple red filled arc
    Arc arc1 = new Arc(45,60,45,45,40,100);
    arc1.setFill(Color.RED);
    // Blue stroked arc
    Arc arc2 = new Arc(155,60,45,45,40,100);
    arc2.setStroke(Color.DODGERBLUE);
    arc2.setFill(null);
    // Create a group to show all the arcs);
    getChildren().add(new Group(arc1,arc2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Arc 1 Fill", arc1.fillProperty()),
            new SimplePropertySheet.PropDesc("Arc 1 Start Angle", arc1.startAngleProperty(), 0d, 360d),
            new SimplePropertySheet.PropDesc("Arc 1 Length", arc1.lengthProperty(), 0d, 360d),
            new SimplePropertySheet.PropDesc("Arc 2 Stroke", arc2.strokeProperty()),
            new SimplePropertySheet.PropDesc("Arc 2 Stroke Width", arc2.strokeWidthProperty(), 1d, 5d),
            new SimplePropertySheet.PropDesc("Arc 2 Radius X", arc2.radiusXProperty(), 0d, 50d),
            new SimplePropertySheet.PropDesc("Arc 2 Radius Y", arc2.radiusYProperty(), 0d, 50d)
    );
    // END REMOVE ME
}
项目:shuffleboard    文件:CurvedArrow.java   
/**
 * Generates the body arc of the arrow.
 *
 * @param startAngle the starting angle of the arc, in radians
 * @param radius     the radius of the arc
 * @param length     the length of the arc, in the same unit as {@code radius}
 * @param xOffset    how much to offset the arc along the X-axis
 */
private static Arc makeBody(double startAngle, double radius, double length, double xOffset) {
  final double angRad = length / radius; // Isn't math nice?
  final double angle = Math.toDegrees(angRad);

  Arc arc = new Arc();
  arc.setRadiusX(radius);
  arc.setRadiusY(radius);
  arc.setCenterX(xOffset);
  arc.setCenterY(0);
  arc.setStartAngle(Math.toDegrees(startAngle));
  arc.setLength(-angle); // -angle because +y is "down", but JavaFX Arc treats +y as "up"

  arc.setFill(null);
  arc.setStroke(Color.WHITE);

  return arc;
}
项目:tilesfx    文件:GaugeTileSkin.java   
@Override protected void handleEvents(final String EVENT_TYPE) {
    super.handleEvents(EVENT_TYPE);

    if ("VISIBILITY".equals(EVENT_TYPE)) {
        Helper.enableNode(titleText, !tile.getTitle().isEmpty());
        Helper.enableNode(valueText, tile.isValueVisible());
        Helper.enableNode(sectionPane, tile.getSectionsVisible());
        Helper.enableNode(thresholdRect, tile.isThresholdVisible());
        Helper.enableNode(thresholdText, tile.isThresholdVisible());
        Helper.enableNode(unitText, !tile.getUnit().isEmpty());
        sectionsVisible = tile.getSectionsVisible();
    } else if ("SECTION".equals(EVENT_TYPE)) {
        sections = tile.getSections();
        sectionMap.clear();
        for(Section section : sections) { sectionMap.put(section, new Arc()); }
    } else if ("ALERT".equals(EVENT_TYPE)) {
        Helper.enableNode(valueText, tile.isValueVisible() && !tile.isAlert());
        Helper.enableNode(unitText, tile.isValueVisible() && !tile.isAlert());
        Helper.enableNode(alertIcon, tile.isAlert());
        alertTooltip.setText(tile.getAlertMessage());
    }
}
项目:tilesfx    文件:TimerControlTileSkin.java   
@Override protected void handleEvents(final String EVENT_TYPE) {
    super.handleEvents(EVENT_TYPE);

    if ("VISIBILITY".equals(EVENT_TYPE)) {
        Helper.enableNode(titleText, !tile.getTitle().isEmpty());
        Helper.enableNode(text, tile.isTextVisible());
        Helper.enableNode(dateText, tile.isDateVisible());
        Helper.enableNode(second, tile.isSecondsVisible());
        Helper.enableNode(sectionsPane, tile.getSectionsVisible());
    } else if ("SECTION".equals(EVENT_TYPE)) {
        sectionMap.clear();
        for (TimeSection section : tile.getTimeSections()) { sectionMap.put(section, new Arc()); }
        sectionsPane.getChildren().setAll(sectionMap.values());
        resize();
        redraw();
    }
}
项目:openjfx-8u-dev-tests    文件:PieChartDescriptionProvider.java   
public PieInfo(Wrap<? extends Region> wrap) {
    region = wrap.getControl();

    regionCenterX = region.getLayoutX();
    regionCenterY = region.getLayoutY();

    Assert.assertTrue(region.getShape() instanceof Arc);
    final Arc arc = (Arc) region.getShape();

    centerX = arc.getCenterX();
    centerY = arc.getCenterY();

    Assert.assertEquals(arc.getRadiusX(), arc.getRadiusY(), 0.00001);
    radius = arc.getRadiusX();
    startAngle = reductionInto0to360(arc.getStartAngle());
    angle = arc.getLength();//yes, angle in grads.
    bisectAngle = reductionInto0to360(startAngle + angle / 2.0);

    dataStyleClass = findStyleClassByPattern(region.getStyleClass(), "data");
    colorSlyleClass = findStyleClassByPattern(region.getStyleClass(), "default-color");
}
项目:Medusa    文件:TileKpiSkin.java   
public TileKpiSkin(Gauge gauge) {
    super(gauge);
    if (gauge.isAutoScale()) gauge.calcAutoScale();
    angleRange           = Helper.clamp(90.0, 180.0, gauge.getAngleRange());
    oldValue             = gauge.getValue();
    minValue             = gauge.getMinValue();
    threshold            = gauge.getThreshold();
    thresholdColor       = gauge.getThresholdColor();
    range                = gauge.getRange();
    angleStep            = angleRange / range;
    formatString         = new StringBuilder("%.").append(Integer.toString(gauge.getDecimals())).append("f").toString();
    locale               = gauge.getLocale();
    sectionsVisible      = gauge.getSectionsVisible();
    highlightSections    = gauge.isHighlightSections();
    sections             = gauge.getSections();
    sectionMap           = new HashMap<>(sections.size());
    currentValueListener = o -> rotateNeedle(gauge.getCurrentValue());
    for(Section section : sections) { sectionMap.put(section, new Arc()); }

    initGraphics();
    registerListeners();

    rotateNeedle(gauge.getCurrentValue());
}
项目:Medusa    文件:IndicatorSkin.java   
private void drawSections() {
    if (sections.isEmpty()) return;
    sectionLayer.getChildren().clear();

    double    centerX     = width * 0.5;
    double    centerY     = height * 0.85;
    double    barRadius   = height * 0.54210526;
    double    barWidth    = width * 0.28472222;
    List<Arc> sectionBars = new ArrayList<>(sections.size());
    for (Section section : sections) {
        Arc sectionBar = new Arc(centerX, centerY, barRadius, barRadius, angleRange * 0.5 + 90 - (section.getStart() * angleStep), -((section.getStop() - section.getStart()) - minValue) * angleStep);
        sectionBar.setType(ArcType.OPEN);
        sectionBar.setStroke(section.getColor());
        sectionBar.setStrokeWidth(barWidth);
        sectionBar.setStrokeLineCap(StrokeLineCap.BUTT);
        sectionBar.setFill(null);
        Tooltip sectionTooltip = new Tooltip(new StringBuilder(section.getText()).append("\n").append(String.format(Locale.US, "%.2f", section.getStart())).append(" - ").append(String.format(Locale.US, "%.2f", section.getStop())).toString());
        sectionTooltip.setTextAlignment(TextAlignment.CENTER);
        Tooltip.install(sectionBar, sectionTooltip);
        sectionBars.add(sectionBar);
    }
    sectionLayer.getChildren().addAll(sectionBars);
}
项目:mars-sim    文件:EarthMinimalClock.java   
private void initGraphics() {

        weekDayLabel = new Label();
        weekDayLabel.getStyleClass().add("weekDay-label");
        //weekDayLabel.setVisible(isWeekDayVisible());

        hourLabel = new Label();
        hourLabel.getStyleClass().add("hour-label");

        dateLabel = new Label();
        dateLabel.getStyleClass().add("date-label");
        dateLabel.setVisible(isDateVisible());

        //minutesLabel = new Label();
        //minutesLabel.getStyleClass().add("minutes-label");

        seconds = new Arc();
        seconds.getStyleClass().add("seconds");
        seconds.setVisible(isSecondsVisible());

        pane = new Pane();
        pane.getChildren().setAll(hourLabel, dateLabel, weekDayLabel, seconds);//, minutesLabel);

        getChildren().setAll(pane);
    }
项目:dnainator    文件:Pie.java   
@SuppressWarnings("unused")
private void onChange(SetChangeListener.Change<? extends String> change) {
    slices.getChildren().clear();
    if (styles.isEmpty()) {
        return;
    }

    int start = 0;
    int delta = FULLCIRCLE / styles.size();
    for (String style : styles) {
        Arc arc = new Arc(0, 0, radius, radius, start, delta);
        arc.setType(ArcType.ROUND);
        arc.getStyleClass().add(style);
        slices.getChildren().add(arc);

        start += delta;
    }
}
项目:Intro-to-Java-Programming    文件:FanPane.java   
/** Add four arcs to a pane and place them in a stack pane */
private void getBlades() {
    double angle = 0;
    for (int i = 0; i < 4; i++) {
        arc = new Arc(); 
        arc.centerXProperty().bind(widthProperty().divide(2));
        arc.centerYProperty().bind(heightProperty().divide(2));
        arc.radiusXProperty().bind(circle.radiusProperty().multiply(.90));
        arc.radiusYProperty().bind(circle.radiusProperty().multiply(.90));
        arc.setStartAngle(angle + 90);
        arc.setLength(50);
        arc.setFill(Color.BLACK);
        arc.setType(ArcType.ROUND);
        paneForBlades.getChildren().add(arc);
        angle += 90;
    }
}
项目:Intro-to-Java-Programming    文件:FanPane.java   
/** Add four arcs to a pane and place them in a stack pane */
private void getBlades() {
    double angle = 0;
    for (int i = 0; i < 4; i++) {
        arc = new Arc(); 
        arc.centerXProperty().bind(widthProperty().divide(2));
        arc.centerYProperty().bind(heightProperty().divide(2));
        arc.radiusXProperty().bind(circle.radiusProperty().multiply(.90));
        arc.radiusYProperty().bind(circle.radiusProperty().multiply(.90));
        arc.setStartAngle(angle + 90);
        arc.setLength(50);
        arc.setFill(Color.BLACK);
        arc.setType(ArcType.ROUND);
        paneForBlades.getChildren().add(arc);
        angle += 90;
    }
}
项目:kotlinfx-ensemble    文件:ArcSample.java   
public ArcSample() {
    super(180,90);
    // Simple red filled arc
    Arc arc1 = new Arc(45,60,45,45,40,100);
    arc1.setFill(Color.RED);
    // Blue stroked arc
    Arc arc2 = new Arc(155,60,45,45,40,100);
    arc2.setStroke(Color.DODGERBLUE);
    arc2.setFill(null);
    // Create a group to show all the arcs);
    getChildren().add(new Group(arc1,arc2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Arc 1 Fill", arc1.fillProperty()),
            new SimplePropertySheet.PropDesc("Arc 1 Start Angle", arc1.startAngleProperty(), 0d, 360d),
            new SimplePropertySheet.PropDesc("Arc 1 Length", arc1.lengthProperty(), 0d, 360d),
            new SimplePropertySheet.PropDesc("Arc 2 Stroke", arc2.strokeProperty()),
            new SimplePropertySheet.PropDesc("Arc 2 Stroke Width", arc2.strokeWidthProperty(), 1d, 5d),
            new SimplePropertySheet.PropDesc("Arc 2 Radius X", arc2.radiusXProperty(), 0d, 50d),
            new SimplePropertySheet.PropDesc("Arc 2 Radius Y", arc2.radiusYProperty(), 0d, 50d)
    );
    // END REMOVE ME
}
项目:teamearth    文件:GameWorldInitializer.java   
private void initItems() {
    Arc arc = new Arc();
    arc.setRadiusX(5.0f);
    arc.setRadiusY(5.0f);
    arc.setStartAngle(45.0f);
    arc.setLength(270.0f);
    arc.setVisible(false);
    arc.setId("Cup");
    arc.setType(ArcType.ROUND);

    List<Node> itemsList = new ArrayList<Node>();
    itemsList.add(arc);

    List<GameObject> objectsList = new ArrayList<GameObject>();


    GameObject item = new Cup();
    item.setNode(arc);
    item.setPosition(new Point2D(200, 200));
    objectsList.add(item);
    getGameObjectManager().addObjects(objectsList);
    root.getChildren().addAll(itemsList);
}
项目:iTrySQL    文件:DropTargetSymbol.java   
public DropTargetSymbol(final Pane parentPane) {
    if (parentPane != null) {
        final double baseSize = Math.min(Math.min(parentPane.getWidth(), parentPane.getHeight()), 160);
        final double bottom = parentPane.getHeight() / 2 + baseSize / 2;

        final double radius = baseSize / 3;
        final double arrowBounds = radius / 2;

        final double centerX = parentPane.getWidth() / 2 - radius;
        final double centerY = bottom - radius;

        final Arc arc = createArc(radius, centerX, centerY);
        final Group arrow = createArrow(centerX, bottom, arrowBounds, radius);

        getChildren().add(arc);
        getChildren().add(arrow);
    }
}
项目:marathonv5    文件:ArcSample.java   
public static Node createIconContent() {
    Arc arc = new Arc(57,57,45,45,40,100);
    arc.setStroke(Color.web("#b9c0c5"));
    arc.setStrokeWidth(5);
    arc.getStrokeDashArray().addAll(15d,15d);
    arc.setFill(null);
    javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
    effect.setOffsetX(1);
    effect.setOffsetY(1);
    effect.setRadius(3);
    effect.setColor(Color.rgb(0,0,0,0.6));
    arc.setEffect(effect);
    return arc;
}
项目:marathonv5    文件:ArcSample.java   
public static Node createIconContent() {
    Arc arc = new Arc(57,57,45,45,40,100);
    arc.setStroke(Color.web("#b9c0c5"));
    arc.setStrokeWidth(5);
    arc.getStrokeDashArray().addAll(15d,15d);
    arc.setFill(null);
    javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow();
    effect.setOffsetX(1);
    effect.setOffsetY(1);
    effect.setRadius(3);
    effect.setColor(Color.rgb(0,0,0,0.6));
    arc.setEffect(effect);
    return arc;
}
项目:HotaruFX    文件:ArcNode.java   
private ArcNode(Arc arc) {
    super(arc);
    this.arc = arc;
    arc.setType(ArcType.ROUND);
    centerX = PropertyTimelineHolder.empty();
    centerY = PropertyTimelineHolder.empty();
    radiusX = PropertyTimelineHolder.empty();
    radiusY = PropertyTimelineHolder.empty();
    startAngle = PropertyTimelineHolder.empty();
    length = PropertyTimelineHolder.empty();
    type = PropertyTimelineHolder.empty();
}
项目:SimpleSectionGauge    文件:SimpleSectionGauge.java   
private void initGraphics() {
    sectionCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    sectionCtx    = sectionCanvas.getGraphicsContext2D();

    barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.4, PREFERRED_HEIGHT * 0.4, model.getStartAngle() + 150, 300);
    barBackground.setType(ArcType.OPEN);
    barBackground.setStroke(model.getBarBackgroundColor());
    barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.125);
    barBackground.setStrokeLineCap(StrokeLineCap.BUTT);
    barBackground.setFill(null);

    bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.4, PREFERRED_HEIGHT * 0.4, model.getStartAngle() + 90, 0);
    bar.setType(ArcType.OPEN);
    bar.setStroke(model.getBarColor());
    bar.setStrokeWidth(PREFERRED_WIDTH * 0.125);
    bar.setStrokeLineCap(StrokeLineCap.BUTT);
    bar.setFill(null);

    titleText = new Text(model.getTitle());
    titleText.setFill(model.getTitleColor());
    Helper.enableNode(titleText, !model.getTitle().isEmpty());

    valueText = new Text();
    valueText.setStroke(null);
    valueText.setFill(model.getValueColor());
    Helper.enableNode(valueText, model.isValueVisible());

    unitText = new Text();
    unitText.setStroke(null);
    unitText.setFill(model.getUnitColor());
    Helper.enableNode(unitText, model.isValueVisible() && !model.getUnit().isEmpty());

    pane = new Pane(barBackground, sectionCanvas, titleText, valueText, unitText, bar);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, new CornerRadii(1024), Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(borderWidth))));

    getChildren().setAll(pane);
}
项目:openjfx-8u-dev-tests    文件:ShapePathElements2App.java   
@Override
public Node drawNode() {
    Arc arc = new Arc(DEFAULT_ARC_X, DEFAULT_ARC_Y, DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_RADIUS_X, DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH);
    arc.setType(ArcType.OPEN);
    arc.setStrokeLineCap(StrokeLineCap.SQUARE);
    Pane slot = new Pane();
    effect.setEffect(arc, slot);
    return slot;
}
项目:openjfx-8u-dev-tests    文件:ShapePathElements2App.java   
@Override
public Node drawNode() {
    //VBox vbox = baseFill(new VBox());
    Arc arc = new Arc(DEFAULT_ARC_X, DEFAULT_ARC_Y, DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_RADIUS_X, DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH);
    arc.setType(ArcType.OPEN);
    arc.setStrokeLineCap(StrokeLineCap.ROUND);
    Pane slot = new Pane();
    effect.setEffect(arc, slot);
    return slot;
}
项目:openjfx-8u-dev-tests    文件:ShapePathElements2App.java   
@Override
public Node drawNode() {
    Arc arc = new Arc();
    arc.setCenterX(DEFAULT_ARC_X);
    arc.setCenterY(DEFAULT_ARC_Y);
    arc.setRadiusX(DEFAULT_ARC_RADIUS_X);
    arc.setRadiusY(DEFAULT_ARC_RADIUS_Y);
    arc.setStartAngle(DEFAULT_ARC_START_ANGLE);
    arc.setLength(DEFAULT_ARC_LENGTH);
    arc.setType(ArcType.OPEN);
    arc.setStrokeLineCap(StrokeLineCap.BUTT);

    Pane slot = new Pane();
    effect.setEffect(arc, slot);
    return slot;
}
项目:openjfx-8u-dev-tests    文件:ShapePathElements2App.java   
@Override
public Node drawNode() {
    Arc arc = new Arc();
    arc.setCenterX(DEFAULT_ARC_X);
    arc.setCenterY(DEFAULT_ARC_Y);
    arc.setRadiusX(DEFAULT_ARC_RADIUS_X);
    arc.setRadiusY(DEFAULT_ARC_RADIUS_Y);
    arc.setStartAngle(DEFAULT_ARC_START_ANGLE);
    arc.setLength(DEFAULT_ARC_LENGTH);
    arc.setType(ArcType.CHORD);

    Pane slot = new Pane();
    effect.setEffect(arc, slot);
    return slot;
}
项目:openjfx-8u-dev-tests    文件:ShapePathElements2App.java   
@Override
public Node drawNode() {
    Arc arc = new Arc(DEFAULT_ARC_X, DEFAULT_ARC_Y, DEFAULT_ARC_RADIUS_X,
            DEFAULT_ARC_RADIUS_X, DEFAULT_ARC_START_ANGLE, DEFAULT_ARC_LENGTH);
    arc.setType(ArcType.ROUND);

    Pane slot = new Pane();
    effect.setEffect(arc, slot);
    return slot;
}
项目:Medusa    文件:TileKpiSkin.java   
@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());
        minValue          = gauge.getMinValue();
        threshold         = gauge.getThreshold();
        range             = gauge.getRange();
        angleStep         = angleRange / range;
        highlightSections = gauge.isHighlightSections();
        redraw();
        rotateNeedle(gauge.getCurrentValue());
    } else if ("VISIBILITY".equals(EVENT_TYPE)) {
        enableNode(titleText, !gauge.getTitle().isEmpty());
        enableNode(valueText, gauge.isValueVisible());
        enableNode(sectionPane, gauge.getSectionsVisible());
        enableNode(thresholdRect, gauge.isThresholdVisible());
        enableNode(thresholdText, gauge.isThresholdVisible());
        enableNode(unitText, !gauge.getUnit().isEmpty());
        sectionsVisible = gauge.getSectionsVisible();
    } else if ("SECTION".equals(EVENT_TYPE)) {
        sections = gauge.getSections();
        sectionMap.clear();
        for(Section section : sections) { sectionMap.put(section, new Arc()); }
    } else if ("ALERT".equals(EVENT_TYPE)) {
        enableNode(valueText, gauge.isValueVisible() && !gauge.isAlert());
        enableNode(unitText, gauge.isValueVisible() && !gauge.isAlert());
        enableNode(alertIcon, gauge.isAlert());
        alertTooltip.setText(gauge.getAlertMessage());
    }
}
项目:submitbutton    文件:SubmitButton.java   
private void initGraphics(final String TEXT) {
    frame = new Rectangle(PREFERRED_WIDTH, PREFERRED_HEIGHT, frameColor.get());
    frame.setArcWidth(PREFERRED_HEIGHT);
    frame.setArcHeight(PREFERRED_HEIGHT);

    buttonArea = new Rectangle(5, 5, PREFERRED_WIDTH - 10, PREFERRED_HEIGHT - 10);
    buttonArea.setFill(buttonColor.get());
    buttonArea.setArcWidth(PREFERRED_HEIGHT);
    buttonArea.setArcHeight(PREFERRED_HEIGHT);

    text = new Text(TEXT);
    text.setFont(Fonts.robotoMedium(48));
    text.setFill(textColor.get());
    text.setMouseTransparent(true);

    progressBar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_HEIGHT * 0.5, 90, 0);
    progressBar.setType(ArcType.OPEN);
    progressBar.setFill(Color.TRANSPARENT);
    progressBar.setStroke(progressBarColor.get());

    progressPane = new Pane(progressBar);
    progressPane.setMouseTransparent(true);

    icon = new FontIcon(FontAwesome.CHECK);
    icon.setTextOrigin(VPos.CENTER);
    icon.setIconColor(iconColor.get());
    icon.setOpacity(0);

    iconPane = new StackPane(icon);
    iconPane.setMouseTransparent(true);

    pane = new StackPane(frame, buttonArea, text, progressPane, iconPane);
    pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
    pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));

    getChildren().setAll(pane);
}
项目:FXImgurUploader    文件:ShapeConverter.java   
public static String shapeToSvgString(final Shape SHAPE) {
    final StringBuilder fxPath = new StringBuilder();
    if (Line.class.equals(SHAPE.getClass())) {
        fxPath.append(convertLine((Line) SHAPE));
    } else if (Arc.class.equals(SHAPE.getClass())) {
        fxPath.append(convertArc((Arc) SHAPE));
    } else if (QuadCurve.class.equals(SHAPE.getClass())) {
        fxPath.append(convertQuadCurve((QuadCurve) SHAPE));
    } else if (CubicCurve.class.equals(SHAPE.getClass())) {
        fxPath.append(convertCubicCurve((CubicCurve) SHAPE));
    } else if (Rectangle.class.equals(SHAPE.getClass())) {
        fxPath.append(convertRectangle((Rectangle) SHAPE));
    } else if (Circle.class.equals(SHAPE.getClass())) {
        fxPath.append(convertCircle((Circle) SHAPE));
    } else if (Ellipse.class.equals(SHAPE.getClass())) {
        fxPath.append(convertEllipse((Ellipse) SHAPE));
    } else if (Text.class.equals(SHAPE.getClass())) {
        Path path = (Path)(Shape.subtract(SHAPE, new Rectangle(0, 0)));
        fxPath.append(convertPath(path));
    } else if (Path.class.equals(SHAPE.getClass())) {
        fxPath.append(convertPath((Path) SHAPE));
    } else if (Polygon.class.equals(SHAPE.getClass())) {
        fxPath.append(convertPolygon((Polygon) SHAPE));
    } else if (Polyline.class.equals(SHAPE.getClass())) {
        fxPath.append(convertPolyline((Polyline) SHAPE));
    } else if (SVGPath.class.equals(SHAPE.getClass())) {
        fxPath.append(((SVGPath) SHAPE).getContent());
    }
    return fxPath.toString();
}
项目:FXImgurUploader    文件:ShapeConverter.java   
public static String convertArc(final Arc ARC) {
    StringBuilder fxPath = new StringBuilder();
    double centerX    = ARC.getCenterX();
    double centerY    = ARC.getCenterY();
    double radiusX    = ARC.getRadiusX();
    double radiusY    = ARC.getRadiusY();
    double startAngle = Math.toRadians(-ARC.getStartAngle());
    double endAngle   = Math.toRadians(-ARC.getStartAngle() - ARC.getLength());
    double length     = ARC.getLength();

    double startX = radiusX * Math.cos(startAngle);
    double startY = radiusY * Math.sin(startAngle);

    double endX   = centerX + radiusX * Math.cos(endAngle);
    double endY   = centerY + radiusY * Math.sin(endAngle);

    int xAxisRot  = 0;
    int largeArc  = (length > 180) ? 1 : 0;
    int sweep     = (length < 0) ? 1 : 0;

    fxPath.append("M ").append(centerX).append(" ").append(centerY).append(" ");

    if (ArcType.ROUND == ARC.getType()) {
        fxPath.append("l ").append(startX).append(" ").append(startY).append(" ");
    }

    fxPath.append("A ").append(radiusX).append(" ").append(radiusY).append(" ")
          .append(xAxisRot).append(" ").append(largeArc).append(" ").append(sweep).append(" ")
          .append(endX).append(" ").append(endY).append(" ");
    if (ArcType.CHORD == ARC.getType() || ArcType.ROUND == ARC.getType()) {
        fxPath.append("Z");
    }
    return fxPath.toString();
}
项目:JFoenix    文件:JFXSpinnerSkin.java   
public JFXSpinnerSkin(JFXSpinner control) {
    super(control, new BehaviorBase<JFXSpinner>(control, Collections.emptyList()));

    this.control = control;

    blueColor = Color.valueOf("#4285f4");
    redColor = Color.valueOf("#db4437");
    yellowColor = Color.valueOf("#f4b400");
    greenColor = Color.valueOf("#0F9D58");

    arc = new Arc();
    arc.setManaged(false);
    arc.setStartAngle(0);
    arc.setLength(180);
    arc.getStyleClass().setAll("arc");
    arc.setFill(Color.TRANSPARENT);
    arc.setStrokeWidth(3);

    fillRect = new Rectangle();
    fillRect.setFill(Color.TRANSPARENT);
    text = new Text();
    text.getStyleClass().setAll("text", "percentage");
    final Group group = new Group(fillRect, arc, text);
    group.setManaged(false);
    arcPane = new StackPane(group);
    arcPane.setPrefSize(50, 50);
    getChildren().setAll(arcPane);

    // register listeners
    registerChangeListener(control.indeterminateProperty(), "INDETERMINATE");
    registerChangeListener(control.progressProperty(), "PROGRESS");
    registerChangeListener(control.visibleProperty(), "VISIBLE");
    registerChangeListener(control.parentProperty(), "PARENT");
    registerChangeListener(control.sceneProperty(), "SCENE");
}
项目:fr.xs.jtk    文件:GaugeBarModernSkin.java   
private Node createGaugeBlend() {
    Group group = new Group();

    float arcBlendDegrees = 130 + (1 - (float) this.gaugeBar.value / this.gaugeBar.maxValue) * 230;
    Arc arcBlend = new Arc(this.size, this.size, this.size, this.size, -90, arcBlendDegrees);
    arcBlend.setType(ArcType.ROUND);
    arcBlend.setFill(Color.BLACK);

    Circle circleBlend = new Circle(this.size, this.size + 3 * GAUGE_MAX_SIZE / 2, this.size - 2 * GAUGE_MAX_SIZE);
    circleBlend.setFill(Color.BLACK);

    group.getChildren().setAll(arcBlend, circleBlend);
    return group;
}
项目:fr.xs.jtk    文件:GaugeBarHollowDiscSkin.java   
private Node createGaugeBlend() {
    Group group = new Group();

    float arcBlendDegrees = (1.0f - (float) this.gaugeBar.value / this.gaugeBar.maxValue) * 360;
    Arc arcBlend = new Arc(this.size, this.size, this.size, this.size, -90, arcBlendDegrees);
    arcBlend.setType(ArcType.ROUND);
    arcBlend.setFill(Color.BLACK);

    Circle circleBlend = new Circle(this.size, this.size, this.size - 2 * GAUGE_MAX_SIZE);
    circleBlend.setFill(Color.BLACK);

    group.getChildren().setAll(arcBlend, circleBlend);
    return group;
}
项目:fr.xs.jtk    文件:GaugeBarSnakeSkin.java   
private Node createGaugeBlend() {
    Group group = new Group();

    float arcBlendDegrees = (1.0f - (float) this.gaugeBar.value / this.gaugeBar.maxValue) * 360;
    Arc arcBlend = new Arc(this.size, this.size, this.size, this.size, -90, arcBlendDegrees);
    arcBlend.setType(ArcType.ROUND);
    arcBlend.setFill(Color.BLACK);
    arcBlend.setRotate((tics += 5 % 360));

    Circle circleBlend = new Circle(this.size, this.size, this.size - 2 * GAUGE_MAX_SIZE);
    circleBlend.setFill(Color.BLACK);

    group.getChildren().setAll(arcBlend, circleBlend);
    return group;
}
项目:org.csstudio.display.builder    文件:ArcRepresentation.java   
@Override
public Arc createJFXNode() throws Exception
{
    final Arc arc = new Arc();
    updateColors();
    updateAngles();
    return arc;
}
项目:javafx-dpi-scaling    文件:ArcAdjuster.java   
@Override
public Node adjust(Node node, double scale) {
    if (node instanceof Arc) {
        Arc arc = (Arc) node;
        arc.centerXProperty().set(arc.centerXProperty().multiply(scale).get());
        arc.centerYProperty().set(arc.centerYProperty().multiply(scale).get());
        arc.radiusXProperty().set(arc.radiusXProperty().multiply(scale).get());
        arc.radiusYProperty().set(arc.radiusYProperty().multiply(scale).get());
    }
    return super.adjust(node, scale);
}
项目:javafx-dpi-scaling    文件:AdjusterTest.java   
@Test
public void testGetArcAdjuster() {
    Adjuster adjuster = Adjuster.getAdjuster(Arc.class);

    assertThat(adjuster, is(instanceOf(ArcAdjuster.class)));
    assertThat(adjuster.getNodeClass(), is(sameInstance(Arc.class)));
}
项目:Intro-to-Java-Programming    文件:FanPane.java   
/** Animate fan blades */
protected void spinFan() {
    ObservableList<Node> list = paneForBlades.getChildren();
    for (int i = 0; i < list.size(); i++) {
        Arc a = (Arc)list.get(i);
        a.setStartAngle(a.getStartAngle() + startAngle);
    }
}
项目:Intro-to-Java-Programming    文件:FanPane.java   
/** Animate fan blades */
protected void spinFan() {
    ObservableList<Node> list = paneForBlades.getChildren();
    for (Node n: list) {
        ((Arc)n).setStartAngle(((Arc)n).getStartAngle() + startAngle);
    }
}
项目:Intro-to-Java-Programming    文件:FanPane.java   
/** Animate fan blades */
protected void spinFan() {
    for (int i = 0; i < list.size(); i++) {
        Arc a = (Arc)list.get(i);
        a.setStartAngle(a.getStartAngle() + startAngle);
    }
}
项目:Intro-to-Java-Programming    文件:FanPane.java   
/** Add four arcs to a pane and place them in a stack pane */
private Pane getBlades() {
    Pane pane = new Pane();
    double angle = 0;
    for (int i = 0; i < 4; i++) {
        Arc arc = new Arc(125, 115, 90, 90, angle + 90, 50);
        arc.setFill(Color.BLACK);
        arc.setType(ArcType.ROUND);
        pane.getChildren().add(arc);
        angle += 90;
    }
    return pane;
}
项目:Intro-to-Java-Programming    文件:Exercise_14_09.java   
/** Add four arcs to a pane and place them in a stack pane */
private void getArcs(StackPane stackPane) {
    double angle = 30; // Start angle
    for (int i = 0; i < 4; i++) {
        Pane pane = new Pane();
        Arc arc = new Arc(100, 100, 80, 80, angle + 90, 35);
        arc.setFill(Color.BLACK);
        arc.setType(ArcType.ROUND);
        pane.getChildren().add(arc);
        stackPane.getChildren().add(pane);
        angle += 90;
    }
}