Select Git revision
Updater.class.uniqueId0
Forked from
COUETOUX Basile / FirefighterStarter
Source project has a limited visibility.
-
BACHTARZI Imed eddine authored
used the Factory Method through ElementFactory
BACHTARZI Imed eddine authoredused the Factory Method through ElementFactory
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
CenterDecorator.java 843 B
package shape;
import javafx.geometry.Point2D;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;
public class CenterDecorator extends Decorator{
private final double radius;
public CenterDecorator(Shape decoratedShape, double radius) {
super(decoratedShape);
this.radius = radius;
}
protected void drawDecoration(GraphicsContext context) {
if (decoratedshape.pointsCount() >= 2) {
Point2D point0 = decoratedshape.point(0);
Point2D point1 = decoratedshape.point(1);
double centerX = point0.getX() + point1.getX() / 2;
double centerY = point0.getY() + point1.getY() / 2;
context.setFill(Color.RED);
context.strokeOval(centerX - radius, centerY - radius, radius * 2, radius * 2);
}
}
}