QGCMapUrlEngine.h 1.91 KB
Newer Older
1 2
/****************************************************************************
 *
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
dogmaphobic's avatar
dogmaphobic committed
9 10 11 12


/**
 *  @file
13
 *  @author Gus Grubba <gus@auterion.com>
dogmaphobic's avatar
dogmaphobic committed
14 15 16 17 18 19
 */

#ifndef QGC_MAP_URL_ENGINE_H
#define QGC_MAP_URL_ENGINE_H


20 21 22 23 24 25 26 27
#include "GoogleMapProvider.h"
#include "BingMapProvider.h"
#include "GenericMapProvider.h"
#include "EsriMapProvider.h"
#include "MapboxMapProvider.h"
#include "ElevationMapProvider.h"

#define MAX_MAP_ZOOM (23.0)
dogmaphobic's avatar
dogmaphobic committed
28 29 30 31 32 33 34 35

class UrlFactory : public QObject {
    Q_OBJECT
public:

    UrlFactory      ();
    ~UrlFactory     ();

36 37
    QNetworkRequest getTileURL          (QString type, int x, int y, int zoom, QNetworkAccessManager* networkManager);
    QNetworkRequest getTileURL          (int id, int x, int y, int zoom, QNetworkAccessManager* networkManager);
dogmaphobic's avatar
dogmaphobic committed
38

39 40
    QString         getImageFormat      (QString type, const QByteArray& image);
    QString         getImageFormat      (int id , const QByteArray& image);
dogmaphobic's avatar
dogmaphobic committed
41

42
    quint32  averageSizeForType  (QString type);
dogmaphobic's avatar
dogmaphobic committed
43

44 45
    int long2tileX(QString mapType, double lon, int z);
    int lat2tileY(QString mapType, double lat, int z);
dogmaphobic's avatar
dogmaphobic committed
46

47 48 49 50 51 52 53 54 55
    QHash<QString, MapProvider*> getProviderTable(){return _providersTable;}

    int getIdFromType(QString type);
    QString getTypeFromId(int id);
    MapProvider* getMapProviderFromId(int id);

    QGCTileSet getTileCount(int zoom, double topleftLon, double topleftLat,
                            double bottomRightLon, double bottomRightLat,
                            QString mapType);
56

57 58 59 60 61 62
    bool isElevation(int mapId);

  private:
    int             _timeout;
    QHash<QString, MapProvider*> _providersTable;
    void registerProvider(QString Name, MapProvider* provider);
dogmaphobic's avatar
dogmaphobic committed
63 64 65 66

};

#endif