#pragma once

#include "QScopedPointer"
#include <QObject>

#include "WimaArea.h"

#include "SettingsFact.h"

class WimaMeasurementArea : public WimaArea {
  Q_OBJECT
public:
  WimaMeasurementArea(QObject *parent = nullptr);
  WimaMeasurementArea(const WimaMeasurementArea &other,
                      QObject *parent = nullptr);
  WimaMeasurementArea &operator=(const WimaMeasurementArea &other);

  Q_PROPERTY(Fact *borderPolygonOffset READ borderPolygonOffsetFact CONSTANT)

  // Overrides from WimaPolygon
  QString mapVisualQML(void) const {
    return "WimaMeasurementAreaMapVisual.qml";
  }
  QString editorQML(void) const { return "WimaMeasurementAreaEditor.qml"; }

  // Member Methodes
  void saveToJson(QJsonObject &json);
  bool loadFromJson(const QJsonObject &json, QString &errorString);

  // Friends
  friend void print(const WimaMeasurementArea &area, QString outputStr);
  friend void print(const WimaMeasurementArea &area);

  // Static Variables
  static const char *settingsGroup;
  static const char *tileHeightName;
  static const char *tileWidthName;
  static const char *minTileAreaName;
  static const char *transcetDistanceName;
  static const char *minTransectLength;
  static const char *WimaMeasurementAreaName;

signals:

public slots:

private:
  // Member Methodes
  void init();

  // Members
  QMap<QString, FactMetaData *> _metaDataMap;

  SettingsFact _tileWidth;
  SettingsFact _tileHeight;
  SettingsFact _minTileArea;
  SettingsFact _transectDistance;
  SettingsFact _minTransectLength;
};
