Imagery.h 2.08 KB
Newer Older
1 2 3 4 5
#ifndef IMAGERY_H
#define IMAGERY_H

#include <inttypes.h>
#include <string>
6 7
#include <QNetworkAccessManager>
#include <QObject>
8 9 10

#include "Texture.h"

11
class Imagery : public QObject
12
{
13 14
//    Q_OBJECT

15
public:
16
    explicit Imagery(QObject* parent);
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

    enum ImageryType
    {
        MAP = 0,
        SATELLITE = 1
    };

    void setImageryType(ImageryType type);
    void setOffset(double xOffset, double yOffset);
    void setUrl(std::string url);

    void prefetch2D(double windowWidth, double windowHeight,
                    double zoom, double xOrigin, double yOrigin,
                    double viewXOffset, double viewYOffset,
                    const std::string& utmZone);
    void draw2D(double windowWidth, double windowHeight,
                double zoom, double xOrigin, double yOrigin,
                double viewXOffset, double viewYOffset,
                const std::string& utmZone);

    void prefetch3D(double radius, double imageResolution,
                    double xOrigin, double yOrigin,
                    double viewXOffset, double viewYOffset,
                    const std::string& utmZone);
    void draw3D(double radius, double imageResolution,
                double xOrigin, double yOrigin,
                double viewXOffset, double viewYOffset,
                const std::string& utmZone);

    bool update(void);

48 49
private slots:
    void downloadFinished(QNetworkReply* reply);
50

51
private:
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
    void UTMtoTile(double northing, double easting, const std::string& utmZone,
                   double imageResolution, int32_t& tileX, int32_t& tileY,
                   int32_t& zoomLevel);

    char UTMLetterDesignator(double latitude);

    void LLtoUTM(const double latitude, const double longitude,
                 double& utmNorthing, double& utmEasting,
                 std::string& utmZone);

    void UTMtoLL(const double utmNorthing, const double utmEasting,
                 const std::string& utmZone,
                 double& latitude, double& longitude);

    ImageryType currentImageryType;
67 68

    QScopedPointer<QNetworkAccessManager> networkManager;
69 70 71
};

#endif // IMAGERY_H