diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java | 20 |
1 files changed, 20 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 efacc18741..9ecc70e123 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 @@ -37,6 +37,7 @@ public class GeoJsonSource extends Source { * @param id the source id */ public GeoJsonSource(String id) { + super(); initialize(id, null); setGeoJson(FeatureCollection.fromFeatures(new ArrayList<Feature>())); } @@ -48,6 +49,7 @@ public class GeoJsonSource extends Source { * @param options options */ public GeoJsonSource(String id, GeoJsonOptions options) { + super(); initialize(id, options); setGeoJson(FeatureCollection.fromFeatures(new ArrayList<Feature>())); } @@ -59,6 +61,7 @@ public class GeoJsonSource extends Source { * @param geoJson raw Json FeatureCollection */ public GeoJsonSource(String id, String geoJson) { + super(); if (geoJson == null || geoJson.startsWith("http")) { throw new IllegalArgumentException("Expected a raw json body"); } @@ -74,6 +77,7 @@ public class GeoJsonSource extends Source { * @param options options */ public GeoJsonSource(String id, String geoJson, GeoJsonOptions options) { + super(); if (geoJson == null || geoJson.startsWith("http")) { throw new IllegalArgumentException("Expected a raw json body"); } @@ -88,6 +92,7 @@ public class GeoJsonSource extends Source { * @param url remote json file */ public GeoJsonSource(String id, URL url) { + super(); initialize(id, null); nativeSetUrl(url.toExternalForm()); } @@ -100,6 +105,7 @@ public class GeoJsonSource extends Source { * @param options options */ public GeoJsonSource(String id, URL url, GeoJsonOptions options) { + super(); initialize(id, options); nativeSetUrl(url.toExternalForm()); } @@ -111,6 +117,7 @@ public class GeoJsonSource extends Source { * @param features the features */ public GeoJsonSource(String id, FeatureCollection features) { + super(); initialize(id, null); setGeoJson(features); } @@ -123,6 +130,7 @@ public class GeoJsonSource extends Source { * @param options options */ public GeoJsonSource(String id, FeatureCollection features, GeoJsonOptions options) { + super(); initialize(id, options); setGeoJson(features); } @@ -134,6 +142,7 @@ public class GeoJsonSource extends Source { * @param feature the feature */ public GeoJsonSource(String id, Feature feature) { + super(); initialize(id, null); setGeoJson(feature); } @@ -146,6 +155,7 @@ public class GeoJsonSource extends Source { * @param options options */ public GeoJsonSource(String id, Feature feature, GeoJsonOptions options) { + super(); initialize(id, options); setGeoJson(feature); } @@ -157,6 +167,7 @@ public class GeoJsonSource extends Source { * @param geometry the geometry */ public GeoJsonSource(String id, Geometry geometry) { + super(); initialize(id, null); setGeoJson(geometry); } @@ -169,6 +180,7 @@ public class GeoJsonSource extends Source { * @param options options */ public GeoJsonSource(String id, Geometry geometry, GeoJsonOptions options) { + super(); initialize(id, options); setGeoJson(geometry); } @@ -179,6 +191,7 @@ public class GeoJsonSource extends Source { * @param feature the GeoJSON {@link Feature} to set */ public void setGeoJson(Feature feature) { + checkThread(); nativeSetFeature(feature); } @@ -188,6 +201,7 @@ public class GeoJsonSource extends Source { * @param geometry the GeoJSON {@link Geometry} to set */ public void setGeoJson(Geometry geometry) { + checkThread(); nativeSetGeometry(geometry); } @@ -197,6 +211,7 @@ public class GeoJsonSource extends Source { * @param features the GeoJSON FeatureCollection */ public void setGeoJson(FeatureCollection features) { + checkThread(); nativeSetFeatureCollection(features); } @@ -206,6 +221,7 @@ public class GeoJsonSource extends Source { * @param json the raw GeoJson FeatureCollection string */ public void setGeoJson(String json) { + checkThread(); nativeSetGeoJsonString(json); } @@ -215,6 +231,7 @@ public class GeoJsonSource extends Source { * @param url the GeoJSON FeatureCollection url */ public void setUrl(URL url) { + checkThread(); setUrl(url.toExternalForm()); } @@ -224,6 +241,7 @@ public class GeoJsonSource extends Source { * @param url the GeoJSON FeatureCollection url */ public void setUrl(String url) { + checkThread(); nativeSetUrl(url); } @@ -232,6 +250,7 @@ public class GeoJsonSource extends Source { */ @Nullable public String getUrl() { + checkThread(); return nativeGetUrl(); } @@ -243,6 +262,7 @@ public class GeoJsonSource extends Source { */ @NonNull public List<Feature> querySourceFeatures(@Nullable Expression filter) { + checkThread(); Feature[] features = querySourceFeatures(filter != null ? filter.toArray() : null); return features != null ? Arrays.asList(features) : new ArrayList<Feature>(); } |