diff options
Diffstat (limited to 'platform/android/src/style/layers/layer.hpp')
-rw-r--r-- | platform/android/src/style/layers/layer.hpp | 66 |
1 files changed, 46 insertions, 20 deletions
diff --git a/platform/android/src/style/layers/layer.hpp b/platform/android/src/style/layers/layer.hpp index ab3b1d339d..633630b891 100644 --- a/platform/android/src/style/layers/layer.hpp +++ b/platform/android/src/style/layers/layer.hpp @@ -1,6 +1,5 @@ #pragma once -#include <mbgl/util/noncopyable.hpp> #include <mbgl/map/map.hpp> #include <mbgl/style/layer.hpp> #include "../../gson/json_array.hpp" @@ -11,35 +10,17 @@ namespace mbgl { - namespace android { -class Layer : private mbgl::util::noncopyable { +class Layer { public: static constexpr auto Name() { return "com/mapbox/mapboxsdk/style/layers/Layer"; }; static void registerNative(jni::JNIEnv&); - /* - * Called when a non-owning peer object is created on the c++ side - */ - Layer(mbgl::Map&, mbgl::style::Layer&); - - /* - * Called when a owning peer object is created on the c++ side - */ - Layer(mbgl::Map&, std::unique_ptr<mbgl::style::Layer>); - - /* - * Called when a Java object was created from the jvm side - */ - Layer(jni::JNIEnv&, std::unique_ptr<mbgl::style::Layer>); - virtual ~Layer(); - virtual jni::Local<jni::Object<Layer>> createJavaPeer(jni::JNIEnv&) = 0; - /** * Set core layer (ie return ownership after remove) */ @@ -82,6 +63,21 @@ public: jni::Local<jni::Object<jni::ObjectTag>> getVisibility(jni::JNIEnv&); protected: + /* + * Called when a non-owning peer object is created on the c++ side + */ + Layer(mbgl::Map&, mbgl::style::Layer&); + + /* + * Called when a owning peer object is created on the c++ side + */ + Layer(mbgl::Map&, std::unique_ptr<mbgl::style::Layer>); + + /* + * Called when a Java object was created from the jvm side + */ + Layer(std::unique_ptr<mbgl::style::Layer>); + // Release the owned view and return it std::unique_ptr<mbgl::style::Layer> releaseCoreLayer(); @@ -95,5 +91,35 @@ protected: mbgl::Map* map; }; +/** + * @brief A factory class for a layer Java peer objects of a certain type. + */ +class JavaLayerPeerFactory { +public: + virtual ~JavaLayerPeerFactory() = default; + /** + * @brief Create a non-owning peer. + */ + virtual jni::Local<jni::Object<Layer>> createJavaLayerPeer(jni::JNIEnv&, mbgl::Map&, mbgl::style::Layer&) = 0; + + /** + * @brief Create an owning peer. + */ + virtual jni::Local<jni::Object<Layer>> createJavaLayerPeer(jni::JNIEnv& env, mbgl::Map& map, std::unique_ptr<mbgl::style::Layer>) = 0; + + /** + * @brief Register peer methods. + */ + virtual void registerNative(jni::JNIEnv&) = 0; + + /** + * @brief Get the corresponding layer factory. + * + * @return style::LayerFactory* must not be \c nullptr. + */ + virtual style::LayerFactory* getLayerFactory() = 0; +}; + + } // namespace android } // namespace mbgl |