WimaServiceArea.h 1.18 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
#pragma once

#include "WimaArea.h"
#include "WimaTrackerPolyline.h"
#include <QObject>

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

  Q_PROPERTY(
      QGeoCoordinate depot READ depotQml WRITE setDepot NOTIFY depotChanged)

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

  // Property acessors
  const QGeoCoordinate &depot(void) const;
  QGeoCoordinate depotQml(void) const;

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

  // static Members
  static const char *wimaServiceAreaName;
  static const char *depotLatitudeName;
  static const char *depotLongitudeName;
  static const char *depotAltitudeName;
signals:
  void depotChanged(void);

public slots:
  bool setDepot(const QGeoCoordinate &coordinate);

private:
  // Member Methodes
  void init();

  // Members
  QGeoCoordinate _depot;
};