javafx.scene.shape.Arc#setLength ( )源码实例Demo

下面列出了javafx.scene.shape.Arc#setLength ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: gef   文件: DotArrowShapeDecorations.java
private static void setSide(Arc arc, String side) {
	// setting the side of an arc based shape to left/right
	if (arc instanceof Curve && side.equals("l")) {//$NON-NLS-1$
		arc.setStartAngle(180);
		arc.setLength(90);
	}
	if (arc instanceof ICurve && side.equals("l")) {//$NON-NLS-1$
		arc.setStartAngle(0);
		arc.setLength(-90);
	}
	if (arc instanceof Curve && side.equals("r")) {//$NON-NLS-1$
		arc.setLength(90);
	}
	if (arc instanceof ICurve && side.equals("r")) {//$NON-NLS-1$
		arc.setLength(-90);
	}
}
 
源代码2 项目: JetUML   文件: StateTransitionEdgeViewer.java
private Shape getSelfEdgeShape(Edge pEdge)
{
	Line line = getSelfEdgeConnectionPoints(pEdge);
	Arc arc = new Arc();
	arc.setRadiusX(SELF_EDGE_OFFSET*2);
	arc.setRadiusY(SELF_EDGE_OFFSET*2);
	arc.setLength(DEGREES_270);
	arc.setType(ArcType.OPEN);
	if( getPosition(pEdge) == 1 )
	{
		arc.setCenterX(line.getX1());
		arc.setCenterY(line.getY1()-SELF_EDGE_OFFSET);
		arc.setStartAngle(DEGREES_270);
	}
	else
	{		
		arc.setCenterX(line.getX1()-SELF_EDGE_OFFSET);
		arc.setCenterY(line.getY1()-SELF_EDGE_OFFSET*2);
		arc.setStartAngle(1);
	}
	return arc;
}
 
源代码3 项目: 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;
	}
}
 
源代码4 项目: 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;
	}
}
 
源代码5 项目: latexdraw   文件: RotationHandler.java
/**
 * The constructor by default.
 * @param border The selection border.
 */
public RotationHandler(final @NotNull Rectangle border) {
	super();
	final Arc arc = new Arc();
	arc.setCenterX(DEFAULT_SIZE / 2d);
	arc.setRadiusX(DEFAULT_SIZE / 2d);
	arc.setRadiusY(DEFAULT_SIZE / 2d);
	arc.setType(ArcType.OPEN);
	arc.setLength(270d);
	arc.setStroke(DEFAULT_COLOR);
	arc.setStrokeWidth(2.5d);
	arc.setStrokeLineCap(StrokeLineCap.BUTT);
	arc.setFill(new Color(1d, 1d, 1d, 0d));
	getChildren().add(arc);

	final Path arrows = new Path();
	arrows.setStroke(null);
	arrows.setFill(new Color(0d, 0d, 0d, 0.4));
	arrows.getElements().add(new MoveTo(DEFAULT_SIZE + DEFAULT_SIZE / 4d, 0d));
	arrows.getElements().add(new LineTo(DEFAULT_SIZE, DEFAULT_SIZE / 2d));
	arrows.getElements().add(new LineTo(DEFAULT_SIZE - DEFAULT_SIZE / 4d, 0d));
	arrows.getElements().add(new ClosePath());
	getChildren().add(arrows);

	translateXProperty().bind(Bindings.createDoubleBinding(() -> border.getLayoutX() + border.getWidth(), border.xProperty(),
		border.widthProperty(), border.layoutXProperty()));
	translateYProperty().bind(Bindings.createDoubleBinding(() -> border.getLayoutY() + DEFAULT_SIZE, border.yProperty(),
		border.heightProperty(), border.layoutYProperty()));
}
 
源代码6 项目: OEE-Designer   文件: TimerControlTileSkin.java
private void drawTimeSections() {
    if (sectionMap.isEmpty()) return;
    ZonedDateTime     time              = tile.getTime();
    DayOfWeek         day               = time.getDayOfWeek();
    boolean           isAM              = time.get(ChronoField.AMPM_OF_DAY) == 0;
    double            offset            = 90;
    double            angleStep         = 360.0 / 60.0;
    boolean           highlightSections = tile.isHighlightSections();
    for (TimeSection section : sectionMap.keySet()) {
        LocalTime   start     = section.getStart();
        LocalTime   stop      = section.getStop();
        boolean     isStartAM = start.get(ChronoField.AMPM_OF_DAY) == 0;
        boolean     isStopAM  = stop.get(ChronoField.AMPM_OF_DAY) == 0;
        boolean     draw      = isAM ? (isStartAM || isStopAM) : (!isStartAM || !isStopAM);
        if (!section.getDays().contains(day)) { draw = false; }
        if (!section.isActive()) { draw = false; }
        if (draw) {
            double sectionStartAngle = (start.getHour() % 12 * 5.0 + start.getMinute() / 12.0 + start.getSecond() / 300.0) * angleStep + 180;
            double sectionAngleExtend = ((stop.getHour() - start.getHour()) % 12 * 5.0 + (stop.getMinute() - start.getMinute()) / 12.0 + (stop.getSecond() - start.getSecond()) / 300.0) * angleStep;
            if (start.getHour() > stop.getHour()) { sectionAngleExtend = (360.0 - Math.abs(sectionAngleExtend)); }

            Arc arc = sectionMap.get(section);
            arc.setCenterX(clockSize * 0.5);
            arc.setCenterY(clockSize * 0.5);
            arc.setRadiusX(clockSize * 0.45);
            arc.setRadiusY(clockSize * 0.45);
            arc.setStartAngle(-(offset + sectionStartAngle));
            arc.setLength(-sectionAngleExtend);
            arc.setType(ArcType.OPEN);
            arc.setStrokeWidth(clockSize * 0.04);
            arc.setStrokeLineCap(StrokeLineCap.BUTT);
            arc.setFill(null);

            if (highlightSections) {
                arc.setStroke(section.contains(time.toLocalTime()) ? section.getHighlightColor() : section.getColor());
            } else {
                arc.setStroke(section.getColor());
            }
        }
    }
}
 
源代码7 项目: tilesfx   文件: TimerControlTileSkin.java
private void drawTimeSections() {
    if (sectionMap.isEmpty()) return;
    ZonedDateTime time              = tile.getTime();
    DayOfWeek     day               = time.getDayOfWeek();
    boolean       isAM              = time.get(ChronoField.AMPM_OF_DAY) == 0;
    double        offset            = 90;
    double        angleStep         = 360.0 / 60.0;
    boolean       highlightSections = tile.isHighlightSections();
    for (TimeSection section : sectionMap.keySet()) {
        LocalTime   start     = section.getStart();
        LocalTime   stop      = section.getStop();
        boolean     isStartAM = start.get(ChronoField.AMPM_OF_DAY) == 0;
        boolean     isStopAM  = stop.get(ChronoField.AMPM_OF_DAY) == 0;
        boolean     draw      = isAM ? (isStartAM || isStopAM) : (!isStartAM || !isStopAM);
        if (!section.getDays().contains(day)) { draw = false; }
        if (!section.isActive()) { draw = false; }
        if (draw) {
            double sectionStartAngle = (start.getHour() % 12 * 5.0 + start.getMinute() / 12.0 + start.getSecond() / 300.0) * angleStep + 180;
            double sectionAngleExtend = ((stop.getHour() - start.getHour()) % 12 * 5.0 + (stop.getMinute() - start.getMinute()) / 12.0 + (stop.getSecond() - start.getSecond()) / 300.0) * angleStep;
            if (start.getHour() > stop.getHour()) { sectionAngleExtend = (360.0 - Math.abs(sectionAngleExtend)); }

            Arc arc = sectionMap.get(section);
            arc.setCenterX(clockSize * 0.5);
            arc.setCenterY(clockSize * 0.5);
            arc.setRadiusX(clockSize * 0.45);
            arc.setRadiusY(clockSize * 0.45);
            arc.setStartAngle(-(offset + sectionStartAngle));
            arc.setLength(-sectionAngleExtend);
            arc.setType(ArcType.OPEN);
            arc.setStrokeWidth(clockSize * 0.04);
            arc.setStrokeLineCap(StrokeLineCap.BUTT);
            arc.setFill(null);

            if (highlightSections) {
                arc.setStroke(section.contains(time.toLocalTime()) ? section.getHighlightColor() : section.getColor());
            } else {
                arc.setStroke(section.getColor());
            }
        }
    }
}
 
源代码8 项目: 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);

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

    fillRect = new Rectangle();
    fillRect.setFill(Color.TRANSPARENT);
    text = new Text();
    text.getStyleClass().setAll("text", "percentage");
    final Group group = new Group(fillRect, track, 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");
}
 
源代码9 项目: FXTutorials   文件: FarCry4Loading.java
public LoadingArc() {
    Arc arc = new Arc();

    arc.setCenterX(25);
    arc.setCenterY(25);
    arc.setRadiusX(25.0f);
    arc.setRadiusY(25.0f);
    arc.setLength(30.0f);
    arc.setStrokeWidth(5);

    Stop[] stops = new Stop[] { new Stop(0, Color.WHITE), new Stop(1, Color.BLUE)};
    LinearGradient lg1 = new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, stops);

    arc.setStroke(lg1);

    Rectangle rect = new Rectangle(50, 50);
    rect.setFill(null);
    rect.setStroke(Color.RED);

    getChildren().addAll(rect, arc);


    double time = 0.75;

    Rotate r = new Rotate(0, 25, 25);
    arc.getTransforms().add(r);
    //arc.getTransforms().add(new Scale(-1, 1, 25, 25));

    Timeline timeline = new Timeline();
    KeyFrame kf2 = new KeyFrame(Duration.seconds(time), new KeyValue(r.angleProperty(), 270));


    timeline.getKeyFrames().addAll(kf2);

    Timeline timeline3 = new Timeline(new KeyFrame(Duration.seconds(time), new KeyValue(r.angleProperty(), 360)));


    SequentialTransition st = new SequentialTransition(timeline, timeline3);
    st.setCycleCount(Timeline.INDEFINITE);
    st.setInterpolator(Interpolator.EASE_BOTH);
    st.play();

    //////////

    Timeline timeline2 = new Timeline();
    timeline2.setAutoReverse(true);
    timeline2.setCycleCount(Timeline.INDEFINITE);


    KeyFrame kf = new KeyFrame(Duration.seconds(time), new KeyValue(arc.lengthProperty(), 270, Interpolator.EASE_BOTH));

    timeline2.getKeyFrames().add(kf);
    timeline2.play();
}