summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobrun <tobrun.van.nuland@gmail.com>2019-01-07 12:06:46 +0100
committerTobrun <tobrun@mapbox.com>2019-01-15 13:33:28 +0100
commit99e369f45e7be1101b86c545caee37d0f02ce61b (patch)
treea2b0a417fbf84575d8029c076c3b2ca4af32e3e5
parent6ca2f6c97f957855811e279952c2b10aeacf43dd (diff)
downloadqtlocation-mapboxgl-99e369f45e7be1101b86c545caee37d0f02ce61b.tar.gz
[android] - introduce NativeMap abstraction, remove static code block removal utility
-rw-r--r--platform/android/MapboxGLAndroidSDK/build.gradle1
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationContainer.java14
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java12
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java247
-rwxr-xr-xplatform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java105
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolygonContainer.java14
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolylineContainer.java14
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java70
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java58
-rw-r--r--platform/android/gradle/gradle-tests-staticblockremover.gradle59
10 files changed, 441 insertions, 153 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle
index e8f4539210..5e7347e3f2 100644
--- a/platform/android/MapboxGLAndroidSDK/build.gradle
+++ b/platform/android/MapboxGLAndroidSDK/build.gradle
@@ -163,5 +163,4 @@ configurations {
apply from: "${rootDir}/gradle/gradle-javadoc.gradle"
apply from: "${rootDir}/gradle/gradle-publish.gradle"
apply from: "${rootDir}/gradle/gradle-checkstyle.gradle"
-apply from: "${rootDir}/gradle/gradle-tests-staticblockremover.gradle"
apply from: "${rootDir}/gradle/gradle-dependencies-graph.gradle" \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationContainer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationContainer.java
index 4612d7d941..e5bf512791 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationContainer.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/AnnotationContainer.java
@@ -14,11 +14,11 @@ import java.util.List;
*/
class AnnotationContainer implements Annotations {
- private final NativeMapView nativeMapView;
+ private final NativeMap nativeMap;
private final LongSparseArray<Annotation> annotations;
- AnnotationContainer(NativeMapView nativeMapView, LongSparseArray<Annotation> annotations) {
- this.nativeMapView = nativeMapView;
+ AnnotationContainer(NativeMap nativeMap, LongSparseArray<Annotation> annotations) {
+ this.nativeMap = nativeMap;
this.annotations = annotations;
}
@@ -39,8 +39,8 @@ class AnnotationContainer implements Annotations {
@Override
public void removeBy(long id) {
- if (nativeMapView != null) {
- nativeMapView.removeAnnotation(id);
+ if (nativeMap != null) {
+ nativeMap.removeAnnotation(id);
}
annotations.remove(id);
}
@@ -80,8 +80,8 @@ class AnnotationContainer implements Annotations {
}
private void removeNativeAnnotations(long[] ids) {
- if (nativeMapView != null) {
- nativeMapView.removeAnnotations(ids);
+ if (nativeMap != null) {
+ nativeMap.removeAnnotations(ids);
}
}
} \ No newline at end of file
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java
index 28f594c62e..3a0824ad11 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/IconManager.java
@@ -26,12 +26,12 @@ class IconManager {
private final Map<Icon, Integer> iconMap = new HashMap<>();
- private NativeMapView nativeMapView;
+ private NativeMap nativeMap;
private int highestIconWidth;
private int highestIconHeight;
- IconManager(NativeMapView nativeMapView) {
- this.nativeMapView = nativeMapView;
+ IconManager(NativeMap nativeMap) {
+ this.nativeMap = nativeMap;
}
Icon loadIconForMarker(@NonNull Marker marker) {
@@ -47,7 +47,7 @@ class IconManager {
}
int getTopOffsetPixelsForIcon(@NonNull Icon icon) {
- return (int) (nativeMapView.getTopOffsetPixelsForAnnotationSymbol(icon.getId()) * nativeMapView.getPixelRatio());
+ return (int) (nativeMap.getTopOffsetPixelsForAnnotationSymbol(icon.getId()) * nativeMap.getPixelRatio());
}
int getHighestIconWidth() {
@@ -101,7 +101,7 @@ class IconManager {
private void loadIcon(Icon icon) {
Bitmap bitmap = icon.getBitmap();
- nativeMapView.addAnnotationIcon(icon.getId(),
+ nativeMap.addAnnotationIcon(icon.getId(),
bitmap.getWidth(),
bitmap.getHeight(),
icon.getScale(),
@@ -144,7 +144,7 @@ class IconManager {
}
private void remove(Icon icon) {
- nativeMapView.removeAnnotationIcon(icon.getId());
+ nativeMap.removeAnnotationIcon(icon.getId());
iconMap.remove(icon);
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java
new file mode 100644
index 0000000000..96aec573cc
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java
@@ -0,0 +1,247 @@
+package com.mapbox.mapboxsdk.maps;
+
+import android.graphics.Bitmap;
+import android.graphics.PointF;
+import android.graphics.RectF;
+import android.support.annotation.IntRange;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.Geometry;
+import com.mapbox.mapboxsdk.annotations.Marker;
+import com.mapbox.mapboxsdk.annotations.Polygon;
+import com.mapbox.mapboxsdk.annotations.Polyline;
+import com.mapbox.mapboxsdk.camera.CameraPosition;
+import com.mapbox.mapboxsdk.geometry.LatLng;
+import com.mapbox.mapboxsdk.geometry.LatLngBounds;
+import com.mapbox.mapboxsdk.geometry.ProjectedMeters;
+import com.mapbox.mapboxsdk.style.expressions.Expression;
+import com.mapbox.mapboxsdk.style.layers.Layer;
+import com.mapbox.mapboxsdk.style.light.Light;
+import com.mapbox.mapboxsdk.style.sources.Source;
+
+import java.util.HashMap;
+import java.util.List;
+
+interface NativeMap {
+ void destroy();
+
+ void update();
+
+ void resizeView(int width, int height);
+
+ void setStyleUrl(String url);
+
+ @NonNull
+ String getStyleUrl();
+
+ void setStyleJson(String newStyleJson);
+
+ @NonNull
+ String getStyleJson();
+
+ void setLatLngBounds(LatLngBounds latLngBounds);
+
+ void cancelTransitions();
+
+ void setGestureInProgress(boolean inProgress);
+
+ void moveBy(double dx, double dy);
+
+ void moveBy(double dx, double dy, long duration);
+
+ void setLatLng(@NonNull LatLng latLng);
+
+ void setLatLng(@NonNull LatLng latLng, long duration);
+
+ LatLng getLatLng();
+
+ CameraPosition getCameraForLatLngBounds(LatLngBounds bounds, int[] padding, double bearing, double tilt);
+
+ CameraPosition getCameraForGeometry(Geometry geometry, int[] padding, double bearing, double tilt);
+
+ void resetPosition();
+
+ double getPitch();
+
+ void setPitch(double pitch);
+
+ void setPitch(double pitch, long duration);
+
+ void setZoom(double zoom, @NonNull PointF focalPoint, long duration);
+
+ double getZoom();
+
+ void resetZoom();
+
+ void setMinZoom(double zoom);
+
+ double getMinZoom();
+
+ void setMaxZoom(double zoom);
+
+ double getMaxZoom();
+
+ void rotateBy(double sx, double sy, double ex, double ey);
+
+ void rotateBy(double sx, double sy, double ex, double ey,
+ long duration);
+
+ void setContentPadding(float[] padding);
+
+ float[] getContentPadding();
+
+ void setBearing(double degrees);
+
+ void setBearing(double degrees, long duration);
+
+ void setBearing(double degrees, double cx, double cy);
+
+ void setBearing(double degrees, double fx, double fy, long duration);
+
+ double getBearing();
+
+ void resetNorth();
+
+ long addMarker(Marker marker);
+
+ @NonNull
+ long[] addMarkers(@NonNull List<Marker> markers);
+
+ long addPolyline(Polyline polyline);
+
+ @NonNull
+ long[] addPolylines(@NonNull List<Polyline> polylines);
+
+ long addPolygon(Polygon polygon);
+
+ @NonNull
+ long[] addPolygons(@NonNull List<Polygon> polygons);
+
+ void updateMarker(@NonNull Marker marker);
+
+ void updatePolygon(@NonNull Polygon polygon);
+
+ void updatePolyline(@NonNull Polyline polyline);
+
+ void removeAnnotation(long id);
+
+ void removeAnnotations(long[] ids);
+
+ @NonNull
+ long[] queryPointAnnotations(RectF rect);
+
+ @NonNull
+ long[] queryShapeAnnotations(RectF rectF);
+
+ void addAnnotationIcon(String symbol, int width, int height, float scale, byte[] pixels);
+
+ void removeAnnotationIcon(String symbol);
+
+ void setVisibleCoordinateBounds(LatLng[] coordinates, RectF padding, double direction, long duration);
+
+ void onLowMemory();
+
+ void setDebug(boolean debug);
+
+ void cycleDebugOptions();
+
+ boolean getDebug();
+
+ boolean isFullyLoaded();
+
+ void setReachability(boolean status);
+
+ double getMetersPerPixelAtLatitude(double lat);
+
+ ProjectedMeters projectedMetersForLatLng(@NonNull LatLng latLng);
+
+ LatLng latLngForProjectedMeters(@NonNull ProjectedMeters projectedMeters);
+
+ @NonNull
+ PointF pixelForLatLng(@NonNull LatLng latLng);
+
+ LatLng latLngForPixel(@NonNull PointF pixel);
+
+ double getTopOffsetPixelsForAnnotationSymbol(String symbolName);
+
+ void jumpTo(double angle, @NonNull LatLng center, double pitch, double zoom);
+
+ void easeTo(double angle, @NonNull LatLng center, long duration, double pitch, double zoom,
+ boolean easingInterpolator);
+
+ void flyTo(double angle, @NonNull LatLng center, long duration, double pitch, double zoom);
+
+ @NonNull
+ CameraPosition getCameraPosition();
+
+ void setPrefetchesTiles(boolean enable);
+
+ boolean getPrefetchesTiles();
+
+ long getTransitionDuration();
+
+ void setTransitionDuration(long duration);
+
+ long getTransitionDelay();
+
+ void setTransitionDelay(long delay);
+
+ @NonNull
+ List<Layer> getLayers();
+
+ Layer getLayer(String layerId);
+
+ void addLayer(@NonNull Layer layer);
+
+ void addLayerBelow(@NonNull Layer layer, @NonNull String below);
+
+ void addLayerAbove(@NonNull Layer layer, @NonNull String above);
+
+ void addLayerAt(@NonNull Layer layer, @IntRange(from = 0) int index);
+
+ boolean removeLayer(@NonNull String layerId);
+
+ boolean removeLayer(@NonNull Layer layer);
+
+ boolean removeLayerAt(@IntRange(from = 0) int index);
+
+ @NonNull
+ List<Source> getSources();
+
+ Source getSource(@NonNull String sourceId);
+
+ void addSource(@NonNull Source source);
+
+ boolean removeSource(@NonNull String sourceId);
+
+ boolean removeSource(@NonNull Source source);
+
+ void addImage(@NonNull String name, @NonNull Bitmap image, boolean sdf);
+
+ void addImages(@NonNull HashMap<String, Bitmap> bitmapHashMap);
+
+ void addImages(@NonNull HashMap<String, Bitmap> bitmapHashMap, boolean sdf);
+
+ void removeImage(String name);
+
+ Bitmap getImage(String name);
+
+ @NonNull
+ List<Feature> queryRenderedFeatures(@NonNull PointF coordinates,
+ @Nullable String[] layerIds,
+ @Nullable Expression filter);
+
+ @NonNull
+ List<Feature> queryRenderedFeatures(@NonNull RectF coordinates,
+ @Nullable String[] layerIds,
+ @Nullable Expression filter);
+
+ void setApiBaseUrl(String baseUrl);
+
+ Light getLight();
+
+ float getPixelRatio();
+
+ void setOnFpsChangedListener(@NonNull MapboxMap.OnFpsChangedListener listener);
+}
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 33d8a4881a..6b8d4b2bf5 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
@@ -45,7 +45,7 @@ import java.util.List;
import java.util.Map;
// Class that wraps the native methods for convenience
-final class NativeMapView {
+final class NativeMapView implements NativeMap {
private static final String TAG = "Mbgl-NativeMapView";
@@ -133,12 +133,14 @@ final class NativeMapView {
return destroyed;
}
+ @Override
public void destroy() {
destroyed = true;
viewCallback = null;
nativeDestroy();
}
+ @Override
public void update() {
if (checkState("update")) {
return;
@@ -147,6 +149,7 @@ final class NativeMapView {
mapRenderer.requestRender();
}
+ @Override
public void resizeView(int width, int height) {
if (checkState("resizeView")) {
return;
@@ -181,6 +184,7 @@ final class NativeMapView {
nativeResizeView(width, height);
}
+ @Override
public void setStyleUrl(String url) {
if (checkState("setStyleUrl")) {
return;
@@ -188,6 +192,7 @@ final class NativeMapView {
nativeSetStyleUrl(url);
}
+ @Override
@NonNull
public String getStyleUrl() {
if (checkState("getStyleUrl")) {
@@ -196,6 +201,7 @@ final class NativeMapView {
return nativeGetStyleUrl();
}
+ @Override
public void setStyleJson(String newStyleJson) {
if (checkState("setStyleJson")) {
return;
@@ -203,6 +209,7 @@ final class NativeMapView {
nativeSetStyleJson(newStyleJson);
}
+ @Override
@NonNull
public String getStyleJson() {
if (checkState("getStyleJson")) {
@@ -211,6 +218,7 @@ final class NativeMapView {
return nativeGetStyleJson();
}
+ @Override
public void setLatLngBounds(LatLngBounds latLngBounds) {
if (checkState("setLatLngBounds")) {
return;
@@ -218,6 +226,7 @@ final class NativeMapView {
nativeSetLatLngBounds(latLngBounds);
}
+ @Override
public void cancelTransitions() {
if (checkState("cancelTransitions")) {
return;
@@ -225,6 +234,7 @@ final class NativeMapView {
nativeCancelTransitions();
}
+ @Override
public void setGestureInProgress(boolean inProgress) {
if (checkState("setGestureInProgress")) {
return;
@@ -232,6 +242,7 @@ final class NativeMapView {
nativeSetGestureInProgress(inProgress);
}
+ @Override
public void moveBy(double dx, double dy) {
if (checkState("moveBy")) {
return;
@@ -239,6 +250,7 @@ final class NativeMapView {
moveBy(dx, dy, 0);
}
+ @Override
public void moveBy(double dx, double dy, long duration) {
if (checkState("moveBy")) {
return;
@@ -246,6 +258,7 @@ final class NativeMapView {
nativeMoveBy(dx / pixelRatio, dy / pixelRatio, duration);
}
+ @Override
public void setLatLng(@NonNull LatLng latLng) {
if (checkState("setLatLng")) {
return;
@@ -253,6 +266,7 @@ final class NativeMapView {
setLatLng(latLng, 0);
}
+ @Override
public void setLatLng(@NonNull LatLng latLng, long duration) {
if (checkState("setLatLng")) {
return;
@@ -260,6 +274,7 @@ final class NativeMapView {
nativeSetLatLng(latLng.getLatitude(), latLng.getLongitude(), duration);
}
+ @Override
public LatLng getLatLng() {
if (checkState("")) {
return new LatLng();
@@ -267,6 +282,7 @@ final class NativeMapView {
return nativeGetLatLng();
}
+ @Override
public CameraPosition getCameraForLatLngBounds(LatLngBounds bounds, int[] padding, double bearing, double tilt) {
if (checkState("getCameraForLatLngBounds")) {
return null;
@@ -282,6 +298,7 @@ final class NativeMapView {
);
}
+ @Override
public CameraPosition getCameraForGeometry(Geometry geometry, int[] padding, double bearing, double tilt) {
if (checkState("getCameraForGeometry")) {
return null;
@@ -297,6 +314,7 @@ final class NativeMapView {
);
}
+ @Override
public void resetPosition() {
if (checkState("resetPosition")) {
return;
@@ -304,6 +322,7 @@ final class NativeMapView {
nativeResetPosition();
}
+ @Override
public double getPitch() {
if (checkState("getPitch")) {
return 0;
@@ -311,10 +330,12 @@ final class NativeMapView {
return nativeGetPitch();
}
+ @Override
public void setPitch(double pitch) {
setPitch(pitch, 0);
}
+ @Override
public void setPitch(double pitch, long duration) {
if (checkState("setPitch")) {
return;
@@ -322,6 +343,7 @@ final class NativeMapView {
nativeSetPitch(pitch, duration);
}
+ @Override
public void setZoom(double zoom, @NonNull PointF focalPoint, long duration) {
if (checkState("setZoom")) {
return;
@@ -329,6 +351,7 @@ final class NativeMapView {
nativeSetZoom(zoom, focalPoint.x / pixelRatio, focalPoint.y / pixelRatio, duration);
}
+ @Override
public double getZoom() {
if (checkState("getZoom")) {
return 0;
@@ -336,6 +359,7 @@ final class NativeMapView {
return nativeGetZoom();
}
+ @Override
public void resetZoom() {
if (checkState("resetZoom")) {
return;
@@ -343,6 +367,7 @@ final class NativeMapView {
nativeResetZoom();
}
+ @Override
public void setMinZoom(double zoom) {
if (checkState("setMinZoom")) {
return;
@@ -350,6 +375,7 @@ final class NativeMapView {
nativeSetMinZoom(zoom);
}
+ @Override
public double getMinZoom() {
if (checkState("getMinZoom")) {
return 0;
@@ -357,6 +383,7 @@ final class NativeMapView {
return nativeGetMinZoom();
}
+ @Override
public void setMaxZoom(double zoom) {
if (checkState("setMaxZoom")) {
return;
@@ -364,6 +391,7 @@ final class NativeMapView {
nativeSetMaxZoom(zoom);
}
+ @Override
public double getMaxZoom() {
if (checkState("getMaxZoom")) {
return 0;
@@ -371,6 +399,7 @@ final class NativeMapView {
return nativeGetMaxZoom();
}
+ @Override
public void rotateBy(double sx, double sy, double ex, double ey) {
if (checkState("rotateBy")) {
return;
@@ -378,6 +407,7 @@ final class NativeMapView {
rotateBy(sx, sy, ex, ey, 0);
}
+ @Override
public void rotateBy(double sx, double sy, double ex, double ey,
long duration) {
if (checkState("rotateBy")) {
@@ -386,6 +416,7 @@ final class NativeMapView {
nativeRotateBy(sx / pixelRatio, sy / pixelRatio, ex, ey, duration);
}
+ @Override
public void setContentPadding(float[] padding) {
if (checkState("setContentPadding")) {
return;
@@ -398,6 +429,7 @@ final class NativeMapView {
padding[2] / pixelRatio);
}
+ @Override
public float[] getContentPadding() {
if (checkState("getContentPadding")) {
return new float[] {0, 0, 0, 0};
@@ -411,6 +443,7 @@ final class NativeMapView {
};
}
+ @Override
public void setBearing(double degrees) {
if (checkState("setBearing")) {
return;
@@ -418,6 +451,7 @@ final class NativeMapView {
setBearing(degrees, 0);
}
+ @Override
public void setBearing(double degrees, long duration) {
if (checkState("setBearing")) {
return;
@@ -425,6 +459,7 @@ final class NativeMapView {
nativeSetBearing(degrees, duration);
}
+ @Override
public void setBearing(double degrees, double cx, double cy) {
if (checkState("setBearing")) {
return;
@@ -432,6 +467,7 @@ final class NativeMapView {
setBearing(degrees, cx, cy, 0);
}
+ @Override
public void setBearing(double degrees, double fx, double fy, long duration) {
if (checkState("setBearing")) {
return;
@@ -439,6 +475,7 @@ final class NativeMapView {
nativeSetBearingXY(degrees, fx / pixelRatio, fy / pixelRatio, duration);
}
+ @Override
public double getBearing() {
if (checkState("getBearing")) {
return 0;
@@ -446,6 +483,7 @@ final class NativeMapView {
return nativeGetBearing();
}
+ @Override
public void resetNorth() {
if (checkState("resetNorth")) {
return;
@@ -453,6 +491,7 @@ final class NativeMapView {
nativeResetNorth();
}
+ @Override
public long addMarker(Marker marker) {
if (checkState("addMarker")) {
return 0;
@@ -461,6 +500,7 @@ final class NativeMapView {
return nativeAddMarkers(markers)[0];
}
+ @Override
@NonNull
public long[] addMarkers(@NonNull List<Marker> markers) {
if (checkState("addMarkers")) {
@@ -469,6 +509,7 @@ final class NativeMapView {
return nativeAddMarkers(markers.toArray(new Marker[markers.size()]));
}
+ @Override
public long addPolyline(Polyline polyline) {
if (checkState("addPolyline")) {
return 0;
@@ -477,6 +518,7 @@ final class NativeMapView {
return nativeAddPolylines(polylines)[0];
}
+ @Override
@NonNull
public long[] addPolylines(@NonNull List<Polyline> polylines) {
if (checkState("addPolylines")) {
@@ -485,6 +527,7 @@ final class NativeMapView {
return nativeAddPolylines(polylines.toArray(new Polyline[polylines.size()]));
}
+ @Override
public long addPolygon(Polygon polygon) {
if (checkState("addPolygon")) {
return 0;
@@ -493,6 +536,7 @@ final class NativeMapView {
return nativeAddPolygons(polygons)[0];
}
+ @Override
@NonNull
public long[] addPolygons(@NonNull List<Polygon> polygons) {
if (checkState("addPolygons")) {
@@ -501,6 +545,7 @@ final class NativeMapView {
return nativeAddPolygons(polygons.toArray(new Polygon[polygons.size()]));
}
+ @Override
public void updateMarker(@NonNull Marker marker) {
if (checkState("updateMarker")) {
return;
@@ -510,6 +555,7 @@ final class NativeMapView {
nativeUpdateMarker(marker.getId(), position.getLatitude(), position.getLongitude(), icon.getId());
}
+ @Override
public void updatePolygon(@NonNull Polygon polygon) {
if (checkState("updatePolygon")) {
return;
@@ -517,6 +563,7 @@ final class NativeMapView {
nativeUpdatePolygon(polygon.getId(), polygon);
}
+ @Override
public void updatePolyline(@NonNull Polyline polyline) {
if (checkState("updatePolyline")) {
return;
@@ -524,6 +571,7 @@ final class NativeMapView {
nativeUpdatePolyline(polyline.getId(), polyline);
}
+ @Override
public void removeAnnotation(long id) {
if (checkState("removeAnnotation")) {
return;
@@ -532,6 +580,7 @@ final class NativeMapView {
removeAnnotations(ids);
}
+ @Override
public void removeAnnotations(long[] ids) {
if (checkState("removeAnnotations")) {
return;
@@ -539,6 +588,7 @@ final class NativeMapView {
nativeRemoveAnnotations(ids);
}
+ @Override
@NonNull
public long[] queryPointAnnotations(RectF rect) {
if (checkState("queryPointAnnotations")) {
@@ -547,6 +597,7 @@ final class NativeMapView {
return nativeQueryPointAnnotations(rect);
}
+ @Override
@NonNull
public long[] queryShapeAnnotations(RectF rectF) {
if (checkState("queryShapeAnnotations")) {
@@ -555,6 +606,7 @@ final class NativeMapView {
return nativeQueryShapeAnnotations(rectF);
}
+ @Override
public void addAnnotationIcon(String symbol, int width, int height, float scale, byte[] pixels) {
if (checkState("addAnnotationIcon")) {
return;
@@ -562,6 +614,7 @@ final class NativeMapView {
nativeAddAnnotationIcon(symbol, width, height, scale, pixels);
}
+ @Override
public void removeAnnotationIcon(String symbol) {
if (checkState("removeAnnotationIcon")) {
return;
@@ -569,6 +622,7 @@ final class NativeMapView {
nativeRemoveAnnotationIcon(symbol);
}
+ @Override
public void setVisibleCoordinateBounds(LatLng[] coordinates, RectF padding, double direction, long duration) {
if (checkState("setVisibleCoordinateBounds")) {
return;
@@ -576,6 +630,7 @@ final class NativeMapView {
nativeSetVisibleCoordinateBounds(coordinates, padding, direction, duration);
}
+ @Override
public void onLowMemory() {
if (checkState("onLowMemory")) {
return;
@@ -583,6 +638,7 @@ final class NativeMapView {
nativeOnLowMemory();
}
+ @Override
public void setDebug(boolean debug) {
if (checkState("setDebug")) {
return;
@@ -590,6 +646,7 @@ final class NativeMapView {
nativeSetDebug(debug);
}
+ @Override
public void cycleDebugOptions() {
if (checkState("cycleDebugOptions")) {
return;
@@ -597,6 +654,7 @@ final class NativeMapView {
nativeCycleDebugOptions();
}
+ @Override
public boolean getDebug() {
if (checkState("getDebug")) {
return false;
@@ -604,6 +662,7 @@ final class NativeMapView {
return nativeGetDebug();
}
+ @Override
public boolean isFullyLoaded() {
if (checkState("isFullyLoaded")) {
return false;
@@ -611,6 +670,7 @@ final class NativeMapView {
return nativeIsFullyLoaded();
}
+ @Override
public void setReachability(boolean status) {
if (checkState("setReachability")) {
return;
@@ -618,6 +678,7 @@ final class NativeMapView {
nativeSetReachability(status);
}
+ @Override
public double getMetersPerPixelAtLatitude(double lat) {
if (checkState("getMetersPerPixelAtLatitude")) {
return 0;
@@ -625,6 +686,7 @@ final class NativeMapView {
return nativeGetMetersPerPixelAtLatitude(lat, getZoom()) / pixelRatio;
}
+ @Override
public ProjectedMeters projectedMetersForLatLng(@NonNull LatLng latLng) {
if (checkState("projectedMetersForLatLng")) {
return null;
@@ -632,6 +694,7 @@ final class NativeMapView {
return nativeProjectedMetersForLatLng(latLng.getLatitude(), latLng.getLongitude());
}
+ @Override
public LatLng latLngForProjectedMeters(@NonNull ProjectedMeters projectedMeters) {
if (checkState("latLngForProjectedMeters")) {
return new LatLng();
@@ -640,6 +703,7 @@ final class NativeMapView {
projectedMeters.getEasting());
}
+ @Override
@NonNull
public PointF pixelForLatLng(@NonNull LatLng latLng) {
if (checkState("pixelForLatLng")) {
@@ -650,6 +714,7 @@ final class NativeMapView {
return pointF;
}
+ @Override
public LatLng latLngForPixel(@NonNull PointF pixel) {
if (checkState("latLngForPixel")) {
return new LatLng();
@@ -657,6 +722,7 @@ final class NativeMapView {
return nativeLatLngForPixel(pixel.x / pixelRatio, pixel.y / pixelRatio);
}
+ @Override
public double getTopOffsetPixelsForAnnotationSymbol(String symbolName) {
if (checkState("getTopOffsetPixelsForAnnotationSymbol")) {
return 0;
@@ -664,6 +730,7 @@ final class NativeMapView {
return nativeGetTopOffsetPixelsForAnnotationSymbol(symbolName);
}
+ @Override
public void jumpTo(double angle, @NonNull LatLng center, double pitch, double zoom) {
if (checkState("jumpTo")) {
return;
@@ -671,6 +738,7 @@ final class NativeMapView {
nativeJumpTo(angle, center.getLatitude(), center.getLongitude(), pitch, zoom);
}
+ @Override
public void easeTo(double angle, @NonNull LatLng center, long duration, double pitch, double zoom,
boolean easingInterpolator) {
if (checkState("easeTo")) {
@@ -680,6 +748,7 @@ final class NativeMapView {
easingInterpolator);
}
+ @Override
public void flyTo(double angle, @NonNull LatLng center, long duration, double pitch, double zoom) {
if (checkState("flyTo")) {
return;
@@ -687,6 +756,7 @@ final class NativeMapView {
nativeFlyTo(angle, center.getLatitude(), center.getLongitude(), duration, pitch, zoom);
}
+ @Override
@NonNull
public CameraPosition getCameraPosition() {
if (checkState("getCameraValues")) {
@@ -695,6 +765,7 @@ final class NativeMapView {
return nativeGetCameraPosition();
}
+ @Override
public void setPrefetchesTiles(boolean enable) {
if (checkState("setPrefetchesTiles")) {
return;
@@ -702,6 +773,7 @@ final class NativeMapView {
nativeSetPrefetchesTiles(enable);
}
+ @Override
public boolean getPrefetchesTiles() {
if (checkState("getPrefetchesTiles")) {
return false;
@@ -711,22 +783,27 @@ final class NativeMapView {
// Runtime style Api
+ @Override
public long getTransitionDuration() {
return nativeGetTransitionDuration();
}
+ @Override
public void setTransitionDuration(long duration) {
nativeSetTransitionDuration(duration);
}
+ @Override
public long getTransitionDelay() {
return nativeGetTransitionDelay();
}
+ @Override
public void setTransitionDelay(long delay) {
nativeSetTransitionDelay(delay);
}
+ @Override
@NonNull
public List<Layer> getLayers() {
if (checkState("getLayers")) {
@@ -735,6 +812,7 @@ final class NativeMapView {
return Arrays.asList(nativeGetLayers());
}
+ @Override
public Layer getLayer(String layerId) {
if (checkState("getLayer")) {
return null;
@@ -742,6 +820,7 @@ final class NativeMapView {
return nativeGetLayer(layerId);
}
+ @Override
public void addLayer(@NonNull Layer layer) {
if (checkState("addLayer")) {
return;
@@ -749,6 +828,7 @@ final class NativeMapView {
nativeAddLayer(layer.getNativePtr(), null);
}
+ @Override
public void addLayerBelow(@NonNull Layer layer, @NonNull String below) {
if (checkState("addLayerBelow")) {
return;
@@ -756,6 +836,7 @@ final class NativeMapView {
nativeAddLayer(layer.getNativePtr(), below);
}
+ @Override
public void addLayerAbove(@NonNull Layer layer, @NonNull String above) {
if (checkState("addLayerAbove")) {
return;
@@ -763,6 +844,7 @@ final class NativeMapView {
nativeAddLayerAbove(layer.getNativePtr(), above);
}
+ @Override
public void addLayerAt(@NonNull Layer layer, @IntRange(from = 0) int index) {
if (checkState("addLayerAt")) {
return;
@@ -770,6 +852,7 @@ final class NativeMapView {
nativeAddLayerAt(layer.getNativePtr(), index);
}
+ @Override
public boolean removeLayer(@NonNull String layerId) {
if (checkState("removeLayer")) {
return false;
@@ -783,6 +866,7 @@ final class NativeMapView {
}
+ @Override
public boolean removeLayer(@NonNull Layer layer) {
if (checkState("removeLayer")) {
return false;
@@ -790,6 +874,7 @@ final class NativeMapView {
return nativeRemoveLayer(layer.getNativePtr());
}
+ @Override
public boolean removeLayerAt(@IntRange(from = 0) int index) {
if (checkState("removeLayerAt")) {
return false;
@@ -797,6 +882,7 @@ final class NativeMapView {
return nativeRemoveLayerAt(index);
}
+ @Override
@NonNull
public List<Source> getSources() {
if (checkState("getSources")) {
@@ -805,6 +891,7 @@ final class NativeMapView {
return Arrays.asList(nativeGetSources());
}
+ @Override
public Source getSource(@NonNull String sourceId) {
if (checkState("getSource")) {
return null;
@@ -812,6 +899,7 @@ final class NativeMapView {
return nativeGetSource(sourceId);
}
+ @Override
public void addSource(@NonNull Source source) {
if (checkState("addSource")) {
return;
@@ -819,6 +907,7 @@ final class NativeMapView {
nativeAddSource(source, source.getNativePtr());
}
+ @Override
public boolean removeSource(@NonNull String sourceId) {
if (checkState("removeSource")) {
return false;
@@ -830,6 +919,7 @@ final class NativeMapView {
return false;
}
+ @Override
public boolean removeSource(@NonNull Source source) {
if (checkState("removeSource")) {
return false;
@@ -837,6 +927,7 @@ final class NativeMapView {
return nativeRemoveSource(source, source.getNativePtr());
}
+ @Override
public void addImage(@NonNull String name, @NonNull Bitmap image, boolean sdf) {
if (checkState("addImage")) {
return;
@@ -847,6 +938,7 @@ final class NativeMapView {
nativeAddImage(name, image, pixelRatio, sdf);
}
+ @Override
public void addImages(@NonNull HashMap<String, Bitmap> bitmapHashMap) {
if (checkState("addImages")) {
return;
@@ -854,6 +946,7 @@ final class NativeMapView {
this.addImages(bitmapHashMap, false);
}
+ @Override
public void addImages(@NonNull HashMap<String, Bitmap> bitmapHashMap, boolean sdf) {
if (checkState("addImages")) {
return;
@@ -862,6 +955,7 @@ final class NativeMapView {
new BitmapImageConversionTask(this, sdf).execute(bitmapHashMap);
}
+ @Override
public void removeImage(String name) {
if (checkState("removeImage")) {
return;
@@ -869,6 +963,7 @@ final class NativeMapView {
nativeRemoveImage(name);
}
+ @Override
public Bitmap getImage(String name) {
if (checkState("getImage")) {
return null;
@@ -878,6 +973,7 @@ final class NativeMapView {
// Feature querying
+ @Override
@NonNull
public List<Feature> queryRenderedFeatures(@NonNull PointF coordinates,
@Nullable String[] layerIds,
@@ -890,6 +986,7 @@ final class NativeMapView {
return features != null ? Arrays.asList(features) : new ArrayList<Feature>();
}
+ @Override
@NonNull
public List<Feature> queryRenderedFeatures(@NonNull RectF coordinates,
@Nullable String[] layerIds,
@@ -907,6 +1004,7 @@ final class NativeMapView {
return features != null ? Arrays.asList(features) : new ArrayList<Feature>();
}
+ @Override
public void setApiBaseUrl(String baseUrl) {
if (checkState("setApiBaseUrl")) {
return;
@@ -914,6 +1012,7 @@ final class NativeMapView {
fileSource.setApiBaseUrl(baseUrl);
}
+ @Override
public Light getLight() {
if (checkState("getLight")) {
return null;
@@ -921,6 +1020,7 @@ final class NativeMapView {
return nativeGetLight();
}
+ @Override
public float getPixelRatio() {
return pixelRatio;
}
@@ -1044,7 +1144,7 @@ final class NativeMapView {
//
@Keep
- private native void nativeInitialize(NativeMapView nativeMapView,
+ private native void nativeInitialize(NativeMapView nativeMap,
FileSource fileSource,
MapRenderer mapRenderer,
float pixelRatio,
@@ -1362,6 +1462,7 @@ final class NativeMapView {
nativeTakeSnapshot();
}
+ @Override
public void setOnFpsChangedListener(@NonNull final MapboxMap.OnFpsChangedListener listener) {
final Handler handler = new Handler();
mapRenderer.queueEvent(new Runnable() {
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolygonContainer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolygonContainer.java
index 2cdcc052fb..a7e2ace061 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolygonContainer.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolygonContainer.java
@@ -16,11 +16,11 @@ import java.util.List;
*/
class PolygonContainer implements Polygons {
- private final NativeMapView nativeMapView;
+ private final NativeMap nativeMap;
private final LongSparseArray<Annotation> annotations;
- PolygonContainer(NativeMapView nativeMapView, LongSparseArray<Annotation> annotations) {
- this.nativeMapView = nativeMapView;
+ PolygonContainer(NativeMap nativeMap, LongSparseArray<Annotation> annotations) {
+ this.nativeMap = nativeMap;
this.annotations = annotations;
}
@@ -28,7 +28,7 @@ class PolygonContainer implements Polygons {
public Polygon addBy(@NonNull PolygonOptions polygonOptions, @NonNull MapboxMap mapboxMap) {
Polygon polygon = polygonOptions.getPolygon();
if (!polygon.getPoints().isEmpty()) {
- long id = nativeMapView != null ? nativeMapView.addPolygon(polygon) : 0;
+ long id = nativeMap != null ? nativeMap.addPolygon(polygon) : 0;
polygon.setId(id);
polygon.setMapboxMap(mapboxMap);
annotations.put(id, polygon);
@@ -43,7 +43,7 @@ class PolygonContainer implements Polygons {
Polygon polygon;
List<Polygon> polygons = new ArrayList<>(count);
- if (nativeMapView != null && count > 0) {
+ if (nativeMap != null && count > 0) {
for (PolygonOptions polygonOptions : polygonOptionsList) {
polygon = polygonOptions.getPolygon();
if (!polygon.getPoints().isEmpty()) {
@@ -51,7 +51,7 @@ class PolygonContainer implements Polygons {
}
}
- long[] ids = nativeMapView.addPolygons(polygons);
+ long[] ids = nativeMap.addPolygons(polygons);
for (int i = 0; i < ids.length; i++) {
polygon = polygons.get(i);
polygon.setMapboxMap(mapboxMap);
@@ -64,7 +64,7 @@ class PolygonContainer implements Polygons {
@Override
public void update(@NonNull Polygon polygon) {
- nativeMapView.updatePolygon(polygon);
+ nativeMap.updatePolygon(polygon);
annotations.setValueAt(annotations.indexOfKey(polygon.getId()), polygon);
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolylineContainer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolylineContainer.java
index ed0ceceb1f..e11da26e08 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolylineContainer.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/PolylineContainer.java
@@ -16,11 +16,11 @@ import java.util.List;
*/
class PolylineContainer implements Polylines {
- private final NativeMapView nativeMapView;
+ private final NativeMap nativeMap;
private final LongSparseArray<Annotation> annotations;
- PolylineContainer(NativeMapView nativeMapView, LongSparseArray<Annotation> annotations) {
- this.nativeMapView = nativeMapView;
+ PolylineContainer(NativeMap nativeMap, LongSparseArray<Annotation> annotations) {
+ this.nativeMap = nativeMap;
this.annotations = annotations;
}
@@ -28,7 +28,7 @@ class PolylineContainer implements Polylines {
public Polyline addBy(@NonNull PolylineOptions polylineOptions, @NonNull MapboxMap mapboxMap) {
Polyline polyline = polylineOptions.getPolyline();
if (!polyline.getPoints().isEmpty()) {
- long id = nativeMapView != null ? nativeMapView.addPolyline(polyline) : 0;
+ long id = nativeMap != null ? nativeMap.addPolyline(polyline) : 0;
polyline.setMapboxMap(mapboxMap);
polyline.setId(id);
annotations.put(id, polyline);
@@ -42,7 +42,7 @@ class PolylineContainer implements Polylines {
int count = polylineOptionsList.size();
Polyline polyline;
List<Polyline> polylines = new ArrayList<>(count);
- if (nativeMapView != null && count > 0) {
+ if (nativeMap != null && count > 0) {
for (PolylineOptions options : polylineOptionsList) {
polyline = options.getPolyline();
if (!polyline.getPoints().isEmpty()) {
@@ -50,7 +50,7 @@ class PolylineContainer implements Polylines {
}
}
- long[] ids = nativeMapView.addPolylines(polylines);
+ long[] ids = nativeMap.addPolylines(polylines);
for (int i = 0; i < ids.length; i++) {
Polyline polylineCreated = polylines.get(i);
polylineCreated.setMapboxMap(mapboxMap);
@@ -63,7 +63,7 @@ class PolylineContainer implements Polylines {
@Override
public void update(@NonNull Polyline polyline) {
- nativeMapView.updatePolyline(polyline);
+ nativeMap.updatePolyline(polyline);
annotations.setValueAt(annotations.indexOfKey(polyline.getId()), polyline);
}
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java
index 3ef6349fc8..49c39e94b3 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java
@@ -28,7 +28,7 @@ import java.util.Map;
*/
public class Style {
- private final NativeMapView nativeMapView;
+ private final NativeMap nativeMap;
private final HashMap<String, Source> sources = new HashMap<>();
private final HashMap<String, Layer> layers = new HashMap<>();
private final HashMap<String, Bitmap> images = new HashMap<>();
@@ -39,11 +39,11 @@ public class Style {
* Private constructor to build a style object.
*
* @param builder the builder used for creating this style
- * @param nativeMapView the map object used to load this style
+ * @param nativeMap the map object used to load this style
*/
- private Style(@NonNull Builder builder, @NonNull NativeMapView nativeMapView) {
+ private Style(@NonNull Builder builder, @NonNull NativeMap nativeMap) {
this.builder = builder;
- this.nativeMapView = nativeMapView;
+ this.nativeMap = nativeMap;
}
/**
@@ -54,7 +54,7 @@ public class Style {
@NonNull
public String getUrl() {
validateState("getUrl");
- return nativeMapView.getStyleUrl();
+ return nativeMap.getStyleUrl();
}
/**
@@ -65,7 +65,7 @@ public class Style {
@NonNull
public String getJson() {
validateState("getJson");
- return nativeMapView.getStyleJson();
+ return nativeMap.getStyleJson();
}
//
@@ -80,7 +80,7 @@ public class Style {
@NonNull
public List<Source> getSources() {
validateState("getSources");
- return nativeMapView.getSources();
+ return nativeMap.getSources();
}
/**
@@ -91,7 +91,7 @@ public class Style {
public void addSource(@NonNull Source source) {
validateState("addSource");
sources.put(source.getId(), source);
- nativeMapView.addSource(source);
+ nativeMap.addSource(source);
}
/**
@@ -105,7 +105,7 @@ public class Style {
validateState("getSource");
Source source = sources.get(id);
if (source == null) {
- source = nativeMapView.getSource(id);
+ source = nativeMap.getSource(id);
}
return source;
}
@@ -124,7 +124,7 @@ public class Style {
if (sources.containsKey(sourceId)) {
return (T) sources.get(sourceId);
}
- return (T) nativeMapView.getSource(sourceId);
+ return (T) nativeMap.getSource(sourceId);
}
/**
@@ -136,7 +136,7 @@ public class Style {
public boolean removeSource(@NonNull String sourceId) {
validateState("removeSource");
sources.remove(sourceId);
- return nativeMapView.removeSource(sourceId);
+ return nativeMap.removeSource(sourceId);
}
/**
@@ -148,7 +148,7 @@ public class Style {
public boolean removeSource(@NonNull Source source) {
validateState("removeSource");
sources.remove(source.getId());
- return nativeMapView.removeSource(source);
+ return nativeMap.removeSource(source);
}
//
@@ -163,7 +163,7 @@ public class Style {
public void addLayer(@NonNull Layer layer) {
validateState("addLayer");
layers.put(layer.getId(), layer);
- nativeMapView.addLayer(layer);
+ nativeMap.addLayer(layer);
}
/**
@@ -175,7 +175,7 @@ public class Style {
public void addLayerBelow(@NonNull Layer layer, @NonNull String below) {
validateState("addLayerBelow");
layers.put(layer.getId(), layer);
- nativeMapView.addLayerBelow(layer, below);
+ nativeMap.addLayerBelow(layer, below);
}
/**
@@ -187,7 +187,7 @@ public class Style {
public void addLayerAbove(@NonNull Layer layer, @NonNull String above) {
validateState("addLayerAbove");
layers.put(layer.getId(), layer);
- nativeMapView.addLayerAbove(layer, above);
+ nativeMap.addLayerAbove(layer, above);
}
/**
@@ -200,7 +200,7 @@ public class Style {
public void addLayerAt(@NonNull Layer layer, @IntRange(from = 0) int index) {
validateState("addLayerAbove");
layers.put(layer.getId(), layer);
- nativeMapView.addLayerAt(layer, index);
+ nativeMap.addLayerAt(layer, index);
}
/**
@@ -214,7 +214,7 @@ public class Style {
validateState("getLayer");
Layer layer = layers.get(id);
if (layer == null) {
- layer = nativeMapView.getLayer(id);
+ layer = nativeMap.getLayer(id);
}
return layer;
}
@@ -230,7 +230,7 @@ public class Style {
public <T extends Layer> T getLayerAs(@NonNull String layerId) {
validateState("getLayerAs");
// noinspection unchecked
- return (T) nativeMapView.getLayer(layerId);
+ return (T) nativeMap.getLayer(layerId);
}
/**
@@ -241,7 +241,7 @@ public class Style {
@NonNull
public List<Layer> getLayers() {
validateState("getLayers");
- return nativeMapView.getLayers();
+ return nativeMap.getLayers();
}
/**
@@ -253,7 +253,7 @@ public class Style {
public boolean removeLayer(@NonNull String layerId) {
validateState("removeLayer");
layers.remove(layerId);
- return nativeMapView.removeLayer(layerId);
+ return nativeMap.removeLayer(layerId);
}
/**
@@ -265,7 +265,7 @@ public class Style {
public boolean removeLayer(@NonNull Layer layer) {
validateState("removeLayer");
layers.remove(layer.getId());
- return nativeMapView.removeLayer(layer);
+ return nativeMap.removeLayer(layer);
}
/**
@@ -276,7 +276,7 @@ public class Style {
*/
public boolean removeLayerAt(@IntRange(from = 0) int index) {
validateState("removeLayerAt");
- return nativeMapView.removeLayerAt(index);
+ return nativeMap.removeLayerAt(index);
}
//
@@ -302,7 +302,7 @@ public class Style {
*/
public void addImage(@NonNull String name, @NonNull Bitmap image, boolean sdf) {
validateState("addImage");
- nativeMapView.addImage(name, image, sdf);
+ nativeMap.addImage(name, image, sdf);
}
/**
@@ -310,7 +310,7 @@ public class Style {
*/
public void addImages(@NonNull HashMap<String, Bitmap> images) {
validateState("addImages");
- nativeMapView.addImages(images);
+ nativeMap.addImages(images);
}
/**
@@ -320,7 +320,7 @@ public class Style {
*/
public void removeImage(@NonNull String name) {
validateState("removeImage");
- nativeMapView.removeImage(name);
+ nativeMap.removeImage(name);
}
/**
@@ -332,7 +332,7 @@ public class Style {
@Nullable
public Bitmap getImage(@NonNull String id) {
validateState("getImage");
- return nativeMapView.getImage(id);
+ return nativeMap.getImage(id);
}
//
@@ -349,8 +349,8 @@ public class Style {
*/
public void setTransition(@NonNull TransitionOptions transitionOptions) {
validateState("setTransition");
- nativeMapView.setTransitionDuration(transitionOptions.getDuration());
- nativeMapView.setTransitionDelay(transitionOptions.getDelay());
+ nativeMap.setTransitionDuration(transitionOptions.getDuration());
+ nativeMap.setTransitionDelay(transitionOptions.getDelay());
}
/**
@@ -364,7 +364,7 @@ public class Style {
@NonNull
public TransitionOptions getTransition() {
validateState("getTransition");
- return new TransitionOptions(nativeMapView.getTransitionDuration(), nativeMapView.getTransitionDelay());
+ return new TransitionOptions(nativeMap.getTransitionDuration(), nativeMap.getTransitionDelay());
}
//
@@ -379,7 +379,7 @@ public class Style {
@Nullable
public Light getLight() {
validateState("getLight");
- return nativeMapView.getLight();
+ return nativeMap.getLight();
}
//
@@ -395,19 +395,19 @@ public class Style {
for (Source source : sources.values()) {
if (source != null) {
source.setDetached();
- nativeMapView.removeSource(source);
+ nativeMap.removeSource(source);
}
}
for (Layer layer : layers.values()) {
if (layer != null) {
layer.setDetached();
- nativeMapView.removeLayer(layer);
+ nativeMap.removeLayer(layer);
}
}
for (Map.Entry<String, Bitmap> bitmapEntry : images.entrySet()) {
- nativeMapView.removeImage(bitmapEntry.getKey());
+ nativeMap.removeImage(bitmapEntry.getKey());
bitmapEntry.getValue().recycle();
}
@@ -671,8 +671,8 @@ public class Style {
/**
* Build the composed style.
*/
- Style build(@NonNull NativeMapView nativeMapView) {
- return new Style(this, nativeMapView);
+ Style build(@NonNull NativeMap nativeMap) {
+ return new Style(this, nativeMap);
}
class ImageWrapper {
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
index 0ba40642f5..be98f7e51d 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Transform.java
@@ -24,7 +24,7 @@ final class Transform implements MapView.OnCameraDidChangeListener {
private static final String TAG = "Mbgl-Transform";
- private final NativeMapView nativeMapView;
+ private final NativeMap nativeMap;
private final MapView mapView;
private final Handler handler = new Handler();
@@ -44,9 +44,9 @@ final class Transform implements MapView.OnCameraDidChangeListener {
}
};
- Transform(MapView mapView, NativeMapView nativeMapView, CameraChangeDispatcher cameraChangeDispatcher) {
+ Transform(MapView mapView, NativeMap nativeMap, CameraChangeDispatcher cameraChangeDispatcher) {
this.mapView = mapView;
- this.nativeMapView = nativeMapView;
+ this.nativeMap = nativeMap;
this.cameraChangeDispatcher = cameraChangeDispatcher;
}
@@ -99,7 +99,7 @@ final class Transform implements MapView.OnCameraDidChangeListener {
if (isValidCameraPosition(cameraPosition)) {
cancelTransitions();
cameraChangeDispatcher.onCameraMoveStarted(OnCameraMoveStartedListener.REASON_API_ANIMATION);
- nativeMapView.jumpTo(cameraPosition.bearing, cameraPosition.target, cameraPosition.tilt, cameraPosition.zoom);
+ nativeMap.jumpTo(cameraPosition.bearing, cameraPosition.target, cameraPosition.tilt, cameraPosition.zoom);
cameraChangeDispatcher.onCameraIdle();
invalidateCameraPosition();
handler.post(new Runnable() {
@@ -125,7 +125,7 @@ final class Transform implements MapView.OnCameraDidChangeListener {
cameraCancelableCallback = callback;
}
mapView.addOnCameraDidChangeListener(this);
- nativeMapView.easeTo(cameraPosition.bearing, cameraPosition.target, durationMs, cameraPosition.tilt,
+ nativeMap.easeTo(cameraPosition.bearing, cameraPosition.target, durationMs, cameraPosition.tilt,
cameraPosition.zoom, easingInterpolator);
}
}
@@ -142,7 +142,7 @@ final class Transform implements MapView.OnCameraDidChangeListener {
cameraCancelableCallback = callback;
}
mapView.addOnCameraDidChangeListener(this);
- nativeMapView.flyTo(cameraPosition.bearing, cameraPosition.target, durationMs, cameraPosition.tilt,
+ nativeMap.flyTo(cameraPosition.bearing, cameraPosition.target, durationMs, cameraPosition.tilt,
cameraPosition.zoom);
}
}
@@ -154,8 +154,8 @@ final class Transform implements MapView.OnCameraDidChangeListener {
@UiThread
@Nullable
CameraPosition invalidateCameraPosition() {
- if (nativeMapView != null) {
- CameraPosition cameraPosition = nativeMapView.getCameraPosition();
+ if (nativeMap != null) {
+ CameraPosition cameraPosition = nativeMap.getCameraPosition();
if (this.cameraPosition != null && !this.cameraPosition.equals(cameraPosition)) {
cameraChangeDispatcher.onCameraMove();
}
@@ -183,7 +183,7 @@ final class Transform implements MapView.OnCameraDidChangeListener {
}
// cancel ongoing transitions
- nativeMapView.cancelTransitions();
+ nativeMap.cancelTransitions();
cameraChangeDispatcher.onCameraIdle();
}
@@ -191,7 +191,7 @@ final class Transform implements MapView.OnCameraDidChangeListener {
@UiThread
void resetNorth() {
cancelTransitions();
- nativeMapView.resetNorth();
+ nativeMap.resetNorth();
}
//
@@ -201,20 +201,20 @@ final class Transform implements MapView.OnCameraDidChangeListener {
// Zoom in or out
double getRawZoom() {
- return nativeMapView.getZoom();
+ return nativeMap.getZoom();
}
void zoomBy(double zoomAddition, @NonNull PointF focalPoint) {
- setZoom(nativeMapView.getZoom() + zoomAddition, focalPoint);
+ setZoom(nativeMap.getZoom() + zoomAddition, focalPoint);
}
void setZoom(double zoom, @NonNull PointF focalPoint) {
- nativeMapView.setZoom(zoom, focalPoint, 0);
+ nativeMap.setZoom(zoom, focalPoint, 0);
}
// Direction
double getBearing() {
- double direction = -nativeMapView.getBearing();
+ double direction = -nativeMap.getBearing();
while (direction > 360) {
direction -= 360;
@@ -227,19 +227,19 @@ final class Transform implements MapView.OnCameraDidChangeListener {
}
double getRawBearing() {
- return nativeMapView.getBearing();
+ return nativeMap.getBearing();
}
void setBearing(double bearing) {
- nativeMapView.setBearing(bearing);
+ nativeMap.setBearing(bearing);
}
void setBearing(double bearing, float focalX, float focalY) {
- nativeMapView.setBearing(bearing, focalX, focalY);
+ nativeMap.setBearing(bearing, focalX, focalY);
}
void setBearing(double bearing, float focalX, float focalY, long duration) {
- nativeMapView.setBearing(bearing, focalX, focalY, duration);
+ nativeMap.setBearing(bearing, focalX, focalY, duration);
}
@@ -248,7 +248,7 @@ final class Transform implements MapView.OnCameraDidChangeListener {
//
LatLng getLatLng() {
- return nativeMapView.getLatLng();
+ return nativeMap.getLatLng();
}
//
@@ -256,11 +256,11 @@ final class Transform implements MapView.OnCameraDidChangeListener {
//
double getTilt() {
- return nativeMapView.getPitch();
+ return nativeMap.getPitch();
}
void setTilt(Double pitch) {
- nativeMapView.setPitch(pitch, 0);
+ nativeMap.setPitch(pitch, 0);
}
//
@@ -268,15 +268,15 @@ final class Transform implements MapView.OnCameraDidChangeListener {
//
LatLng getCenterCoordinate() {
- return nativeMapView.getLatLng();
+ return nativeMap.getLatLng();
}
void setCenterCoordinate(LatLng centerCoordinate) {
- nativeMapView.setLatLng(centerCoordinate);
+ nativeMap.setLatLng(centerCoordinate);
}
void setGestureInProgress(boolean gestureInProgress) {
- nativeMapView.setGestureInProgress(gestureInProgress);
+ nativeMap.setGestureInProgress(gestureInProgress);
if (!gestureInProgress) {
invalidateCameraPosition();
}
@@ -286,7 +286,7 @@ final class Transform implements MapView.OnCameraDidChangeListener {
if (duration > 0) {
mapView.addOnCameraDidChangeListener(moveByChangeListener);
}
- nativeMapView.moveBy(offsetX, offsetY, duration);
+ nativeMap.moveBy(offsetX, offsetY, duration);
}
//
@@ -298,11 +298,11 @@ final class Transform implements MapView.OnCameraDidChangeListener {
Logger.e(TAG, String.format("Not setting minZoomPreference, value is in unsupported range: %s", minZoom));
return;
}
- nativeMapView.setMinZoom(minZoom);
+ nativeMap.setMinZoom(minZoom);
}
double getMinZoom() {
- return nativeMapView.getMinZoom();
+ return nativeMap.getMinZoom();
}
void setMaxZoom(double maxZoom) {
@@ -310,10 +310,10 @@ final class Transform implements MapView.OnCameraDidChangeListener {
Logger.e(TAG, String.format("Not setting maxZoomPreference, value is in unsupported range: %s", maxZoom));
return;
}
- nativeMapView.setMaxZoom(maxZoom);
+ nativeMap.setMaxZoom(maxZoom);
}
double getMaxZoom() {
- return nativeMapView.getMaxZoom();
+ return nativeMap.getMaxZoom();
}
}
diff --git a/platform/android/gradle/gradle-tests-staticblockremover.gradle b/platform/android/gradle/gradle-tests-staticblockremover.gradle
deleted file mode 100644
index 523dc99dd1..0000000000
--- a/platform/android/gradle/gradle-tests-staticblockremover.gradle
+++ /dev/null
@@ -1,59 +0,0 @@
-buildscript {
- repositories {
- mavenCentral()
- mavenLocal()
- }
-
- dependencies {
- classpath 'com.darylteo.gradle:javassist-plugin:0.4.1'
- }
-}
-
-import com.darylteo.gradle.javassist.tasks.TransformationTask
-import com.darylteo.gradle.javassist.transformers.ClassTransformer
-import javassist.CtClass
-import javassist.CtConstructor
-
-class StaticBlockRemover extends ClassTransformer {
-
- private static final NATIVE_MAP_VIEW = "com.mapbox.mapboxsdk.maps.NativeMapView";
- private static
- final NATIVE_CONNECTIVITY_LISTENER = "com.mapbox.mapboxsdk.net.NativeConnectivityListener";
- private static final OFFLINE_MANAGER = "com.mapbox.mapboxsdk.offline.OfflineManager";
- private static final OFFLINE_REGION = "com.mapbox.mapboxsdk.offline.OfflineRegion";
-
- public void applyTransformations(CtClass clazz) throws Exception {
- if (shouldFilter(clazz)) {
- CtConstructor constructor = clazz.getClassInitializer()
- if (constructor != null) {
- clazz.removeConstructor(constructor)
- }
- }
- }
-
- public boolean shouldFilter(CtClass clazz) {
- return hasAStaticBlock(clazz);
- }
-
- private boolean hasAStaticBlock(CtClass clazz) {
- String name = clazz.getName();
- boolean isNativeMapView = name.equals(NATIVE_MAP_VIEW);
- boolean isNativeConnectivityListener = name.equals(NATIVE_CONNECTIVITY_LISTENER);
- boolean isOfflineManager = name.equals(OFFLINE_MANAGER);
- boolean isOfflineRegion = name.equals(OFFLINE_REGION);
-
- return isNativeMapView || isNativeConnectivityListener || isOfflineManager || isOfflineRegion;
- }
-}
-
-task removeStatic(type: TransformationTask) {
- // TODO Find a better way to get output classes path
- String fromToDirPath = buildDir.getAbsolutePath() + "/intermediates/classes/debug"
- from fromToDirPath
- transformation = new StaticBlockRemover()
- into fromToDirPath
-}
-
-afterEvaluate {
- compileDebugUnitTestSources.dependsOn(removeStatic)
-} \ No newline at end of file