• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ClosePath类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: clearSmallPolygons

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private void clearSmallPolygons(Path... paths){
    validPaths = new ArrayList<>();
    Point2D p0 = Point2D.ZERO;
    for (Path path : paths) {
        for (PathElement elem : path.getElements()) {
            if (elem instanceof MoveTo) {
                elements = new ArrayList<>();
                elements.add(elem);
                listPoints = new ArrayList<>();
                p0 = new Point2D(((MoveTo)elem).getX(), ((MoveTo)elem).getY());
                listPoints.add(p0);
            } else if (elem instanceof CubicCurveTo) {
                elements.add(elem);
                Point2D ini = listPoints.size() > 0 ? listPoints.get(listPoints.size() - 1) : p0;
                listPoints.addAll(evalCubicCurve((CubicCurveTo) elem, ini, POINTS_CURVE));
            } else if (elem instanceof ClosePath) {
                elements.add(elem);
                listPoints.add(p0);
                if (Math.abs(calculateArea()) > MINIMUM_AREA) {
                    validPaths.add(new Path(elements));
                }
            } 
        }
    }
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:26,代码来源:BadgeOutline.java


示例2: drawingAreaMouseClicked

import javafx.scene.shape.ClosePath; //导入依赖的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: drawChart

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private void drawChart(final List<Point> POINTS) {
    if (POINTS.isEmpty()) return;
    Point[] points = smoothing ? Helper.subdividePoints(POINTS.toArray(new Point[0]), 8) : POINTS.toArray(new Point[0]);

    fillPath.getElements().clear();
    fillPath.getElements().add(new MoveTo(0, height));

    strokePath.getElements().clear();
    strokePath.getElements().add(new MoveTo(points[0].getX(), points[0].getY()));

    for (Point p : points) {
        fillPath.getElements().add(new LineTo(p.getX(), p.getY()));
        strokePath.getElements().add(new LineTo(p.getX(), p.getY()));
    }

    fillPath.getElements().add(new LineTo(width, height));
    fillPath.getElements().add(new LineTo(0, height));
    fillPath.getElements().add(new ClosePath());

    if (dataPointsVisible) { drawDataPoints(POINTS, tile.isFillWithGradient() ? tile.getGradientStops().get(0).getColor() : tile.getBarColor()); }
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:22,代码来源:SmoothAreaChartTileSkin.java


示例4: pathsToSVGPath

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private String pathsToSVGPath() {
    final StringBuilder sb = new StringBuilder();
    for (Path path : validPaths) {
        for (PathElement element : path.getElements()) {
            if (element instanceof MoveTo) {
                sb.append("M ").append(((MoveTo) element).getX()).append(" ")
                               .append(((MoveTo) element).getY());
            } else if (element instanceof CubicCurveTo) {
                CubicCurveTo curve = (CubicCurveTo) element;
                sb.append(" C ")
                        .append(curve.getControlX1()).append(" ").append(curve.getControlY1()).append(" ")
                        .append(curve.getControlX2()).append(" ").append(curve.getControlY2()).append(" ")
                        .append(curve.getX()).append(" ").append(curve.getY());
            } else if (element instanceof ClosePath) {
                sb.append(" Z ");
            }
        }
    }
    return sb.toString();
}
 
开发者ID:gluonhq,项目名称:javaone2016,代码行数:21,代码来源:BadgeOutline.java


示例5: createNeedle

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private void createNeedle() {
    double needleWidth  = size * 0.04;
    double needleHeight = size * 0.4675;
    needle.getElements().clear();
    needle.getElements().add(new MoveTo(0.3125 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.3125 * needleWidth, 0.005319148936170213 * needleHeight,
                                              0.4375 * needleWidth, 0.0,
                                              0.5 * needleWidth, 0.0));
    needle.getElements().add(new CubicCurveTo(0.5625 * needleWidth, 0.0,
                                              0.6875 * needleWidth, 0.005319148936170213 * needleHeight,
                                              0.6875 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.6875 * needleWidth, 0.015957446808510637 * needleHeight,
                                              needleWidth, 0.9946808510638298 * needleHeight,
                                              needleWidth, 0.9946808510638298 * needleHeight));
    needle.getElements().add(new LineTo(0.0, 0.9946808510638298 * needleHeight));
    needle.getElements().add(new CubicCurveTo(0.0, 0.9946808510638298 * needleHeight,
                                              0.3125 * needleWidth, 0.015957446808510637 * needleHeight,
                                              0.3125 * needleWidth, 0.015957446808510637 * needleHeight));
    needle.getElements().add(new ClosePath());
    needle.setFill(new LinearGradient(needle.getLayoutBounds().getMinX(), 0,
                                      needle.getLayoutBounds().getMaxX(), 0,
                                      false, CycleMethod.NO_CYCLE,
                                      new Stop(0.0, gauge.getNeedleColor().darker()),
                                      new Stop(0.5, gauge.getNeedleColor()),
                                      new Stop(1.0, gauge.getNeedleColor().darker())));
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:27,代码来源:SectionSkin.java


示例6: drawAverage

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private void drawAverage() {
    double scaledWidth = width * 1.106;
    double centerX     = width * 0.5;
    double centerY     = height * 0.77;
    double minValue    = gauge.getMinValue();
    // Draw average
    average.getElements().clear();
    double averageAngle = START_ANGLE - (gauge.getAverage() - minValue) * angleStep;
    double averageSize  = Helper.clamp(2.0, 2.5, 0.01 * scaledWidth);
    double sinValue     = Math.sin(Math.toRadians(averageAngle));
    double cosValue     = Math.cos(Math.toRadians(averageAngle));
    average.getElements().add(new MoveTo(centerX + scaledWidth * 0.38 * sinValue, centerY + scaledWidth * 0.38 * cosValue));
    sinValue = Math.sin(Math.toRadians(averageAngle - averageSize));
    cosValue = Math.cos(Math.toRadians(averageAngle - averageSize));
    average.getElements().add(new LineTo(centerX + scaledWidth * 0.35 * sinValue, centerY + scaledWidth * 0.35 * cosValue));
    sinValue = Math.sin(Math.toRadians(averageAngle + averageSize));
    cosValue = Math.cos(Math.toRadians(averageAngle + averageSize));
    average.getElements().add(new LineTo(centerX + scaledWidth * 0.35 * sinValue, centerY + scaledWidth * 0.35 * cosValue));
    average.getElements().add(new ClosePath());
    average.setFill(gauge.getAverageColor());
    average.setStroke(gauge.getTickMarkColor());
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:23,代码来源:AmpSkin.java


示例7: initGraphics

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private void initGraphics() {
    moveTo     = new MoveTo();
    upperLeft  = new LineTo();
    upperRight = new LineTo();
    lowerRight = new LineTo();
    lowerLeft  = new LineTo();

    path = new Path();
    path.getElements().add(moveTo);
    path.getElements().add(upperLeft);
    path.getElements().add(upperRight);
    path.getElements().add(lowerRight);
    path.getElements().add(lowerLeft);
    path.getElements().add(new ClosePath());

    path.getStyleClass().add("segment");

    pane = new Pane(path);
    pane.getStyleClass().add("segment");

    getChildren().setAll(pane);
}
 
开发者ID:HanSolo,项目名称:bpmgauge,代码行数:23,代码来源:Segment.java


示例8: draw

import javafx.scene.shape.ClosePath; //导入依赖的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


示例9: start

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
	Path shape = new Path(new MoveTo(450, 450),
               new LineTo(-SIZE, -SIZE),
               new LineTo(0, -2 * SIZE),
               new LineTo(SIZE, -SIZE),
               new LineTo(450, 450),
               new ClosePath());

	shape.setFill(Color.BLUE);
	shape.setStroke(Color.RED);
	shape.setStrokeWidth(2.0);
	shape.getStrokeDashArray().addAll(10.0, 5.0);

	Pane root = new Pane();
	root.getChildren().add(shape);

	stage.setScene(new Scene(root, 900, 900));
	stage.show();
}
 
开发者ID:bourgesl,项目名称:marlin-fx,代码行数:21,代码来源:ShapeOutlineBugRectangle.java


示例10: processPath

import javafx.scene.shape.ClosePath; //导入依赖的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


示例11: PathSample

import javafx.scene.shape.ClosePath; //导入依赖的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


示例12: smooth

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private void smooth(ObservableList<PathElement> strokeElements, ObservableList<PathElement> fillElements, final double HEIGHT) {
    if (fillElements.isEmpty()) return;
    // as we do not have direct access to the data, first recreate the list of all the data points we have
    final Point2D[] dataPoints = new Point2D[strokeElements.size()];
    for (int i = 0; i < strokeElements.size(); i++) {
        final PathElement element = strokeElements.get(i);
        if (element instanceof MoveTo) {
            final MoveTo move = (MoveTo) element;
            dataPoints[i] = new Point2D(move.getX(), move.getY());
        } else if (element instanceof LineTo) {
            final LineTo line = (LineTo) element;
            final double x = line.getX(), y = line.getY();
            dataPoints[i] = new Point2D(x, y);
        }
    }
    double firstX = dataPoints[0].getX();
    double lastX  = dataPoints[dataPoints.length - 1].getX();

    Point2D[] points = Helper.subdividePoints(dataPoints, getSubDivisions());

    fillElements.clear();
    fillElements.add(new MoveTo(firstX, HEIGHT));

    strokeElements.clear();
    strokeElements.add(new MoveTo(points[0].getX(), points[0].getY()));

    for (Point2D p : points) {
        if (Double.compare(p.getX(), firstX) >= 0) {
            fillElements.add(new LineTo(p.getX(), p.getY()));
            strokeElements.add(new LineTo(p.getX(), p.getY()));
        }
    }

    fillElements.add(new LineTo(lastX, HEIGHT));
    fillElements.add(new LineTo(0, HEIGHT));
    fillElements.add(new ClosePath());
}
 
开发者ID:HanSolo,项目名称:smoothcharts,代码行数:38,代码来源:SmoothedChart.java


示例13: drawTriangle

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private void drawTriangle() {
    MoveTo    moveTo    = new MoveTo(0, 0.028 * size);
    LineTo    lineTo1   = new LineTo(0.022 * size, 0);
    LineTo    lineTo2   = new LineTo(0.044 * size, 0.028 * size);
    LineTo    lineTo3   = new LineTo(0, 0.028 * size);
    ClosePath closePath = new ClosePath();
    triangle.getElements().setAll(moveTo, lineTo1, lineTo2, lineTo3, closePath);
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:9,代码来源:LeaderBoardItem.java


示例14: drawTriangle

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private void drawTriangle() {
    MoveTo       moveTo        = new MoveTo(0.056 * size, 0.032 * size);
    CubicCurveTo cubicCurveTo1 = new CubicCurveTo(0.060 * size, 0.028 * size, 0.064 * size, 0.028 * size, 0.068 * size, 0.032 * size);
    CubicCurveTo cubicCurveTo2 = new CubicCurveTo(0.068 * size, 0.032 * size, 0.120 * size, 0.080 * size, 0.12 * size,  0.080 * size);
    CubicCurveTo cubicCurveTo3 = new CubicCurveTo(0.128 * size, 0.088 * size, 0.124 * size, 0.096 * size, 0.112 * size, 0.096 * size);
    CubicCurveTo cubicCurveTo4 = new CubicCurveTo(0.112 * size, 0.096 * size, 0.012 * size, 0.096 * size, 0.012 * size, 0.096 * size);
    CubicCurveTo cubicCurveTo5 = new CubicCurveTo(0.0, 0.096 * size, -0.004 * size, 0.088 * size, 0.004 * size, 0.080 * size);
    CubicCurveTo cubicCurveTo6 = new CubicCurveTo(0.004 * size, 0.080 * size, 0.056 * size, 0.032 * size, 0.056 * size, 0.032 * size);
    ClosePath    closePath     = new ClosePath();
    triangle.getElements().setAll(moveTo, cubicCurveTo1, cubicCurveTo2, cubicCurveTo3, cubicCurveTo4, cubicCurveTo5, cubicCurveTo6, closePath);
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:12,代码来源:HighLowTileSkin.java


示例15: drawTriangle

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private void drawTriangle() {
    MoveTo       moveTo        = new MoveTo(0.056 * size * 0.5, 0.032 * size * 0.5);
    CubicCurveTo cubicCurveTo1 = new CubicCurveTo(0.060 * size * 0.5, 0.028 * size * 0.5, 0.064 * size * 0.5, 0.028 * size * 0.5, 0.068 * size * 0.5, 0.032 * size * 0.5);
    CubicCurveTo cubicCurveTo2 = new CubicCurveTo(0.068 * size * 0.5, 0.032 * size * 0.5, 0.120 * size * 0.5, 0.080 * size * 0.5, 0.12 * size * 0.5,  0.080 * size * 0.5);
    CubicCurveTo cubicCurveTo3 = new CubicCurveTo(0.128 * size * 0.5, 0.088 * size * 0.5, 0.124 * size * 0.5, 0.096 * size * 0.5, 0.112 * size * 0.5, 0.096 * size * 0.5);
    CubicCurveTo cubicCurveTo4 = new CubicCurveTo(0.112 * size * 0.5, 0.096 * size * 0.5, 0.012 * size * 0.5, 0.096 * size * 0.5, 0.012 * size * 0.5, 0.096 * size * 0.5);
    CubicCurveTo cubicCurveTo5 = new CubicCurveTo(0.0, 0.096 * size * 0.5, -0.004 * size * 0.5, 0.088 * size * 0.5, 0.004 * size * 0.5, 0.080 * size * 0.5);
    CubicCurveTo cubicCurveTo6 = new CubicCurveTo(0.004 * size * 0.5, 0.080 * size * 0.5, 0.056 * size * 0.5, 0.032 * size * 0.5, 0.056 * size * 0.5, 0.032 * size * 0.5);
    ClosePath    closePath     = new ClosePath();
    triangle.getElements().setAll(moveTo, cubicCurveTo1, cubicCurveTo2, cubicCurveTo3, cubicCurveTo4, cubicCurveTo5, cubicCurveTo6, closePath);
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:12,代码来源:StockTileSkin.java


示例16: smooth

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private void smooth(ObservableList<PathElement> strokeElements, ObservableList<PathElement> fillElements, final double HEIGHT) {
    if (fillElements.isEmpty()) return;
    // as we do not have direct access to the data, first recreate the list of all the data points we have
    final Point[] dataPoints = new Point[strokeElements.size()];
    for (int i = 0; i < strokeElements.size(); i++) {
        final PathElement element = strokeElements.get(i);
        if (element instanceof MoveTo) {
            final MoveTo move = (MoveTo) element;
            dataPoints[i] = new Point(move.getX(), move.getY());
        } else if (element instanceof LineTo) {
            final LineTo line = (LineTo) element;
            final double x = line.getX(), y = line.getY();
            dataPoints[i] = new Point(x, y);
        }
    }
    double firstX = dataPoints[0].getX();
    double lastX  = dataPoints[dataPoints.length - 1].getX();

    Point[] points = Helper.subdividePoints(dataPoints, getSubDivisions());

    fillElements.clear();
    fillElements.add(new MoveTo(firstX, HEIGHT));

    strokeElements.clear();
    strokeElements.add(new MoveTo(points[0].getX(), points[0].getY()));

    for (Point p : points) {
        if (Double.compare(p.getX(), firstX) >= 0) {
            fillElements.add(new LineTo(p.getX(), p.getY()));
            strokeElements.add(new LineTo(p.getX(), p.getY()));
        }
    }

    fillElements.add(new LineTo(lastX, HEIGHT));
    fillElements.add(new LineTo(0, HEIGHT));
    fillElements.add(new ClosePath());
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:38,代码来源:SmoothedChart.java


示例17: smoothPath

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
public static final Path smoothPath(final ObservableList<PathElement> ELEMENTS, final boolean FILLED) {
    if (ELEMENTS.isEmpty()) { return new Path(); }
    final Point[] dataPoints = new Point[ELEMENTS.size()];
    for (int i = 0; i < ELEMENTS.size(); i++) {
        final PathElement element = ELEMENTS.get(i);
        if (element instanceof MoveTo) {
            MoveTo move   = (MoveTo) element;
            dataPoints[i] = new Point(move.getX(), move.getY());
        } else if (element instanceof LineTo) {
            LineTo line   = (LineTo) element;
            dataPoints[i] = new Point(line.getX(), line.getY());
        }
    }
    double                 zeroY               = ((MoveTo) ELEMENTS.get(0)).getY();
    List<PathElement>      smoothedElements    = new ArrayList<>();
    Pair<Point[], Point[]> result              = calcCurveControlPoints(dataPoints);
    Point[]                firstControlPoints  = result.getKey();
    Point[]                secondControlPoints = result.getValue();
    // Start path dependent on filled or not
    if (FILLED) {
        smoothedElements.add(new MoveTo(dataPoints[0].getX(), zeroY));
        smoothedElements.add(new LineTo(dataPoints[0].getX(), dataPoints[0].getY()));
    } else {
        smoothedElements.add(new MoveTo(dataPoints[0].getX(), dataPoints[0].getY()));
    }
    // Add curves
    for (int i = 2; i < dataPoints.length; i++) {
        final int ci = i - 1;
        smoothedElements.add(new CubicCurveTo(
            firstControlPoints[ci].getX(), firstControlPoints[ci].getY(),
            secondControlPoints[ci].getX(), secondControlPoints[ci].getY(),
            dataPoints[i].getX(), dataPoints[i].getY()));
    }
    // Close the path if filled
    if (FILLED) {
        smoothedElements.add(new LineTo(dataPoints[dataPoints.length - 1].getX(), zeroY));
        smoothedElements.add(new ClosePath());
    }
    return new Path(smoothedElements);
}
 
开发者ID:HanSolo,项目名称:tilesfx,代码行数:41,代码来源:Helper.java


示例18: drawAverage

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private void drawAverage() {
    double centerX = size * 0.5;
    double centerY = size * 0.5;
    // Draw average
    average.getElements().clear();
    double averageAngle;
    if (ScaleDirection.CLOCKWISE == scaleDirection) {
        averageAngle = startAngle - (getSkinnable().getAverage() - minValue) * angleStep;
    } else {
        averageAngle = startAngle + (getSkinnable().getAverage() - minValue) * angleStep;
    }
    double averageSize = Helper.clamp(3.0, 3.5, 0.01 * size);
    double sinValue      = Math.sin(Math.toRadians(averageAngle));
    double cosValue      = Math.cos(Math.toRadians(averageAngle));
    switch (tickLabelLocation) {
        case OUTSIDE:
            average.getElements().add(new MoveTo(centerX + size * 0.38 * sinValue, centerY + size * 0.38 * cosValue));
            sinValue = Math.sin(Math.toRadians(averageAngle - averageSize));
            cosValue = Math.cos(Math.toRadians(averageAngle - averageSize));
            average.getElements().add(new LineTo(centerX + size * 0.34 * sinValue, centerY + size * 0.34 * cosValue));
            sinValue = Math.sin(Math.toRadians(averageAngle + averageSize));
            cosValue = Math.cos(Math.toRadians(averageAngle + averageSize));
            average.getElements().add(new LineTo(centerX + size * 0.34 * sinValue, centerY + size * 0.34 * cosValue));
            average.getElements().add(new ClosePath());
            break;
        case INSIDE:
        default:
            average.getElements().add(new MoveTo(centerX + size * 0.465 * sinValue, centerY + size * 0.465 * cosValue));
            sinValue = Math.sin(Math.toRadians(averageAngle - averageSize));
            cosValue = Math.cos(Math.toRadians(averageAngle - averageSize));
            average.getElements().add(new LineTo(centerX + size * 0.425 * sinValue, centerY + size * 0.425 * cosValue));
            sinValue = Math.sin(Math.toRadians(averageAngle + averageSize));
            cosValue = Math.cos(Math.toRadians(averageAngle + averageSize));
            average.getElements().add(new LineTo(centerX + size * 0.425 * sinValue, centerY + size * 0.425 * cosValue));
            average.getElements().add(new ClosePath());
            break;
    }
    average.setFill(getSkinnable().getAverageColor());
    average.setStroke(getSkinnable().getTickMarkColor());
}
 
开发者ID:HanSolo,项目名称:medusademo,代码行数:41,代码来源:InteractiveGaugeSkin.java


示例19: drawAverage

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private void drawAverage() {
    double scaledSize = size * 1.95;
    // Draw average
    average.getElements().clear();
    double averageAngle;
    if (ScaleDirection.CLOCKWISE == scaleDirection) {
        averageAngle = startAngle - (gauge.getAverage() - minValue) * angleStep;
    } else {
        averageAngle = startAngle + (gauge.getAverage() - minValue) * angleStep;
    }
    double averageSize = Helper.clamp(3.0, 3.5, 0.01 * size);
    double sinValue      = Math.sin(Math.toRadians(averageAngle));
    double cosValue      = Math.cos(Math.toRadians(averageAngle));
    switch (tickLabelLocation) {
        case OUTSIDE:
            average.getElements().add(new MoveTo(centerX + scaledSize * 0.38 * sinValue, centerY + scaledSize * 0.38 * cosValue));
            sinValue = Math.sin(Math.toRadians(averageAngle - averageSize));
            cosValue = Math.cos(Math.toRadians(averageAngle - averageSize));
            average.getElements().add(new LineTo(centerX + scaledSize * 0.34 * sinValue, centerY + scaledSize * 0.34 * cosValue));
            sinValue = Math.sin(Math.toRadians(averageAngle + averageSize));
            cosValue = Math.cos(Math.toRadians(averageAngle + averageSize));
            average.getElements().add(new LineTo(centerX + scaledSize * 0.34 * sinValue, centerY + scaledSize * 0.34 * cosValue));
            average.getElements().add(new ClosePath());
            break;
        case INSIDE:
        default:
            average.getElements().add(new MoveTo(centerX + scaledSize * 0.465 * sinValue, centerY + scaledSize * 0.465 * cosValue));
            sinValue = Math.sin(Math.toRadians(averageAngle - averageSize));
            cosValue = Math.cos(Math.toRadians(averageAngle - averageSize));
            average.getElements().add(new LineTo(centerX + scaledSize * 0.425 * sinValue, centerY + scaledSize * 0.425 * cosValue));
            sinValue = Math.sin(Math.toRadians(averageAngle + averageSize));
            cosValue = Math.cos(Math.toRadians(averageAngle + averageSize));
            average.getElements().add(new LineTo(centerX + scaledSize * 0.425 * sinValue, centerY + scaledSize * 0.425 * cosValue));
            average.getElements().add(new ClosePath());
            break;
    }
    average.setFill(gauge.getAverageColor());
    average.setStroke(gauge.getTickMarkColor());
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:40,代码来源:QuarterSkin.java


示例20: createHourPointer

import javafx.scene.shape.ClosePath; //导入依赖的package包/类
private void createHourPointer() {
    double width  = size * 0.09733333;
    double height = size * 0.42066667;
    hour.setCache(false);
    hour.getElements().clear();
    hour.getElements().add(new MoveTo(0.0, 0.0));
    hour.getElements().add(new CubicCurveTo(0.0, 0.0, 0.0, 0.884310618066561 * height, 0.0, 0.884310618066561 * height));
    hour.getElements().add(new CubicCurveTo(0.0, 0.9477020602218701 * height, 0.22602739726027396 * width, height, 0.5 * width, height));
    hour.getElements().add(new CubicCurveTo(0.773972602739726 * width, height, width, 0.9477020602218701 * height, width, 0.884310618066561 * height));
    hour.getElements().add(new CubicCurveTo(width, 0.884310618066561 * height, width, 0.0, width, 0.0));
    hour.getElements().add(new LineTo(0.0, 0.0));
    hour.getElements().add(new ClosePath());
    hour.setCache(true);
    hour.setCacheHint(CacheHint.ROTATE);
}
 
开发者ID:HanSolo,项目名称:Medusa,代码行数:16,代码来源:FatClockSkin.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MapTileModuleProviderBase类代码示例发布时间:2022-05-21
下一篇:
Java Music类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap