當前位置: 首頁>>代碼示例>>Java>>正文


Java ArcType.CHORD屬性代碼示例

本文整理匯總了Java中javafx.scene.shape.ArcType.CHORD屬性的典型用法代碼示例。如果您正苦於以下問題:Java ArcType.CHORD屬性的具體用法?Java ArcType.CHORD怎麽用?Java ArcType.CHORD使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javafx.scene.shape.ArcType的用法示例。


在下文中一共展示了ArcType.CHORD屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: intToArcType

private ArcType intToArcType(int t) {
    if (t == Arc2D.CHORD) {
        return ArcType.CHORD;
    } else if (t == Arc2D.OPEN) {
        return ArcType.OPEN;
    } else if (t == Arc2D.PIE) {
        return ArcType.ROUND;
    }
    throw new IllegalArgumentException("Unrecognised t: " + t);
}
 
開發者ID:mdzio,項目名稱:ccu-historian,代碼行數:10,代碼來源:FXGraphics2D.java

示例2: convertArc

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();
}
 
開發者ID:Simego,項目名稱:FXImgurUploader,代碼行數:34,代碼來源:ShapeConverter.java

示例3: convertArc

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();
}
 
開發者ID:stefaneidelloth,項目名稱:JavaFxNodeToSvg,代碼行數:47,代碼來源:ShapeConverter.java


注:本文中的javafx.scene.shape.ArcType.CHORD屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。