@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; }
/** * 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); }
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; }
Path path = null; if (vessel.getOwner() instanceof IHumanPlayer) { path = new Path(); path.setStroke(Color.RED);
Path path = new Path();
protected Path createPath(T element, RectangularShape2afp<?, ?, ?, ?, ?, ?> bounds) { final PathIterator2afp<PathElement2d> pathIterator = element.toPath2D().getPathIterator(); final Path fxPath = new Path(); switch (pathIterator.getWindingRule()) { case EVEN_ODD:
protected Path createPath(T element, RectangularShape2afp<?, ?, ?, ?, ?, ?> bounds) { final PathIterator2afp<PathElement2d> pathIterator = element.toPath2D().getPathIterator(); final Path fxPath = new Path(); switch (pathIterator.getWindingRule()) { case EVEN_ODD:
connectionPath = new Path(moveTo, curveTo);