summaryrefslogtreecommitdiff
path: root/platform/macos/src/MGLMapView+Impl.h
blob: 2d523716d4c6d7f8bb653a097e3cccbbfd59c4fa (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
#import <mbgl/gfx/renderer_backend.hpp>
#import <mbgl/map/map_observer.hpp>
#import <mbgl/util/image.hpp>

@class MGLMapView;

typedef struct _CGLContextObject* CGLContextObj;

class MGLMapViewImpl : public mbgl::MapObserver {
public:
    static std::unique_ptr<MGLMapViewImpl> Create(MGLMapView*);

    MGLMapViewImpl(MGLMapView*);
    virtual ~MGLMapViewImpl() = default;

    virtual mbgl::gfx::RendererBackend& getRendererBackend() = 0;

    // We need a static image of what was rendered for printing.
    virtual mbgl::PremultipliedImage readStillImage() = 0;

    virtual CGLContextObj getCGLContextObj() {
        return nullptr;
    }

    // mbgl::MapObserver implementation
    void onCameraWillChange(mbgl::MapObserver::CameraChangeMode) override;
    void onCameraIsChanging() override;
    void onCameraDidChange(mbgl::MapObserver::CameraChangeMode) override;
    void onWillStartLoadingMap() override;
    void onDidFinishLoadingMap() override;
    void onDidFailLoadingMap(mbgl::MapLoadError mapError, const std::string& what) override;
    void onWillStartRenderingFrame() override;
    void onDidFinishRenderingFrame(mbgl::MapObserver::RenderMode) override;
    void onWillStartRenderingMap() override;
    void onDidFinishRenderingMap(mbgl::MapObserver::RenderMode) override;
    void onDidFinishLoadingStyle() override;
    void onSourceChanged(mbgl::style::Source& source) override;
    void onDidBecomeIdle() override;
    bool onCanRemoveUnusedStyleImage(const std::string& imageIdentifier) override;

protected:
    /// Cocoa map view that this adapter bridges to.
    __weak MGLMapView *mapView = nullptr;
};