@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); }
path2.setFill(Color.RED); path2.setStroke(Color.RED); path2.setStrokeWidth(1); path2.setLayoutX(0); path2.setLayoutY(0);
path.setStroke(Color.RED); path.setStrokeWidth(2); if (!pathModel.getBezierCurves().isEmpty()) { Point2D p = pathModel.getStartpoint();
createBackgroundShape, (backgroundShape, tuple) -> { backgroundShape.setStrokeWidth(0); backgroundShape.setFill(tuple._1); backgroundShape.getElements().setAll(getRangeShape(tuple._2)); (borderShape, tuple) -> { BorderAttributes attributes = tuple._1; borderShape.setStrokeWidth(attributes.width); borderShape.setStroke(attributes.color); if (attributes.type != null) { UnderlineAttributes attributes = tuple._1; underlineShape.setStroke(attributes.color); underlineShape.setStrokeWidth(attributes.width); underlineShape.setStrokeLineCap(attributes.cap); if (attributes.dashArray != null) {