summaryrefslogtreecommitdiff
path: root/platform/android/src/native_map_view.cpp
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2017-10-24 09:36:23 -0700
committerTobrun <tobrun@mapbox.com>2017-10-30 09:34:23 -0700
commit5893af7f245311d89b8d2ccd0fc0278394acbf83 (patch)
treedb9d0aefee075978979559be23730d1f5baa4339 /platform/android/src/native_map_view.cpp
parent72a6eb8b5c317e4cc3d30a998af3ba09a2fc5138 (diff)
downloadqtlocation-mapboxgl-5893af7f245311d89b8d2ccd0fc0278394acbf83.tar.gz
[android] - move shape annotation click handling to core
Diffstat (limited to 'platform/android/src/native_map_view.cpp')
-rwxr-xr-xplatform/android/src/native_map_view.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp
index 24a35a7068..7372ecdf71 100755
--- a/platform/android/src/native_map_view.cpp
+++ b/platform/android/src/native_map_view.cpp
@@ -633,6 +633,26 @@ jni::Array<jlong> NativeMapView::queryPointAnnotations(JNIEnv& env, jni::Object<
return result;
}
+jni::Array<jlong> NativeMapView::queryShapeAnnotations(JNIEnv &env, jni::Object<RectF> rect) {
+ using namespace mbgl::style;
+ using namespace mbgl::style::conversion;
+
+ // Convert input
+ mbgl::ScreenBox box = {
+ {RectF::getLeft(env, rect), RectF::getTop(env, rect)},
+ {RectF::getRight(env, rect), RectF::getBottom(env, rect)},
+ };
+
+ mbgl::AnnotationIDs ids = rendererFrontend->queryShapeAnnotations(box);
+
+ // Convert result
+ std::vector<jlong> longIds(ids.begin(), ids.end());
+ auto result = jni::Array<jni::jlong>::New(env, ids.size());
+ result.SetRegion<std::vector<jni::jlong>>(env, 0, longIds);
+
+ return result;
+}
+
jni::Array<jni::Object<geojson::Feature>> NativeMapView::queryRenderedFeaturesForPoint(JNIEnv& env, jni::jfloat x, jni::jfloat y,
jni::Array<jni::String> layerIds,
jni::Array<jni::Object<>> jfilter) {
@@ -1000,6 +1020,7 @@ void NativeMapView::registerNative(jni::JNIEnv& env) {
METHOD(&NativeMapView::getTransitionDelay, "nativeGetTransitionDelay"),
METHOD(&NativeMapView::setTransitionDelay, "nativeSetTransitionDelay"),
METHOD(&NativeMapView::queryPointAnnotations, "nativeQueryPointAnnotations"),
+ METHOD(&NativeMapView::queryShapeAnnotations, "nativeQueryShapeAnnotations"),
METHOD(&NativeMapView::queryRenderedFeaturesForPoint, "nativeQueryRenderedFeaturesForPoint"),
METHOD(&NativeMapView::queryRenderedFeaturesForBox, "nativeQueryRenderedFeaturesForBox"),
METHOD(&NativeMapView::getLight, "nativeGetLight"),