summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorOsana Babayan <32496536+osana@users.noreply.github.com>2018-02-08 08:44:24 -0500
committerGitHub <noreply@github.com>2018-02-08 08:44:24 -0500
commit4498917a3b9dbf6cc9728da01f479a027f27f902 (patch)
tree5d432d0d57e4b0ec34936c04ddfa7fc5c8cac328 /platform
parent2ed069cb0a4e057d0a6135530e073d7094e6c4ee (diff)
downloadqtlocation-mapboxgl-4498917a3b9dbf6cc9728da01f479a027f27f902.tar.gz
migrated to use mapbox-java3.0
migrated to use mapbox-java3.0 note that old 2.2.9 telementry is still used though
Diffstat (limited to 'platform')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java4
-rwxr-xr-xplatform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java4
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java4
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeoJsonSource.java6
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeometryTileProvider.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/VectorSource.java2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/build.gradle2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java8
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java8
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java12
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java5
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java15
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QuerySourceFeaturesActivity.java9
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java18
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java4
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java21
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java9
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java20
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java11
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/ZoomFunctionSymbolLayerActivity.java18
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java16
-rw-r--r--platform/android/config.cmake2
-rw-r--r--platform/android/gradle/dependencies.gradle12
-rw-r--r--platform/android/src/geojson/conversion/geometry.hpp130
-rw-r--r--platform/android/src/geojson/feature.cpp18
-rw-r--r--platform/android/src/geojson/feature.hpp8
-rw-r--r--platform/android/src/geojson/feature_collection.cpp6
-rw-r--r--platform/android/src/geojson/feature_collection.hpp4
-rw-r--r--platform/android/src/geojson/geometry.cpp2
-rw-r--r--platform/android/src/geojson/geometry.hpp2
-rw-r--r--platform/android/src/geojson/line_string.cpp28
-rw-r--r--platform/android/src/geojson/line_string.hpp6
-rw-r--r--platform/android/src/geojson/multi_line_string.cpp22
-rw-r--r--platform/android/src/geojson/multi_line_string.hpp6
-rw-r--r--platform/android/src/geojson/multi_point.cpp10
-rw-r--r--platform/android/src/geojson/multi_point.hpp4
-rw-r--r--platform/android/src/geojson/multi_polygon.cpp16
-rw-r--r--platform/android/src/geojson/multi_polygon.hpp4
-rw-r--r--platform/android/src/geojson/point.cpp34
-rw-r--r--platform/android/src/geojson/point.hpp10
-rw-r--r--platform/android/src/geojson/polygon.cpp12
-rw-r--r--platform/android/src/geojson/polygon.hpp6
-rw-r--r--platform/android/src/geojson/position.cpp27
-rw-r--r--platform/android/src/geojson/position.hpp27
-rwxr-xr-xplatform/android/src/jni.cpp2
46 files changed, 284 insertions, 314 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
index 509e784e58..834317dd25 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
@@ -16,6 +16,8 @@ import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.Geometry;
import com.mapbox.mapboxsdk.annotations.Annotation;
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions;
@@ -42,8 +44,6 @@ import com.mapbox.mapboxsdk.style.layers.Layer;
import com.mapbox.mapboxsdk.style.light.Light;
import com.mapbox.mapboxsdk.style.sources.Source;
import com.mapbox.services.android.telemetry.location.LocationEngine;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.Geometry;
import java.lang.reflect.ParameterizedType;
import java.util.HashMap;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java
index f1635c898f..785b045779 100755
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java
@@ -11,6 +11,8 @@ import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.util.DisplayMetrics;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.Geometry;
import com.mapbox.mapboxsdk.LibraryLoader;
import com.mapbox.mapboxsdk.annotations.Icon;
import com.mapbox.mapboxsdk.annotations.Marker;
@@ -29,8 +31,6 @@ import com.mapbox.mapboxsdk.style.light.Light;
import com.mapbox.mapboxsdk.style.sources.CannotAddSourceException;
import com.mapbox.mapboxsdk.style.sources.Source;
import com.mapbox.mapboxsdk.utils.BitmapUtils;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.Geometry;
import java.nio.ByteBuffer;
import java.util.ArrayList;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java
index 50cb93e6c0..1b0999ae2e 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/CustomGeometrySource.java
@@ -5,10 +5,10 @@ import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import android.support.annotation.WorkerThread;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.FeatureCollection;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.style.layers.Filter;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.FeatureCollection;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
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 10ecb945ad..5c740554cd 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
@@ -4,10 +4,10 @@ import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.FeatureCollection;
+import com.mapbox.geojson.Geometry;
import com.mapbox.mapboxsdk.style.layers.Filter;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.FeatureCollection;
-import com.mapbox.services.commons.geojson.Geometry;
import java.net.URL;
import java.util.ArrayList;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeometryTileProvider.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeometryTileProvider.java
index 3f1eb315d3..17e7f0f5e4 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeometryTileProvider.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/sources/GeometryTileProvider.java
@@ -2,8 +2,8 @@ package com.mapbox.mapboxsdk.style.sources;
import android.support.annotation.WorkerThread;
+import com.mapbox.geojson.FeatureCollection;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
-import com.mapbox.services.commons.geojson.FeatureCollection;
/**
* Interface that defines methods for working with {@link CustomGeometrySource}.
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 9b59cf8967..62b08a90ed 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
@@ -5,8 +5,8 @@ import android.support.annotation.Nullable;
import android.support.annotation.Size;
import android.support.annotation.UiThread;
+import com.mapbox.geojson.Feature;
import com.mapbox.mapboxsdk.style.layers.Filter;
-import com.mapbox.services.commons.geojson.Feature;
import java.net.URL;
import java.util.ArrayList;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle
index 3723ae2acf..1f889a6218 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/build.gradle
+++ b/platform/android/MapboxGLAndroidSDKTestApp/build.gradle
@@ -57,6 +57,8 @@ dependencies {
transitive = true
}
+ api dependenciesList.mapboxJavaTurf
+
implementation dependenciesList.supportAppcompatV7
implementation dependenciesList.supportRecyclerView
implementation dependenciesList.supportDesign
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java
index 5d10cfa38a..2156c96973 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java
@@ -13,9 +13,9 @@ import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.FeatureCollection;
-import com.mapbox.services.commons.geojson.Point;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.FeatureCollection;
+import com.mapbox.geojson.Point;
import org.hamcrest.Matcher;
import org.junit.Test;
@@ -67,7 +67,7 @@ public class GeoJsonSourceTests extends BaseActivityTest {
@Override
public void perform(UiController uiController, View view) {
- GeoJsonSource source = new GeoJsonSource("source", Point.fromCoordinates(new double[] {0d, 0d}));
+ GeoJsonSource source = new GeoJsonSource("source", Point.fromLngLat(0d, 0d));
mapboxMap.addSource(source);
mapboxMap.addLayer(new CircleLayer("layer", source.getId()));
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java
index a557bb4ed4..e6db071141 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/annotation/AnimatedMarkerActivity.java
@@ -12,6 +12,7 @@ import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
+import com.mapbox.geojson.Point;
import com.mapbox.mapboxsdk.annotations.Icon;
import com.mapbox.mapboxsdk.annotations.IconFactory;
import com.mapbox.mapboxsdk.annotations.Marker;
@@ -25,8 +26,7 @@ import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.utils.IconUtils;
-import com.mapbox.services.api.utils.turf.TurfMeasurement;
-import com.mapbox.services.commons.models.Position;
+import com.mapbox.turf.TurfMeasurement;
import java.util.ArrayList;
import java.util.List;
@@ -272,8 +272,8 @@ public class AnimatedMarkerActivity extends AppCompatActivity {
private double getBearing(LatLng from, LatLng to) {
return TurfMeasurement.bearing(
- Position.fromCoordinates(from.getLongitude(), from.getLatitude()),
- Position.fromCoordinates(to.getLongitude(), to.getLatitude())
+ Point.fromLngLat(from.getLongitude(), from.getLatitude()),
+ Point.fromLngLat(to.getLongitude(), to.getLatitude())
);
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java
index 70d5b53428..c4ea81263b 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxCountActivity.java
@@ -7,10 +7,10 @@ import android.view.View;
import android.widget.Toast;
import com.google.gson.JsonElement;
+import com.mapbox.geojson.Feature;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.services.commons.geojson.Feature;
import java.util.List;
import java.util.Map;
@@ -62,12 +62,12 @@ public class QueryRenderedFeaturesBoxCountActivity extends AppCompatActivity {
for (Feature feature : features) {
if (feature != null) {
Timber.i("Got feature %s with %s properties and Geometry %s",
- feature.getId(),
- feature.getProperties() != null ? feature.getProperties().entrySet().size() : "<null>",
- feature.getGeometry() != null ? feature.getGeometry().getClass().getSimpleName() : "<null>"
+ feature.id(),
+ feature.properties() != null ? feature.properties().entrySet().size() : "<null>",
+ feature.geometry() != null ? feature.geometry().getClass().getSimpleName() : "<null>"
);
- if (feature.getProperties() != null) {
- for (Map.Entry<String, JsonElement> entry : feature.getProperties().entrySet()) {
+ if (feature.properties() != null) {
+ for (Map.Entry<String, JsonElement> entry : feature.properties().entrySet()) {
Timber.i("Prop %s - %s", entry.getKey(), entry.getValue());
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java
index 8c9d056764..df608360ad 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxHighlightActivity.java
@@ -7,14 +7,15 @@ import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.FeatureCollection;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.style.layers.FillLayer;
import com.mapbox.mapboxsdk.style.layers.Filter;
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.FeatureCollection;
+
import java.util.List;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java
index 9bad5f3e62..46409d1893 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesBoxSymbolCountActivity.java
@@ -7,13 +7,13 @@ import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
+import com.mapbox.geojson.Feature;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils;
-import com.mapbox.services.commons.geojson.Feature;
import java.io.IOException;
import java.util.List;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java
index 150b081f7f..be32718dc3 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QueryRenderedFeaturesPropertiesActivity.java
@@ -12,12 +12,13 @@ import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.gson.JsonElement;
+import com.mapbox.geojson.Feature;
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
import com.mapbox.mapboxsdk.annotations.Marker;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.services.commons.geojson.Feature;
+
import java.util.List;
import java.util.Map;
@@ -80,12 +81,12 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity {
for (Feature feature : features) {
if (feature != null) {
Timber.i("Got feature %s with %s properties and Geometry %s",
- feature.getId(),
- feature.getProperties() != null ? feature.getProperties().entrySet().size() : "<null>",
- feature.getGeometry() != null ? feature.getGeometry().getClass().getSimpleName() : "<null>"
+ feature.id(),
+ feature.properties() != null ? feature.properties().entrySet().size() : "<null>",
+ feature.geometry() != null ? feature.geometry().getClass().getSimpleName() : "<null>"
);
- if (feature.getProperties() != null) {
- for (Map.Entry<String, JsonElement> entry : feature.getProperties().entrySet()) {
+ if (feature.properties() != null) {
+ for (Map.Entry<String, JsonElement> entry : feature.properties().entrySet()) {
Timber.i("Prop %s - %s", entry.getKey(), entry.getValue());
}
}
@@ -114,7 +115,7 @@ public class QueryRenderedFeaturesPropertiesActivity extends AppCompatActivity {
if (customMarker.features.size() > 0) {
view.addView(row(String.format("Found %s features", customMarker.features.size())));
Feature feature = customMarker.features.get(0);
- for (Map.Entry<String, JsonElement> prop : feature.getProperties().entrySet()) {
+ for (Map.Entry<String, JsonElement> prop : feature.properties().entrySet()) {
view.addView(row(String.format("%s: %s", prop.getKey(), prop.getValue())));
}
} else {
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QuerySourceFeaturesActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QuerySourceFeaturesActivity.java
index c8bef26856..14de81ab30 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QuerySourceFeaturesActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/feature/QuerySourceFeaturesActivity.java
@@ -5,15 +5,16 @@ import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;
import com.google.gson.JsonObject;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.FeatureCollection;
+import com.mapbox.geojson.Point;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.style.layers.CircleLayer;
import com.mapbox.mapboxsdk.style.layers.Filter;
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.FeatureCollection;
-import com.mapbox.services.commons.geojson.Point;
+
import java.util.List;
@@ -42,7 +43,7 @@ public class QuerySourceFeaturesActivity extends AppCompatActivity {
properties.addProperty("key1", "value1");
final GeoJsonSource source = new GeoJsonSource("test-source",
FeatureCollection.fromFeatures(new Feature[] {
- Feature.fromGeometry(Point.fromCoordinates(new double[] {0, 0}), properties)
+ Feature.fromGeometry(Point.fromLngLat(0, 0), properties)
}));
mapboxMap.addSource(source);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java
index 8d35e659d3..30cb0a8660 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/CustomSpriteActivity.java
@@ -7,6 +7,9 @@ import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.FeatureCollection;
+import com.mapbox.geojson.Point;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapView;
@@ -15,10 +18,7 @@ import com.mapbox.mapboxsdk.style.layers.Layer;
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.FeatureCollection;
-import com.mapbox.services.commons.geojson.Point;
-import com.mapbox.services.commons.models.Position;
+
import timber.log.Timber;
@@ -58,7 +58,7 @@ public class CustomSpriteActivity extends AppCompatActivity {
mapboxMap.addImage(CUSTOM_ICON, BitmapFactory.decodeResource(getResources(), R.drawable.ic_car_top));
// Add a source with a geojson point
- point = Point.fromCoordinates(Position.fromCoordinates(13.400972d, 52.519003d));
+ point = Point.fromLngLat(13.400972d, 52.519003d);
source = new GeoJsonSource(
"point",
FeatureCollection.fromFeatures(new Feature[] {Feature.fromGeometry(point)})
@@ -78,15 +78,13 @@ public class CustomSpriteActivity extends AppCompatActivity {
fab.setImageResource(R.drawable.ic_directions_car_black);
} else {
// Update point
- point = Point.fromCoordinates(
- Position.fromCoordinates(point.getCoordinates().getLongitude() + 0.001,
- point.getCoordinates().getLatitude() + 0.001)
- );
+ point = Point.fromLngLat(point.longitude() + 0.001,
+ point.latitude() + 0.001);
source.setGeoJson(FeatureCollection.fromFeatures(new Feature[] {Feature.fromGeometry(point)}));
// Move the camera as well
mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(
- point.getCoordinates().getLatitude(), point.getCoordinates().getLongitude())));
+ point.latitude(), point.longitude())));
}
}
});
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java
index a88a489cb1..15d7024abf 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java
@@ -12,7 +12,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer;
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.services.commons.geojson.Polygon;
+import com.mapbox.geojson.Polygon;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionColor;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionHeight;
@@ -35,7 +35,7 @@ public class FillExtrusionActivity extends AppCompatActivity {
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(map -> {
mapboxMap = map;
- Polygon domTower = Polygon.fromCoordinates(new double[][][] {
+ Polygon domTower = Polygon.fromLngLats(new double[][][] {
new double[][] {
new double[] {
5.12112557888031,
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java
index 9dda0f8fa2..fdc3826fb1 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/GridSourceActivity.java
@@ -5,6 +5,10 @@ import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.FeatureCollection;
+import com.mapbox.geojson.MultiLineString;
+import com.mapbox.geojson.Point;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
@@ -13,10 +17,7 @@ import com.mapbox.mapboxsdk.style.layers.LineLayer;
import com.mapbox.mapboxsdk.style.sources.CustomGeometrySource;
import com.mapbox.mapboxsdk.style.sources.GeometryTileProvider;
import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.FeatureCollection;
-import com.mapbox.services.commons.geojson.MultiLineString;
-import com.mapbox.services.commons.models.Position;
+
import java.util.ArrayList;
import java.util.Arrays;
@@ -68,18 +69,18 @@ public class GridSourceActivity extends AppCompatActivity implements OnMapReadyC
List gridLines = new ArrayList();
for (double y = Math.ceil(bounds.getLatNorth() / gridSpacing) * gridSpacing;
y >= Math.floor(bounds.getLatSouth() / gridSpacing) * gridSpacing; y -= gridSpacing) {
- gridLines.add(Arrays.asList(Position.fromCoordinates(bounds.getLonWest(), y),
- Position.fromCoordinates(bounds.getLonEast(), y)));
+ gridLines.add(Arrays.asList(Point.fromLngLat(bounds.getLonWest(), y),
+ Point.fromLngLat(bounds.getLonEast(), y)));
}
- features.add(Feature.fromGeometry(MultiLineString.fromCoordinates(gridLines)));
+ features.add(Feature.fromGeometry(MultiLineString.fromLngLats(gridLines)));
gridLines = new ArrayList();
for (double x = Math.floor(bounds.getLonWest() / gridSpacing) * gridSpacing;
x <= Math.ceil(bounds.getLonEast() / gridSpacing) * gridSpacing; x += gridSpacing) {
- gridLines.add(Arrays.asList(Position.fromCoordinates(x, bounds.getLatSouth()),
- Position.fromCoordinates(x, bounds.getLatNorth())));
+ gridLines.add(Arrays.asList(Point.fromLngLat(x, bounds.getLatSouth()),
+ Point.fromLngLat(x, bounds.getLatNorth())));
}
- features.add(Feature.fromGeometry(MultiLineString.fromCoordinates(gridLines)));
+ features.add(Feature.fromGeometry(MultiLineString.fromLngLats(gridLines)));
return FeatureCollection.fromFeatures(features);
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java
index 942ce9aa3d..6eb4772b15 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java
@@ -8,6 +8,8 @@ import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.FeatureCollection;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapView;
@@ -28,8 +30,7 @@ import com.mapbox.mapboxsdk.style.sources.TileSet;
import com.mapbox.mapboxsdk.style.sources.VectorSource;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.FeatureCollection;
+
import java.io.IOException;
import java.util.ArrayList;
@@ -364,7 +365,7 @@ public class RuntimeStyleActivity extends AppCompatActivity {
Timber.d("Updating parks source");
// change the source
- int park = counter < parks.getFeatures().size() - 1 ? counter : 0;
+ int park = counter < parks.features().size() - 1 ? counter : 0;
GeoJsonSource source = mapboxMap.getSourceAs("dynamic-park-source");
@@ -375,7 +376,7 @@ public class RuntimeStyleActivity extends AppCompatActivity {
}
List<Feature> features = new ArrayList<>();
- features.add(parks.getFeatures().get(park));
+ features.add(parks.features().get(park));
source.setGeoJson(FeatureCollection.fromFeatures(features));
// Re-post
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
index 1ef59db9b1..ca4176be6e 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java
@@ -15,7 +15,8 @@ import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
-import com.google.gson.GsonBuilder;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.FeatureCollection;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
@@ -25,12 +26,7 @@ import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.mapbox.mapboxsdk.style.sources.Source;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.utils.ResourceUtils;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.FeatureCollection;
-import com.mapbox.services.commons.geojson.Geometry;
-import com.mapbox.services.commons.geojson.custom.GeometryDeserializer;
-import com.mapbox.services.commons.geojson.custom.PositionDeserializer;
-import com.mapbox.services.commons.models.Position;
+
import java.io.IOException;
import java.util.HashMap;
@@ -211,14 +207,8 @@ public class SymbolGeneratorActivity extends AppCompatActivity implements OnMapR
try {
// read local geojson from raw folder
String tinyCountriesJson = ResourceUtils.readRawResource(activity, R.raw.tiny_countries);
+ return FeatureCollection.fromJson(tinyCountriesJson);
- // convert geojson to a model
- FeatureCollection featureCollection = new GsonBuilder()
- .registerTypeAdapter(Geometry.class, new GeometryDeserializer())
- .registerTypeAdapter(Position.class, new PositionDeserializer())
- .create().fromJson(tinyCountriesJson, FeatureCollection.class);
-
- return featureCollection;
} catch (IOException exception) {
return null;
}
@@ -288,7 +278,7 @@ public class SymbolGeneratorActivity extends AppCompatActivity implements OnMapR
FeatureCollection featureCollection = params[0];
HashMap<String, Bitmap> imagesMap = new HashMap<>();
- for (Feature feature : featureCollection.getFeatures()) {
+ for (Feature feature : featureCollection.features()) {
String countryName = feature.getStringProperty(FEATURE_ID);
TextView textView = new TextView(context);
textView.setBackgroundColor(context.getResources().getColor(R.color.blueAccent));
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java
index d89d71e604..e3a4f4be93 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolLayerActivity.java
@@ -11,6 +11,9 @@ import android.view.MenuItem;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.FeatureCollection;
+import com.mapbox.geojson.Point;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapView;
@@ -18,9 +21,7 @@ import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.FeatureCollection;
-import com.mapbox.services.commons.geojson.Point;
+
import java.util.Arrays;
import java.util.List;
@@ -62,8 +63,8 @@ public class SymbolLayerActivity extends AppCompatActivity implements MapboxMap.
// Add a source
FeatureCollection markers = FeatureCollection.fromFeatures(new Feature[] {
- Feature.fromGeometry(Point.fromCoordinates(new double[] {4.91638, 52.35673}), featureProperties("Marker 1")),
- Feature.fromGeometry(Point.fromCoordinates(new double[] {4.91638, 52.34673}), featureProperties("Marker 2"))
+ Feature.fromGeometry(Point.fromLngLat(4.91638, 52.35673), featureProperties("Marker 1")),
+ Feature.fromGeometry(Point.fromLngLat(4.91638, 52.34673), featureProperties("Marker 2"))
});
mapboxMap.addSource(new GeoJsonSource(MARKER_SOURCE, markers));
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/ZoomFunctionSymbolLayerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/ZoomFunctionSymbolLayerActivity.java
index 4a6e62ef7d..180e2e726a 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/ZoomFunctionSymbolLayerActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/ZoomFunctionSymbolLayerActivity.java
@@ -7,16 +7,16 @@ import android.view.Menu;
import android.view.MenuItem;
import com.google.gson.JsonObject;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.FeatureCollection;
+import com.mapbox.geojson.Point;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.style.layers.Property;
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.FeatureCollection;
-import com.mapbox.services.commons.geojson.Point;
-import com.mapbox.services.commons.models.Position;
+
import java.util.List;
@@ -87,15 +87,13 @@ public class ZoomFunctionSymbolLayerActivity extends AppCompatActivity {
}
private FeatureCollection createFeatureCollection() {
- Position position = isInitialPosition
- ? Position.fromCoordinates(-74.01618140, 40.701745)
- : Position.fromCoordinates(-73.988097, 40.749864);
+ Point point = isInitialPosition
+ ? Point.fromLngLat(-74.01618140, 40.701745)
+ : Point.fromLngLat(-73.988097, 40.749864);
- Point point = Point.fromCoordinates(position);
- Feature feature = Feature.fromGeometry(point);
JsonObject properties = new JsonObject();
properties.addProperty(KEY_PROPERTY_SELECTED, isSelected);
- feature.setProperties(properties);
+ Feature feature = Feature.fromGeometry(point, properties);
return FeatureCollection.fromFeatures(new Feature[] {feature});
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java
index 97f70e33bb..c21e479659 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/utils/GeoParseUtil.java
@@ -2,11 +2,11 @@ package com.mapbox.mapboxsdk.testapp.utils;
import android.content.Context;
import android.text.TextUtils;
+
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.FeatureCollection;
+import com.mapbox.geojson.Point;
import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.FeatureCollection;
-import com.mapbox.services.commons.geojson.Point;
-import com.mapbox.services.commons.models.Position;
import java.io.BufferedReader;
import java.io.IOException;
@@ -31,10 +31,10 @@ public class GeoParseUtil {
public static List<LatLng> parseGeoJsonCoordinates(String geojsonStr) {
List<LatLng> latLngs = new ArrayList<>();
FeatureCollection featureCollection = FeatureCollection.fromJson(geojsonStr);
- for (Feature feature : featureCollection.getFeatures()) {
- if (feature.getGeometry() instanceof Point) {
- Position point = ((Point) feature.getGeometry()).getCoordinates();
- latLngs.add(new LatLng(point.getLatitude(), point.getLongitude()));
+ for (Feature feature : featureCollection.features()) {
+ if (feature.geometry() instanceof Point) {
+ Point point = (Point) feature.geometry();
+ latLngs.add(new LatLng(point.latitude(), point.longitude()));
}
}
return latLngs;
diff --git a/platform/android/config.cmake b/platform/android/config.cmake
index 4832f8b251..e1c36789f5 100644
--- a/platform/android/config.cmake
+++ b/platform/android/config.cmake
@@ -248,8 +248,6 @@ add_library(mbgl-android STATIC
platform/android/src/geojson/point.hpp
platform/android/src/geojson/polygon.cpp
platform/android/src/geojson/polygon.hpp
- platform/android/src/geojson/position.cpp
- platform/android/src/geojson/position.hpp
# Geometry
platform/android/src/geometry/lat_lng.cpp
diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle
index 0c72368d3d..7ce0cd6196 100644
--- a/platform/android/gradle/dependencies.gradle
+++ b/platform/android/gradle/dependencies.gradle
@@ -8,7 +8,8 @@ ext {
]
versions = [
- mapboxServices: '2.2.9',
+ mapboxServices: '3.0.0-beta.2',
+ mapboxTelemetry: '2.2.9',
supportLib : '25.4.0',
espresso : '3.0.1',
testRunner : '1.0.1',
@@ -22,9 +23,12 @@ ext {
]
dependenciesList = [
- mapboxJavaServices : "com.mapbox.mapboxsdk:mapbox-java-services:${versions.mapboxServices}@jar",
- mapboxJavaGeoJSON : "com.mapbox.mapboxsdk:mapbox-java-geojson:${versions.mapboxServices}@jar",
- mapboxAndroidTelemetry: "com.mapbox.mapboxsdk:mapbox-android-telemetry:${versions.mapboxServices}@aar",
+ mapboxJavaServices : "com.mapbox.mapboxsdk:mapbox-sdk-services:${versions.mapboxServices}@jar",
+ mapboxJavaGeoJSON : "com.mapbox.mapboxsdk:mapbox-sdk-geojson:${versions.mapboxServices}@jar",
+ mapboxAndroidTelemetry: "com.mapbox.mapboxsdk:mapbox-android-telemetry:${versions.mapboxTelemetry}@aar",
+
+ // for testApp
+ mapboxJavaTurf : "com.mapbox.mapboxsdk:mapbox-sdk-turf:${versions.mapboxServices}@jar",
junit : "junit:junit:${versions.junit}",
mockito : "org.mockito:mockito-core:${versions.mockito}",
diff --git a/platform/android/src/geojson/conversion/geometry.hpp b/platform/android/src/geojson/conversion/geometry.hpp
index 2ca63e2c11..5d2aab4c2d 100644
--- a/platform/android/src/geojson/conversion/geometry.hpp
+++ b/platform/android/src/geojson/conversion/geometry.hpp
@@ -21,88 +21,91 @@ public:
jni::JNIEnv& env;
/**
- * Point (double[])
+ * static Point fromLngLat(double longitude,double latitude)
*/
jni::jobject* operator()(const mapbox::geometry::point<T> &geometry) const {
- static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/Point")).release();
- static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([D)Lcom/mapbox/services/commons/geojson/Point;");
+ static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/Point")).release();
+ static jni::jmethodID* fromLngLat = &jni::GetStaticMethodID(env, *javaClass, "fromLngLat", "(DD)Lcom/mapbox/geojson/Point;");
- // Create Point
- jni::LocalObject<jni::jarray<jni::jdouble>> position = jni::NewLocalObject(env, toGeoJsonPosition(env, geometry.x, geometry.y));
- return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromCoordinates, position.get()));
+ return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromLngLat, geometry.x, geometry.y));
}
/**
- * LineString (double[][])
+ * static LineString fromLngLats(List<Point> points)
*/
jni::jobject* operator()(const mapbox::geometry::line_string<T> &geometry) const {
- static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/LineString")).release();
- static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[D)Lcom/mapbox/services/commons/geojson/LineString;");
+ static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/LineString")).release();
+ static jni::jmethodID* fromLngLats = &jni::GetStaticMethodID(env, *javaClass, "fromLngLats", "(Ljava/util/List;)Lcom/mapbox/geojson/LineString;");
// Create
- jni::LocalObject<jni::jarray<jni::jobject>> coordinates = jni::NewLocalObject(env, toGeoJsonCoordinates(env, geometry));
- return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromCoordinates, coordinates.get()));
+ jni::LocalObject<jni::jobject> listOfPoints = jni::NewLocalObject(env, toGeoJsonListOfPoints(env, geometry));
+ return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromLngLats, listOfPoints.get()));
}
/**
- * MultiPoint (double[][])
+ * static MultiPoint fromLngLats(List<Point> points)
*/
jni::jobject* operator()(const mapbox::geometry::multi_point<T> &geometry) const {
- static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/MultiPoint")).release();
- static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[D)Lcom/mapbox/services/commons/geojson/MultiPoint;");
+ static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/MultiPoint")).release();
+ static jni::jmethodID* fromLngLats = &jni::GetStaticMethodID(env, *javaClass, "fromLngLats", "(Ljava/util/List;)Lcom/mapbox/geojson/MultiPoint;");
// Create
- jni::LocalObject<jni::jarray<jni::jobject>> coordinates = jni::NewLocalObject(env, toGeoJsonCoordinates(env, geometry));
- return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromCoordinates, coordinates.get()));
+ jni::LocalObject<jni::jobject> coordinates = jni::NewLocalObject(env, toGeoJsonListOfPoints(env, geometry));
+ return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromLngLats, coordinates.get()));
}
/**
- * Polygon (double[][][])
+ * static Polygon fromLngLats(List<List<Point>> coordinates)
*/
jni::jobject* operator()(const mapbox::geometry::polygon<T> &geometry) const {
- static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/Polygon")).release();
- static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[[D)Lcom/mapbox/services/commons/geojson/Polygon;");
+ static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/Polygon")).release();
+ static jni::jmethodID* fromLngLats = &jni::GetStaticMethodID(env, *javaClass, "fromLngLats", "(Ljava/util/List;)Lcom/mapbox/geojson/Polygon;");
// Create
- jni::LocalObject<jni::jarray<jni::jobject>> shape = jni::NewLocalObject(env, toShape<>(env, geometry));
- return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromCoordinates, shape.get()));
+ jni::LocalObject<jni::jobject> shape = jni::NewLocalObject(env, toShape<>(env, geometry));
+ return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromLngLats, shape.get()));
}
/**
- * MultiLineString (double[][][])
+ * static MultiLineString fromLngLats(List<List<Point>> points)
*/
jni::jobject* operator()(const mapbox::geometry::multi_line_string<T> &geometry) const {
- static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/MultiLineString")).release();
- static jni::jmethodID* fromCoordinates = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[[D)Lcom/mapbox/services/commons/geojson/MultiLineString;");
+ static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/MultiLineString")).release();
+ static jni::jmethodID* fromLngLats = &jni::GetStaticMethodID(env, *javaClass, "fromLngLats", "(Ljava/util/List;)Lcom/mapbox/geojson/MultiLineString;");
// Create
- jni::LocalObject<jni::jarray<jni::jobject>> shape = jni::NewLocalObject(env, toShape<>(env, geometry));
- return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromCoordinates, shape.get()));
+ jni::LocalObject<jni::jobject> shape = jni::NewLocalObject(env, toShape<>(env, geometry));
+ return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromLngLats, shape.get()));
}
/**
* MultiPolygon (double[][][][]) -> [[[D + Object array == [[[[D
+ *
+ * static MultiPolygon fromLngLats(List<List<List<Point>>> points)
*/
jni::jobject* operator()(const mapbox::geometry::multi_polygon<T> &geometry) const {
- static jni::jclass* listClass = jni::NewGlobalRef(env, &jni::FindClass(env, "[[[D")).release();
- jni::LocalObject<jni::jarray<jni::jobject>> jarray = jni::NewLocalObject(env, &jni::NewObjectArray(env, geometry.size(), *listClass));
+ // ArrayList
+ static jni::jclass* arrayListClass = jni::NewGlobalRef(env, &jni::FindClass(env, "java/util/ArrayList")).release();
+ static jni::jmethodID* constructor = &jni::GetMethodID(env, *arrayListClass, "<init>", "(I)V");
+ static jni::jmethodID* add = &jni::GetMethodID(env, *arrayListClass, "add", "(ILjava/lang/Object;)V");
+ jni::jobject* arrayList = &jni::NewObject(env, *arrayListClass, *constructor, geometry.size());
for(size_t i = 0; i < geometry.size(); i = i + 1) {
- jni::LocalObject<jni::jarray<jni::jobject>> shape = jni::NewLocalObject(env, toShape<>(env, geometry.at(i)));
- jni::SetObjectArrayElement(env, *jarray, i, shape.get());
+ jni::LocalObject<jni::jobject> shape = jni::NewLocalObject(env, toShape<>(env, geometry.at(i)));
+ jni::CallMethod<void>(env, arrayList, *add, i, shape.get());
}
// Create the MultiPolygon
- static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/MultiPolygon")).release();
- static jni::jmethodID* fromGeometries = &jni::GetStaticMethodID(env, *javaClass, "fromCoordinates", "([[[[D)Lcom/mapbox/services/commons/geojson/MultiPolygon;");
- return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromGeometries, jarray.get()));
+ static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/MultiPolygon")).release();
+ static jni::jmethodID* fromGeometries = &jni::GetStaticMethodID(env, *javaClass, "fromLngLats", "(Ljava/util/List;)Lcom/mapbox/geojson/MultiPolygon;");
+ return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromGeometries, arrayList));
}
/**
* GeometryCollection
*/
jni::jobject* operator()(const mapbox::geometry::geometry_collection<T> &collection) const {
- static jni::jclass* geometryClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/Geometry")).release();
+ static jni::jclass* geometryClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/Geometry")).release();
jni::LocalObject<jni::jarray<jni::jobject>> jarray = jni::NewLocalObject(env, &jni::NewObjectArray(env, collection.size(), *geometryClass));
for(size_t i = 0; i < collection.size(); i = i + 1) {
@@ -112,8 +115,8 @@ public:
}
// Turn into array list and create the GeometryCollection
- static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/services/commons/geojson/GeometryCollection")).release();
- static jni::jmethodID* fromGeometries = &jni::GetStaticMethodID(env, *javaClass, "fromGeometries", "(Ljava/util/List;)Lcom/mapbox/services/commons/geojson/GeometryCollection;");
+ static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/GeometryCollection")).release();
+ static jni::jmethodID* fromGeometries = &jni::GetStaticMethodID(env, *javaClass, "fromGeometries", "(Ljava/util/List;)Lcom/mapbox/geojson/GeometryCollection;");
jni::LocalObject<jni::jobject> list = jni::NewLocalObject(env, toArrayList<>(env, *jarray));
return reinterpret_cast<jni::jobject*>(jni::CallStaticMethod<jni::jobject*>(env, *javaClass, *fromGeometries, list.get()));
@@ -122,47 +125,50 @@ public:
private:
/**
- * x, y -> jarray<jdouble> ([x,y])
- */
- static jni::jarray<jni::jdouble>* toGeoJsonPosition(JNIEnv& env, double x, double y) {
- jni::jarray<jni::jdouble>& jarray = jni::NewArray<jni::jdouble>(env, 2);
- jni::jdouble array[] = {x, y};
- jni::SetArrayRegion(env, jarray, 0, 2, array);
- return &jarray;
- }
+ * vector<point<T>> -> List<Point>
+ */
+ static jni::jobject* toGeoJsonListOfPoints(JNIEnv& env, std::vector<mapbox::geometry::point<T>> points) {
- /**
- * vector<point<T>> -> jarray<jobject> (double[][]) -> [D + Object array == [[D
- */
- static jni::jarray<jni::jobject>* toGeoJsonCoordinates(JNIEnv& env, std::vector<mapbox::geometry::point<T>> points) {
- static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "[D")).release();
- jni::jarray<jni::jobject>& jarray = jni::NewObjectArray(env, points.size(), *javaClass);
+ // ArrayList
+ static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "java/util/ArrayList")).release();
+ static jni::jmethodID* constructor = &jni::GetMethodID(env, *javaClass, "<init>", "(I)V");
+ static jni::jmethodID* add = &jni::GetMethodID(env, *javaClass, "add", "(ILjava/lang/Object;)V");
+ jni::jobject* arrayList = &jni::NewObject(env, *javaClass, *constructor, points.size());
+
+
+ // Point
+ static jni::jclass* pointJavaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "com/mapbox/geojson/Point")).release();
+ static jni::jmethodID* fromLngLat = &jni::GetStaticMethodID(env, *pointJavaClass, "fromLngLat", "(DD)Lcom/mapbox/geojson/Point;");
for(size_t i = 0; i < points.size(); i = i + 1) {
mapbox::geometry::point<T> point = points.at(i);
- jni::LocalObject<jni::jarray<jni::jdouble>> position = jni::NewLocalObject(env, toGeoJsonPosition(env, point.x, point.y));
- jni::SetObjectArrayElement(env, jarray, i, position.get());
+ jni::LocalObject<jni::jobject> pointObject =
+ jni::NewLocalObject(env, jni::CallStaticMethod<jni::jobject*>(env, *pointJavaClass, *fromLngLat, point.x, point.y));
+ jni::CallMethod<void>(env, arrayList, *add, i, pointObject.get());
}
- return &jarray;
+ return arrayList;
}
/**
- * polygon<T>
- * multi_line_string<T>
- * -> jarray<jobject> (double[][][]) -> [[D + Object array == [[[D
+ * geometry -> List<List<Point>>
*/
template <class SHAPE>
- static jni::jarray<jni::jobject>* toShape(JNIEnv& env, SHAPE value) {
- static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "[[D")).release();
- jni::jarray<jni::jobject>& jarray = jni::NewObjectArray(env, value.size(), *javaClass);
+ static jni::jobject* toShape(JNIEnv& env, SHAPE value) {
+
+ // ArrayList
+ static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "java/util/ArrayList")).release();
+ static jni::jmethodID* constructor = &jni::GetMethodID(env, *javaClass, "<init>", "(I)V");
+ static jni::jmethodID* add = &jni::GetMethodID(env, *javaClass, "add", "(ILjava/lang/Object;)V");
+ jni::jobject* arrayList = &jni::NewObject(env, *javaClass, *constructor, value.size());
+
for(size_t i = 0; i < value.size(); i = i + 1) {
- jni::LocalObject<jni::jarray<jni::jobject>> coordinates = jni::NewLocalObject(env, toGeoJsonCoordinates(env, value.at(i)));
- jni::SetObjectArrayElement(env, jarray, i, coordinates.get());
+ jni::LocalObject<jni::jobject> listOfPoints = jni::NewLocalObject(env, toGeoJsonListOfPoints(env, value.at(i)));
+ jni::CallMethod<void>(env, arrayList, *add, i, listOfPoints.get());
}
- return &jarray;
+ return arrayList;
}
};
diff --git a/platform/android/src/geojson/feature.cpp b/platform/android/src/geojson/feature.cpp
index a6b387cd15..d8a4e829e2 100644
--- a/platform/android/src/geojson/feature.cpp
+++ b/platform/android/src/geojson/feature.cpp
@@ -8,11 +8,11 @@ namespace geojson {
mbgl::Feature Feature::convert(jni::JNIEnv& env, jni::Object<Feature> jFeature) {
// Convert
- auto jGeometry = getGeometry(env, jFeature);
- auto jProperties = Feature::getProperties(env, jFeature);
+ auto jGeometry = geometry(env, jFeature);
+ auto jProperties = Feature::properties(env, jFeature);
std::experimental::optional<mapbox::geometry::identifier> id;
- auto jId = Feature::getId(env, jFeature);
+ auto jId = Feature::id(env, jFeature);
if (jId) {
id = { jni::Make<std::string>(env, jId) };
}
@@ -31,18 +31,18 @@ mbgl::Feature Feature::convert(jni::JNIEnv& env, jni::Object<Feature> jFeature)
return feature;
}
-jni::Object<Geometry> Feature::getGeometry(jni::JNIEnv& env, jni::Object<Feature> jFeature) {
- static auto method = Feature::javaClass.GetMethod<jni::Object<Geometry> ()>(env, "getGeometry");
+jni::Object<Geometry> Feature::geometry(jni::JNIEnv& env, jni::Object<Feature> jFeature) {
+ static auto method = Feature::javaClass.GetMethod<jni::Object<Geometry> ()>(env, "geometry");
return jFeature.Call(env, method);
}
-jni::Object<gson::JsonObject> Feature::getProperties(jni::JNIEnv& env, jni::Object<Feature> jFeature) {
- static auto method = Feature::javaClass.GetMethod<jni::Object<gson::JsonObject> ()>(env, "getProperties");
+jni::Object<gson::JsonObject> Feature::properties(jni::JNIEnv& env, jni::Object<Feature> jFeature) {
+ static auto method = Feature::javaClass.GetMethod<jni::Object<gson::JsonObject> ()>(env, "properties");
return jFeature.Call(env, method);
}
-jni::String Feature::getId(jni::JNIEnv& env, jni::Object<Feature> jFeature) {
- static auto method = Feature::javaClass.GetMethod<jni::String ()>(env, "getId");
+jni::String Feature::id(jni::JNIEnv& env, jni::Object<Feature> jFeature) {
+ static auto method = Feature::javaClass.GetMethod<jni::String ()>(env, "id");
return jFeature.Call(env, method);
}
diff --git a/platform/android/src/geojson/feature.hpp b/platform/android/src/geojson/feature.hpp
index b5d856cc42..ab59d783e5 100644
--- a/platform/android/src/geojson/feature.hpp
+++ b/platform/android/src/geojson/feature.hpp
@@ -16,17 +16,17 @@ namespace geojson {
class Feature : private mbgl::util::noncopyable {
public:
- static constexpr auto Name() { return "com/mapbox/services/commons/geojson/Feature"; };
+ static constexpr auto Name() { return "com/mapbox/geojson/Feature"; };
static jni::Object<Feature> fromGeometry(jni::JNIEnv&, jni::Object<Geometry>, jni::Object<gson::JsonObject>, jni::String);
static mbgl::Feature convert(jni::JNIEnv&, jni::Object<Feature>);
- static jni::Object<Geometry> getGeometry(jni::JNIEnv&, jni::Object<Feature>);
+ static jni::Object<Geometry> geometry(jni::JNIEnv&, jni::Object<Feature>);
- static jni::String getId(jni::JNIEnv&, jni::Object<Feature>);
+ static jni::String id(jni::JNIEnv&, jni::Object<Feature>);
- static jni::Object<gson::JsonObject> getProperties(jni::JNIEnv&, jni::Object<Feature>);
+ static jni::Object<gson::JsonObject> properties(jni::JNIEnv&, jni::Object<Feature>);
static jni::Class<Feature> javaClass;
diff --git a/platform/android/src/geojson/feature_collection.cpp b/platform/android/src/geojson/feature_collection.cpp
index 2f156532ae..59f1e317e6 100644
--- a/platform/android/src/geojson/feature_collection.cpp
+++ b/platform/android/src/geojson/feature_collection.cpp
@@ -7,7 +7,7 @@ namespace android {
namespace geojson {
mbgl::FeatureCollection FeatureCollection::convert(jni::JNIEnv& env, jni::Object<FeatureCollection> jCollection) {
- auto jFeatureList = FeatureCollection::getFeatures(env, jCollection);
+ auto jFeatureList = FeatureCollection::features(env, jCollection);
auto jFeatures = java::util::List::toArray<Feature>(env, jFeatureList);
auto size = size_t(jFeatures.Length(env));
@@ -23,8 +23,8 @@ mbgl::FeatureCollection FeatureCollection::convert(jni::JNIEnv& env, jni::Object
return collection;
}
-jni::Object<java::util::List> FeatureCollection::getFeatures(jni::JNIEnv& env, jni::Object<FeatureCollection> jCollection) {
- static auto method = FeatureCollection::javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "getFeatures");
+jni::Object<java::util::List> FeatureCollection::features(jni::JNIEnv& env, jni::Object<FeatureCollection> jCollection) {
+ static auto method = FeatureCollection::javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "features");
return jCollection.Call(env, method);
}
diff --git a/platform/android/src/geojson/feature_collection.hpp b/platform/android/src/geojson/feature_collection.hpp
index 8e9717e82b..259ffab370 100644
--- a/platform/android/src/geojson/feature_collection.hpp
+++ b/platform/android/src/geojson/feature_collection.hpp
@@ -13,11 +13,11 @@ namespace geojson {
class FeatureCollection : private mbgl::util::noncopyable {
public:
- static constexpr auto Name() { return "com/mapbox/services/commons/geojson/FeatureCollection"; };
+ static constexpr auto Name() { return "com/mapbox/geojson/FeatureCollection"; };
static mbgl::FeatureCollection convert(jni::JNIEnv&, jni::Object<FeatureCollection>);
- static jni::Object<java::util::List> getFeatures(jni::JNIEnv&, jni::Object<FeatureCollection>);
+ static jni::Object<java::util::List> features(jni::JNIEnv&, jni::Object<FeatureCollection>);
static jni::Class<FeatureCollection> javaClass;
diff --git a/platform/android/src/geojson/geometry.cpp b/platform/android/src/geojson/geometry.cpp
index 33bb4ee3db..ca19d8fb03 100644
--- a/platform/android/src/geojson/geometry.cpp
+++ b/platform/android/src/geojson/geometry.cpp
@@ -33,7 +33,7 @@ mapbox::geojson::geometry Geometry::convert(jni::JNIEnv &env, jni::Object<Geomet
}
std::string Geometry::getType(jni::JNIEnv &env, jni::Object<Geometry> jGeometry) {
- static auto method = Geometry::javaClass.GetMethod<jni::String ()>(env, "getType");
+ static auto method = Geometry::javaClass.GetMethod<jni::String ()>(env, "type");
auto jType = jGeometry.Call(env, method);
auto type = jni::Make<std::string>(env, jType);
jni::DeleteLocalRef(env, jType);
diff --git a/platform/android/src/geojson/geometry.hpp b/platform/android/src/geojson/geometry.hpp
index bdcff6bb3e..b7f8909f6f 100644
--- a/platform/android/src/geojson/geometry.hpp
+++ b/platform/android/src/geojson/geometry.hpp
@@ -11,7 +11,7 @@ namespace geojson {
class Geometry : private mbgl::util::noncopyable {
public:
- static constexpr auto Name() { return "com/mapbox/services/commons/geojson/Geometry"; };
+ static constexpr auto Name() { return "com/mapbox/geojson/Geometry"; };
static mapbox::geojson::geometry convert(jni::JNIEnv&, jni::Object<Geometry>);
diff --git a/platform/android/src/geojson/line_string.cpp b/platform/android/src/geojson/line_string.cpp
index d0719f2538..9e99c72c4c 100644
--- a/platform/android/src/geojson/line_string.cpp
+++ b/platform/android/src/geojson/line_string.cpp
@@ -1,6 +1,6 @@
#include "line_string.hpp"
-#include "position.hpp"
+#include "point.hpp"
namespace mbgl {
namespace android {
@@ -10,35 +10,35 @@ mapbox::geojson::line_string LineString::convert(jni::JNIEnv &env, jni::Object<L
mapbox::geojson::line_string lineString;
if (jLineString) {
- auto jPositionList = LineString::getCoordinates(env, jLineString);
- lineString = LineString::convert(env, jPositionList);
- jni::DeleteLocalRef(env, jPositionList);
+ auto jPointList = LineString::coordinates(env, jLineString);
+ lineString = LineString::convert(env, jPointList);
+ jni::DeleteLocalRef(env, jPointList);
}
return lineString;
}
-mapbox::geojson::line_string LineString::convert(jni::JNIEnv &env, jni::Object<java::util::List/*<Position>*/> jPositionList) {
+mapbox::geojson::line_string LineString::convert(jni::JNIEnv &env, jni::Object<java::util::List/*<Point>*/> jPointList) {
mapbox::geojson::line_string lineString;
- if (jPositionList) {
- auto jPositionArray = java::util::List::toArray<Position>(env, jPositionList);
+ if (jPointList) {
+ auto jPointArray = java::util::List::toArray<Point>(env, jPointList);
- auto size = jPositionArray.Length(env);
+ auto size = jPointArray.Length(env);
for (std::size_t i = 0; i < size; i++) {
- auto jPosition = jPositionArray.Get(env, i);
- lineString.push_back(Position::convert(env, jPosition));
- jni::DeleteLocalRef(env, jPosition);
+ auto jPoint = jPointArray.Get(env, i);
+ lineString.push_back(Point::convert(env, jPoint));
+ jni::DeleteLocalRef(env, jPoint);
}
- jni::DeleteLocalRef(env, jPositionArray);
+ jni::DeleteLocalRef(env, jPointArray);
}
return lineString;
}
-jni::Object<java::util::List> LineString::getCoordinates(jni::JNIEnv &env, jni::Object<LineString> jLineString) {
- static auto method = LineString::javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "getCoordinates");
+jni::Object<java::util::List> LineString::coordinates(jni::JNIEnv &env, jni::Object<LineString> jLineString) {
+ static auto method = LineString::javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "coordinates");
return jLineString.Call(env, method);
}
diff --git a/platform/android/src/geojson/line_string.hpp b/platform/android/src/geojson/line_string.hpp
index d3be68d0a5..86033c2e6a 100644
--- a/platform/android/src/geojson/line_string.hpp
+++ b/platform/android/src/geojson/line_string.hpp
@@ -14,15 +14,15 @@ namespace geojson {
class LineString : private mbgl::util::noncopyable {
public:
- static constexpr auto Name() { return "com/mapbox/services/commons/geojson/LineString"; };
+ static constexpr auto Name() { return "com/mapbox/geojson/LineString"; };
static constexpr auto Type() { return "LineString"; };
static mapbox::geojson::line_string convert(jni::JNIEnv&, jni::Object<LineString>);
- static mapbox::geojson::line_string convert(jni::JNIEnv&, jni::Object<java::util::List/*<Position>*/>);
+ static mapbox::geojson::line_string convert(jni::JNIEnv&, jni::Object<java::util::List/*<Point>*/>);
- static jni::Object<java::util::List> getCoordinates(jni::JNIEnv&, jni::Object<LineString>);
+ static jni::Object<java::util::List> coordinates(jni::JNIEnv&, jni::Object<LineString>);
static jni::Class<LineString> javaClass;
diff --git a/platform/android/src/geojson/multi_line_string.cpp b/platform/android/src/geojson/multi_line_string.cpp
index b676144bf5..c748d4786f 100644
--- a/platform/android/src/geojson/multi_line_string.cpp
+++ b/platform/android/src/geojson/multi_line_string.cpp
@@ -10,27 +10,27 @@ mapbox::geojson::multi_line_string MultiLineString::convert(jni::JNIEnv &env, jn
mapbox::geojson::multi_line_string multiLineString;
if (jMultiLineString) {
- auto jPositionListsList = MultiLineString::getCoordinates(env, jMultiLineString);
- multiLineString = MultiLineString::convert(env, jPositionListsList);
- jni::DeleteLocalRef(env, jPositionListsList);
+ auto jPointListsList = MultiLineString::coordinates(env, jMultiLineString);
+ multiLineString = MultiLineString::convert(env, jPointListsList);
+ jni::DeleteLocalRef(env, jPointListsList);
}
return multiLineString;
}
-mapbox::geojson::multi_line_string MultiLineString::convert(jni::JNIEnv &env, jni::Object<java::util::List/*<java::util::List<Position>>*/> jPositionListsList) {
+mapbox::geojson::multi_line_string MultiLineString::convert(jni::JNIEnv &env, jni::Object<java::util::List/*<java::util::List<Point>>*/> jPointListsList) {
mapbox::geojson::multi_line_string multiLineString;
- if (jPositionListsList) {
- auto jPositionListsArray = java::util::List::toArray<java::util::List>(env, jPositionListsList);
+ if (jPointListsList) {
+ auto jPositionListsArray = java::util::List::toArray<java::util::List>(env, jPointListsList);
auto size = jPositionListsArray.Length(env);
multiLineString.reserve(size);
for (std::size_t i = 0; i < size; i++) {
- auto jPositionList = jPositionListsArray.Get(env, i);
- multiLineString.push_back(LineString::convert(env, jPositionList));
- jni::DeleteLocalRef(env, jPositionList);
+ auto jPointsList = jPositionListsArray.Get(env, i);
+ multiLineString.push_back(LineString::convert(env, jPointsList));
+ jni::DeleteLocalRef(env, jPointsList);
}
jni::DeleteLocalRef(env, jPositionListsArray);
@@ -39,8 +39,8 @@ mapbox::geojson::multi_line_string MultiLineString::convert(jni::JNIEnv &env, jn
return multiLineString;
}
-jni::Object<java::util::List> MultiLineString::getCoordinates(jni::JNIEnv &env, jni::Object<MultiLineString> jLineString) {
- static auto method = MultiLineString::javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "getCoordinates");
+jni::Object<java::util::List> MultiLineString::coordinates(jni::JNIEnv &env, jni::Object<MultiLineString> jLineString) {
+ static auto method = MultiLineString::javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "coordinates");
return jLineString.Call(env, method);
}
diff --git a/platform/android/src/geojson/multi_line_string.hpp b/platform/android/src/geojson/multi_line_string.hpp
index af33fe72d6..358a6b5dda 100644
--- a/platform/android/src/geojson/multi_line_string.hpp
+++ b/platform/android/src/geojson/multi_line_string.hpp
@@ -13,15 +13,15 @@ namespace geojson {
class MultiLineString : private mbgl::util::noncopyable {
public:
- static constexpr auto Name() { return "com/mapbox/services/commons/geojson/MultiLineString"; };
+ static constexpr auto Name() { return "com/mapbox/geojson/MultiLineString"; };
static constexpr auto Type() { return "MultiLineString"; };
static mapbox::geojson::multi_line_string convert(jni::JNIEnv&, jni::Object<MultiLineString>);
- static mapbox::geojson::multi_line_string convert(jni::JNIEnv&, jni::Object<java::util::List/*<java::util::List<Position>>*/>);
+ static mapbox::geojson::multi_line_string convert(jni::JNIEnv&, jni::Object<java::util::List/*<java::util::List<Point>>*/>);
- static jni::Object<java::util::List> getCoordinates(jni::JNIEnv&, jni::Object<MultiLineString>);
+ static jni::Object<java::util::List> coordinates(jni::JNIEnv&, jni::Object<MultiLineString>);
static jni::Class<MultiLineString> javaClass;
diff --git a/platform/android/src/geojson/multi_point.cpp b/platform/android/src/geojson/multi_point.cpp
index f3acdb1ea6..4f9ff596b2 100644
--- a/platform/android/src/geojson/multi_point.cpp
+++ b/platform/android/src/geojson/multi_point.cpp
@@ -12,16 +12,16 @@ mapbox::geojson::multi_point MultiPoint::convert(jni::JNIEnv &env, jni::Object<M
mapbox::geojson::multi_point multiPoint;
if (jMultiPoint) {
- auto jPositionListsList = MultiPoint::getCoordinates(env, jMultiPoint);
- multiPoint = convertExplicit<mapbox::geojson::multi_point>(LineString::convert(env, jPositionListsList));
- jni::DeleteLocalRef(env, jPositionListsList);
+ auto jPointListsList = MultiPoint::coordinates(env, jMultiPoint);
+ multiPoint = convertExplicit<mapbox::geojson::multi_point>(LineString::convert(env, jPointListsList));
+ jni::DeleteLocalRef(env, jPointListsList);
}
return multiPoint;
}
-jni::Object<java::util::List> MultiPoint::getCoordinates(jni::JNIEnv &env, jni::Object<MultiPoint> jMultiPoint) {
- static auto method = MultiPoint::javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "getCoordinates");
+jni::Object<java::util::List> MultiPoint::coordinates(jni::JNIEnv &env, jni::Object<MultiPoint> jMultiPoint) {
+ static auto method = MultiPoint::javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "coordinates");
return jMultiPoint.Call(env, method);
}
diff --git a/platform/android/src/geojson/multi_point.hpp b/platform/android/src/geojson/multi_point.hpp
index 7a698287eb..e893e879af 100644
--- a/platform/android/src/geojson/multi_point.hpp
+++ b/platform/android/src/geojson/multi_point.hpp
@@ -13,13 +13,13 @@ namespace geojson {
class MultiPoint : private mbgl::util::noncopyable {
public:
- static constexpr auto Name() { return "com/mapbox/services/commons/geojson/MultiPoint"; };
+ static constexpr auto Name() { return "com/mapbox/geojson/MultiPoint"; };
static constexpr auto Type() { return "MultiPoint"; };
static mapbox::geojson::multi_point convert(jni::JNIEnv&, jni::Object<MultiPoint>);
- static jni::Object<java::util::List> getCoordinates(jni::JNIEnv&, jni::Object<MultiPoint>);
+ static jni::Object<java::util::List> coordinates(jni::JNIEnv&, jni::Object<MultiPoint>);
static jni::Class<MultiPoint> javaClass;
diff --git a/platform/android/src/geojson/multi_polygon.cpp b/platform/android/src/geojson/multi_polygon.cpp
index a55884a110..f4eb0f6b2a 100644
--- a/platform/android/src/geojson/multi_polygon.cpp
+++ b/platform/android/src/geojson/multi_polygon.cpp
@@ -10,27 +10,27 @@ mapbox::geojson::multi_polygon MultiPolygon::convert(jni::JNIEnv &env, jni::Obje
mapbox::geojson::multi_polygon multiPolygon;
if (jMultiPolygon) {
- auto jPositionListsListList = MultiPolygon::getCoordinates(env, jMultiPolygon);
- auto jPositionListsListArray = java::util::List::toArray<java::util::List>(env, jPositionListsListList);
+ auto jPointListsListList = MultiPolygon::coordinates(env, jMultiPolygon);
+ auto jPointListsListArray = java::util::List::toArray<java::util::List>(env, jPointListsListList);
- auto size = jPositionListsListArray.Length(env);
+ auto size = jPointListsListArray.Length(env);
multiPolygon.reserve(size);
for (size_t i = 0; i < size; i++) {
- auto jPositionListsList = jPositionListsListArray.Get(env, i);
+ auto jPositionListsList = jPointListsListArray.Get(env, i);
multiPolygon.push_back(Polygon::convert(env, jPositionListsList));
jni::DeleteLocalRef(env, jPositionListsList);
}
- jni::DeleteLocalRef(env, jPositionListsListList);
- jni::DeleteLocalRef(env, jPositionListsListArray);
+ jni::DeleteLocalRef(env, jPointListsListList);
+ jni::DeleteLocalRef(env, jPointListsListArray);
}
return multiPolygon;
}
-jni::Object<java::util::List> MultiPolygon::getCoordinates(jni::JNIEnv &env, jni::Object<MultiPolygon> jPolygon) {
- static auto method = MultiPolygon::javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "getCoordinates");
+jni::Object<java::util::List> MultiPolygon::coordinates(jni::JNIEnv &env, jni::Object<MultiPolygon> jPolygon) {
+ static auto method = MultiPolygon::javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "coordinates");
return jPolygon.Call(env, method);
}
diff --git a/platform/android/src/geojson/multi_polygon.hpp b/platform/android/src/geojson/multi_polygon.hpp
index 1f144cffd2..6e1dfacfc8 100644
--- a/platform/android/src/geojson/multi_polygon.hpp
+++ b/platform/android/src/geojson/multi_polygon.hpp
@@ -13,13 +13,13 @@ namespace geojson {
class MultiPolygon : private mbgl::util::noncopyable {
public:
- static constexpr auto Name() { return "com/mapbox/services/commons/geojson/MultiPolygon"; };
+ static constexpr auto Name() { return "com/mapbox/geojson/MultiPolygon"; };
static constexpr auto Type() { return "MultiPolygon"; };
static mapbox::geojson::multi_polygon convert(jni::JNIEnv&, jni::Object<MultiPolygon>);
- static jni::Object<java::util::List> getCoordinates(jni::JNIEnv&, jni::Object<MultiPolygon>);
+ static jni::Object<java::util::List> coordinates(jni::JNIEnv&, jni::Object<MultiPolygon>);
static jni::Class<MultiPolygon> javaClass;
diff --git a/platform/android/src/geojson/point.cpp b/platform/android/src/geojson/point.cpp
index 3d19a119d7..5feb1b8521 100644
--- a/platform/android/src/geojson/point.cpp
+++ b/platform/android/src/geojson/point.cpp
@@ -1,19 +1,41 @@
#include "point.hpp"
+#include "../java/util.hpp"
+#include "../java_types.hpp"
namespace mbgl {
namespace android {
namespace geojson {
mapbox::geojson::point Point::convert(jni::JNIEnv &env, jni::Object<Point> jPoint) {
- auto jPosition = Point::getPosition(env, jPoint);
- auto point = Position::convert(env, jPosition);
- jni::DeleteLocalRef(env, jPosition);
+ mapbox::geojson::point point;
+
+ if (jPoint) {
+ auto jDoubleList = Point::coordinates(env, jPoint);
+ point = Point::convert(env, jDoubleList);
+ jni::DeleteLocalRef(env, jDoubleList);
+ }
+
+ return point;
+}
+
+mapbox::geojson::point Point::convert(jni::JNIEnv &env, jni::Object<java::util::List/*<Double>*/> jDoubleList) {
+ auto jDoubleArray = java::util::List::toArray<double>(env, jDoubleList);
+
+ jni::jdouble lon = jni::CallMethod<jni::jdouble>(env,
+ jDoubleArray.Get(env, 0),
+ *java::Number::doubleValueMethodId);
+ jni::jdouble lat = jni::CallMethod<jni::jdouble>(env,
+ jDoubleArray.Get(env, 1),
+ *java::Number::doubleValueMethodId);
+ mapbox::geojson::point point(lon, lat);
+ jni::DeleteLocalRef(env, jDoubleArray);
+
return point;
}
-jni::Object<Position> Point::getPosition(JNIEnv& env, jni::Object<Point> jPoint) {
- static auto method = Point::javaClass.GetMethod<jni::Object<Position> ()>(env, "getCoordinates");
- return jPoint.Call(env, method);
+jni::Object<java::util::List> Point::coordinates(jni::JNIEnv &env, jni::Object<Point> jPoint) {
+ static auto method = Point::javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "coordinates");
+ return jPoint.Call(env, method);
}
void Point::registerNative(jni::JNIEnv &env) {
diff --git a/platform/android/src/geojson/point.hpp b/platform/android/src/geojson/point.hpp
index 64ac0af9cc..c6412299bf 100644
--- a/platform/android/src/geojson/point.hpp
+++ b/platform/android/src/geojson/point.hpp
@@ -3,23 +3,25 @@
#include <mbgl/util/geojson.hpp>
#include <mbgl/util/noncopyable.hpp>
-#include "position.hpp"
-
#include <jni/jni.hpp>
+#include "../java/util.hpp"
+
namespace mbgl {
namespace android {
namespace geojson {
class Point : private mbgl::util::noncopyable {
public:
- static constexpr auto Name() { return "com/mapbox/services/commons/geojson/Point"; };
+ static constexpr auto Name() { return "com/mapbox/geojson/Point"; };
static constexpr auto Type() { return "Point"; };
static mapbox::geojson::point convert(jni::JNIEnv&, jni::Object<Point>);
- static jni::Object<Position> getPosition(JNIEnv&, jni::Object<Point>);
+ static mapbox::geojson::point convert(jni::JNIEnv&, jni::Object<java::util::List/*<Double>*/>);
+
+ static jni::Object<java::util::List> coordinates(JNIEnv&, jni::Object<Point>);
static jni::Class<Point> javaClass;
diff --git a/platform/android/src/geojson/polygon.cpp b/platform/android/src/geojson/polygon.cpp
index ef00f9df3f..30ba996640 100644
--- a/platform/android/src/geojson/polygon.cpp
+++ b/platform/android/src/geojson/polygon.cpp
@@ -12,7 +12,7 @@ mapbox::geojson::polygon Polygon::convert(jni::JNIEnv &env, jni::Object<Polygon>
mapbox::geojson::polygon polygon;
if (jPolygon) {
- auto jPositionListsList = Polygon::getCoordinates(env, jPolygon);
+ auto jPositionListsList = Polygon::coordinates(env, jPolygon);
polygon = Polygon::convert(env, jPositionListsList);
jni::DeleteLocalRef(env, jPositionListsList);
}
@@ -20,11 +20,11 @@ mapbox::geojson::polygon Polygon::convert(jni::JNIEnv &env, jni::Object<Polygon>
return polygon;
}
-mapbox::geojson::polygon Polygon::convert(jni::JNIEnv &env, jni::Object<java::util::List/*<java::util::List<Position>>*/> jPositionListsList) {
+mapbox::geojson::polygon Polygon::convert(jni::JNIEnv &env, jni::Object<java::util::List/*<java::util::List<Point>>*/> jPointListsList) {
mapbox::geojson::polygon polygon;
- if (jPositionListsList) {
- auto multiLine = MultiLineString::convert(env, jPositionListsList);
+ if (jPointListsList) {
+ auto multiLine = MultiLineString::convert(env, jPointListsList);
polygon.reserve(multiLine.size());
for (auto&& line : multiLine) {
polygon.emplace_back(convertExplicit<mapbox::geojson::linear_ring>(std::move(line)));
@@ -35,8 +35,8 @@ mapbox::geojson::polygon Polygon::convert(jni::JNIEnv &env, jni::Object<java::ut
}
-jni::Object<java::util::List> Polygon::getCoordinates(jni::JNIEnv &env, jni::Object<Polygon> jPolygon) {
- static auto method = Polygon::javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "getCoordinates");
+jni::Object<java::util::List> Polygon::coordinates(jni::JNIEnv &env, jni::Object<Polygon> jPolygon) {
+ static auto method = Polygon::javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "coordinates");
return jPolygon.Call(env, method);
}
diff --git a/platform/android/src/geojson/polygon.hpp b/platform/android/src/geojson/polygon.hpp
index e5362cedf1..a8b2b93827 100644
--- a/platform/android/src/geojson/polygon.hpp
+++ b/platform/android/src/geojson/polygon.hpp
@@ -13,15 +13,15 @@ namespace geojson {
class Polygon : private mbgl::util::noncopyable {
public:
- static constexpr auto Name() { return "com/mapbox/services/commons/geojson/Polygon"; };
+ static constexpr auto Name() { return "com/mapbox/geojson/Polygon"; };
static constexpr auto Type() { return "Polygon"; };
static mapbox::geojson::polygon convert(jni::JNIEnv &, jni::Object<Polygon>);
- static mapbox::geojson::polygon convert(jni::JNIEnv&, jni::Object<java::util::List/*<java::util::List<Position>>*/>);
+ static mapbox::geojson::polygon convert(jni::JNIEnv&, jni::Object<java::util::List/*<java::util::List<Point>>*/>);
- static jni::Object<java::util::List> getCoordinates(jni::JNIEnv&, jni::Object<Polygon>);
+ static jni::Object<java::util::List> coordinates(jni::JNIEnv&, jni::Object<Polygon>);
static jni::Class<Polygon> javaClass;
diff --git a/platform/android/src/geojson/position.cpp b/platform/android/src/geojson/position.cpp
deleted file mode 100644
index c0e6da3887..0000000000
--- a/platform/android/src/geojson/position.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "position.hpp"
-
-namespace mbgl {
-namespace android {
-namespace geojson {
-
-mapbox::geojson::point Position::convert(jni::JNIEnv &env, jni::Object<Position> jPosition) {
- static auto method = Position::javaClass.GetMethod<jni::Array<jdouble> ()>(env, "getCoordinates");
- // Array with 0: longitude, 1: latitude (and optionally 2: altitude)
- auto coordinates = jPosition.Call(env, method);
- jdouble lngLat[2];
- coordinates.GetRegion(env, 0, lngLat);
- mapbox::geojson::point point(lngLat[0], lngLat[1]);
- jni::DeleteLocalRef(env, coordinates);
- return point;
-}
-
-void Position::registerNative(jni::JNIEnv &env) {
- // Lookup the class
- javaClass = *jni::Class<Position>::Find(env).NewGlobalRef(env).release();
-}
-
-jni::Class<Position> Position::javaClass;
-
-} // namespace geojson
-} // namespace android
-} // namespace mbgl \ No newline at end of file
diff --git a/platform/android/src/geojson/position.hpp b/platform/android/src/geojson/position.hpp
deleted file mode 100644
index 7017a8172a..0000000000
--- a/platform/android/src/geojson/position.hpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#pragma once
-
-#include <mbgl/util/geojson.hpp>
-#include <mbgl/util/noncopyable.hpp>
-
-#include <jni/jni.hpp>
-
-namespace mbgl {
-namespace android {
-namespace geojson {
-
-class Position : private mbgl::util::noncopyable {
-public:
- static constexpr auto Name() { return "com/mapbox/services/commons/models/Position"; };
-
- static constexpr auto Type() { return "Position"; };
-
- static mapbox::geojson::point convert(jni::JNIEnv&, jni::Object<Position>);
-
- static jni::Class<Position> javaClass;
-
- static void registerNative(jni::JNIEnv&);
-};
-
-} // namespace geojson
-} // namespace android
-} // namespace mbgl \ No newline at end of file
diff --git a/platform/android/src/jni.cpp b/platform/android/src/jni.cpp
index 88ad0edb9e..c2fd1c95ad 100755
--- a/platform/android/src/jni.cpp
+++ b/platform/android/src/jni.cpp
@@ -20,7 +20,6 @@
#include "geojson/multi_polygon.hpp"
#include "geojson/point.hpp"
#include "geojson/polygon.hpp"
-#include "geojson/position.hpp"
#include "geometry/lat_lng.hpp"
#include "geometry/lat_lng_bounds.hpp"
#include "geometry/lat_lng_quad.hpp"
@@ -128,7 +127,6 @@ void registerNatives(JavaVM *vm) {
geojson::MultiPolygon::registerNative(env);
geojson::Point::registerNative(env);
geojson::Polygon::registerNative(env);
- geojson::Position::registerNative(env);
// Geometry
LatLng::registerNative(env);