DefaultManager.h 1.58 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#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;
18 19 20 21 22
//!
//! \brief The DefaultManager class is used to manage SimpleMissionItems.
//!
//! @note The \class QmlObjectList returned by \fn missionItems doesn't contain a MissionSettingsItem.
//! This list is supposed to be used for display purposes only.
23 24 25 26
class DefaultManager : public ManagerBase
{
public:
    DefaultManager() = delete;
27 28 29 30
    DefaultManager(Settings &settings,
                   AreaInterface &interface);

    void clear() override;
31 32 33 34 35 36 37 38


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

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

    AreaInterface *_areaInterface;
private:
    bool _worker();

};

} // namespace WaypointManager