summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LayerFeatureProvider.java
diff options
context:
space:
mode:
authorŁukasz Paczos <lukasz.paczos@mapbox.com>2018-08-28 17:06:21 +0200
committerŁukasz Paczos <lukasz.paczos@mapbox.com>2018-09-12 13:59:11 +0200
commit5d000d090fd1d69fb902fd5b477d3bb996e3c955 (patch)
tree95c94ac5e599ac3426fd702c93723c3025578724 /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LayerFeatureProvider.java
parente70fe057566104b2e845533c6e58f3a8572159f9 (diff)
downloadqtlocation-mapboxgl-5d000d090fd1d69fb902fd5b477d3bb996e3c955.tar.gz
[android] merge LocationLayerPlugin to Maps SDK
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LayerFeatureProvider.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LayerFeatureProvider.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LayerFeatureProvider.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LayerFeatureProvider.java
new file mode 100644
index 0000000000..9f119ef6eb
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LayerFeatureProvider.java
@@ -0,0 +1,26 @@
+package com.mapbox.mapboxsdk.plugins.locationlayer;
+
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.Point;
+
+import static com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerConstants.PROPERTY_COMPASS_BEARING;
+import static com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerConstants.PROPERTY_GPS_BEARING;
+import static com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerConstants.PROPERTY_LOCATION_STALE;
+
+class LayerFeatureProvider {
+
+ @NonNull
+ Feature generateLocationFeature(@Nullable Feature locationFeature, LocationLayerOptions options) {
+ if (locationFeature != null) {
+ return locationFeature;
+ }
+ locationFeature = Feature.fromGeometry(Point.fromLngLat(0.0, 0.0));
+ locationFeature.addNumberProperty(PROPERTY_GPS_BEARING, 0f);
+ locationFeature.addNumberProperty(PROPERTY_COMPASS_BEARING, 0f);
+ locationFeature.addBooleanProperty(PROPERTY_LOCATION_STALE, options.enableStaleState());
+ return locationFeature;
+ }
+}