GoogleMapProvider.h 1.47 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#pragma once

#include "MapProvider.h"

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

class GoogleMapProvider : public MapProvider {
    Q_OBJECT
  public:
    GoogleMapProvider(QObject* parent);

    ~GoogleMapProvider();

    static quint32 getAverageSize();
    // Google Specific private slots
  private slots:
    void _networkReplyError(QNetworkReply::NetworkError error);
    void _googleVersionCompleted();
    void _replyDestroyed();

Pierre TILAK's avatar
Pierre TILAK committed
26
  protected:
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
    // Define the url to Request
    QString _getURL(int x, int y, int zoom,
                    QNetworkAccessManager* networkManager) ;

    // Google Specific private methods
    void _getSecGoogleWords(int x, int y, QString& sec1, QString& sec2);
    void _tryCorrectGoogleVersions(QNetworkAccessManager* networkManager);

    // Google Specific attributes
    bool           _googleVersionRetrieved;
    QNetworkReply* _googleReply;
    QMutex         _googleVersionMutex;
    QString        _versionGoogleMap;
    QString        _versionGoogleSatellite;
    QString        _versionGoogleLabels;
    QString        _versionGoogleTerrain;
    QString        _secGoogleWord;
};
Pierre TILAK's avatar
Pierre TILAK committed
45 46 47 48 49 50 51 52 53

class GoogleSatelliteMapProvider : public GoogleMapProvider {
    Q_OBJECT
  public:
    GoogleSatelliteMapProvider(QObject* parent):GoogleMapProvider(parent){}
  protected:
    QString _getURL(int x, int y, int zoom,
                    QNetworkAccessManager* networkManager);
};