public EllipseSample() { super(180,90); // Simple red filled ellipse Ellipse ellipse1 = new Ellipse(45,45,30,45); ellipse1.setFill(Color.RED); // Blue stroked ellipse Ellipse ellipse2 = new Ellipse(135,45,30,45); ellipse2.setStroke(Color.DODGERBLUE); ellipse2.setFill(null); // Create a group to show all the ellipses); getChildren().add(new Group(ellipse1,ellipse2)); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Ellipse 1 Fill", ellipse1.fillProperty()), new SimplePropertySheet.PropDesc("Ellipse 1 Width", ellipse1.radiusXProperty(), 10d, 40d), new SimplePropertySheet.PropDesc("Ellipse 1 Height", ellipse1.radiusYProperty(), 10d, 45d), new SimplePropertySheet.PropDesc("Ellipse 2 Stroke", ellipse2.strokeProperty()), new SimplePropertySheet.PropDesc("Ellipse 2 Stroke Width", ellipse2.strokeWidthProperty(), 1d, 5d), new SimplePropertySheet.PropDesc("Ellipse 2 Width", ellipse2.radiusXProperty(), 10d, 40d), new SimplePropertySheet.PropDesc("Ellipse 2 Height", ellipse2.radiusYProperty(), 10d, 45d) ); // END REMOVE ME }
/** * 添加一个椭圆 * * @param dragBox * @param strokeWidth * @param rotate * @param fill * @param stroke */ private void circle(DragBox dragBox, double strokeWidth, double rotate, Color fill, Color stroke) { dragBox.setContentNode(new Ellipse(), (node, root) -> { ((Ellipse) node).centerXProperty().bind(root.widthProperty().divide(2)); ((Ellipse) node).centerYProperty().bind(root.heightProperty().divide(2)); ((Ellipse) node).radiusXProperty().bind(root.widthProperty().divide(2).subtract(10)); ((Ellipse) node).radiusYProperty().bind(root.heightProperty().divide(2).subtract(10)); ((Ellipse) node).setSmooth(true); root.setLineWidth(strokeWidth); root.setNodeRotate(rotate); root.setColor(fill); root.setLineColor(stroke); }); mainPane.getChildren() .add(dragBox); mainPane.setChooseListener(dragBox); mainPane.requestFocus(); }
@Before public void findSourceTarget() { from = Lookups.byID(scene, ID_RECTANGLE, Node.class); fromPoint = from.getClickPoint(); toEllipse = Lookups.byID(scene, ID_ELLIPSE, Node.class); toEllipsePoint = toEllipse.getClickPoint(); toEllipsePoint.x = (int) (toEllipsePoint.x - ((Ellipse) toEllipse.getControl()).getRadiusX() + 2); toCircle = Lookups.byID(scene, ID_CIRCLEOVERELLIPSE, Node.class); toCirclePoint = toCircle.getClickPoint(); toParentNode = Lookups.byID(scene, ID_VB, Node.class); toParentPoint = toParentNode.getClickPoint(); toParentPoint.x = (int) (toParentPoint.x - ((Pane) toParentNode.getControl()).getWidth() / 2 + 3); toParentPoint.y = (int) (toParentPoint.y - ((Pane) toParentNode.getControl()).getHeight() / 2 + 3); }
/** * Returns a group containing all GraphSegments on the segment coordinates. */ private Group getGraphSegments() { double maxY = dbm.getDbReader().getMaxYCoord(); double ellipseHeigth = 30*maxY/1050; System.out.println("MAX Y: " + maxY); Group res = new Group(); Iterator<Integer> iterator = segmentIds.iterator(); while (iterator.hasNext()) { int segmentId = iterator.next(); Group graphSegment = new Group(); Ellipse ellipse = createEllipse(segmentId,ellipseHeigth); graphSegment.getChildren().add(ellipse); graphSegment.getChildren().add(visualizeDnaContent(segmentId)); graphSegment.addEventFilter(MouseEvent.MOUSE_CLICKED, new NodeSelectHandler(segmentId, selectedContent, dbm)); res.getChildren().add(graphSegment); } return res; }
/** * Create stimulus in ellipse shape. * @param locationX * @param locationY * @param sizeXY * @return Ellipse stimulus. */ private Ellipse createEllipseStimulus(double locationX, double locationY, double[] sizeXY) { /* Get horizontal and vertical radius of the ellipse */ double radiusX = sizeXY[0] / 2; double radiusY = sizeXY[1] / 2; /* Get ellipse color */ double hue = settings.getLuminanceScaleForStimuli().getHue(); double saturation = settings.getLuminanceScaleForStimuli().getSaturation() / 100; double brightness = settings.getStimuliMaxBrightness() / 100; Color color = Color.hsb(hue, saturation, brightness); /* Create ellipse */ Ellipse ellipse = new Ellipse(locationX, locationY, radiusX, radiusY); ellipse.setFill(color); ellipse.setStroke(color); return ellipse; }
public void setDisplayVals(int displayWidth, int displayHeight, int feedWidth, int feedHeight) { final double scaleX = (double) displayWidth / (double) feedWidth; final double scaleY = (double) displayHeight / (double) feedHeight; double scaledX, scaledY; if (displayX.isPresent()) { scaledX = displayX.get() * scaleX; scaledY = displayY.get() * scaleY; } else { scaledX = super.getX() * scaleX; scaledY = super.getY() * scaleY; } if (logger.isTraceEnabled()) { logger.trace("setTranslation {} {} - {} {} to {} {}", scaleX, scaleY, super.getX(), super.getY(), scaledX, scaledY); } marker = new Ellipse(scaledX, scaledY, marker.radiusXProperty().get(), marker.radiusYProperty().get()); marker.setFill(colorMap.get(color)); displayX = Optional.of(scaledX); displayY = Optional.of(scaledY); }
@Override public void Draw(Pane canvas) { double outerDiamX = canvas.getWidth() * (GetDoubleAttribute("Width") / MaximumX); double outerDiamY = GetDoubleAttribute("Height") == 0 ? outerDiamX : canvas.getHeight() * (GetDoubleAttribute("Height") / MaximumY); double proportion = GetDoubleAttribute("Size") / MaximumX; double innerDiamX = outerDiamX * proportion; double innerDiamY = outerDiamY * proportion; double locX = (canvas.getWidth() * (GetDoubleAttribute("X") / MaximumX)); double locY = (canvas.getHeight() * (GetDoubleAttribute("Y") / MaximumY)); Ellipse outer = new Ellipse(locX, locY, outerDiamX / 2, outerDiamY / 2); Ellipse inner = new Ellipse(locX, locY, innerDiamX / 2, innerDiamY / 2); Shape ring = Path.subtract(outer, inner); ring.setFill(GetColorAttribute("Color")); canvas.getChildren().add(ring); }
@Override protected Shape[] Thumbnail() { Rectangle border = new Rectangle(25, 30, new Color(1, 1, 0, 0)); border.setStrokeWidth(3); border.setLayoutX(2.5); Rectangle square = new Rectangle(8, 8); square.setLayoutX(7); square.setLayoutY(5); Ellipse circle = new Ellipse(19, 15, 4, 4); Polygon triangle = new Polygon(8, 25, 12, 17, 16, 25); return new Shape[] { border, square, circle, triangle }; }
@Override protected Shape[] Thumbnail() { final int count = 7; final int radius = 10; final double interval = 2 * Math.PI / count; Shape[] shapes = new Shape[count]; for (int i = 0; i < count; i++) { double left = Math.cos(i * interval) * radius + 15; double top = Math.sin(i * interval) * radius + 15; shapes[i] = new Ellipse(left, top, 2.5, 2.5); } return shapes; }
private Group encloseLabelWithOval(DrawingEntity entity, Label label) { Ellipse ellipse = new Ellipse(); ellipse.getStyleClass().add("outline"); ellipse.setFill(entity.getColor()); ellipse.setCenterX(0); ellipse.setCenterY(0); int insets = 5; label.boundsInLocalProperty().addListener((observable, oldValue, newValue) -> { double halfWidth = newValue.getWidth() / 2; double halfHeight = newValue.getHeight() / 2; label.setLayoutX(-halfWidth); label.setLayoutY(-halfHeight); // Calculate the relevant radii of the ellipse while maintaining // aspect ratio. // Thanks: http://stackoverflow.com/questions/433371/ellipse-bounding-a-rectangle ellipse.setRadiusX((halfWidth + insets) * SQRT2); ellipse.setRadiusY((halfHeight + insets) * SQRT2); }); return new Group(ellipse, label); }
@Override public void start(Stage primaryStage) throws IOException { Group root = new Group(); // describes the window itself: name, size primaryStage.setTitle(" Aufgabe 10 by John Malc "); primaryStage.setScene(new Scene(root)); // say: center on screen, user can resize, and it will in general exists primaryStage.centerOnScreen(); primaryStage.setResizable(true); primaryStage.show(); // Ellipse alone Ellipse a = new Ellipse(); a.setFill(Color.RED); a.setCenterX(205); a.setCenterY(150); a.setRadiusX(80); a.setRadiusY(30); // shows Ellipse and it will add it to the group root.getChildren().add(new Group(a)); }
private void configureBackground() { ImageView imageView = new ImageView(); Image image = loadImage(); imageView.setImage(image); Circle circle1 = new Circle(); circle1.setCenterX(140); circle1.setCenterY(140); circle1.setRadius(120); circle1.setFill(Color.TRANSPARENT); circle1.setStroke(Color.web("#0A0A0A")); circle1.setStrokeWidth(0.3); Circle circle2 = new Circle(); circle2.setCenterX(140); circle2.setCenterY(140); circle2.setRadius(118); circle2.setFill(Color.TRANSPARENT); circle2.setStroke(Color.web("#0A0A0A")); circle2.setStrokeWidth(0.3); Circle circle3 = new Circle(); circle3.setCenterX(140); circle3.setCenterY(140); circle3.setRadius(140); circle3.setFill(Color.TRANSPARENT); circle3.setStroke(Color.web("#818a89")); circle3.setStrokeWidth(1); Ellipse ellipse = new Ellipse(140, 95, 180, 95); Circle ellipseClip = new Circle(140, 140, 140); ellipse.setFill(Color.web("#535450")); ellipse.setStrokeWidth(0); GaussianBlur ellipseEffect = new GaussianBlur(); ellipseEffect.setRadius(10); ellipse.setEffect(ellipseEffect); ellipse.setOpacity(0.1); ellipse.setClip(ellipseClip); background.getChildren().addAll(imageView, circle1, circle2, circle3, ellipse); }
private Shape createPieceTab(double eclipseCenterX, double eclipseCenterY, double eclipseRadiusX, double eclipseRadiusY, double rectangleX, double rectangleY, double rectangleWidth, double rectangleHeight, double circle1CenterX, double circle1CenterY, double circle1Radius, double circle2CenterX, double circle2CenterY, double circle2Radius) { Ellipse e = new Ellipse(eclipseCenterX, eclipseCenterY, eclipseRadiusX, eclipseRadiusY); Rectangle r = new Rectangle(rectangleX, rectangleY, rectangleWidth, rectangleHeight); Shape tab = Shape.union(e, r); Circle c1 = new Circle(circle1CenterX, circle1CenterY, circle1Radius); tab = Shape.subtract(tab, c1); Circle c2 = new Circle(circle2CenterX, circle2CenterY, circle2Radius); tab = Shape.subtract(tab, c2); return tab; }
public static Node createIconContent() { Ellipse ellipse = new Ellipse(57,57, 20,40); ellipse.setStroke(Color.web("#b9c0c5")); ellipse.setStrokeWidth(5); ellipse.getStrokeDashArray().addAll(15d,15d); ellipse.setFill(null); javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow(); effect.setOffsetX(1); effect.setOffsetY(1); effect.setRadius(3); effect.setColor(Color.rgb(0,0,0,0.6)); ellipse.setEffect(effect); return ellipse; }
private EllipseNode(Ellipse ellipse) { super(ellipse); this.ellipse = ellipse; centerX = PropertyTimelineHolder.empty(); centerY = PropertyTimelineHolder.empty(); radiusX = PropertyTimelineHolder.empty(); radiusY = PropertyTimelineHolder.empty(); }
private Node[] createBubble(final double SIZE) { final double CENTER = SIZE * 0.5; final Node[] NODES = new Node[3]; final Circle MAIN = new Circle(CENTER, CENTER, CENTER); final Paint MAIN_FILL = new LinearGradient(CENTER, 0.02 * SIZE, 0.50 * SIZE, 0.98 * SIZE, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.TRANSPARENT), new Stop(0.85, Color.rgb(255, 255, 255, 0.2)), new Stop(1.0, Color.rgb(255, 255, 255, 0.90))); MAIN.setFill(MAIN_FILL); MAIN.setStroke(null); final Circle FRAME = new Circle(CENTER, CENTER, CENTER); final Paint FRAME_FILL = new RadialGradient(0, 0, CENTER, CENTER, 0.48 * SIZE, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.TRANSPARENT), new Stop(0.92, Color.TRANSPARENT), new Stop(1.0, Color.rgb(255, 255, 255, 0.5))); FRAME.setFill(FRAME_FILL); FRAME.setStroke(null); final Ellipse HIGHLIGHT = new Ellipse(CENTER, 0.27 * SIZE, 0.38 * SIZE, 0.25 * SIZE); final Paint HIGHLIGHT_FILL = new LinearGradient(CENTER, 0.04 * SIZE, CENTER, CENTER, false, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(255, 255, 255, 0.7)), new Stop(1.0, Color.TRANSPARENT)); HIGHLIGHT.setFill(HIGHLIGHT_FILL); HIGHLIGHT.setStroke(null); NODES[0] = FRAME; NODES[1] = MAIN; NODES[2] = HIGHLIGHT; return NODES; }
public void start(Stage s1) { Scene scene1 = new Scene(new Group()); Group root = new Group(); scene1.setRoot(root); Ellipse circle = new Ellipse(30, 30, 30, 30); root.getChildren().add(circle); s1.setWidth(100); s1.setHeight(100); s1.setX(50); s1.setY(50); s1.setScene(scene1); s1.show(); s1.setTitle("title0"); Scene scene2 = new Scene(new Group()); Group root2 = new Group(); scene2.setRoot(root2); Group g = new Group(); g.setLayoutX(0); g.setLayoutY(0); Rectangle rect = new Rectangle(10, 20, 70, 40); rect.setId("rect1"); g.getChildren().add(rect); root2.getChildren().add(g); Text text = new Text(); text.setText("text1"); text.setFont(new Font(Font.getDefault().getFamily(), 20F)); g.getChildren().add(text); Stage s2 = new Stage(); s2.setTitle("title1"); s2.setWidth(200); s2.setHeight(200); s2.setX(200); s2.setY(200); s2.setScene(scene2); s2.show(); }
/** * Returns a visualization of a graph segment */ public Ellipse createEllipse(int segmentId, double ellipseHeigth) { int contentLength = segmentdna.get(segmentId - 1).length(); double xcoord = graphxcoords.get(segmentId - 1); double ycoord = graphycoords.get(segmentId - 1); double xradius = 30 + 2 * Math.log(contentLength); Ellipse node = new Ellipse(xcoord, ycoord, xradius, ellipseHeigth); node.setFill(Color.DODGERBLUE); node.setStroke(Color.BLACK); node.setStrokeType(StrokeType.INSIDE); return node; }
/** * Draw fixation point on given location on Display Pane. */ private void drawFixationPoint() { /* Create Ellipse object, fill it and set its stroke */ Ellipse fixPoint = new Ellipse(centerOfTheGridInPxX, centerOfTheGridInPxY, fixPointSizeInPxX / 2, fixPointSizeInPxY / 2); fixPoint.setFill(fixPointColor); fixPoint.setStroke(fixPointColor); /* Add created fixation point to the Display Pane */ displayPane.getChildren().add(fixPoint); }
/** * Init fixation monitor shape. */ private void initFixationMonitorShape() { double monitorStimulusRadiusX = (settingsFixMonFixPointChange.getChangedFixPointSizeInDegreesHorizontal() / 2) * pxForOneDgX; double monitorStimulusRadiusY = (settingsFixMonFixPointChange.getChangedFixPointSizeInDegreesVertical() / 2) * pxForOneDgY; fixationMonitorShape = new Ellipse(centerOfTheGridInPxX, centerOfTheGridInPxY, monitorStimulusRadiusX, monitorStimulusRadiusY); fixationMonitorShape.setFill(settingsFixMonFixPointChange.getChangedFixPointColor()); fixationMonitorShape.setStroke(settingsFixMonFixPointChange.getChangedFixPointColor()); }
/** * Init fixation monitor shape. */ private void initFixationMonitorShape() { double monitorStimulusRadiusX = (settingsFixMonitorBlindspot.getMonitorStimulusSizeInDegreesHorizontal() / 2) * pxForOneDgX; double monitorStimulusRadiusY = (settingsFixMonitorBlindspot.getMonitorStimulusSizeInDegreesVertical() / 2) * pxForOneDgY; double monitorStimulusPositionX; double monitorStimulusPositionY; if (settings.isUseCorrectionForSphericityOfTheFieldOfView()) { double r = StartApplication.getSpecvisData().getUiSettingsScreenAndLuminanceScale().getPatientDistanceFromTheScreen(); double ax = settingsFixMonitorBlindspot.getMonitorStimulusDistanceFromFixPointInDegreesHorizontal(); double ay = settingsFixMonitorBlindspot.getMonitorStimulusDistanceFromFixPointInDegreesVertical(); double mx = functions.calculateOppositeAngle(ax, r); double my = functions.calculateOppositeAngle(ay, r); double mxPixels = functions.millimitersToPixels(mx, screenResInPxX, settings.getScreenWidthInMm()); double myPixels = functions.millimitersToPixels(my, screenResInPxY, settings.getScreenHeightInMm()); monitorStimulusPositionX = centerOfTheGridInPxX + mxPixels; monitorStimulusPositionY = centerOfTheGridInPxY + myPixels; } else { monitorStimulusPositionX = centerOfTheGridInPxX + (settingsFixMonitorBlindspot.getMonitorStimulusDistanceFromFixPointInDegreesHorizontal() * pxForOneDgX); monitorStimulusPositionY = centerOfTheGridInPxY + (settingsFixMonitorBlindspot.getMonitorStimulusDistanceFromFixPointInDegreesVertical() * pxForOneDgY); } double hue = settings.getLuminanceScaleForStimuli().getHue(); double saturation = settings.getLuminanceScaleForStimuli().getSaturation() / 100; double brightness = Double.valueOf(settingsFixMonitorBlindspot.getMonitorStimulusBrightness()) / 100; Color color = Color.hsb(hue, saturation, brightness); fixationMonitorShape = new Ellipse(monitorStimulusPositionX, monitorStimulusPositionY, monitorStimulusRadiusX, monitorStimulusRadiusY); fixationMonitorShape.setFill(color); fixationMonitorShape.setStroke(color); }
private void drawFixationPoint() { double radiusX = (fixationPointSizeX / 2) * pixelsForOneDegreeX; double radiusY = (fixationPointSizeY / 2) * pixelsForOneDegreeY; Ellipse ellipse = new Ellipse(centerOfTheGridInPixelsX, centerOfTheGridInPixelsY, radiusX, radiusY); ellipse.setFill(fixationPointColor); ellipse.setStroke(fixationPointColor); displayPane.getChildren().add(ellipse); }
/** * Init fixation monitor shape (Blindspot). */ private void initFixationMonitorShape_Blindspot() { double monitorStimulusRadiusX = (settingsFixMonitorBoth.getFixMonitorStimulusSizeInDgX() / 2) * pxForOneDgX; double monitorStimulusRadiusY = (settingsFixMonitorBoth.getFixMonitorStimulusSizeInDgY() / 2) * pxForOneDgY; double monitorStimulusPositionX; double monitorStimulusPositionY; if (settings.isUseCorrectionForSphericityOfTheFieldOfView()) { double r = StartApplication.getSpecvisData().getUiSettingsScreenAndLuminanceScale().getPatientDistanceFromTheScreen(); double ax = settingsFixMonitorBoth.getFixMonitorStimulusDistanceFromFixPointInDgX(); double ay = settingsFixMonitorBoth.getFixMonitorStimulusDistanceFromFixPointInDgY(); double mx = functions.calculateOppositeAngle(ax, r); double my = functions.calculateOppositeAngle(ay, r); double mxPixels = functions.millimitersToPixels(mx, screenResInPxX, settings.getScreenWidthInMm()); double myPixels = functions.millimitersToPixels(my, screenResInPxY, settings.getScreenHeightInMm()); monitorStimulusPositionX = centerOfTheGridInPxX + mxPixels; monitorStimulusPositionY = centerOfTheGridInPxY + myPixels; } else { monitorStimulusPositionX = centerOfTheGridInPxX + (settingsFixMonitorBoth.getFixMonitorStimulusDistanceFromFixPointInDgX() * pxForOneDgX); monitorStimulusPositionY = centerOfTheGridInPxY + (settingsFixMonitorBoth.getFixMonitorStimulusDistanceFromFixPointInDgY() * pxForOneDgY); } double hue = settings.getLuminanceScaleForStimuli().getHue(); double saturation = settings.getLuminanceScaleForStimuli().getSaturation() / 100; double brightness = Double.valueOf(settingsFixMonitorBoth.getFixMonitorStimulusBrightness()) / 100; Color color = Color.hsb(hue, saturation, brightness); fixationMonitorShape = new Ellipse(monitorStimulusPositionX, monitorStimulusPositionY, monitorStimulusRadiusX, monitorStimulusRadiusY); fixationMonitorShape.setFill(color); fixationMonitorShape.setStroke(color); }
/** * Init fixation monitor shape (Fixation point change). */ private void initFixationMonitorShape_FixPointChange() { double monitorStimulusRadiusX = (settingsFixMonitorBoth.getChangedFixPointSizeInDgX() / 2) * pxForOneDgX; double monitorStimulusRadiusY = (settingsFixMonitorBoth.getChangedFixPointSizeInDgY() / 2) * pxForOneDgY; fixationMonitorShape = new Ellipse(centerOfTheGridInPxX, centerOfTheGridInPxY, monitorStimulusRadiusX, monitorStimulusRadiusY); fixationMonitorShape.setFill(settingsFixMonitorBoth.getChangedFixPointColor()); fixationMonitorShape.setStroke(settingsFixMonitorBoth.getChangedFixPointColor()); }
public Bond(boolean isInput) { super(); this.setMinSize(0, 0); this.setMaxSize(0, 0); Ellipse bond = new Ellipse(7, 3); bond.setFill(Color.BLACK); bond.setTranslateY(isInput ? -3 : 3); this.getChildren().add(bond); }
public static String shapeToSvgString(final Shape SHAPE) { final StringBuilder fxPath = new StringBuilder(); if (Line.class.equals(SHAPE.getClass())) { fxPath.append(convertLine((Line) SHAPE)); } else if (Arc.class.equals(SHAPE.getClass())) { fxPath.append(convertArc((Arc) SHAPE)); } else if (QuadCurve.class.equals(SHAPE.getClass())) { fxPath.append(convertQuadCurve((QuadCurve) SHAPE)); } else if (CubicCurve.class.equals(SHAPE.getClass())) { fxPath.append(convertCubicCurve((CubicCurve) SHAPE)); } else if (Rectangle.class.equals(SHAPE.getClass())) { fxPath.append(convertRectangle((Rectangle) SHAPE)); } else if (Circle.class.equals(SHAPE.getClass())) { fxPath.append(convertCircle((Circle) SHAPE)); } else if (Ellipse.class.equals(SHAPE.getClass())) { fxPath.append(convertEllipse((Ellipse) SHAPE)); } else if (Text.class.equals(SHAPE.getClass())) { Path path = (Path)(Shape.subtract(SHAPE, new Rectangle(0, 0))); fxPath.append(convertPath(path)); } else if (Path.class.equals(SHAPE.getClass())) { fxPath.append(convertPath((Path) SHAPE)); } else if (Polygon.class.equals(SHAPE.getClass())) { fxPath.append(convertPolygon((Polygon) SHAPE)); } else if (Polyline.class.equals(SHAPE.getClass())) { fxPath.append(convertPolyline((Polyline) SHAPE)); } else if (SVGPath.class.equals(SHAPE.getClass())) { fxPath.append(((SVGPath) SHAPE).getContent()); } return fxPath.toString(); }
public static String convertEllipse(final Ellipse ELLIPSE) { final StringBuilder fxPath = new StringBuilder(); final double CENTER_X = ELLIPSE.getCenterX() == 0 ? ELLIPSE.getRadiusX() : ELLIPSE.getCenterX(); final double CENTER_Y = ELLIPSE.getCenterY() == 0 ? ELLIPSE.getRadiusY() : ELLIPSE.getCenterY(); final double RADIUS_X = ELLIPSE.getRadiusX(); final double RADIUS_Y = ELLIPSE.getRadiusY(); final double CONTROL_DISTANCE_X = RADIUS_X * KAPPA; final double CONTROL_DISTANCE_Y = RADIUS_Y * KAPPA; // Move to first point fxPath.append("M ").append(CENTER_X).append(" ").append(CENTER_Y - RADIUS_Y).append(" "); // 1. quadrant fxPath.append("C ").append(CENTER_X + CONTROL_DISTANCE_X).append(" ").append(CENTER_Y - RADIUS_Y).append(" ") .append(CENTER_X + RADIUS_X).append(" ").append(CENTER_Y - CONTROL_DISTANCE_Y).append(" ") .append(CENTER_X + RADIUS_X).append(" ").append(CENTER_Y).append(" "); // 2. quadrant fxPath.append("C ").append(CENTER_X + RADIUS_X).append(" ").append(CENTER_Y + CONTROL_DISTANCE_Y).append(" ") .append(CENTER_X + CONTROL_DISTANCE_X).append(" ").append(CENTER_Y + RADIUS_Y).append(" ") .append(CENTER_X).append(" ").append(CENTER_Y + RADIUS_Y).append(" "); // 3. quadrant fxPath.append("C ").append(CENTER_X - CONTROL_DISTANCE_X).append(" ").append(CENTER_Y + RADIUS_Y).append(" ") .append(CENTER_X - RADIUS_X).append(" ").append(CENTER_Y + CONTROL_DISTANCE_Y).append(" ") .append(CENTER_X - RADIUS_X).append(" ").append(CENTER_Y).append(" "); // 4. quadrant fxPath.append("C ").append(CENTER_X - RADIUS_X).append(" ").append(CENTER_Y - CONTROL_DISTANCE_Y).append(" ") .append(CENTER_X - CONTROL_DISTANCE_X).append(" ").append(CENTER_Y - RADIUS_Y).append(" ") .append(CENTER_X).append(" ").append(CENTER_Y - RADIUS_Y).append(" "); // Close path fxPath.append("Z"); return fxPath.toString(); }
public ArenaShot(DisplayShot shot) { super(shot, shot.getMarker()); if (shot instanceof ArenaShot) { this.arenaX = ((ArenaShot) shot).arenaX; this.arenaY = ((ArenaShot) shot).arenaY; } this.arenaMarker = new Ellipse(getX(), getY(), shot.getMarker().getRadiusX(), shot.getMarker().getRadiusX()); this.arenaMarker.setFill(colorMap.get(color)); }
public void setArenaCoords(double x, double y) { arenaX = Optional.of(x); arenaY = Optional.of(y); this.arenaMarker = new Ellipse(getX(), getY(), getMarker().getRadiusX(), getMarker().getRadiusX()); this.arenaMarker.setFill(colorMap.get(color)); }