@Nonnull public static Path createArrowToTop(int lineLength) { Path arrowHeadPath = new Path(); arrowHeadPath.getStyleClass().add("arrow"); arrowHeadPath.getElements().add(new MoveTo(0, -ARROW_LENGTH)); //start @ top of arrow arrowHeadPath.getElements().add(new LineTo(ARROW_WIDTH_HALF, 0)); //bottom right arrowHeadPath.getElements().add(new LineTo(-ARROW_WIDTH_HALF, 0)); //bottom left arrowHeadPath.getElements().add(new LineTo(0, -ARROW_LENGTH)); //back to top of arrow arrowHeadPath.getElements().add(new MoveTo(0, 0)); //middle bottom arrowHeadPath.getElements().add(new LineTo(0, lineLength)); //middle bottom return arrowHeadPath; } }
private Node createInsertionMarker(double lineHeight) { double lineWidth = lineHeight / 15d; double arrowSide = lineHeight / 2d; double arrowHeight = arrowSide / 2d; Path marker = new Path(); marker.getElements().add(new MoveTo(- arrowSide / 2d, - arrowHeight)); marker.getElements().add(new LineTo(+ arrowSide / 2d, - arrowHeight)); marker.getElements().add(new LineTo(+ lineWidth / 2d, 0)); marker.getElements().add(new LineTo(+ lineWidth / 2d, lineHeight)); marker.getElements().add(new LineTo(+ arrowSide / 2d, lineHeight + arrowHeight)); marker.getElements().add(new LineTo(- arrowSide / 2d, lineHeight + arrowHeight)); marker.getElements().add(new LineTo(- lineWidth / 2d, lineHeight)); marker.getElements().add(new LineTo(- lineWidth / 2d, 0)); marker.getElements().add(new ClosePath()); marker.setVisible(false); marker.getStyleClass().add("insertion-marker"); //$NON-NLS-1$ marker.setMouseTransparent(true); return marker; }
private void redrawPath(double oldScale) { double scaleCorrection = 1/oldScale; double scale = this.scale.doubleValue() * scaleCorrection; logger.debug("Rescale path from {} to {}, which is a correction of {}", oldScale, this.scale, scale); for (Node node : shipCanvas.getChildren()) { if (node instanceof Path) { for (PathElement pathElement : ((Path) node).getElements()) { rescale(pathElement, scale); } } } }
double mx = element.getX() + ptsSize; double my = element.getY() + ptsSize; path1.getElements().add(new MoveTo(x, y)); path1.getElements().add(new LineTo(mx, y)); path1.getElements().add(new LineTo(mx, my)); path1.getElements().add(new LineTo(x, my)); path1.getElements().add(new ClosePath()); if (element.isDoubleFramed()) { final Path path2 = new Path(); mx += ptsSize; my += ptsSize; path2.getElements().add(new MoveTo(x, y)); path2.getElements().add(new LineTo(mx, y)); path2.getElements().add(new LineTo(mx, my)); path2.getElements().add(new LineTo(x, my)); path2.getElements().add(new ClosePath()); return new Path[] {path1, path2};
double mx = pts.getX() + ptsSize; double my = pts.getY() + ptsSize; path1.getElements().add(new MoveTo(x, y)); path1.getElements().add(new LineTo(mx, y)); path1.getElements().add(new LineTo(mx, my)); path1.getElements().add(new LineTo(x, my)); path1.getElements().add(new ClosePath()); if (path2 != null) { x -= ptsSize; mx += ptsSize; my += ptsSize; path2.getElements().add(new MoveTo(x, y)); path2.getElements().add(new LineTo(mx, y)); path2.getElements().add(new LineTo(mx, my)); path2.getElements().add(new LineTo(x, my)); path2.getElements().add(new ClosePath());
elements.add(topCurveTo); path.getElements().setAll(elements); clip.getElements().setAll(elements);
/** * Create a path shape out of a list of points. * When the path is created the vessel will be added to the * TravellingVessels container. * @param vessel vessel that is traveling the path. * @param pointedPath input points. * @param scale scaling that is used on the path due to the sacle of the map. * @return shape representing a path. */ public Optional<Path> createPath(INavigableVessel vessel, List<Point2D> pointedPath, double scale) { Path path = new Path(); path.setStroke(Color.RED); path.setStrokeWidth(2); if (!pointedPath.isEmpty()) { Point2D p = pointedPath.get(0); MoveTo moveTo = new MoveTo(); moveTo.setX(p.getX() * scale); moveTo.setY(p.getY() * scale); path.getElements().add(moveTo); for (int i = 1; i < pointedPath.size(); i++) { p = pointedPath.get(i); LineTo lineTo = new LineTo(); lineTo.setX(p.getX() * scale); lineTo.setY(p.getY() * scale); path.getElements().add(lineTo); } } vessels.addVessel(vessel, Optional.ofNullable(path), pointedPath); return Optional.ofNullable(path); }
path.getElements().add(e1); path.getElements().add(e2); path.getElements().add(e3); path.getElements().add(e4); path.getElements().add(e5); path.getElements().add(e6); }else{ arcTo.setRadiusX(15.0f); arcTo.setRadiusY(15.0f); path.getElements().add(arcTo); path.getElements().add(e7);
moveTo.setX(p.getX()); moveTo.setY(p.getY()); path.getElements().add(moveTo); for (BezierCurveControls segment : pathModel.getBezierCurves()) { CubicCurveTo cubicTo = new CubicCurveTo(); cubicTo.setX(segment.getPoint().getX()); cubicTo.setY(segment.getPoint().getY()); path.getElements().add(cubicTo);
public Bounds getRangeBoundsOnScreen(int from, int to) { layout(); // ensure layout, is a no-op if not dirty PathElement[] rangeShape = getRangeShapeSafely(from, to); Path p = new Path(); p.setManaged(false); p.setLayoutX(getInsets().getLeft()); p.setLayoutY(getInsets().getTop()); getChildren().add(p); p.getElements().setAll(rangeShape); Bounds localBounds = p.getBoundsInLocal(); Bounds rangeBoundsOnScreen = p.localToScreen(localBounds); getChildren().remove(p); return rangeBoundsOnScreen; }
backgroundShape.setStrokeWidth(0); backgroundShape.setFill(tuple._1); backgroundShape.getElements().setAll(getRangeShape(tuple._2)); }, addToBackgroundAndIncrementSelectionIndex, borderShape.getStrokeDashArray().setAll(attributes.dashArray); borderShape.getElements().setAll(getRangeShape(tuple._2)); }, addToBackground, underlineShape.getStrokeDashArray().setAll(attributes.dashArray); underlineShape.getElements().setAll(getUnderlineShape(tuple._2)); }, addToForeground,
fxPath.getElements().add(pelt);
fxPath.getElements().add(pelt);