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


Java Arc类代码示例

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


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

示例1: makeBody

import javafx.scene.shape.Arc; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:26,代码来源:CurvedArrow.java

示例2: ArcSample

import javafx.scene.shape.Arc; //导入依赖的package包/类
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
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:24,代码来源:ArcSample.java

示例3: handleEvents

import javafx.scene.shape.Arc; //导入依赖的package包/类
@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());
    }
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:23,代码来源:GaugeTileSkin.java

示例4: handleEvents

import javafx.scene.shape.Arc; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:18,代码来源:TimerControlTileSkin.java

示例5: PieInfo

import javafx.scene.shape.Arc; //导入依赖的package包/类
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");
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:22,代码来源:PieChartDescriptionProvider.java

示例6: TileKpiSkin

import javafx.scene.shape.Arc; //导入依赖的package包/类
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());
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:25,代码来源:TileKpiSkin.java

示例7: drawSections

import javafx.scene.shape.Arc; //导入依赖的package包/类
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);
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:24,代码来源:IndicatorSkin.java

示例8: initGraphics

import javafx.scene.shape.Arc; //导入依赖的package包/类
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);
    }
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:26,代码来源:EarthMinimalClock.java

示例9: onChange

import javafx.scene.shape.Arc; //导入依赖的package包/类
@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;
	}
}
 
开发者ID:ProgrammingLife2015,项目名称:dnainator,代码行数:19,代码来源:Pie.java

示例10: getBlades

import javafx.scene.shape.Arc; //导入依赖的package包/类
/** 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;
	}
}
 
开发者ID:jsquared21,项目名称:Intro-to-Java-Programming,代码行数:18,代码来源:FanPane.java

示例11: initItems

import javafx.scene.shape.Arc; //导入依赖的package包/类
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);
}
 
开发者ID:kpetkova,项目名称:teamearth,代码行数:24,代码来源:GameWorldInitializer.java

示例12: DropTargetSymbol

import javafx.scene.shape.Arc; //导入依赖的package包/类
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);
	}
}
 
开发者ID:Silent-Fred,项目名称:iTrySQL,代码行数:19,代码来源:DropTargetSymbol.java

示例13: createIconContent

import javafx.scene.shape.Arc; //导入依赖的package包/类
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;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:15,代码来源:ArcSample.java

示例14: ArcNode

import javafx.scene.shape.Arc; //导入依赖的package包/类
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();
}
 
开发者ID:aNNiMON,项目名称:HotaruFX,代码行数:13,代码来源:ArcNode.java

示例15: initGraphics

import javafx.scene.shape.Arc; //导入依赖的package包/类
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);
}
 
开发者ID:HanSolo,项目名称:SimpleSectionGauge,代码行数:39,代码来源:SimpleSectionGauge.java


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