SnakeDataManager.h 1.54 KB
Newer Older
1 2
#pragma once

3 4
#include <QGeoCoordinate>
#include <QList>
5 6 7 8
#include <QObject>
#include <QThread>

#include "QNemoHeartbeat.h"
9 10
#include "QNemoProgress.h"
#include "SnakeTiles.h"
11

12
#include <boost/units/systems/si.hpp>
13 14 15 16 17

using namespace boost::units;
using Length = quantity<si::length>;
using Area = quantity<si::area>;

18 19
class SnakeDataManager : public QThread {
  Q_OBJECT
20

21 22
  class SnakeImpl;
  using SnakeImplPtr = std::unique_ptr<SnakeImpl>;
23

24 25 26
public:
  SnakeDataManager(QObject *parent = nullptr);
  ~SnakeDataManager() override;
27

28 29 30
  void setMeasurementArea(const QList<QGeoCoordinate> &measurementArea);
  void setServiceArea(const QList<QGeoCoordinate> &serviceArea);
  void setCorridor(const QList<QGeoCoordinate> &corridor);
31

32 33 34 35 36 37
  const QmlObjectListModel *tiles() const;
  QVariantList tileCenterPoints() const;
  QNemoProgress nemoProgress() const;
  bool calcInProgress() const;
  QString errorMessage() const;
  bool success() const;
38

39 40 41
  QVector<QGeoCoordinate> waypoints() const;
  QVector<QGeoCoordinate> arrivalPath() const;
  QVector<QGeoCoordinate> returnPath() const;
42

43 44
  Length lineDistance() const;
  void setLineDistance(Length lineDistance);
45

46 47
  Length minTransectLength() const;
  void setMinTransectLength(Length minTransectLength);
48

49 50
  Area minTileArea() const;
  void setMinTileArea(Area minTileArea);
51

52 53
  Length tileHeight() const;
  void setTileHeight(Length tileHeight);
54

55 56
  Length tileWidth() const;
  void setTileWidth(Length tileWidth);
57

58
signals:
59
  void calcInProgressChanged(bool inProgress);
60 61

protected:
62 63
  void run() override;

64
private:
65
  SnakeImplPtr pImpl;
66
};