summaryrefslogtreecommitdiff
path: root/platform/android/src/style/sources/geojson_source.cpp
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-03-05 16:55:58 -0800
committerJesse Bounds <jesse@rebounds.net>2017-03-10 11:08:32 -0800
commita3121fc7a3228b7f1c66ab7388bee16cadfd70e0 (patch)
treedd9e3be9c54374b56f5a09ada0945b19783e8605 /platform/android/src/style/sources/geojson_source.cpp
parenta7fd788b5d5d7734666758320235f14be8187179 (diff)
downloadqtlocation-mapboxgl-a3121fc7a3228b7f1c66ab7388bee16cadfd70e0.tar.gz
[android] query source features
Diffstat (limited to 'platform/android/src/style/sources/geojson_source.cpp')
-rw-r--r--platform/android/src/style/sources/geojson_source.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/platform/android/src/style/sources/geojson_source.cpp b/platform/android/src/style/sources/geojson_source.cpp
index 37ce0644c1..7ab98e47c0 100644
--- a/platform/android/src/style/sources/geojson_source.cpp
+++ b/platform/android/src/style/sources/geojson_source.cpp
@@ -1,7 +1,15 @@
#include "geojson_source.hpp"
+// Java -> C++ conversion
#include "../android_conversion.hpp"
+#include "../conversion/filter.hpp"
#include "../conversion/geojson.hpp"
+
+// C++ -> Java conversion
+#include "../../conversion/conversion.hpp"
+#include "../../conversion/collection.hpp"
+#include "../../geometry/conversion/feature.hpp"
+#include "../conversion/url_or_tileset.hpp"
#include <mbgl/style/conversion.hpp>
#include <mbgl/style/conversion/geojson_options.hpp>
@@ -43,6 +51,16 @@ namespace android {
source.as<mbgl::style::GeoJSONSource>()->GeoJSONSource::setURL(jni::Make<std::string>(env, url));
}
+ jni::Array<jni::Object<Feature>> GeoJSONSource::querySourceFeatures(jni::JNIEnv& env,
+ jni::Array<jni::Object<>> jfilter) {
+ using namespace mbgl::android::conversion;
+ using namespace mapbox::geometry;
+
+ auto filter = toFilter(env, jfilter);
+ auto features = source.querySourceFeatures({ {}, filter });
+ return *convert<jni::Array<jni::Object<Feature>>, std::vector<mbgl::Feature>>(env, features);
+ }
+
jni::Class<GeoJSONSource> GeoJSONSource::javaClass;
jni::jobject* GeoJSONSource::createJavaPeer(jni::JNIEnv& env) {
@@ -63,7 +81,8 @@ namespace android {
"initialize",
"finalize",
METHOD(&GeoJSONSource::setGeoJSON, "nativeSetGeoJson"),
- METHOD(&GeoJSONSource::setURL, "nativeSetUrl")
+ METHOD(&GeoJSONSource::setURL, "nativeSetUrl"),
+ METHOD(&GeoJSONSource::querySourceFeatures, "querySourceFeatures")
);
}