ElevationMapProvider.h 1.47 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
//-----------------------------------------------------------------------------
Cosmin Marc's avatar
Cosmin Marc committed
15
static const double srtm1TileSize = 0.01;
16 17 18 19

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

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

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

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

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

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

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

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