path.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent t) { Path p = (Path)t.getSource() p.setStroke(Color.RED); p.getStrokeDashArray().clear(); } });
@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; }
/** * 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); }
BorderAttributes attributes = tuple._1; borderShape.setStrokeWidth(attributes.width); borderShape.setStroke(attributes.color); if (attributes.type != null) { borderShape.setStrokeType(attributes.type); (underlineShape, tuple) -> { UnderlineAttributes attributes = tuple._1; underlineShape.setStroke(attributes.color); underlineShape.setStrokeWidth(attributes.width); underlineShape.setStrokeLineCap(attributes.cap);
path2.setStroke(Color.RED); path2.setStrokeWidth(1); path2.setLayoutX(0);
@Override @Pure public Node drawShape(MapMultiPoint element, RectangularShape2afp<?, ?, ?, ?, ?, ?> bounds) { final Path[] paths = createPaths(element, bounds); final Path path1 = paths[0]; final Color color = GisFxTools.rgb(element.getColor()); path1.setFill(color); path1.setStroke(color); if (paths.length > 1) { final Path path2 = paths[1]; path2.setFill(null); path2.setStroke(color); final Group shape = new Group(); shape.getChildren().add(path1); shape.getChildren().add(path2); return shape; } return path1; }
if (vessel.getOwner() instanceof IHumanPlayer) { path = new Path(); path.setStroke(Color.RED);
@Override @Pure public Node drawShape(MapPoint element, RectangularShape2afp<?, ?, ?, ?, ?, ?> bounds) { final Path[] paths = createPaths(element, bounds); final Path path1 = paths[0]; final Color color = GisFxTools.rgb(element.getColor()); path1.setFill(color); path1.setStroke(color); if (paths.length > 1) { final Path path2 = paths[1]; path2.setFill(null); path2.setStroke(color); final Group shape = new Group(); shape.getChildren().add(path1); shape.getChildren().add(path2); return shape; } return path1; }
@Override @Pure public Node drawShape(MapPolygon element, RectangularShape2afp<?, ?, ?, ?, ?, ?> bounds) { final Path fxPath = createPath(element, bounds); final Color color = GisFxTools.rgb(element.getColor()); fxPath.setFill(color); fxPath.setStroke(color); return fxPath; }
path.setStroke(Color.TRANSPARENT); root.getChildren().add(path);