QGCMapUrlEngine.h 1.86 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

Don Gagne's avatar
Don Gagne committed
27
#define MAX_MAP_ZOOM (20.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 51
    int getIdFromType(QString type);
    QString getTypeFromId(int id);

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

56 57
    bool isElevation(int mapId);

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

dogmaphobic's avatar
dogmaphobic committed
63 64 65
};

#endif