diff options
Diffstat (limited to 'platform/android/src/style/sources')
6 files changed, 26 insertions, 2 deletions
diff --git a/platform/android/src/style/sources/geojson_source.cpp b/platform/android/src/style/sources/geojson_source.cpp index 9b56446e31..780cc4b6f6 100644 --- a/platform/android/src/style/sources/geojson_source.cpp +++ b/platform/android/src/style/sources/geojson_source.cpp @@ -97,6 +97,11 @@ namespace android { source.as<mbgl::style::GeoJSONSource>()->GeoJSONSource::setURL(jni::Make<std::string>(env, url)); } + jni::String GeoJSONSource::getURL(jni::JNIEnv& env) { + optional<std::string> url = source.as<mbgl::style::GeoJSONSource>()->GeoJSONSource::getURL(); + return url ? jni::Make<jni::String>(env, *url) : jni::String(); + } + jni::Array<jni::Object<geojson::Feature>> GeoJSONSource::querySourceFeatures(jni::JNIEnv& env, jni::Array<jni::Object<>> jfilter) { using namespace mbgl::android::conversion; @@ -133,6 +138,7 @@ namespace android { METHOD(&GeoJSONSource::setFeature, "nativeSetFeature"), METHOD(&GeoJSONSource::setGeometry, "nativeSetGeometry"), METHOD(&GeoJSONSource::setURL, "nativeSetUrl"), + METHOD(&GeoJSONSource::getURL, "nativeGetUrl"), METHOD(&GeoJSONSource::querySourceFeatures, "querySourceFeatures") ); } diff --git a/platform/android/src/style/sources/geojson_source.hpp b/platform/android/src/style/sources/geojson_source.hpp index 51ea452fb2..938a20612c 100644 --- a/platform/android/src/style/sources/geojson_source.hpp +++ b/platform/android/src/style/sources/geojson_source.hpp @@ -38,6 +38,8 @@ public: jni::Array<jni::Object<geojson::Feature>> querySourceFeatures(jni::JNIEnv&, jni::Array<jni::Object<>> jfilter); + jni::String getURL(jni::JNIEnv&); + jni::jobject* createJavaPeer(jni::JNIEnv&); }; // class GeoJSONSource diff --git a/platform/android/src/style/sources/raster_source.cpp b/platform/android/src/style/sources/raster_source.cpp index 0234901a77..32fdb163b0 100644 --- a/platform/android/src/style/sources/raster_source.cpp +++ b/platform/android/src/style/sources/raster_source.cpp @@ -28,6 +28,11 @@ namespace android { RasterSource::~RasterSource() = default; + jni::String RasterSource::getURL(jni::JNIEnv& env) { + optional<std::string> url = source.as<mbgl::style::RasterSource>()->RasterSource::getURL(); + return url ? jni::Make<jni::String>(env, *url) : jni::String(); + } + jni::Class<RasterSource> RasterSource::javaClass; jni::jobject* RasterSource::createJavaPeer(jni::JNIEnv& env) { @@ -46,7 +51,8 @@ namespace android { env, RasterSource::javaClass, "nativePtr", std::make_unique<RasterSource, JNIEnv&, jni::String, jni::Object<>, jni::jint>, "initialize", - "finalize" + "finalize", + METHOD(&RasterSource::getURL, "nativeGetUrl") ); } diff --git a/platform/android/src/style/sources/raster_source.hpp b/platform/android/src/style/sources/raster_source.hpp index 6600096f6d..a79ccc10a4 100644 --- a/platform/android/src/style/sources/raster_source.hpp +++ b/platform/android/src/style/sources/raster_source.hpp @@ -22,6 +22,8 @@ public: ~RasterSource(); + jni::String getURL(jni::JNIEnv&); + jni::jobject* createJavaPeer(jni::JNIEnv&); }; // class RasterSource diff --git a/platform/android/src/style/sources/vector_source.cpp b/platform/android/src/style/sources/vector_source.cpp index a8f74df142..e2d9f60dec 100644 --- a/platform/android/src/style/sources/vector_source.cpp +++ b/platform/android/src/style/sources/vector_source.cpp @@ -34,6 +34,11 @@ namespace android { VectorSource::~VectorSource() = default; + jni::String VectorSource::getURL(jni::JNIEnv& env) { + optional<std::string> url = source.as<mbgl::style::VectorSource>()->VectorSource::getURL(); + return url ? jni::Make<jni::String>(env, *url) : jni::String(); + } + jni::Array<jni::Object<geojson::Feature>> VectorSource::querySourceFeatures(jni::JNIEnv& env, jni::Array<jni::String> jSourceLayerIds, jni::Array<jni::Object<>> jfilter) { @@ -66,7 +71,8 @@ namespace android { std::make_unique<VectorSource, JNIEnv&, jni::String, jni::Object<>>, "initialize", "finalize", - METHOD(&VectorSource::querySourceFeatures, "querySourceFeatures") + METHOD(&VectorSource::querySourceFeatures, "querySourceFeatures"), + METHOD(&VectorSource::getURL, "nativeGetUrl") ); } diff --git a/platform/android/src/style/sources/vector_source.hpp b/platform/android/src/style/sources/vector_source.hpp index cac687bb6f..643b468338 100644 --- a/platform/android/src/style/sources/vector_source.hpp +++ b/platform/android/src/style/sources/vector_source.hpp @@ -26,6 +26,8 @@ public: jni::Array<jni::Object<geojson::Feature>> querySourceFeatures(jni::JNIEnv&, jni::Array<jni::String>, jni::Array<jni::Object<>> jfilter); + jni::String getURL(jni::JNIEnv&); + jni::jobject* createJavaPeer(jni::JNIEnv&); }; // class VectorSource |