#pragma once

#include <QObject>
#include <QPointF>
#include <QPolygonF>

#include <cmath>

#include "PlanimetryCalculus.h"

class Circle : public QObject
{
    Q_OBJECT
public:
    Circle(QObject *parent = nullptr);
    Circle(double radius = 0, QObject *parent = nullptr);
    Circle(double radius = 0, QPointF origin = QPointF(0,0), QObject *parent = nullptr);
    Circle(const Circle &other, QObject *parent = nullptr);
    Circle &operator=(const Circle &other);

    // Property setters
    void setRadius(double radius);
    void setOrigin(const QPointF &origin);

    // Property getters
    double radius() const;
    QPointF origin() const;

    // Member methodes
    QVector<QPointF> approximate      (int numberOfCorners) const;
    QVector<QPointF> approximate      (double angleDiscretisation) const;
    QVector<QPointF> approximateSektor(int numberOfCorners, double alpha1, double alpha2) const;
    QVector<QPointF> approximateSektor(double angleDiscretisation, double alpha1, double alpha2) const;
    void           toCoordinate     (QPointF &toCoordinate, double alpha) const;
    QPointF        toCoordinate     (double alpha) const;
    bool isNull() const;

signals:
    void radiusChanged(double radius);
    void originChanged(QPointF origin);

private:
    double  _circleRadius;
    QPointF _circleOrigin;
};

