package shape;

import javafx.geometry.Point2D;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.paint.Color;

public class Polygon extends AbstractShape {

    private final Color color;

    public Polygon(Color color, Point2D... points) {
        this.color = color;
        addPoints(points);
    }


    @Override
    public void draw(GraphicsContext context) {
        context.setStroke(color);
        context.beginPath();
        context.moveTo(points.get(0).getX(), points.get(0).getY());
        for (int i = 1; i < pointsCount() ; i++) {
            context.lineTo(points.get(i).getX(), points.get(i).getY());
        }
        context.closePath();
        context.stroke();

    }

    @Override
    public void paint(GraphicsContext graphicsContext) {

    }

    @Override
    public boolean contains(double x, double y) {
        return false;
    }

    @Override
    public void translate(double dx, double dy) {

    }
}