diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-03-05 16:55:58 -0800 |
---|---|---|
committer | Jesse Bounds <jesse@rebounds.net> | 2017-03-10 11:08:32 -0800 |
commit | a3121fc7a3228b7f1c66ab7388bee16cadfd70e0 (patch) | |
tree | dd9e3be9c54374b56f5a09ada0945b19783e8605 /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java | |
parent | a7fd788b5d5d7734666758320235f14be8187179 (diff) | |
download | qtlocation-mapboxgl-a3121fc7a3228b7f1c66ab7388bee16cadfd70e0.tar.gz |
[android] query source features
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java index feaca839d3..68eb81b7f4 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java @@ -1,12 +1,24 @@ package com.mapbox.mapboxsdk.style.sources; +import android.support.annotation.NonNull; +import android.support.annotation.Nullable; +import android.support.annotation.Size; +import android.support.annotation.UiThread; + +import com.mapbox.mapboxsdk.style.layers.Filter; +import com.mapbox.services.commons.geojson.Feature; + import java.net.URL; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; /** * Vector source enables the use of vector tiles. * * @see <a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources-vector">the style specification</a> */ +@UiThread public class VectorSource extends Source { /** @@ -48,8 +60,28 @@ public class VectorSource extends Source { initialize(id, tileSet.toValueObject()); } + /** + * Queries the source for features. + * + * @param sourceLayerIds the source layer identifiers. At least one must be specified. + * @param filter an optional filter statement to filter the returned Features + * @return the features + */ + @NonNull + public List<Feature> querySourceFeatures(@Size(min = 1) String[] sourceLayerIds, + @Nullable Filter.Statement filter) { + Feature[] features = querySourceFeatures( + sourceLayerIds, + filter != null ? filter.toArray() : null); + return features != null ? Arrays.asList(features) : new ArrayList<Feature>(); + } + protected native void initialize(String layerId, Object payload); @Override protected native void finalize() throws Throwable; + + private native Feature[] querySourceFeatures(String[] sourceLayerId, + Object[] filter); + } |