当前位置: 首页>>代码示例>>Java>>正文


Java ArcTo类代码示例

本文整理汇总了Java中javafx.scene.shape.ArcTo的典型用法代码示例。如果您正苦于以下问题:Java ArcTo类的具体用法?Java ArcTo怎么用?Java ArcTo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ArcTo类属于javafx.scene.shape包,在下文中一共展示了ArcTo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createIconContent

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
public static Node createIconContent() {
    Path path = new Path();
           path.getElements().addAll(
            new MoveTo(25, 25),
            new HLineTo(45),
            new ArcTo(20, 20, 0, 80, 25, true, true)
            );
    path.setStroke(Color.web("#b9c0c5"));
    path.setStrokeWidth(5);
    path.getStrokeDashArray().addAll(15d,15d);
    path.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));
    path.setEffect(effect);
    return path;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:20,代码来源:PathSample.java

示例2: drawingAreaMouseClicked

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
@FXML
private void drawingAreaMouseClicked(MouseEvent e)
{
   polyline.getPoints().addAll(e.getX(), e.getY());
   polygon.getPoints().addAll(e.getX(), e.getY());
 
   // if path is empty, move to first click position and close path
   if (path.getElements().isEmpty())
   {
      path.getElements().add(new MoveTo(e.getX(), e.getY()));
      path.getElements().add(new ClosePath());      
   }
   else // insert a new path segment before the ClosePath element
   {
      // create an arc segment and insert it in the path
      ArcTo arcTo = new ArcTo();
      arcTo.setX(e.getX());
      arcTo.setY(e.getY());
      arcTo.setRadiusX(100.0);
      arcTo.setRadiusY(100.0);
      arcTo.setSweepFlag(sweepFlag);
      sweepFlag = !sweepFlag;
      path.getElements().add(path.getElements().size() - 1, arcTo);
   }
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:26,代码来源:PolyShapesController.java

示例3: initializeHalfCircle

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
private Path initializeHalfCircle() {
    final Path halfCircle = new Path();

    halfCircle.setStroke(Color.BLACK);
    MoveTo p1 = new MoveTo();
    ArcTo p2 = new ArcTo();

    p1.xProperty().bind(xProperty().add(CIRCLE_RADIUS));
    p1.yProperty().bind(yProperty());

    p2.xProperty().bind(xProperty().subtract(CIRCLE_RADIUS));
    p2.yProperty().bind(yProperty());
    p2.setRadiusX(CIRCLE_RADIUS);
    p2.setRadiusY(CIRCLE_RADIUS);

    halfCircle.getElements().add(p1);
    halfCircle.getElements().add(p2);

    return halfCircle;
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:21,代码来源:HandshakeChannelSenderArrowHead.java

示例4: initializeLargeCircle

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
private Path initializeLargeCircle() {
    final Path largeCircle = new Path();

    largeCircle.setStroke(Color.BLACK);
    MoveTo p1 = new MoveTo();
    ArcTo p2 = new ArcTo();

    p1.xProperty().bind(xProperty().add(LARGE_CIRCLE_RADIUS));
    p1.yProperty().bind(yProperty());

    p2.xProperty().bind(xProperty().subtract(LARGE_CIRCLE_RADIUS));
    p2.yProperty().bind(yProperty());
    p2.setRadiusX(LARGE_CIRCLE_RADIUS);
    p2.setRadiusY(LARGE_CIRCLE_RADIUS);

    largeCircle.getElements().add(p1);
    largeCircle.getElements().add(p2);

    return largeCircle;
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:21,代码来源:BroadcastChannelSenderArrowHead.java

示例5: initializeMediumCircle

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
private Path initializeMediumCircle() {
    final Path mediumCircle = new Path();

    mediumCircle.setStroke(Color.BLACK);
    MoveTo p1 = new MoveTo();
    ArcTo p2 = new ArcTo();

    p1.xProperty().bind(xProperty().add(MEDIUM_CIRCLE_RADIUS));
    p1.yProperty().bind(yProperty());

    p2.xProperty().bind(xProperty().subtract(MEDIUM_CIRCLE_RADIUS));
    p2.yProperty().bind(yProperty());
    p2.setRadiusX(MEDIUM_CIRCLE_RADIUS);
    p2.setRadiusY(MEDIUM_CIRCLE_RADIUS);

    mediumCircle.getElements().add(p1);
    mediumCircle.getElements().add(p2);

    return mediumCircle;
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:21,代码来源:BroadcastChannelSenderArrowHead.java

示例6: initializeSmallCircle

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
private Path initializeSmallCircle() {
    final Path smallCircle = new Path();

    smallCircle.setStroke(Color.BLACK);
    MoveTo p1 = new MoveTo();
    ArcTo p2 = new ArcTo();

    p1.xProperty().bind(xProperty().add(SMALL_CIRCLE_RADIUS));
    p1.yProperty().bind(yProperty());

    p2.xProperty().bind(xProperty().subtract(SMALL_CIRCLE_RADIUS));
    p2.yProperty().bind(yProperty());
    p2.setRadiusX(SMALL_CIRCLE_RADIUS);
    p2.setRadiusY(SMALL_CIRCLE_RADIUS);

    smallCircle.getElements().add(p1);
    smallCircle.getElements().add(p2);

    return smallCircle;
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:21,代码来源:BroadcastChannelSenderArrowHead.java

示例7: draw

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
/**
 * Draws the arrow-head for its current size and position values.
 */
public void draw() {

    getElements().clear();

    getElements().add(new MoveTo(x, y + length / 2));
    getElements().add(new LineTo(x + width / 2, y - length / 2));

    if (radius > 0) {
        final ArcTo arcTo = new ArcTo();
        arcTo.setX(x - width / 2);
        arcTo.setY(y - length / 2);
        arcTo.setRadiusX(radius);
        arcTo.setRadiusY(radius);
        arcTo.setSweepFlag(true);
        getElements().add(arcTo);
    } else {
        getElements().add(new LineTo(x - width / 2, y - length / 2));
    }

    getElements().add(new ClosePath());
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:25,代码来源:ArrowHead.java

示例8: processPath

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
private static Path processPath(final List<String> PATH_LIST, final PathReader READER) {
    final Path PATH = new Path();
    PATH.setFillRule(FillRule.EVEN_ODD);
    while (!PATH_LIST.isEmpty()) {
        if ("M".equals(READER.read())) {
            PATH.getElements().add(new MoveTo(READER.nextX(), READER.nextY()));
        } else if ("L".equals(READER.read())) {
            PATH.getElements().add(new LineTo(READER.nextX(), READER.nextY()));
        } else if ("C".equals(READER.read())) {
            PATH.getElements().add(new CubicCurveTo(READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY()));
        } else if ("Q".equals(READER.read())) {
            PATH.getElements().add(new QuadCurveTo(READER.nextX(), READER.nextY(), READER.nextX(), READER.nextY()));
        } else if ("H".equals(READER.read())) {
            PATH.getElements().add(new HLineTo(READER.nextX()));
        } else if ("L".equals(READER.read())) {
            PATH.getElements().add(new VLineTo(READER.nextY()));
        } else if ("A".equals(READER.read())) {
            PATH.getElements().add(new ArcTo(READER.nextX(), READER.nextY(), 0, READER.nextX(), READER.nextY(), false, false));
        } else if ("Z".equals(READER.read())) {
            PATH.getElements().add(new ClosePath());
        }
    }
    return PATH;
}
 
开发者ID:Simego,项目名称:FXImgurUploader,代码行数:25,代码来源:ShapeConverter.java

示例9: createSegment

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
private Path createSegment(final double START_ANGLE, final double END_ANGLE, final double INNER_RADIUS, final double OUTER_RADIUS, final Color FILL, final Color STROKE, final TreeNode NODE) {
    double  startAngleRad = Math.toRadians(START_ANGLE + 90);
    double  endAngleRad   = Math.toRadians(END_ANGLE + 90);
    boolean largeAngle    = Math.abs(END_ANGLE - START_ANGLE) > 180.0;

    double x1 = centerX + INNER_RADIUS * Math.sin(startAngleRad);
    double y1 = centerY - INNER_RADIUS * Math.cos(startAngleRad);

    double x2 = centerX + OUTER_RADIUS * Math.sin(startAngleRad);
    double y2 = centerY - OUTER_RADIUS * Math.cos(startAngleRad);

    double x3 = centerX + OUTER_RADIUS * Math.sin(endAngleRad);
    double y3 = centerY - OUTER_RADIUS * Math.cos(endAngleRad);

    double x4 = centerX + INNER_RADIUS * Math.sin(endAngleRad);
    double y4 = centerY - INNER_RADIUS * Math.cos(endAngleRad);

    MoveTo moveTo1 = new MoveTo(x1, y1);
    LineTo lineTo2 = new LineTo(x2, y2);
    ArcTo  arcTo3  = new ArcTo(OUTER_RADIUS, OUTER_RADIUS, 0, x3, y3, largeAngle, true);
    LineTo lineTo4 = new LineTo(x4, y4);
    ArcTo  arcTo1  = new ArcTo(INNER_RADIUS, INNER_RADIUS, 0, x1, y1, largeAngle, false);

    Path path = new Path(moveTo1, lineTo2, arcTo3, lineTo4, arcTo1);

    path.setFill(FILL);
    path.setStroke(STROKE);

    String tooltipText = new StringBuilder(NODE.getData().getName()).append("\n").append(String.format(Locale.US, formatString, NODE.getData().getValue())).toString();
    Tooltip.install(path, new Tooltip(tooltipText));

    path.setOnMousePressed(new WeakEventHandler<>(e -> NODE.getTreeRoot().fireTreeNodeEvent(new TreeNodeEvent(NODE, EventType.NODE_SELECTED))));

    return path;
}
 
开发者ID:HanSolo,项目名称:SunburstChart,代码行数:36,代码来源:SunburstChart.java

示例10: PathSample

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
public PathSample() {
    super(180,90);
    // Create path shape - square
    Path path1 = new Path();
    path1.getElements().addAll(
            new MoveTo(25, 25),
            new HLineTo(65),
            new VLineTo(65),
            new LineTo(25, 65),
            new ClosePath()         
            );
    path1.setFill(null);
    path1.setStroke(Color.RED);
    path1.setStrokeWidth(2);

    // Create path shape - curves
    Path path2 = new Path();
    path2.getElements().addAll(
            new MoveTo(100, 45),
            new CubicCurveTo(120, 20, 130, 80, 140, 45),
            new QuadCurveTo(150, 0, 160, 45),
            new ArcTo(20, 40, 0, 180, 45, true, true)
            );
    path2.setFill(null);
    path2.setStroke(Color.DODGERBLUE);
    path2.setStrokeWidth(2);

    // show the path shapes;
    getChildren().add(new Group(path1, path2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Path 1 Stroke", path1.strokeProperty()),
            new SimplePropertySheet.PropDesc("Path 2 Stroke", path2.strokeProperty())
    );
    // END REMOVE ME
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:37,代码来源:PathSample.java

示例11: createSegment

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
private Path createSegment(final double START_ANGLE, final double END_ANGLE, final double INNER_RADIUS, final double OUTER_RADIUS, final Paint FILL, final Color STROKE, final TreeNode NODE) {
    double  startAngleRad = Math.toRadians(START_ANGLE + 90);
    double  endAngleRad   = Math.toRadians(END_ANGLE + 90);
    boolean largeAngle    = Math.abs(END_ANGLE - START_ANGLE) > 180.0;

    double x1 = centerX + INNER_RADIUS * Math.sin(startAngleRad);
    double y1 = centerY - INNER_RADIUS * Math.cos(startAngleRad);

    double x2 = centerX + OUTER_RADIUS * Math.sin(startAngleRad);
    double y2 = centerY - OUTER_RADIUS * Math.cos(startAngleRad);

    double x3 = centerX + OUTER_RADIUS * Math.sin(endAngleRad);
    double y3 = centerY - OUTER_RADIUS * Math.cos(endAngleRad);

    double x4 = centerX + INNER_RADIUS * Math.sin(endAngleRad);
    double y4 = centerY - INNER_RADIUS * Math.cos(endAngleRad);

    MoveTo moveTo1 = new MoveTo(x1, y1);
    LineTo lineTo2 = new LineTo(x2, y2);
    ArcTo  arcTo3  = new ArcTo(OUTER_RADIUS, OUTER_RADIUS, 0, x3, y3, largeAngle, true);
    LineTo lineTo4 = new LineTo(x4, y4);
    ArcTo  arcTo1  = new ArcTo(INNER_RADIUS, INNER_RADIUS, 0, x1, y1, largeAngle, false);

    Path path = new Path(moveTo1, lineTo2, arcTo3, lineTo4, arcTo1);

    path.setFill(FILL);
    path.setStroke(STROKE);

    String tooltipText = new StringBuilder(NODE.getItem().getName()).append("\n").append(String.format(Locale.US, formatString, NODE.getItem().getValue())).toString();
    Tooltip.install(path, new Tooltip(tooltipText));

    path.setOnMousePressed(new WeakEventHandler<>(e -> NODE.getTreeRoot().fireTreeNodeEvent(new TreeNodeEvent(NODE, EventType.NODE_SELECTED))));

    return path;
}
 
开发者ID:HanSolo,项目名称:charts,代码行数:36,代码来源:SunburstChart.java

示例12: arcRel

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
/** arc from current position, using the specified center coordinates, radius, and angle */
public void arcRel(double xc, double yc, double radius, double angle)
{
	// arcTo seems to fail if sweep angle is greater than 360
	if(angle >= FX.TWO_PI)
	{
		angle = FX.TWO_PI - 0.0000001;
	}
	else if(angle <= -FX.TWO_PI)
	{
		angle = - FX.TWO_PI + 0.0000001;
	}
	
	Point2D p = currentPos();
	
	double a = Math.atan2(yc + yorigin - p.getY(), p.getX() - xc - xorigin);
	double b = a - angle;
	double xe = xorigin + xc + radius * Math.cos(b);
	double ye = yorigin - yc - radius * Math.sin(b);

	// arcTo sweep is explained here: 
	// https://docs.oracle.com/javase/8/javafx/api/javafx/scene/shape/ArcTo.html
	boolean large = (angle >= Math.PI);
	boolean sweep = (angle > 0);
	
	add(new ArcTo(radius, radius, 0, xe, ye, large, sweep));
}
 
开发者ID:andy-goryachev,项目名称:FxEditor,代码行数:28,代码来源:FxIconBuilder.java

示例13: PathMorphTransition

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
/**
 * Create a transition
 *
 * @param sourceElements
 *            the source elements
 * @param targetElements
 *            the target elements
 * @param duation
 *            the duration
 * @param pathNode
 *            the path not the morph is done on
 */
public PathMorphTransition(List<PathElement> sourceElements, List<PathElement> targetElements, Duration duation, Path pathNode) {
    this.pathNode = pathNode;
    setCycleDuration(duation);

    if (sourceElements.size() != targetElements.size()) {
        throw new IllegalArgumentException("Only equal paths are allowed"); //$NON-NLS-1$
    }

    for (int i = 0; i < sourceElements.size(); i++) {
        PathElement sourceElement = sourceElements.get(i);
        PathElement targetElement = targetElements.get(i);
        if (sourceElement.getClass() != targetElement.getClass()) {
            throw new IllegalArgumentException("Only equal paths are allowed"); //$NON-NLS-1$
        }
        if (sourceElement instanceof ArcTo) {
            this.interpolateList.add(new ArcToInterpolatable((ArcTo) sourceElement));
        } else if (sourceElement instanceof CubicCurveTo) {
            this.interpolateList.add(new CubicCurveToInterpolatable((CubicCurveTo) sourceElement));
        } else if (sourceElement instanceof HLineTo) {
            this.interpolateList.add(new HLineToInterpolatable((HLineTo) sourceElement));
        } else if (sourceElement instanceof LineTo) {
            this.interpolateList.add(new LineToInterpolatable((LineTo) sourceElement));
        } else if (sourceElement instanceof MoveTo) {
            this.interpolateList.add(new MoveToInterpolatable((MoveTo) sourceElement));
        } else if (sourceElement instanceof QuadCurveTo) {
            this.interpolateList.add(new QuadCurveToInterpolatable((QuadCurveTo) sourceElement));
        } else if (sourceElement instanceof VLineTo) {
            this.interpolateList.add(new VLineToInterpolatable((VLineTo) sourceElement));
        }
    }

    this.sourceElements = sourceElements;
    this.targetElements = targetElements;
}
 
开发者ID:HanSolo,项目名称:bpmgauge,代码行数:47,代码来源:PathMorphTransition.java

示例14: interpolate

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
@Override public ArcTo interpolate(ArcTo endValue, double t) {
    ArcTo rv = new ArcTo(this.source.getRadiusX() + (endValue.getRadiusX() - this.source.getRadiusX()) * t,
                         this.source.getRadiusY() + (endValue.getRadiusY() - this.source.getRadiusY()) * t,
                         this.source.getXAxisRotation() + (endValue.getXAxisRotation() - this.source.getXAxisRotation()) * t,
                         this.source.getX() + (endValue.getX() - this.source.getX()) * t,
                         this.source.getY() + (endValue.getY() - this.source.getY()) * t,
                         this.source.isLargeArcFlag(), this.source.isSweepFlag());
    rv.setAbsolute(this.source.isAbsolute());
    return rv;
}
 
开发者ID:HanSolo,项目名称:bpmgauge,代码行数:11,代码来源:PathMorphTransition.java

示例15: addArcTo

import javafx.scene.shape.ArcTo; //导入依赖的package包/类
/**
 * Adds a circular detour arc to the path, to the given position.
 *
 * @param x the final x position of the arc
 * @param y the final y position of the arc
 */
private void addArcTo(final double x, final double y) {

    final ArcTo arcTo = new ArcTo();

    arcTo.setRadiusX(DETOUR_RADIUS);
    arcTo.setRadiusY(DETOUR_RADIUS);
    arcTo.setSweepFlag(sign > 0);
    arcTo.setX(GeometryUtils.moveOffPixel(x));
    arcTo.setY(GeometryUtils.moveOffPixel(y));

    getPathElements().add(arcTo);
}
 
开发者ID:Heverton,项目名称:grapheditor,代码行数:19,代码来源:DetouredConnectionSegment.java


注:本文中的javafx.scene.shape.ArcTo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。