summaryrefslogtreecommitdiff
path: root/src/imports/location/tilesphere.h
blob: e3a7647ab10a6e5a0a06fc2f57d07fb1e7eae752 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef TILESPHERE_H
#define TILESPHERE_H

#include <QObject>

class QGLSceneNode;
class QGeometryData;

class Tile;
class TileCache;

class TileSphere : public QObject
{
    Q_OBJECT
public:
    TileSphere(QObject *parent, TileCache *tileCache, int zoom = 4, double radius = 1.0);

    void setZoom(int zoom);
    int zoom() const;

    void setRadius(double radius);
    double radius() const;

    void limitView(int x1, int y1, int x2, int y2);
    void clearLimit();

    QGLSceneNode* sphereSceneNode() const;

public slots:
    void update();

private slots:
    void prefetchingFinished();

signals:
    void sphereUpdated();

private:
    QGeometryData tileSpecToSphereQuad(int x, int y) const;
    QGLSceneNode* tileToSceneNode(const Tile &tile) const;

    void prefetchSphere() const;
    void buildSphere() const;

    TileCache *tileCache_;
    int zoom_;
    double radius_;

    bool viewLimited_;
    int viewX1_;
    int viewY1_;
    int viewX2_;
    int viewY2_;

    QGLSceneNode* sphereNode_;
};

#endif // TILESPHERE_H