#pragma once #include #include #include #include "layer.hpp" #include #include #include namespace mbgl { namespace android { /** * @brief A singleton class forwarding calls to the corresponding \c JavaLayerPeerFactory instance. */ class LayerManagerAndroid final : public mbgl::LayerManager { public: ~LayerManagerAndroid() final; static LayerManagerAndroid* get() noexcept; jni::Local> createJavaLayerPeer(jni::JNIEnv&, mbgl::Map&, mbgl::style::Layer&); jni::Local> createJavaLayerPeer(jni::JNIEnv& env, mbgl::Map& map, std::unique_ptr); void registerNative(jni::JNIEnv&); private: LayerManagerAndroid(); /** * @brief Enables a layer type for both JSON style an runtime API. */ void addLayerType(std::unique_ptr); /** * @brief 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 - JNI glue code for these layer types * won't be added to the binary. */ void addLayerTypeCoreOnly(std::unique_ptr); void registerCoreFactory(mbgl::LayerFactory*); JavaLayerPeerFactory* getPeerFactory(const mbgl::style::LayerTypeInfo*); // mbgl::LayerManager overrides. LayerFactory* getFactory(const std::string& type) noexcept final; LayerFactory* getFactory(const mbgl::style::LayerTypeInfo* info) noexcept final; std::vector> peerFactories; std::vector> coreFactories; std::map typeToFactory; }; } // namespace android } // namespace mbgl