summaryrefslogtreecommitdiff
path: root/platform/android/src/style/sources/source.cpp
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2016-11-10 12:35:49 +0100
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2016-11-11 13:46:10 +0100
commit822b83ae4e0308f6f84c1955afbd27f753cfba12 (patch)
treedd47005b705c35369ebf16468420f5ff24e52828 /platform/android/src/style/sources/source.cpp
parent3a4a27c95f1c10c480532c46c4edb7b3120b7a2b (diff)
downloadqtlocation-mapboxgl-822b83ae4e0308f6f84c1955afbd27f753cfba12.tar.gz
[android] fix source ownership
Diffstat (limited to 'platform/android/src/style/sources/source.cpp')
-rw-r--r--platform/android/src/style/sources/source.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/platform/android/src/style/sources/source.cpp b/platform/android/src/style/sources/source.cpp
index f3daa777d1..24fce79e94 100644
--- a/platform/android/src/style/sources/source.cpp
+++ b/platform/android/src/style/sources/source.cpp
@@ -35,6 +35,19 @@ namespace android {
return jni::Make<jni::String>(env, source.getID());
}
+ void Source::addToMap(mbgl::Map& _map) {
+ //Check to see if we own the source first
+ if (!ownedSource) {
+ throw std::runtime_error("Cannot add source twice");
+ }
+
+ //Add source to map
+ _map.addSource(releaseCoreSource());
+
+ //Save pointer to the map
+ this->map = &_map;
+ }
+
std::unique_ptr<mbgl::style::Source> Source::releaseCoreSource() {
assert(ownedSource != nullptr);
return std::move(ownedSource);