AirspaceAdvisoryProvider.h 3.45 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 18
#include "QmlObjectListModel.h"

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

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

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

    Q_ENUM(AdvisoryColor)

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

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

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

    /**
     * Set region of interest that should be queried. When finished, the advisoryChanged() signal will be emmited.
     * @param center Center coordinate for ROI
     */
    virtual void setROI (const QGeoCoordinate& center, double radiusMeters) = 0;

signals:
    void advisoryChanged  ();
};
Gus Grubba's avatar
Gus Grubba committed
57 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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103

//-----------------------------------------------------------------------------
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)

    AirspaceAdvisory    (QObject* parent = NULL);

    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;
};