ElevationMapProvider.h 1.35 KB
Newer Older
1 2 3
#pragma once

#include "MapProvider.h"
Pierre TILAK's avatar
Pierre TILAK committed
4
#include <cmath>
5 6 7 8 9 10 11 12

#include <QByteArray>
#include <QMutex>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QPoint>
#include <QString>

Cosmin Marc's avatar
Cosmin Marc committed
13
static const quint32 AVERAGE_AIRMAP_ELEV_SIZE = 2786;
14 15 16 17

class ElevationProvider : public MapProvider {
    Q_OBJECT
  public:
Cosmin Marc's avatar
Cosmin Marc committed
18 19
    ElevationProvider(const QString& imageFormat, quint32 averageSize,
                      QGeoMapType::MapStyle mapType, QObject* parent = nullptr);
20

Cosmin Marc's avatar
Cosmin Marc committed
21
    virtual bool _isElevationProvider() const override { return true; }
22 23 24 25 26 27 28 29
};

// -----------------------------------------------------------
// Airmap Elevation

class AirmapElevationProvider : public ElevationProvider {
    Q_OBJECT
  public:
Cosmin Marc's avatar
Cosmin Marc committed
30 31
    AirmapElevationProvider(QObject* parent = nullptr)
        : ElevationProvider(QStringLiteral("bin"), AVERAGE_AIRMAP_ELEV_SIZE,
32 33
                            QGeoMapType::StreetMap, parent) {}

Cosmin Marc's avatar
Cosmin Marc committed
34 35 36
    int long2tileX(const double lon, const int z) const override;

    int lat2tileY(const double lat, const int z) const override;
37

Cosmin Marc's avatar
Cosmin Marc committed
38 39 40
    QGCTileSet getTileCount(const int zoom, const double topleftLon,
                            const double topleftLat, const double bottomRightLon,
                            const double bottomRightLat) const override;
41

42
  protected:
Cosmin Marc's avatar
Cosmin Marc committed
43
    QString _getURL(const int x, const int y, const int zoom, QNetworkAccessManager* networkManager) override;
44 45
};