summaryrefslogtreecommitdiff
path: root/platform/darwin/src/MGLStyleLayerManager.h
blob: 95fecd0252b14b485634477f4bed0be51c14ed4a (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
#pragma once

#import "MGLStyleLayer_Private.h"

#include <mbgl/layermanager/layer_manager.hpp>
#include <mbgl/style/layer.hpp>

#include <map>
#include <string>
#include <vector>

namespace mbgl {

class LayerManagerDarwin : public LayerManager {
public:
    static LayerManagerDarwin* get() noexcept;
    ~LayerManagerDarwin();

    MGLStyleLayer* createPeer(style::Layer*);

private:
    LayerManagerDarwin();
    /**
     * Enables a layer type for both JSON style and runtime API.
     */
    void addLayerType(std::unique_ptr<LayerPeerFactory>);
    /**
     * Enables a layer type for JSON style only.
     *
     * We might not want to expose runtime API for some layer types
     * in order to save binary size (the corresponding SDK layer wrappers
     * should be excluded from the project build).
     */
    void addLayerTypeCoreOnly(std::unique_ptr<mbgl::LayerFactory>);

    void registerCoreFactory(LayerFactory*);
    LayerPeerFactory* getPeerFactory(const style::LayerTypeInfo* typeInfo);
    // mbgl::LayerManager overrides.
    LayerFactory* getFactory(const std::string& type) noexcept final;
    LayerFactory* getFactory(const mbgl::style::LayerTypeInfo* info) noexcept final;

    std::vector<std::unique_ptr<LayerPeerFactory>> peerFactories;
    std::vector<std::unique_ptr<LayerFactory>> coreFactories;
    std::map<std::string, LayerFactory*> typeToFactory;
};
    
}  // namespace mbgl