#include "MeasurementTile.h"

MeasurementTile::MeasurementTile(QObject *parent)
    : GeoArea(parent), _progress(0), _id(0) {
  init();
}

MeasurementTile::MeasurementTile(const MeasurementTile &other, QObject *parent)
    : GeoArea(other, parent), _progress(other._progress), _id(other._id) {
  init();
}

MeasurementTile::~MeasurementTile() {}

MeasurementTile &MeasurementTile::operator=(const MeasurementTile &other) {
  GeoArea::operator=(other);
  setProgress(other._progress);
  setId(other._id);
  return *this;
}

QString MeasurementTile::mapVisualQML() const { return QStringLiteral(""); }

QString MeasurementTile::editorQML() const { return QStringLiteral(""); }

MeasurementTile *MeasurementTile::clone(QObject *parent) const {
  return new MeasurementTile(*this, parent);
}

void MeasurementTile::push_back(const QGeoCoordinate &c) {
  this->appendVertex(c);
}

void MeasurementTile::init() { this->setObjectName("Tile"); }

int64_t MeasurementTile::id() const { return _id; }

void MeasurementTile::setId(const int64_t &id) {
  if (_id != id) {
    _id = id;
    emit idChanged();
  }
}

QList<QGeoCoordinate> MeasurementTile::tile() const { return coordinateList(); }

double MeasurementTile::progress() const { return _progress; }

void MeasurementTile::setProgress(double progress) {
  if (_progress != progress) {
    _progress = progress;
    emit progressChanged();
  }
}
