summaryrefslogtreecommitdiff
path: root/platform/qt/src/qmapboxgl_p.hpp
blob: bfa5b8c326236c69ba29a1213c3595a1a336c5c5 (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
#pragma once

#include "qmapboxgl.hpp"

#include <mbgl/map/map.hpp>
#include <mbgl/map/backend.hpp>
#include <mbgl/map/view.hpp>
#include <mbgl/util/default_thread_pool.hpp>
#include <mbgl/storage/default_file_source.hpp>
#include <mbgl/util/geo.hpp>

#include <QObject>
#include <QSize>

class QMapboxGLPrivate : public QObject, public mbgl::View, public mbgl::Backend
{
    Q_OBJECT

public:
    explicit QMapboxGLPrivate(QMapboxGL *, const QMapboxGLSettings &, const QSize &size, qreal pixelRatio);
    virtual ~QMapboxGLPrivate();

    // mbgl::View implementation.
    float getPixelRatio() const;
    void bind() final;
    std::array<uint16_t, 2> getSize() const;
    std::array<uint16_t, 2> getFramebufferSize() const;

    void activate() final {}
    void deactivate() final {}
    void invalidate() final;
    void notifyMapChange(mbgl::MapChange) final;

    mbgl::EdgeInsets margins;
    QSize size { 0, 0 };
    QSize fbSize { 0, 0 };

    QMapboxGL *q_ptr { nullptr };

    std::unique_ptr<mbgl::DefaultFileSource> fileSourceObj;
    mbgl::ThreadPool threadPool;
    std::unique_ptr<mbgl::Map> mapObj;

    bool dirty { false };

    QOpenGLFramebufferObject *fbo { nullptr };

public slots:
    void connectionEstablished();

signals:
    void needsRendering();
    void mapChanged(QMapbox::MapChange);
    void copyrightsChanged(const QString &copyrightsHtml);
};