AirspaceController.h 2.02 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
/****************************************************************************
 *
 *   (c) 2009-2016 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

#include "AirspaceManagement.h"
#include "QGCMapPolygon.h"

class AirspaceController : public QObject
{
    Q_OBJECT
    
public:
    AirspaceController(QObject* parent = NULL);
    ~AirspaceController() = default;

Gus Grubba's avatar
Gus Grubba committed
23 24 25 26 27
    Q_PROPERTY(QmlObjectListModel*  polygons    READ polygons       CONSTANT)   ///< List of PolygonAirspaceRestriction objects
    Q_PROPERTY(QmlObjectListModel*  circles     READ circles        CONSTANT)   ///< List of CircularAirspaceRestriction objects
    Q_PROPERTY(QString              weatherIcon READ weatherIcon    NOTIFY weatherChanged)
    Q_PROPERTY(int                  weatherTemp READ weatherTemp    NOTIFY weatherChanged)
    Q_PROPERTY(bool                 hasWeather  READ hasWeather     NOTIFY weatherChanged)
28

Gus Grubba's avatar
Gus Grubba committed
29
    Q_INVOKABLE void setROI(QGeoCoordinate center, double radius);
30 31 32 33 34 35 36

    QmlObjectListModel* polygons() { return _manager->polygonRestrictions(); }
    QmlObjectListModel* circles() { return _manager->circularRestrictions(); }

    Q_PROPERTY(QString providerName             READ providerName CONSTANT)

    QString providerName() { return _manager->name(); }
Gus Grubba's avatar
Gus Grubba committed
37 38 39 40 41 42 43 44 45 46 47

    QString weatherIcon         () { return _weatherIcon; }
    int     weatherTemp         () { return _weatherTemp; }
    bool    hasWeather          () { return _hasWeather;  }

signals:
    void    weatherChanged      ();

private slots:
    void    _weatherUpdate      (bool success, QGeoCoordinate coordinate, WeatherInformation weather);

48
private:
Gus Grubba's avatar
Gus Grubba committed
49 50 51 52 53 54
    AirspaceManager*    _manager;
    QGeoCoordinate      _lastRoiCenter;
    QTime               _weatherTime;
    QString             _weatherIcon;
    int                 _weatherTemp;
    bool                _hasWeather;
55
};