summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java
diff options
context:
space:
mode:
authortobrun <tobrun.van.nuland@gmail.com>2018-12-20 19:34:55 +0100
committertobrun <tobrun.van.nuland@gmail.com>2019-01-10 17:58:43 +0100
commit44db1e0548db1807ce91efe7d77e531657a160c5 (patch)
treee8d35232ab9386676cd81c393aff0237f3bef3da /platform/android/MapboxGLAndroidSDK/src/main/java
parent3a77ea6ff77558e3182510ef0f90000039b29bfe (diff)
downloadqtlocation-mapboxgl-44db1e0548db1807ce91efe7d77e531657a160c5.tar.gz
[android] - expose query feature extensionsupstream/tvn-implement-feature-extensions
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java57
1 files changed, 57 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java
index c59cfeaf0b..ac2b644173 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java
@@ -285,6 +285,54 @@ public class GeoJsonSource extends Source {
return features != null ? Arrays.asList(features) : new ArrayList<Feature>();
}
+ /**
+ * Returns the children of a cluster (on the next zoom level) given its id (cluster_id value from feature properties).
+ * <p>
+ * Requires configuring this source as a cluster by calling {@link GeoJsonOptions#withCluster(boolean)}.
+ * </p>
+ *
+ * @param cluster cluster from which to retrieve children from
+ * @return a list of features for the underlying children
+ */
+ @NonNull
+ public FeatureCollection getClusterChildren(@NonNull Feature cluster) {
+ checkThread();
+ return FeatureCollection.fromFeatures(nativeGetClusterChildren(cluster));
+ }
+
+ /**
+ * Returns all the points of a cluster (given its cluster_id), with pagination support: limit is the number of points
+ * to return (set to Infinity for all points), and offset is the amount of points to skip (for pagination).
+ * <p>
+ * Requires configuring this source as a cluster by calling {@link GeoJsonOptions#withCluster(boolean)}.
+ * </p>
+ *
+ * @param cluster cluster from which to retrieve leaves from
+ * @param limit limit is the number of points to return
+ * @param offset offset is the amount of points to skip (for pagination)
+ * @return a list of features for the underlying leaves
+ */
+ @NonNull
+ public FeatureCollection getClusterLeaves(@NonNull Feature cluster, long limit, long offset) {
+ checkThread();
+ return FeatureCollection.fromFeatures(nativeGetClusterLeaves(cluster, limit, offset));
+ }
+
+ /**
+ * Returns the zoom on which the cluster expands into several children (useful for "click to zoom" feature)
+ * given the cluster's cluster_id (cluster_id value from feature properties).
+ * <p>
+ * Requires configuring this source as a cluster by calling {@link GeoJsonOptions#withCluster(boolean)}.
+ * </p>
+ *
+ * @param cluster cluster from which to retrieve the expansion zoom from
+ * @return the zoom on which the cluster expands into several children
+ */
+ public double getClusterExpansionZoom(@NonNull Feature cluster) {
+ checkThread();
+ return nativeGetClusterExpansionZoom(cluster);
+ }
+
@Keep
protected native void initialize(String layerId, Object options);
@@ -311,6 +359,15 @@ public class GeoJsonSource extends Source {
@Keep
private native Feature[] querySourceFeatures(Object[] filter);
+ @Keep
+ private native Feature[] nativeGetClusterChildren(Feature feature);
+
+ @Keep
+ private native Feature[] nativeGetClusterLeaves(Feature feature, long limit, long offset);
+
+ @Keep
+ private native double nativeGetClusterExpansionZoom(Feature feature);
+
@Override
@Keep
protected native void finalize() throws Throwable;