path.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { Path p = (Path)t.getSource() p.setStroke(Color.RED); p.getStrokeDashArray().clear(); } });
PathClickTransition(final Path path) { super(JFXCustomColorPicker.this, new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(((DropShadow) path.getEffect()).radiusProperty(), JFXDepthManager.getShadowAt(2).radiusProperty().get(), EASE_BOTH), new KeyValue(((DropShadow) path.getEffect()).spreadProperty(), JFXDepthManager.getShadowAt(2).spreadProperty().get(), EASE_BOTH), new KeyValue(((DropShadow) path.getEffect()).offsetXProperty(), JFXDepthManager.getShadowAt(2).offsetXProperty().get(), EASE_BOTH), new KeyValue(((DropShadow) path.getEffect()).offsetYProperty(), JFXDepthManager.getShadowAt(2).offsetYProperty().get(), EASE_BOTH), new KeyValue(path.strokeWidthProperty(), 0, EASE_BOTH) ), new KeyFrame(Duration.millis(1000), new KeyValue(((DropShadow) path.getEffect()).radiusProperty(), JFXDepthManager.getShadowAt(5).radiusProperty().get(), EASE_BOTH), new KeyValue(((DropShadow) path.getEffect()).spreadProperty(), JFXDepthManager.getShadowAt(5).spreadProperty().get(), EASE_BOTH), new KeyValue(((DropShadow) path.getEffect()).offsetXProperty(), JFXDepthManager.getShadowAt(5).offsetXProperty().get(), EASE_BOTH), new KeyValue(((DropShadow) path.getEffect()).offsetYProperty(), JFXDepthManager.getShadowAt(5).offsetYProperty().get(), EASE_BOTH),
/** * 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); }
shape.setManaged(false); shape.layoutXProperty().bind(leftInset); shape.layoutYProperty().bind(topInset); return shape; }; createBackgroundShape, (backgroundShape, tuple) -> { backgroundShape.setStrokeWidth(0); backgroundShape.setFill(tuple._1); backgroundShape.getElements().setAll(getRangeShape(tuple._2)); }, addToBackgroundAndIncrementSelectionIndex, (borderShape, tuple) -> { BorderAttributes attributes = tuple._1; borderShape.setStrokeWidth(attributes.width); borderShape.setStroke(attributes.color); if (attributes.type != null) { borderShape.setStrokeType(attributes.type); borderShape.getStrokeDashArray().setAll(attributes.dashArray); borderShape.getElements().setAll(getRangeShape(tuple._2)); }, addToBackground, (underlineShape, tuple) -> { UnderlineAttributes attributes = tuple._1;
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; }
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; }
@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; } }
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: fxPath.setFillRule(FillRule.EVEN_ODD); break; case NON_ZERO: fxPath.setFillRule(FillRule.NON_ZERO); break; default: fxPath.getElements().add(pelt);
Path path = new 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); path.setFill(Color.BLACK);
final Path path1 = new Path(); final double ptsSize = element.getPointSize() / 2.; double x = element.getX() - ptsSize; 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(); x -= ptsSize; y -= 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()); return new Path[] {path1, path2};
@Override @Pure public Node drawShape(MapPolyline element, RectangularShape2afp<?, ?, ?, ?, ?, ?> bounds) { final Path fxPath = createPath(element, bounds); final Color color = GisFxTools.rgb(element.getColor()); fxPath.setFill(null); fxPath.setStroke(color); if (element.isWidePolyline()) { fxPath.setStrokeWidth(element.getWidth()); } else { fxPath.setStrokeWidth(1); } fxPath.setStrokeLineCap(StrokeLineCap.ROUND); fxPath.setStrokeLineJoin(StrokeLineJoin.ROUND); return fxPath; }
path2.setFill(Color.RED); path2.setStroke(Color.RED); path2.setStrokeWidth(1); path2.setLayoutX(0); path2.setLayoutY(0);
}); path = new Path(); path.getStyleClass().add("border"); //$NON-NLS-1$ path.setManaged(false); clip = new Path(); clip.setFill(YELLOW);
path.setFill(Color.GRAY); path.setStroke(Color.TRANSPARENT); root.getChildren().add(path); path.setOnDragDetected(event -> { mouseLocation.value = new Point2D(event.getScreenX(), event.getScreenY()); }); path.setOnMouseDragged(event -> { if (mouseLocation.value != null) { stage.setX(stage.getX() + event.getScreenX() - mouseLocation.value.getX()); path.setOnMouseReleased(event -> mouseLocation.value = null);
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); } } } }
connectionPath = new Path(moveTo, curveTo);
protected void initStyle() { connectionPath.getStyleClass().setAll( "vnode-new-connection", "vnode-new-connection-" + getSender().getType()); receiverConnectorUI.getStyleClass().setAll( "vnode-new-connection-receiver", "vnode-new-connection-receiver-" + getSender().getType()); receiverConnectorUI.setStrokeWidth(3); // }
Path path = null; if (vessel.getOwner() instanceof IHumanPlayer) { path = new Path(); path.setStroke(Color.RED); path.setStrokeWidth(2); if (!pathModel.getBezierCurves().isEmpty()) { Point2D p = pathModel.getStartpoint(); 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);
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: fxPath.setFillRule(FillRule.EVEN_ODD); break; case NON_ZERO: fxPath.setFillRule(FillRule.NON_ZERO); break; default: fxPath.getElements().add(pelt);