AirspaceAdvisoryProvider.h 3.48 KB
Newer Older
Gus Grubba's avatar
Gus Grubba committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/****************************************************************************
 *
 *   (c) 2017 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#pragma once

/**
 * @file AirspaceAdvisoryProvider.h
 * Weather information provided by the Airspace Managemement
 */

Gus Grubba's avatar
Gus Grubba committed
17
#include "QmlObjectListModel.h"
18
#include "QGCGeoBoundingCube.h"
Gus Grubba's avatar
Gus Grubba committed
19

Gus Grubba's avatar
Gus Grubba committed
20 21 22
#include <QObject>
#include <QGeoCoordinate>

Gus Grubba's avatar
Gus Grubba committed
23
//-----------------------------------------------------------------------------
Gus Grubba's avatar
Gus Grubba committed
24 25 26 27
class AirspaceAdvisoryProvider : public QObject
{
    Q_OBJECT
public:
Gus Grubba's avatar
Gus Grubba committed
28 29 30 31 32 33 34 35 36 37

    enum AdvisoryColor {
        Green,
        Yellow,
        Orange,
        Red
    };

    Q_ENUM(AdvisoryColor)

Gus Grubba's avatar
Gus Grubba committed
38 39 40
    AirspaceAdvisoryProvider            (QObject *parent = nullptr);
    virtual ~AirspaceAdvisoryProvider   () {}

Gus Grubba's avatar
Gus Grubba committed
41 42
    Q_PROPERTY(bool                 valid           READ valid          NOTIFY advisoryChanged)
    Q_PROPERTY(AdvisoryColor        airspaceColor   READ airspaceColor  NOTIFY advisoryChanged)
43
    Q_PROPERTY(QmlObjectListModel*  advisories      READ advisories     NOTIFY advisoryChanged)
Gus Grubba's avatar
Gus Grubba committed
44

Gus Grubba's avatar
Gus Grubba committed
45 46
    virtual bool                valid           () = 0;     ///< Current data is valid
    virtual AdvisoryColor       airspaceColor   () = 0;     ///< Aispace overall color
47
    virtual QmlObjectListModel* advisories      () = 0;     ///< List of AirspaceAdvisory
Gus Grubba's avatar
Gus Grubba committed
48 49 50 51 52

    /**
     * Set region of interest that should be queried. When finished, the advisoryChanged() signal will be emmited.
     * @param center Center coordinate for ROI
     */
53
    virtual void setROI (const QGCGeoBoundingCube& roi, bool reset = false) = 0;
Gus Grubba's avatar
Gus Grubba committed
54 55 56 57

signals:
    void advisoryChanged  ();
};
Gus Grubba's avatar
Gus Grubba committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83

//-----------------------------------------------------------------------------
class AirspaceAdvisory : public QObject
{
    Q_OBJECT
public:

    enum AdvisoryType {
        Invalid              = 0,
        Airport              = 1 << 0,
        Controlled_airspace  = 1 << 1,
        Special_use_airspace = 1 << 2,
        Tfr                  = 1 << 3,
        Wildfire             = 1 << 4,
        Park                 = 1 << 5,
        Power_plant          = 1 << 6,
        Heliport             = 1 << 7,
        Prison               = 1 << 8,
        School               = 1 << 9,
        Hospital             = 1 << 10,
        Fire                 = 1 << 11,
        Emergency            = 1 << 12,
    };

    Q_ENUM(AdvisoryType)

84
    AirspaceAdvisory    (QObject* parent = nullptr);
Gus Grubba's avatar
Gus Grubba committed
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104

    Q_PROPERTY(QString          id              READ id             CONSTANT)
    Q_PROPERTY(QString          name            READ name           CONSTANT)
    Q_PROPERTY(AdvisoryType     type            READ type           CONSTANT)
    Q_PROPERTY(QString          typeStr         READ typeStr        CONSTANT)
    Q_PROPERTY(QGeoCoordinate   coordinates     READ coordinates    CONSTANT)
    Q_PROPERTY(qreal            radius          READ radius         CONSTANT)

    Q_PROPERTY(AirspaceAdvisoryProvider::AdvisoryColor color READ color CONSTANT)

    virtual QString         id              () = 0;
    virtual QString         name            () = 0;
    virtual AdvisoryType    type            () = 0;
    virtual QString         typeStr         ();
    virtual QGeoCoordinate  coordinates     () = 0;
    virtual qreal           radius          () = 0;

    virtual AirspaceAdvisoryProvider::AdvisoryColor color () = 0;
};