diff options
Diffstat (limited to 'platform/android/src/style/sources/source.cpp')
-rw-r--r-- | platform/android/src/style/sources/source.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/platform/android/src/style/sources/source.cpp b/platform/android/src/style/sources/source.cpp index fda0f0084c..f4040a5718 100644 --- a/platform/android/src/style/sources/source.cpp +++ b/platform/android/src/style/sources/source.cpp @@ -109,6 +109,21 @@ namespace android { return jni::Local<jni::Integer>(env, nullptr); } + void Source::addToStyle(JNIEnv& env, const jni::Object<Source>& obj, mbgl::style::Style& style) { + if (!ownedSource) { + throw std::runtime_error("Cannot add source twice"); + } + + // Add source to style and release ownership + style.addSource(std::move(ownedSource)); + + // Add peer to core source + source.peer = std::unique_ptr<Source>(this); + + // Add strong reference to java source + javaPeer = jni::NewGlobal(env, obj); + } + void Source::addToMap(JNIEnv& env, const jni::Object<Source>& obj, mbgl::Map& map, AndroidRendererFrontend& frontend) { // Check to see if we own the source first if (!ownedSource) { |