DefaultManager.h 1.34 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
#pragma once

#include <QGeoCoordinate>
#include <QVector>

#include "GenericWaypointManager.h"
#include "QmlObjectListModel.h"
#include "Settings.h"
#include "AreaInterface.h"

namespace WaypointManager {

typedef GenericWaypointManager<QGeoCoordinate,
                               QVector,
                               QmlObjectListModel,
                               Settings>
        ManagerBase;

class DefaultManager : public ManagerBase
{
public:
    DefaultManager() = delete;
23 24 25 26
    DefaultManager(Settings &settings,
                   AreaInterface &interface);

    void clear() override;
27 28 29 30 31 32 33 34


    virtual bool update() override;
    virtual bool next() override;
    virtual bool previous() override;
    virtual bool reset() override;

protected:
35 36 37 38 39 40 41
    bool _insertMissionItem(const QGeoCoordinate &c,
                            size_t index,
                            QmlObjectListModel &list,
                            bool doUpdate);
    bool _insertMissionItem(const QGeoCoordinate &c,
                            size_t index,
                            bool doUpdate);
42 43 44 45 46 47 48 49 50 51 52
    bool _calcShortestPath(const QGeoCoordinate &start,
                           const QGeoCoordinate &destination,
                           QVector<QGeoCoordinate> &path);

    AreaInterface *_areaInterface;
private:
    bool _worker();

};

} // namespace WaypointManager