SnakeDataManager.h 1.32 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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
#pragma once

#include <QObject>
#include <QThread>
#include <QList>
#include <QGeoCoordinate>

#include "QNemoProgress.h"
#include "QNemoHeartbeat.h"

#include <boost/units/systems/si.hpp>>


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

class SnakeImpl;

class SnakeDataManager : public QThread{
    Q_OBJECT

public:
    using SnakeImplPtr  = std::unique_ptr<SnakeImpl>;

    SnakeDataManager(QObject *parent = nullptr);
    ~SnakeDataManager() override;


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

    QNemoProgress progress();
    QNemoHeartbeat heartbeat();
    bool calcInProgress();

    Length lineDistance() const;
    void setLineDistance(Length lineDistance);

    Length minTransectLength() const;
    void setMinTransectLength(Length minTransectLength);

    Area minTileArea() const;
    void setMinTileArea(Area minTileArea);

    Length tileHeight() const;
    void setTileHeight(Length tileHeight);

    Length tileWidth() const;
    void setTileWidth(Length tileWidth);



protected:
    void run() override;

private:
    bool precondition() const;
    SnakeImplPtr _pImpl;
};