SnakeThread.h 1.68 KB
Newer Older
1 2
#pragma once

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

8 9
#include "QNemoProgress.h"
#include "SnakeTiles.h"
Valentin Platzgummer's avatar
Valentin Platzgummer committed
10
#include "SnakeTilesLocal.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>;

Valentin Platzgummer's avatar
Valentin Platzgummer committed
18
class SnakeThread : public QThread {
19
  Q_OBJECT
20

Valentin Platzgummer's avatar
Valentin Platzgummer committed
21 22
  class Impl;
  using PImpl = std::unique_ptr<Impl>;
23

24
public:
Valentin Platzgummer's avatar
Valentin Platzgummer committed
25 26
  SnakeThread(QObject *parent = nullptr);
  ~SnakeThread() override;
27

28 29 30
  void setMeasurementArea(const QList<QGeoCoordinate> &measurementArea);
  void setServiceArea(const QList<QGeoCoordinate> &serviceArea);
  void setCorridor(const QList<QGeoCoordinate> &corridor);
Valentin Platzgummer's avatar
Valentin Platzgummer committed
31
  void setProgress(const QVector<int> &progress);
32

Valentin Platzgummer's avatar
Valentin Platzgummer committed
33 34 35
  SnakeTiles tiles() const;
  SnakeTilesLocal tilesENU() const;
  QGeoCoordinate ENUOrigin() const;
36
  QVariantList tileCenterPoints() const;
Valentin Platzgummer's avatar
Valentin Platzgummer committed
37
  QVector<int> progress() const;
38 39 40
  bool calcInProgress() const;
  QString errorMessage() const;
  bool success() const;
41

Valentin Platzgummer's avatar
Valentin Platzgummer committed
42 43 44 45
  bool tilesUpdated();
  bool waypointsUpdated();
  bool progressUpdated();

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

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

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

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

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

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

65
signals:
66
  void calcInProgressChanged(bool inProgress);
67 68

protected:
69 70
  void run() override;

71
private:
Valentin Platzgummer's avatar
Valentin Platzgummer committed
72
  PImpl pImpl;
73
};