SnakeDataManager.h 1.79 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 20 21 22
enum class NemoStatus {
  NotConnected = 0,
  Connected = 1,
  Timeout = -1,
  InvalidHeartbeat = -2
23 24
};

25 26
class SnakeDataManager : public QThread {
  Q_OBJECT
27

28 29
  class SnakeImpl;
  using SnakeImplPtr = std::unique_ptr<SnakeImpl>;
30

31 32 33
public:
  SnakeDataManager(QObject *parent = nullptr);
  ~SnakeDataManager() override;
34

35 36 37
  void setMeasurementArea(const QList<QGeoCoordinate> &measurementArea);
  void setServiceArea(const QList<QGeoCoordinate> &serviceArea);
  void setCorridor(const QList<QGeoCoordinate> &corridor);
38

39 40 41 42 43 44 45
  const QmlObjectListModel *tiles() const;
  QVariantList tileCenterPoints() const;
  QNemoProgress nemoProgress() const;
  int nemoStatus() const;
  bool calcInProgress() const;
  QString errorMessage() const;
  bool success() const;
46

47 48 49
  QVector<QGeoCoordinate> waypoints() const;
  QVector<QGeoCoordinate> arrivalPath() const;
  QVector<QGeoCoordinate> returnPath() const;
50

51 52
  Length lineDistance() const;
  void setLineDistance(Length lineDistance);
53

54 55
  Length minTransectLength() const;
  void setMinTransectLength(Length minTransectLength);
56

57 58
  Area minTileArea() const;
  void setMinTileArea(Area minTileArea);
59

60 61
  Length tileHeight() const;
  void setTileHeight(Length tileHeight);
62

63 64
  Length tileWidth() const;
  void setTileWidth(Length tileWidth);
65

66 67
  void enableRosBridge();
  void disableRosBride();
68

69
signals:
70 71 72
  void nemoProgressChanged();
  void nemoStatusChanged(int status);
  void calcInProgressChanged(bool inProgress);
73 74

protected:
75 76
  void run() override;

77
private:
78
  SnakeImplPtr pImpl;
79
};