QGCMapUrlEngine.h 1.91 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
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
Gus Grubba's avatar
Gus Grubba committed
13
 *  @author Gus Grubba <gus@auterion.com>
dogmaphobic's avatar
dogmaphobic committed
14 15 16 17 18
 */

#ifndef QGC_MAP_URL_ENGINE_H
#define QGC_MAP_URL_ENGINE_H

Pierre TILAK's avatar
Pierre TILAK committed
19

20
#include "GoogleMapProvider.h"
Pierre TILAK's avatar
Pierre TILAK committed
21
#include "BingMapProvider.h"
22 23
#include "GenericMapProvider.h"
#include "EsriMapProvider.h"
Pierre TILAK's avatar
Pierre TILAK committed
24
#include "MapboxMapProvider.h"
25
#include "ElevationMapProvider.h"
dogmaphobic's avatar
dogmaphobic committed
26

27
#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 38 39 40
    QNetworkRequest getTileURL          (QString type, int x, int y, int zoom, QNetworkAccessManager* networkManager);
    QNetworkRequest getTileURL          (int id, int x, int y, int zoom, QNetworkAccessManager* networkManager);

    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 46
    int long2tileX(QString mapType, double lon, int z);
    int lat2tileY(QString mapType, double lat, int z);

47
    QHash<QString, MapProvider*> getProviderTable(){return _providersTable;}
dogmaphobic's avatar
dogmaphobic committed
48

49 50
    int getIdFromType(QString type);
    QString getTypeFromId(int id);
51
    MapProvider* getMapProviderFromId(int id);
52

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

57 58
    bool isElevation(int mapId);

59
  private:
dogmaphobic's avatar
dogmaphobic committed
60
    int             _timeout;
61
    QHash<QString, MapProvider*> _providersTable;
62
    void registerProvider(QString Name, MapProvider* provider);
63

dogmaphobic's avatar
dogmaphobic committed
64 65 66
};

#endif