AirmapWeatherInformation.h 2.03 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
/****************************************************************************
 *
 *   (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

Gus Grubba's avatar
Gus Grubba committed
12
#include "LifetimeChecker.h"
13

14 15
#include "AirspaceWeatherInfoProvider.h"

Gus Grubba's avatar
Gus Grubba committed
16 17 18
#include <QGeoCoordinate>
#include <QTime>

19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
/**
 * @file AirMapWeatherInformation.h
 * Weather information provided by AirMap.
 */

class AirMapWeatherInformation : public AirspaceWeatherInfoProvider, public LifetimeChecker
{
    Q_OBJECT
public:
    AirMapWeatherInformation(AirMapSharedState &shared, QObject *parent = nullptr);

    bool        valid           () override { return _valid; }
    QString     condition       () override { return _condition; }
    QString     icon            () override { return _icon; }
    quint32     windHeading     () override { return _windHeading; }
    quint32     windSpeed       () override { return _windSpeed; }
    quint32     windGusting     () override { return _windGusting; }
    qint32      temperature     () override { return _temperature; }
    float       humidity        () override { return _humidity; }
    quint32     visibility      () override { return _visibility; }
    quint32     precipitation   () override { return _precipitation; }

    void        setROI          (const QGeoCoordinate& center) override;

private:
    void        _requestWeatherUpdate   (const QGeoCoordinate& coordinate);

private:
    bool            _valid;
    QString         _condition;
    QString         _icon;
    quint32         _windHeading;
    quint32         _windSpeed;
    quint32         _windGusting;
    qint32          _temperature;
    float           _humidity;
    quint32         _visibility;
    quint32         _precipitation;
    //-- Don't check the weather every time the user moves the map
    QGeoCoordinate  _lastRoiCenter;
    QTime           _weatherTime;
};