From ef31fc5aed4e07b3d9e98b25180b8f809d51a5cf Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Sat, 20 Jun 2015 16:21:41 -0700 Subject: [PATCH 01/30] attempting to put one annotation on the map - gets to the native call and then nothing happens --- android/cpp/jni.cpp | 22 +++++++++++++ .../com/mapbox/mapboxgl/views/MapView.java | 4 +++ .../mapbox/mapboxgl/views/NativeMapView.java | 6 ++++ .../mapbox/mapboxgl/testapp/MainActivity.java | 33 +++++++++++++++++++ .../src/main/res/menu/menu_main.xml | 12 ++++--- .../src/main/res/values/strings.xml | 2 ++ 6 files changed, 75 insertions(+), 4 deletions(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 64e72e149..bfa07a2ff 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -419,6 +419,26 @@ void JNICALL nativeSetLatLng(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, j nativeMapView->getMap().setLatLng(mbgl::LatLng(latitude, longitude), std::chrono::milliseconds(duration)); } +void JNICALL nativeAddAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject latLng) { + mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddAnnotation"); + assert(nativeMapViewPtr != 0); + NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); + + jdouble latitude = env->GetDoubleField(latLng, latLngLatitudeId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return; + } + + jdouble longitude = env->GetDoubleField(latLng, latLngLongitudeId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return; + } + + nativeMapView->getMap().addPointAnnotation(mbgl::LatLng(latitude, longitude), std::string("")); +} + jobject JNICALL nativeGetLatLng(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetLatLng"); assert(nativeMapViewPtr != 0); @@ -952,6 +972,8 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { {"nativeMoveBy", "(JDDJ)V", reinterpret_cast(&nativeMoveBy)}, {"nativeSetLatLng", "(JLcom/mapbox/mapboxgl/geometry/LatLng;J)V", reinterpret_cast(&nativeSetLatLng)}, + {"nativeAddAnnotation", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)V", + reinterpret_cast(&nativeAddAnnotation)}, {"nativeGetLatLng", "(J)Lcom/mapbox/mapboxgl/geometry/LatLng;", reinterpret_cast(&nativeGetLatLng)}, {"nativeResetPosition", "(J)V", reinterpret_cast(&nativeResetPosition)}, diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java index e482c0be5..9588f1e5a 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java @@ -204,6 +204,10 @@ public class MapView extends SurfaceView { } } + public void addAnnotation(LatLng marker) { + mNativeMapView.addAnnotation(marker); + } + // // Property methods // diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java index 7f074c6db..9a2baa447 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java @@ -197,6 +197,10 @@ class NativeMapView { nativeSetLatLng(mNativeMapViewPtr, latLng, duration); } + public void addAnnotation(LatLng latLng) { + nativeAddAnnotation(mNativeMapViewPtr, latLng); + } + public LatLng getLatLng() { return nativeGetLatLng(mNativeMapViewPtr); } @@ -422,6 +426,8 @@ class NativeMapView { private native void nativeSetLatLng(long nativeMapViewPtr, LatLng latLng, long duration); + private native void nativeAddAnnotation(long nativeMapViewPtr, LatLng latLng); + private native LatLng nativeGetLatLng(long nativeMapViewPtr); private native void nativeResetPosition(long nativeMapViewPtr); diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index 65cb17462..8bef3392c 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -77,6 +77,9 @@ public class MainActivity extends ActionBarActivity { private float mCompassBearing; private boolean mCompassValid = false; + // Used for point annotations + private boolean mIsPointAnnotationsOn = false; + // // Lifecycle events // @@ -210,6 +213,10 @@ public class MainActivity extends ActionBarActivity { } return true; + case R.id.action_point_annotations: + // Toggle point annotations + togglePointAnnotations(!mIsPointAnnotationsOn); + default: return super.onOptionsItemSelected(item); } @@ -249,6 +256,32 @@ public class MainActivity extends ActionBarActivity { } } + /** + * Enable / Disable Point annotations. + * + * TODO: Implement updating the UI and removing point annotations from the map. + * + * @param enablePointAnnotations + */ + private void togglePointAnnotations(boolean enablePointAnnotations) { + if (enablePointAnnotations) { + if (!mIsPointAnnotationsOn) { + mIsPointAnnotationsOn = true; + addPointAnnotations(); + } + } else { + if (mIsPointAnnotationsOn) { + mIsPointAnnotationsOn = false; + + } + } + } + + private void addPointAnnotations() { + LatLng backLot = new LatLng(38.649441, -121.369064); + mMapFragment.getMap().addAnnotation(backLot); + } + // This class forwards location updates to updateLocation() private class GpsListener implements LocationListener { diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_main.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_main.xml index bf6dbbf36..965f88254 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_main.xml +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_main.xml @@ -1,11 +1,15 @@ - + + diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml index 901e23192..cddf228bf 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml @@ -7,6 +7,8 @@ Toggle debug mode + Toggle point annotations + FPS: Map compass. Click to reset the map rotation to North. From 3ab8e6c0dd614ff46683ceccf9cdbd2c38bc5294 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Mon, 13 Jul 2015 11:59:54 -0700 Subject: [PATCH 02/30] Specifically naming the sprite in JNI adds a marker to the map #1716 --- android/cpp/jni.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index bfa07a2ff..f3cc1dc07 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -436,7 +436,7 @@ void JNICALL nativeAddAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPt return; } - nativeMapView->getMap().addPointAnnotation(mbgl::LatLng(latitude, longitude), std::string("")); + nativeMapView->getMap().addPointAnnotation(mbgl::LatLng(latitude, longitude), std::string("default_marker")); } jobject JNICALL nativeGetLatLng(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) { From 7efa69ff24a05d4972c38308feb30f005b972a04 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Mon, 13 Jul 2015 17:32:05 -0700 Subject: [PATCH 03/30] Refactored PointAnnotation to be called Markers a la Google Maps --- android/cpp/jni.cpp | 8 ++--- .../com/mapbox/mapboxgl/views/MapView.java | 5 ++- .../mapbox/mapboxgl/views/NativeMapView.java | 7 ++-- .../mapbox/mapboxgl/testapp/MainActivity.java | 34 +++++++++---------- .../src/main/res/menu/menu_main.xml | 2 +- 5 files changed, 27 insertions(+), 29 deletions(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index f04ed94b3..7b905598c 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -434,8 +434,8 @@ void JNICALL nativeSetLatLng(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, j nativeMapView->getMap().setLatLng(mbgl::LatLng(latitude, longitude), std::chrono::milliseconds(duration)); } -void JNICALL nativeAddAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject latLng) { - mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddAnnotation"); +void JNICALL nativeAddMarker(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject latLng) { + mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddMarker"); assert(nativeMapViewPtr != 0); NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); @@ -997,8 +997,8 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { {"nativeMoveBy", "(JDDJ)V", reinterpret_cast(&nativeMoveBy)}, {"nativeSetLatLng", "(JLcom/mapbox/mapboxgl/geometry/LatLng;J)V", reinterpret_cast(&nativeSetLatLng)}, - {"nativeAddAnnotation", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)V", - reinterpret_cast(&nativeAddAnnotation)}, + {"nativeAddMarker", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)V", + reinterpret_cast(&nativeAddMarker)}, {"nativeGetLatLng", "(J)Lcom/mapbox/mapboxgl/geometry/LatLng;", reinterpret_cast(&nativeGetLatLng)}, {"nativeResetPosition", "(J)V", reinterpret_cast(&nativeResetPosition)}, diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java index 06807dfa0..6af2e3e60 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java @@ -26,7 +26,6 @@ import android.view.SurfaceView; import android.view.View; import android.view.ViewConfiguration; import android.widget.ZoomButtonsController; -import android.util.Log; import com.almeros.android.multitouch.gesturedetectors.RotateGestureDetector; import com.almeros.android.multitouch.gesturedetectors.TwoFingerGestureDetector; @@ -205,8 +204,8 @@ public class MapView extends SurfaceView { } } - public void addAnnotation(LatLng marker) { - mNativeMapView.addAnnotation(marker); + public void addMarker(LatLng marker) { + mNativeMapView.addMarker(marker); } // diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java index ad8666506..c1969c961 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java @@ -2,7 +2,6 @@ package com.mapbox.mapboxgl.views; import android.graphics.PointF; import android.view.Surface; -import android.util.Log; import com.mapbox.mapboxgl.geometry.LatLng; import com.mapbox.mapboxgl.geometry.LatLngZoom; @@ -214,8 +213,8 @@ class NativeMapView { nativeSetLatLng(mNativeMapViewPtr, latLng, duration); } - public void addAnnotation(LatLng latLng) { - nativeAddAnnotation(mNativeMapViewPtr, latLng); + public void addMarker(LatLng latLng) { + nativeAddMarker(mNativeMapViewPtr, latLng); } public LatLng getLatLng() { @@ -450,7 +449,7 @@ class NativeMapView { private native void nativeSetLatLng(long nativeMapViewPtr, LatLng latLng, long duration); - private native void nativeAddAnnotation(long nativeMapViewPtr, LatLng latLng); + private native void nativeAddMarker(long nativeMapViewPtr, LatLng latLng); private native LatLng nativeGetLatLng(long nativeMapViewPtr); diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index 8bef3392c..34fe4f02f 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -77,8 +77,8 @@ public class MainActivity extends ActionBarActivity { private float mCompassBearing; private boolean mCompassValid = false; - // Used for point annotations - private boolean mIsPointAnnotationsOn = false; + // Used for markers + private boolean mIsMarkersOn = false; // // Lifecycle events @@ -213,9 +213,9 @@ public class MainActivity extends ActionBarActivity { } return true; - case R.id.action_point_annotations: - // Toggle point annotations - togglePointAnnotations(!mIsPointAnnotationsOn); + case R.id.action_markers: + // Toggle markers + toggleMarkers(!mIsMarkersOn); default: return super.onOptionsItemSelected(item); @@ -257,29 +257,29 @@ public class MainActivity extends ActionBarActivity { } /** - * Enable / Disable Point annotations. + * Enable / Disable markers. * - * TODO: Implement updating the UI and removing point annotations from the map. + * TODO: Implement updating the UI and removing markers from the map. * - * @param enablePointAnnotations + * @param enableMarkers */ - private void togglePointAnnotations(boolean enablePointAnnotations) { - if (enablePointAnnotations) { - if (!mIsPointAnnotationsOn) { - mIsPointAnnotationsOn = true; - addPointAnnotations(); + private void toggleMarkers(boolean enableMarkers) { + if (enableMarkers) { + if (!mIsMarkersOn) { + mIsMarkersOn = true; + addMarkers(); } } else { - if (mIsPointAnnotationsOn) { - mIsPointAnnotationsOn = false; + if (mIsMarkersOn) { + mIsMarkersOn = false; } } } - private void addPointAnnotations() { + private void addMarkers() { LatLng backLot = new LatLng(38.649441, -121.369064); - mMapFragment.getMap().addAnnotation(backLot); + mMapFragment.getMap().addMarker(backLot); } // This class forwards location updates to updateLocation() diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_main.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_main.xml index 965f88254..f16522d99 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_main.xml +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_main.xml @@ -4,7 +4,7 @@ android:icon="@drawable/ic_action_about" android:title="@string/action_debug" app:showAsAction="ifRoom" /> - From f710e9607a2d7b5817a84df5c33bcb6a441d2dd6 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Mon, 13 Jul 2015 18:11:36 -0700 Subject: [PATCH 04/30] Returning annotationIds as long from JNI in addMarker --- android/cpp/jni.cpp | 11 ++++++----- .../java/com/mapbox/mapboxgl/views/NativeMapView.java | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 7b905598c..23a297220 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -434,7 +434,7 @@ void JNICALL nativeSetLatLng(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, j nativeMapView->getMap().setLatLng(mbgl::LatLng(latitude, longitude), std::chrono::milliseconds(duration)); } -void JNICALL nativeAddMarker(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject latLng) { +jlong JNICALL nativeAddMarker(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject latLng) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddMarker"); assert(nativeMapViewPtr != 0); NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); @@ -442,16 +442,17 @@ void JNICALL nativeAddMarker(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, j jdouble latitude = env->GetDoubleField(latLng, latLngLatitudeId); if (env->ExceptionCheck()) { env->ExceptionDescribe(); - return; + return -1; } jdouble longitude = env->GetDoubleField(latLng, latLngLongitudeId); if (env->ExceptionCheck()) { env->ExceptionDescribe(); - return; + return -1; } - nativeMapView->getMap().addPointAnnotation(mbgl::PointAnnotation(mbgl::LatLng(latitude, longitude), std::string("default_marker"))); + // Because Java only has int, not unsigned int, we need to bump the annotation id up to a long. + return (jlong) nativeMapView->getMap().addPointAnnotation(mbgl::PointAnnotation(mbgl::LatLng(latitude, longitude), std::string("default_marker"))); } jobject JNICALL nativeGetLatLng(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) { @@ -997,7 +998,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { {"nativeMoveBy", "(JDDJ)V", reinterpret_cast(&nativeMoveBy)}, {"nativeSetLatLng", "(JLcom/mapbox/mapboxgl/geometry/LatLng;J)V", reinterpret_cast(&nativeSetLatLng)}, - {"nativeAddMarker", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)V", + {"nativeAddMarker", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)J", reinterpret_cast(&nativeAddMarker)}, {"nativeGetLatLng", "(J)Lcom/mapbox/mapboxgl/geometry/LatLng;", reinterpret_cast(&nativeGetLatLng)}, diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java index c1969c961..6d4f026b1 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java @@ -449,7 +449,7 @@ class NativeMapView { private native void nativeSetLatLng(long nativeMapViewPtr, LatLng latLng, long duration); - private native void nativeAddMarker(long nativeMapViewPtr, LatLng latLng); + private native long nativeAddMarker(long nativeMapViewPtr, LatLng latLng); private native LatLng nativeGetLatLng(long nativeMapViewPtr); From 1ac1ba0e18a2d99caeacc86cde096b72ea4a89f3 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Tue, 14 Jul 2015 10:45:29 -0700 Subject: [PATCH 05/30] Fleshing out Android Annotation API, working on removing annotations through JNI. --- android/cpp/jni.cpp | 9 ++ .../mapboxgl/annotations/Annotation.java | 42 ++++++ .../mapbox/mapboxgl/annotations/Circle.java | 8 ++ .../mapboxgl/annotations/CircleOptions.java | 9 ++ .../mapbox/mapboxgl/annotations/Marker.java | 98 +++++++++++++ .../mapboxgl/annotations/MarkerOptions.java | 134 ++++++++++++++++++ .../mapbox/mapboxgl/annotations/Polygon.java | 9 ++ .../mapboxgl/annotations/PolygonOptions.java | 9 ++ .../mapbox/mapboxgl/annotations/Polyline.java | 9 ++ .../mapboxgl/annotations/PolylineOptions.java | 9 ++ .../com/mapbox/mapboxgl/views/MapView.java | 23 ++- .../mapbox/mapboxgl/views/NativeMapView.java | 12 +- .../mapbox/mapboxgl/testapp/MainActivity.java | 16 ++- 13 files changed, 381 insertions(+), 6 deletions(-) create mode 100644 android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Annotation.java create mode 100644 android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Circle.java create mode 100644 android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java create mode 100644 android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java create mode 100644 android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MarkerOptions.java create mode 100644 android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java create mode 100644 android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java create mode 100644 android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java create mode 100644 android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 23a297220..61af695f5 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -455,6 +455,13 @@ jlong JNICALL nativeAddMarker(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, return (jlong) nativeMapView->getMap().addPointAnnotation(mbgl::PointAnnotation(mbgl::LatLng(latitude, longitude), std::string("default_marker"))); } +// void JNICALL nativeRemoveAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jlong annotationId) { +// mbgl::Log::Debug(mbgl::Event::JNI, "nativeRemoveAnnotation"); +// assert(nativeMapViewPtr != 0); +// NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); +// nativeMapView->getMap().setLatLng((uint32_t)annotationId); +// } + jobject JNICALL nativeGetLatLng(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetLatLng"); assert(nativeMapViewPtr != 0); @@ -1000,6 +1007,8 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { reinterpret_cast(&nativeSetLatLng)}, {"nativeAddMarker", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)J", reinterpret_cast(&nativeAddMarker)}, + // {"nativeRemoveAnnotation", "(J)V", + // reinterpret_cast(&nativeRemoveAnnotation)}, {"nativeGetLatLng", "(J)Lcom/mapbox/mapboxgl/geometry/LatLng;", reinterpret_cast(&nativeGetLatLng)}, {"nativeResetPosition", "(J)V", reinterpret_cast(&nativeResetPosition)}, diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Annotation.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Annotation.java new file mode 100644 index 000000000..fb2b7e2a3 --- /dev/null +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Annotation.java @@ -0,0 +1,42 @@ +package com.mapbox.mapboxgl.annotations; + +import com.mapbox.mapboxgl.views.MapView; + +/** + * Created by Nicholas Hallahan on 7/13/15. + * nick@theoutpost.io + */ +public abstract class Annotation { + + /** + * The annotation id + * + * Internal C++ id is stored as unsigned int. + */ + protected Long id; + private MapView mapView; + + public Annotation() {} + + public Annotation(long id) { + this.id = id; + } + + public long getId() { + return id; + } + + public void remove() { + if (mapView == null) return; + mapView.removeAnnotation(this); + } + + public void setId(Long id) { + this.id = id; + } + + public void setMapView(MapView mapView) { + this.mapView = mapView; + } + +} diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Circle.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Circle.java new file mode 100644 index 000000000..298643f64 --- /dev/null +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Circle.java @@ -0,0 +1,8 @@ +package com.mapbox.mapboxgl.annotations; + +/** + * Created by Nicholas Hallahan on 7/13/15. + * nick@theoutpost.io + */ +public class Circle { +} diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java new file mode 100644 index 000000000..afb80b78a --- /dev/null +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java @@ -0,0 +1,9 @@ +package com.mapbox.mapboxgl.annotations; + +/** + * Created by Nicholas Hallahan on 7/13/15. + * nick@theoutpost.io + */ +public class CircleOptions { + +} diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java new file mode 100644 index 000000000..a178786c5 --- /dev/null +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java @@ -0,0 +1,98 @@ +package com.mapbox.mapboxgl.annotations; + +import com.mapbox.mapboxgl.geometry.LatLng; + +/** + * Created by Nicholas Hallahan on 7/13/15. + * nick@theoutpost.io + */ +public class Marker extends Annotation { + + /** + * Member fields are without access qualifiers + * so that they can be directly set by MarkerOptions + * from within the module. + */ + float alpha; + float anchorU; + float anchorV; + boolean draggable; + boolean flat; + float infoWindowAnchorU; + float infoWindowAnchorV; + LatLng position; + float rotation; + String snippet; + String title; + boolean visible; + + private boolean infoWindowShown = false; + + public Marker() { + + } + + public boolean equals(Object other) { + double lat = position.getLatitude(); + double lng = position.getLongitude(); + // TODO Implement equals + return false; + } + + public float getAlpha() { + return alpha; + } + + /** + * NOTE: Google Maps Android API uses String for IDs. + * + * Internal C++ id is stored as unsigned int. + * + * @return the annotation id + */ + public long getId() { + return id; + } + + public LatLng getPosition() { + return position; + } + + public float getRotation() { + return rotation; + } + + public String getSnippet() { + return snippet; + } + + public String getTitle() { + return title; + } + +// Method in Google Maps Android API +// public int hashCode() + + public void hideInfoWindow() { + //TODO hideInfoWindow + infoWindowShown = true; + } + + public boolean isDraggable() { + return draggable; + } + + public boolean isFlat() { + return flat; + } + + public boolean isInfoWindowShown () { + return infoWindowShown; + } + + public boolean isVisible() { + return visible; + } + + +} diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MarkerOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MarkerOptions.java new file mode 100644 index 000000000..723707a85 --- /dev/null +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MarkerOptions.java @@ -0,0 +1,134 @@ +package com.mapbox.mapboxgl.annotations; + +import com.mapbox.mapboxgl.geometry.LatLng; + +/** + * Created by Nicholas Hallahan on 7/13/15. + * nick@theoutpost.io + */ +public class MarkerOptions { + + private Marker marker; + + public MarkerOptions() { + marker = new Marker(); + } + + public MarkerOptions alpha(float alpha) { + marker.alpha = alpha; + return this; + } + + public MarkerOptions anchor(float u, float v) { + marker.anchorU = u; + marker.anchorV = v; + return this; + } + + public MarkerOptions draggable(boolean draggable) { + marker.draggable = draggable; + return this; + } + + public MarkerOptions flat(boolean flat) { + marker.flat = flat; + return this; + } + + public float getAlpha() { + return marker.alpha; + } + + public float getAnchorU() { + return marker.anchorU; + } + + public float getAnchorV() { + return marker.anchorV; + } + + // TODO: Implement this method of Google Maps Android API +// public BitmapDescriptor getIcon () { +// +// } + + public float getInfoWindowAnchorU() { + return marker.infoWindowAnchorU; + } + + public float getInfoWindowAnchorV() { + return marker.infoWindowAnchorV; + } + + public Marker getMarker() { + return marker; + } + + public LatLng getPosition() { + return marker.position; + } + + public float getRotation() { + return marker.rotation; + } + + public String getSnippet() { + return marker.snippet; + } + + public String getTitle() { + return marker.title; + } + + // TODO: Implement this method of Google Maps Android API +// public MarkerOptions icon(BitmapDescriptor icon) { +// +// } + + public MarkerOptions infoWindowAnchor(float u, float v) { + marker.infoWindowAnchorU = u; + marker.infoWindowAnchorV = v; + return this; + } + + public boolean isDraggable() { + return marker.draggable; + } + + public boolean isFlat() { + return marker.flat; + } + + public boolean isVisible() { + return marker.visible; + } + + public MarkerOptions position(LatLng position) { + marker.position = position; + return this; + } + + public MarkerOptions rotation(float rotation) { + marker.rotation = rotation; + return this; + } + + public MarkerOptions snippet(String snippet) { + marker.snippet = snippet; + return this; + } + + public MarkerOptions title(String title) { + marker.title = title; + return this; + } + + public MarkerOptions visible(boolean visible) { + marker.visible = visible; + return this; + } + + // TODO: Implement this method of Google Maps Android API +// public void writeToParcel (Parcel out, int flags) + +} diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java new file mode 100644 index 000000000..acd88673d --- /dev/null +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java @@ -0,0 +1,9 @@ +package com.mapbox.mapboxgl.annotations; + +/** + * Created by Nicholas Hallahan on 7/13/15. + * nick@theoutpost.io + */ +public class Polygon { + +} diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java new file mode 100644 index 000000000..29673465f --- /dev/null +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java @@ -0,0 +1,9 @@ +package com.mapbox.mapboxgl.annotations; + +/** + * Created by Nicholas Hallahan on 7/13/15. + * nick@theoutpost.io + */ +public class PolygonOptions { + +} diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java new file mode 100644 index 000000000..c60054978 --- /dev/null +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java @@ -0,0 +1,9 @@ +package com.mapbox.mapboxgl.annotations; + +/** + * Created by Nicholas Hallahan on 7/13/15. + * nick@theoutpost.io + */ +public class Polyline { + +} diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java new file mode 100644 index 000000000..4201d41b5 --- /dev/null +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java @@ -0,0 +1,9 @@ +package com.mapbox.mapboxgl.annotations; + +/** + * Created by Nicholas Hallahan on 7/13/15. + * nick@theoutpost.io + */ +public class PolylineOptions { + +} diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java index 6af2e3e60..f9524bad2 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java @@ -29,6 +29,9 @@ import android.widget.ZoomButtonsController; import com.almeros.android.multitouch.gesturedetectors.RotateGestureDetector; import com.almeros.android.multitouch.gesturedetectors.TwoFingerGestureDetector; +import com.mapbox.mapboxgl.annotations.Annotation; +import com.mapbox.mapboxgl.annotations.Marker; +import com.mapbox.mapboxgl.annotations.MarkerOptions; import com.mapbox.mapboxgl.geometry.LatLng; import com.mapbox.mapboxgl.geometry.LatLngZoom; @@ -62,6 +65,11 @@ public class MapView extends SurfaceView { private static final String STATE_CLASSES = "classes"; private static final String STATE_DEFAULT_TRANSITION_DURATION = "defaultTransitionDuration"; + /** + * Every annotation that has been added to the map. + */ + private List annotations = new ArrayList<>(); + // // Instance members // @@ -204,10 +212,21 @@ public class MapView extends SurfaceView { } } - public void addMarker(LatLng marker) { - mNativeMapView.addMarker(marker); + public Marker addMarker(MarkerOptions markerOptions) { + Marker marker = markerOptions.getMarker(); + Long markerId = mNativeMapView.addMarker(marker); + marker.setId(markerId); // the annotation needs to know its id + marker.setMapView(this); // the annotation needs to know which map view it is in + annotations.add(marker); + return marker; } + public void removeAnnotation(Annotation annotation) { + long id = annotation.getId(); + mNativeMapView.removeAnnotation(id); + } + + // // Property methods // diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java index 6d4f026b1..9ed7d29b9 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java @@ -3,6 +3,7 @@ package com.mapbox.mapboxgl.views; import android.graphics.PointF; import android.view.Surface; +import com.mapbox.mapboxgl.annotations.Marker; import com.mapbox.mapboxgl.geometry.LatLng; import com.mapbox.mapboxgl.geometry.LatLngZoom; import com.mapbox.mapboxgl.geometry.ProjectedMeters; @@ -213,8 +214,13 @@ class NativeMapView { nativeSetLatLng(mNativeMapViewPtr, latLng, duration); } - public void addMarker(LatLng latLng) { - nativeAddMarker(mNativeMapViewPtr, latLng); + public long addMarker(Marker marker) { + LatLng latLng = marker.getPosition(); + return nativeAddMarker(mNativeMapViewPtr, latLng); + } + + public void removeAnnotation(long id) { +// nativeRemoveAnnotation(mNativeMapViewPtr, id); } public LatLng getLatLng() { @@ -451,6 +457,8 @@ class NativeMapView { private native long nativeAddMarker(long nativeMapViewPtr, LatLng latLng); + private native void nativeRemoveAnnotation(long nativeMapViewPtr, long id); + private native LatLng nativeGetLatLng(long nativeMapViewPtr); private native void nativeResetPosition(long nativeMapViewPtr); diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index 34fe4f02f..9bc696b40 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -23,6 +23,8 @@ import android.widget.ImageView; import android.widget.Spinner; import android.widget.TextView; +import com.mapbox.mapboxgl.annotations.Marker; +import com.mapbox.mapboxgl.annotations.MarkerOptions; import com.mapbox.mapboxgl.geometry.LatLng; import com.mapbox.mapboxgl.views.MapView; import com.mapzen.android.lost.api.LocationListener; @@ -80,6 +82,8 @@ public class MainActivity extends ActionBarActivity { // Used for markers private boolean mIsMarkersOn = false; + private Marker marker; + // // Lifecycle events // @@ -272,14 +276,22 @@ public class MainActivity extends ActionBarActivity { } else { if (mIsMarkersOn) { mIsMarkersOn = false; - + removeMarkers(); } } } private void addMarkers() { LatLng backLot = new LatLng(38.649441, -121.369064); - mMapFragment.getMap().addMarker(backLot); + MapView map = mMapFragment.getMap(); + marker = map.addMarker(new MarkerOptions() + .position(backLot) + .title("Back Lot") + .snippet("The back lot behind my house")); + } + + private void removeMarkers() { + marker.remove(); } // This class forwards location updates to updateLocation() From afcc78a0aba6a7de6bd676982c9671dbc0eb6acd Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Tue, 14 Jul 2015 11:11:14 -0700 Subject: [PATCH 06/30] Able to remove an annotation from the map #1716 --- android/cpp/jni.cpp | 15 +++++++-------- .../com/mapbox/mapboxgl/views/NativeMapView.java | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 61af695f5..0e26311f4 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -455,12 +455,12 @@ jlong JNICALL nativeAddMarker(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, return (jlong) nativeMapView->getMap().addPointAnnotation(mbgl::PointAnnotation(mbgl::LatLng(latitude, longitude), std::string("default_marker"))); } -// void JNICALL nativeRemoveAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jlong annotationId) { -// mbgl::Log::Debug(mbgl::Event::JNI, "nativeRemoveAnnotation"); -// assert(nativeMapViewPtr != 0); -// NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); -// nativeMapView->getMap().setLatLng((uint32_t)annotationId); -// } +void JNICALL nativeRemoveAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jlong annotationId) { + mbgl::Log::Debug(mbgl::Event::JNI, "nativeRemoveAnnotation"); + assert(nativeMapViewPtr != 0); + NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); + nativeMapView->getMap().removeAnnotation((uint32_t)annotationId); +} jobject JNICALL nativeGetLatLng(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetLatLng"); @@ -1007,8 +1007,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { reinterpret_cast(&nativeSetLatLng)}, {"nativeAddMarker", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)J", reinterpret_cast(&nativeAddMarker)}, - // {"nativeRemoveAnnotation", "(J)V", - // reinterpret_cast(&nativeRemoveAnnotation)}, + {"nativeRemoveAnnotation", "(JJ)V", reinterpret_cast(&nativeRemoveAnnotation)}, {"nativeGetLatLng", "(J)Lcom/mapbox/mapboxgl/geometry/LatLng;", reinterpret_cast(&nativeGetLatLng)}, {"nativeResetPosition", "(J)V", reinterpret_cast(&nativeResetPosition)}, diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java index 9ed7d29b9..13260a64b 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java @@ -220,7 +220,7 @@ class NativeMapView { } public void removeAnnotation(long id) { -// nativeRemoveAnnotation(mNativeMapViewPtr, id); + nativeRemoveAnnotation(mNativeMapViewPtr, id); } public LatLng getLatLng() { From 7c5fde4a3edaf95cc2229453897edf3a3366cd59 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Tue, 14 Jul 2015 17:04:13 -0700 Subject: [PATCH 07/30] Fleshed out the shell of the Google Maps API #1716 --- .../mapboxgl/annotations/Annotation.java | 25 +++-- .../mapbox/mapboxgl/annotations/Circle.java | 63 ++++++++++- .../mapboxgl/annotations/CircleOptions.java | 67 +++++++++++- .../mapbox/mapboxgl/annotations/Marker.java | 53 ++++++--- .../mapboxgl/annotations/MultiPoint.java | 49 +++++++++ .../mapbox/mapboxgl/annotations/Polygon.java | 101 +++++++++++++++++- .../mapboxgl/annotations/PolygonOptions.java | 90 +++++++++++++++- .../mapbox/mapboxgl/annotations/Polyline.java | 63 ++++++++++- .../mapboxgl/annotations/PolylineOptions.java | 101 +++++++++++++++++- .../mapbox/mapboxgl/testapp/MainActivity.java | 2 - 10 files changed, 563 insertions(+), 51 deletions(-) create mode 100644 android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPoint.java diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Annotation.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Annotation.java index fb2b7e2a3..04fa5a4f2 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Annotation.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Annotation.java @@ -2,30 +2,31 @@ package com.mapbox.mapboxgl.annotations; import com.mapbox.mapboxgl.views.MapView; -/** - * Created by Nicholas Hallahan on 7/13/15. - * nick@theoutpost.io - */ + public abstract class Annotation { /** * The annotation id - * + *

* Internal C++ id is stored as unsigned int. */ - protected Long id; + protected Long id; // null unless added to a MapView private MapView mapView; + float alpha = 1; + boolean visible = true; + + public Annotation() {} - public Annotation(long id) { - this.id = id; - } - public long getId() { return id; } + public boolean isVisible() { + return visible; + } + public void remove() { if (mapView == null) return; mapView.removeAnnotation(this); @@ -39,4 +40,8 @@ public abstract class Annotation { this.mapView = mapView; } + public void setVisible(boolean visible) { + this.visible = visible; + } + } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Circle.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Circle.java index 298643f64..6111e959f 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Circle.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Circle.java @@ -1,8 +1,61 @@ package com.mapbox.mapboxgl.annotations; -/** - * Created by Nicholas Hallahan on 7/13/15. - * nick@theoutpost.io - */ -public class Circle { + +import android.graphics.Color; + +import com.mapbox.mapboxgl.geometry.LatLng; + +public class Circle extends Annotation { + + LatLng center; + int fillColor = Color.BLACK; + double radius; + int strokeColor = Color.BLACK; + float strokeWidth = 10; // Google Maps API defaults to 10 + + public LatLng getCenter() { + return center; + } + + public int getFillColor() { + return fillColor; + } + + /** + * Returns the circle's radius, in meters. + * + * @return radius in meters + */ + public double getRadius() { + return radius; + } + + public int getStrokeColor() { + return strokeColor; + } + + public float getStrokeWidth() { + return strokeWidth; + } + + public void setCenter(LatLng center) { + this.center = center; + } + + public void setFillColor(int color) { + fillColor = color; + } + + public void setRadius(double radius) { + this.radius = radius; + } + + public void setStrokeColor (int color) { + strokeColor = color; + } + + public void setStrokeWidth (float width) { + strokeWidth = width; + } + } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java index afb80b78a..18c570c85 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java @@ -1,9 +1,68 @@ package com.mapbox.mapboxgl.annotations; -/** - * Created by Nicholas Hallahan on 7/13/15. - * nick@theoutpost.io - */ + +import com.mapbox.mapboxgl.geometry.LatLng; + public class CircleOptions { + private Circle circle; + + public CircleOptions() { + circle = new Circle(); + } + public CircleOptions center(LatLng center) { + circle.center = center; + return this; + } + + public CircleOptions fillColor(int color) { + circle.fillColor = color; + return this; + } + + public LatLng getCenter() { + return circle.center; + } + + public int getFillColor() { + return circle.fillColor; + } + + public double getRadius() { + return circle.radius; + } + + public int getStrokeColor () { + return circle.strokeColor; + } + + public float getStrokeWidth() { + return circle.strokeWidth; + } + + // TODO: Implement getZIndex of Google Maps Android API +// public float getZIndex () { +// +// } + + public CircleOptions radius (double radius) { + circle.radius = radius; + return this; + } + + public CircleOptions strokeColor(int color) { + circle.strokeColor = color; + return this; + } + + public CircleOptions strokeWidth (float width) { + circle.strokeWidth = width; + return this; + } + + // TODO: Implement zIndex of Google Maps Android API +// public CircleOptions zIndex (float zIndex) { +// +// } + } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java index a178786c5..34413fb97 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java @@ -2,10 +2,7 @@ package com.mapbox.mapboxgl.annotations; import com.mapbox.mapboxgl.geometry.LatLng; -/** - * Created by Nicholas Hallahan on 7/13/15. - * nick@theoutpost.io - */ + public class Marker extends Annotation { /** @@ -13,7 +10,6 @@ public class Marker extends Annotation { * so that they can be directly set by MarkerOptions * from within the module. */ - float alpha; float anchorU; float anchorV; boolean draggable; @@ -24,13 +20,10 @@ public class Marker extends Annotation { float rotation; String snippet; String title; - boolean visible; private boolean infoWindowShown = false; - public Marker() { - - } + public Marker() {} public boolean equals(Object other) { double lat = position.getLatitude(); @@ -75,7 +68,7 @@ public class Marker extends Annotation { public void hideInfoWindow() { //TODO hideInfoWindow - infoWindowShown = true; + infoWindowShown = false; } public boolean isDraggable() { @@ -90,9 +83,45 @@ public class Marker extends Annotation { return infoWindowShown; } - public boolean isVisible() { - return visible; + void setAlpha(float alpha) { + this.alpha = alpha; } + void setDraggable(boolean draggable) { + this.draggable = draggable; + } + void setFlat(boolean flat) { + this.flat = flat; + } + + // TODO: Implement this method of Google Maps Android API +// void setIcon(BitmapDescriptor icon) { +// +// } + + void setInfoWindowAnchor(float u, float v) { + infoWindowAnchorU = u; + infoWindowAnchorV = v; + } + + void setPosition(LatLng latlng) { + this.position = position; + } + + void setRotation(float rotation) { + this.rotation = rotation; + } + + void setSnippet(String snippet) { + this.snippet = snippet; + } + + void setTitle(String title) { + this.title = title; + } + + void showInfoWindow() { + infoWindowShown = true; + } } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPoint.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPoint.java new file mode 100644 index 000000000..4f01f2c1e --- /dev/null +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPoint.java @@ -0,0 +1,49 @@ +package com.mapbox.mapboxgl.annotations; + +import com.mapbox.mapboxgl.geometry.LatLng; + +import java.util.ArrayList; +import java.util.List; + +public abstract class MultiPoint extends Annotation { + + List points; + + public MultiPoint() { + points = new ArrayList<>(); + } + + public List getPoints() { + return points; + } + + // TODO: Implement getZIndex of Google Maps Android API +// public float getZIndex() { +// +// } + + // TODO: Implement hashCode of Google Maps Android API +// public int hashCode() { +// +// } + + // TODO: Implement isGeodesic of Google Maps Android API +// public boolean isGeodesic() { +// +// } + + /** + * Sets the points of this polyline. This method will take a copy + * of the points, so further mutations to points will have no effect + * on this polyline. + * + * @param points + */ + void setPoints(List points) { + this.points = new ArrayList<>(); + for (LatLng latLng : points) { + this.points.add(latLng); + } + } + +} diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java index acd88673d..5e4abf680 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java @@ -1,9 +1,100 @@ package com.mapbox.mapboxgl.annotations; -/** - * Created by Nicholas Hallahan on 7/13/15. - * nick@theoutpost.io - */ -public class Polygon { +import android.graphics.Color; + +import com.mapbox.mapboxgl.geometry.LatLng; + +import java.util.ArrayList; +import java.util.List; + +public class Polygon extends MultiPoint { + + int fillColor = Color.BLACK; // default fillColor is black + float strokeAlpha = 1; + int strokeColor = Color.BLACK; // default strokeColor is black + float strokeWidth = 10; // As specified by Google API Docs (in pixels) + + List> holes; + + public Polygon() { + super(); + holes = new ArrayList<>(); + } + + // TODO: Implement equals of Google Maps Android API +// public boolean equals (Object other) { +// +// } + + public int getFillColor() { + return fillColor; + } + + public List> getHoles () { + return holes; + } + + public int getStrokeColor() { + return strokeColor; + } + + public float getStrokeWidth() { + return strokeWidth; + } + + // TODO: Implement getZIndex of Google Maps Android API +// public float getZIndex() { +// +// } + + // TODO: Implement hashCode of Google Maps Android API +// public int hashCode () { +// +// } + + public void setFillAlpha(float alpha) { + this.alpha = alpha; + } + + public void setFillColor(int color) { + fillColor = color; + } + + /** + * Sets the holes of this polygon. This method will take a copy of the holes, + * so further mutations to holes will have no effect on this polygon. + * + * @param holes + */ + public void setHoles(List> holes) { + this.holes = new ArrayList<>(); + for (List hole : holes) { + List newHole = new ArrayList<>(); + this.holes.add(newHole); + for (LatLng latLng : hole) { + newHole.add(latLng); + } + } + } + + /** + * Sets the alpha (opacity) of the stroke + */ + public void setStrokeAlpha(float alpha) { + strokeAlpha = alpha; + } + + public void setStrokeColor(int color) { + strokeColor = color; + } + + public void setStrokeWidth(float width) { + strokeWidth = width; + } + + // TODO: Implement setZIndex of Google Maps Android API +// public void setZIndex(float zIndex) { +// +// } } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java index 29673465f..4ffa58167 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java @@ -1,9 +1,91 @@ package com.mapbox.mapboxgl.annotations; -/** - * Created by Nicholas Hallahan on 7/13/15. - * nick@theoutpost.io - */ + +import com.mapbox.mapboxgl.geometry.LatLng; + +import java.util.ArrayList; +import java.util.List; + public class PolygonOptions { + private Polygon polygon; + + public PolygonOptions() { + polygon = new Polygon(); + } + + public PolygonOptions add(LatLng point) { + polygon.points.add(point); + return this; + } + + public PolygonOptions add(LatLng... points) { + for (LatLng point : points) { + add(point); + } + return this; + } + + public PolygonOptions addAll(Iterable points) { + for (LatLng point : points) { + add(point); + } + return this; + } + + public PolygonOptions addHole (Iterable points) { + List hole = new ArrayList<>(); + for (LatLng point : points) { + hole.add(point); + } + polygon.holes.add(hole); + return this; + } + + public PolygonOptions fillColor(int color) { + polygon.fillColor = color; + return this; + } + + public int getFillColor() { + return polygon.fillColor; + } + + public List> getHoles() { + return polygon.holes; + } + + public int getStrokeColor() { + return polygon.strokeColor; + } + + public float getStrokeWidth() { + return polygon.strokeWidth; + } + + // TODO: Implement getZIndex of Google Maps Android API +// public float getZIndex() { +// +// } + + public PolygonOptions strokeColor(int color) { + polygon.strokeColor = color; + return this; + } + + public PolygonOptions strokeWidth(float width) { + polygon.strokeWidth = width; + return this; + } + + // TODO: Implement writeToParcel of Google Maps Android API +// public void writeToParcel(Parcel out, int flags) { +// +// } + + // TODO: Implement zIndex of Google Maps Android API +// public PolygonOptions zIndex(float zIndex) { +// +// return this; +// } } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java index c60054978..703e5d524 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java @@ -1,9 +1,62 @@ package com.mapbox.mapboxgl.annotations; -/** - * Created by Nicholas Hallahan on 7/13/15. - * nick@theoutpost.io - */ -public class Polyline { +import android.graphics.Color; + +import com.mapbox.mapboxgl.geometry.LatLng; + +import java.util.List; + +public class Polyline extends MultiPoint { + + int color = Color.BLACK; // default color is black + float width = 10; // As specified by Google API Docs (in pixels) + List points; + + public Polyline() { + super(); + } + + // TODO: Implement equals of Google Maps Android API +// public boolean equals(Object other) { +// +// } + + public int getColor() { + return color; + } + + public float getWidth() { + return width; + } + + + /** + * Sets the color of the polyline. + * + * @param color - the color in ARGB format + */ + public void setColor(int color) { + this.color = color; + } + + // TODO: Implement setGeodesic of Google Maps Android API +// public void setGeodesic(boolean geodesic) { +// +// } + + /** + * Sets the width of the polyline. + * + * @param width in pixels + * @return + */ + public void setWidth(float width) { + this.width = width; + } + + // TODO: Implement setZIndex of Google Maps Android API +// public void setZIndex(float zIndex) { +// +// } } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java index 4201d41b5..09e7969c3 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java @@ -1,9 +1,102 @@ package com.mapbox.mapboxgl.annotations; -/** - * Created by Nicholas Hallahan on 7/13/15. - * nick@theoutpost.io - */ +import com.mapbox.mapboxgl.geometry.LatLng; + +import java.util.List; + public class PolylineOptions { + private Polyline polyline; + + public PolylineOptions() { + polyline = new Polyline(); + } + + public PolylineOptions alpha(float alpha) { + polyline.alpha = alpha; + return this; + } + + public PolylineOptions add(LatLng point) { + polyline.points.add(point); + return this; + } + + public PolylineOptions add(LatLng... points) { + for (LatLng point : points) { + add(point); + } + return this; + } + + public PolylineOptions addAll(Iterable points) { + for (LatLng point : points) { + add(point); + } + return this; + } + + public PolylineOptions color(int color) { + polyline.color = color; + return this; + } + + // TODO: Implement geodesic of Google Maps Android API +// public PolylineOptions geodesic (boolean geodesic) { +// +// } + + public int getColor() { + return polyline.color; + } + + public List getPoints() { + return polyline.points; + } + + public float getWidth() { + return polyline.width; + } + + // TODO: Implement getZIndex of Google Maps Android API +// public float getZIndex() { +// +// } + + // TODO: Implement isGeodesic of Google Maps Android API +// public boolean isGeodesic() { +// +// } + + public boolean isVisible() { + return polyline.visible; + } + + public PolylineOptions visible(boolean visible) { + polyline.visible = visible; + return this; + } + + /** + * Sets the width of the polyline. + * + * @param width in pixels + * @return + */ + public PolylineOptions width(float width) { + polyline.width = width; + return this; + } + + // TODO: Implement writeToParcel of Google Maps Android API +// public void writeToParcel(Parcel out, int flags) { +// +// } + + // TODO: Implement zIndex of Google Maps Android API +// public PolylineOptions zIndex(float zIndex) { +// +// return this; +// } + } diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index 9bc696b40..8f4109fce 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -263,8 +263,6 @@ public class MainActivity extends ActionBarActivity { /** * Enable / Disable markers. * - * TODO: Implement updating the UI and removing markers from the map. - * * @param enableMarkers */ private void toggleMarkers(boolean enableMarkers) { From 82e88a6a7756cec0dcae424eabdb3f76bcf947be Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Tue, 14 Jul 2015 19:18:34 -0700 Subject: [PATCH 08/30] parsed coordinates from geojson, ready to add polyline via JNI #1716 --- .../mapboxgl/annotations/CircleOptions.java | 2 +- .../mapboxgl/annotations/PolygonOptions.java | 4 + .../mapboxgl/annotations/PolylineOptions.java | 4 + .../com/mapbox/mapboxgl/views/MapView.java | 8 + .../src/main/assets/tillicum.geojson | 4063 +++++++++++++++++ .../mapbox/mapboxgl/testapp/MainActivity.java | 23 + .../com/mapbox/mapboxgl/testapp/Util.java | 53 + 7 files changed, 4156 insertions(+), 1 deletion(-) create mode 100644 android/java/MapboxGLAndroidSDKTestApp/src/main/assets/tillicum.geojson create mode 100644 android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/Util.java diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java index 18c570c85..43643c0fd 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java @@ -64,5 +64,5 @@ public class CircleOptions { // public CircleOptions zIndex (float zIndex) { // // } - + } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java index 4ffa58167..3ae47803d 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java @@ -55,6 +55,10 @@ public class PolygonOptions { return polygon.holes; } + public Polygon getPolygon() { + return polygon; + } + public int getStrokeColor() { return polygon.strokeColor; } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java index 09e7969c3..f87b91c98 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java @@ -54,6 +54,10 @@ public class PolylineOptions { return polyline.points; } + public Polyline getPolyline() { + return polyline; + } + public float getWidth() { return polyline.width; } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java index f9524bad2..29a9f227a 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java @@ -32,6 +32,8 @@ import com.almeros.android.multitouch.gesturedetectors.TwoFingerGestureDetector; import com.mapbox.mapboxgl.annotations.Annotation; import com.mapbox.mapboxgl.annotations.Marker; import com.mapbox.mapboxgl.annotations.MarkerOptions; +import com.mapbox.mapboxgl.annotations.Polyline; +import com.mapbox.mapboxgl.annotations.PolylineOptions; import com.mapbox.mapboxgl.geometry.LatLng; import com.mapbox.mapboxgl.geometry.LatLngZoom; @@ -221,6 +223,12 @@ public class MapView extends SurfaceView { return marker; } + public Polyline addPolyline(PolylineOptions polylineOptions) { + Polyline polyline = polylineOptions.getPolyline(); + + return polyline; + } + public void removeAnnotation(Annotation annotation) { long id = annotation.getId(); mNativeMapView.removeAnnotation(id); diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/assets/tillicum.geojson b/android/java/MapboxGLAndroidSDKTestApp/src/main/assets/tillicum.geojson new file mode 100644 index 000000000..2324e9ddc --- /dev/null +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/assets/tillicum.geojson @@ -0,0 +1,4063 @@ +{ + "type": "Feature", + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -123.77252789, + 44.37857221 + ], + [ + -123.77317087, + 44.37864694 + ], + [ + -123.77383407, + 44.37875853 + ], + [ + -123.7744676, + 44.37886305 + ], + [ + -123.77507677, + 44.37893017 + ], + [ + -123.77566451, + 44.37901047 + ], + [ + -123.77605842, + 44.37892161 + ], + [ + -123.77660114, + 44.37895724 + ], + [ + -123.77720403, + 44.37897655 + ], + [ + -123.77781983, + 44.37900344 + ], + [ + -123.77838906, + 44.37898221 + ], + [ + -123.7789954, + 44.37899854 + ], + [ + -123.77951988, + 44.37891571 + ], + [ + -123.78004217, + 44.37883105 + ], + [ + -123.78056503, + 44.37875077 + ], + [ + -123.78105914, + 44.37868172 + ], + [ + -123.78156765, + 44.37852908 + ], + [ + -123.78211778, + 44.37847079 + ], + [ + -123.78269313, + 44.37840336 + ], + [ + -123.78319893, + 44.37834025 + ], + [ + -123.79013846, + 44.37675321 + ], + [ + -123.79067206, + 44.37666117 + ], + [ + -123.79122235, + 44.37667708 + ], + [ + -123.79156935, + 44.37655781 + ], + [ + -123.79231801, + 44.37652196 + ], + [ + -123.79301538, + 44.37651473 + ], + [ + -123.79359988, + 44.37656075 + ], + [ + -123.79428722, + 44.37655133 + ], + [ + -123.79487322, + 44.37661456 + ], + [ + -123.79548606, + 44.37666101 + ], + [ + -123.79603541, + 44.37670013 + ], + [ + -123.79660795, + 44.37662235 + ], + [ + -123.79718365, + 44.37650581 + ], + [ + -123.79780967, + 44.37653439 + ], + [ + -123.79831292, + 44.37685522 + ], + [ + -123.79883296, + 44.37696685 + ], + [ + -123.7993581, + 44.37709195 + ], + [ + -123.79988118, + 44.37718879 + ], + [ + -123.80039793, + 44.37728202 + ], + [ + -123.80089376, + 44.37738925 + ], + [ + -123.80142092, + 44.37766936 + ], + [ + -123.80179753, + 44.37789379 + ], + [ + -123.80233272, + 44.37795562 + ], + [ + -123.80277717, + 44.37816047 + ], + [ + -123.80331138, + 44.3783486 + ], + [ + -123.80381643, + 44.37850233 + ], + [ + -123.80420021, + 44.37865152 + ], + [ + -123.80474815, + 44.37882091 + ], + [ + -123.80522525, + 44.37906232 + ], + [ + -123.80570349, + 44.37922411 + ], + [ + -123.80620571, + 44.37941275 + ], + [ + -123.80673037, + 44.37965326 + ], + [ + -123.80735339, + 44.37979863 + ], + [ + -123.80784469, + 44.37999957 + ], + [ + -123.80837458, + 44.37998017 + ], + [ + -123.80899232, + 44.380014 + ], + [ + -123.80952307, + 44.37993165 + ], + [ + -123.80987634, + 44.37978153 + ], + [ + -123.81017161, + 44.37953295 + ], + [ + -123.81074873, + 44.37925199 + ], + [ + -123.81119243, + 44.37897587 + ], + [ + -123.81154793, + 44.37873989 + ], + [ + -123.81198778, + 44.37842102 + ], + [ + -123.81235373, + 44.37816192 + ], + [ + -123.81275348, + 44.37788448 + ], + [ + -123.81310351, + 44.37766604 + ], + [ + -123.81337983, + 44.37730145 + ], + [ + -123.81357531, + 44.37692989 + ], + [ + -123.81361254, + 44.37647844 + ], + [ + -123.81353376, + 44.37594116 + ], + [ + -123.813198, + 44.37561605 + ], + [ + -123.81284754, + 44.37547955 + ], + [ + -123.81254975, + 44.37524719 + ], + [ + -123.81227721, + 44.37500803 + ], + [ + -123.81207289, + 44.3746695 + ], + [ + -123.81171276, + 44.37434638 + ], + [ + -123.81097859, + 44.37413431 + ], + [ + -123.81041401, + 44.37394429 + ], + [ + -123.80976458, + 44.37373029 + ], + [ + -123.80923389, + 44.37352906 + ], + [ + -123.80863022, + 44.37335692 + ], + [ + -123.80827452, + 44.37322894 + ], + [ + -123.8079216, + 44.37304699 + ], + [ + -123.80755687, + 44.37290854 + ], + [ + -123.80710749, + 44.37269837 + ], + [ + -123.80659847, + 44.37245911 + ], + [ + -123.80613857, + 44.37221401 + ], + [ + -123.80573546, + 44.37193255 + ], + [ + -123.80540784, + 44.37151577 + ], + [ + -123.80511308, + 44.37120469 + ], + [ + -123.80500888, + 44.37078896 + ], + [ + -123.80529524, + 44.37037566 + ], + [ + -123.80558562, + 44.37019806 + ], + [ + -123.80585412, + 44.36996992 + ], + [ + -123.80610692, + 44.36970942 + ], + [ + -123.80661414, + 44.36946727 + ], + [ + -123.80708477, + 44.36926607 + ], + [ + -123.80747679, + 44.36907467 + ], + [ + -123.80784949, + 44.368733 + ], + [ + -123.80826348, + 44.36838459 + ], + [ + -123.80868817, + 44.36802111 + ], + [ + -123.80912729, + 44.36773598 + ], + [ + -123.80960812, + 44.36738742 + ], + [ + -123.81008551, + 44.36707347 + ], + [ + -123.81063481, + 44.36684946 + ], + [ + -123.81115119, + 44.36661789 + ], + [ + -123.811705, + 44.36640043 + ], + [ + -123.81227943, + 44.36624681 + ], + [ + -123.81272103, + 44.36622733 + ], + [ + -123.81348991, + 44.36635102 + ], + [ + -123.81411031, + 44.36622347 + ], + [ + -123.81475065, + 44.3661859 + ], + [ + -123.81536292, + 44.36625908 + ], + [ + -123.8160232, + 44.36634012 + ], + [ + -123.81661561, + 44.36646415 + ], + [ + -123.81719049, + 44.36652826 + ], + [ + -123.81784426, + 44.36665079 + ], + [ + -123.81846565, + 44.36680154 + ], + [ + -123.81905878, + 44.36690594 + ], + [ + -123.81970058, + 44.36704457 + ], + [ + -123.82030833, + 44.36728783 + ], + [ + -123.82091327, + 44.36747762 + ], + [ + -123.82156675, + 44.36747158 + ], + [ + -123.82213205, + 44.36750236 + ], + [ + -123.8227688, + 44.36753587 + ], + [ + -123.82339934, + 44.36749609 + ], + [ + -123.82400308, + 44.36747441 + ], + [ + -123.82437384, + 44.36736178 + ], + [ + -123.82498006, + 44.36711433 + ], + [ + -123.82554355, + 44.36692204 + ], + [ + -123.82599663, + 44.36659999 + ], + [ + -123.82653738, + 44.36631833 + ], + [ + -123.82687629, + 44.36595919 + ], + [ + -123.82730895, + 44.36559104 + ], + [ + -123.82752535, + 44.36508675 + ], + [ + -123.82778797, + 44.36466732 + ], + [ + -123.8280572, + 44.36424929 + ], + [ + -123.82826364, + 44.36381812 + ], + [ + -123.8284935, + 44.36337296 + ], + [ + -123.82872595, + 44.36288338 + ], + [ + -123.82894503, + 44.36243078 + ], + [ + -123.82914801, + 44.36196883 + ], + [ + -123.82942984, + 44.36158184 + ], + [ + -123.82967989, + 44.36114209 + ], + [ + -123.82984482, + 44.36067615 + ], + [ + -123.83000072, + 44.36021653 + ], + [ + -123.8302136, + 44.35975596 + ], + [ + -123.83043508, + 44.35927715 + ], + [ + -123.83043676, + 44.35897974 + ], + [ + -123.83066164, + 44.3585452 + ], + [ + -123.83087389, + 44.35808419 + ], + [ + -123.83123077, + 44.35771716 + ], + [ + -123.83149219, + 44.35730191 + ], + [ + -123.8317935, + 44.35689183 + ], + [ + -123.83221309, + 44.35652466 + ], + [ + -123.83264602, + 44.35620468 + ], + [ + -123.83295909, + 44.35604074 + ], + [ + -123.83322863, + 44.35582838 + ], + [ + -123.83363274, + 44.35546781 + ], + [ + -123.8339284, + 44.35504505 + ], + [ + -123.83421101, + 44.35462757 + ], + [ + -123.83441642, + 44.35420053 + ], + [ + -123.83459364, + 44.35374425 + ], + [ + -123.83484153, + 44.35328064 + ], + [ + -123.83503992, + 44.35279836 + ], + [ + -123.83532486, + 44.35239401 + ], + [ + -123.83558141, + 44.35190388 + ], + [ + -123.83584591, + 44.35144822 + ], + [ + -123.8362086, + 44.35106632 + ], + [ + -123.83646984, + 44.35061601 + ], + [ + -123.83682396, + 44.35027306 + ], + [ + -123.83741823, + 44.35002993 + ], + [ + -123.83797977, + 44.34977041 + ], + [ + -123.8384272, + 44.34973236 + ], + [ + -123.83891831, + 44.34973886 + ], + [ + -123.8393342, + 44.34980157 + ], + [ + -123.83983914, + 44.34970795 + ], + [ + -123.8402702, + 44.34971164 + ], + [ + -123.84067923, + 44.34973058 + ], + [ + -123.8410633, + 44.34970312 + ], + [ + -123.84147372, + 44.34971455 + ], + [ + -123.84204825, + 44.3498711 + ], + [ + -123.84264285, + 44.34994949 + ], + [ + -123.84321946, + 44.35001037 + ], + [ + -123.84377642, + 44.35003907 + ], + [ + -123.84432658, + 44.35025777 + ], + [ + -123.84203507, + 44.35487086 + ], + [ + -123.84165892, + 44.35522761 + ], + [ + -123.84141926, + 44.35562524 + ], + [ + -123.8411565, + 44.35599439 + ], + [ + -123.8410185, + 44.3562787 + ], + [ + -123.84055746, + 44.35664891 + ], + [ + -123.8402963, + 44.35698133 + ], + [ + -123.83992088, + 44.35727933 + ], + [ + -123.83973137, + 44.35754806 + ], + [ + -123.83932875, + 44.35773088 + ], + [ + -123.83914337, + 44.3580173 + ], + [ + -123.83895031, + 44.35825633 + ], + [ + -123.83850815, + 44.35862331 + ], + [ + -123.83822746, + 44.35907347 + ], + [ + -123.83796045, + 44.35949625 + ], + [ + -123.83768553, + 44.35990376 + ], + [ + -123.83745996, + 44.3604108 + ], + [ + -123.83714948, + 44.36078632 + ], + [ + -123.83691018, + 44.36125106 + ], + [ + -123.83671357, + 44.36176473 + ], + [ + -123.83643361, + 44.36221479 + ], + [ + -123.83615206, + 44.36264813 + ], + [ + -123.83578463, + 44.36307576 + ], + [ + -123.83542661, + 44.36349149 + ], + [ + -123.83506758, + 44.36384017 + ], + [ + -123.83472312, + 44.36423027 + ], + [ + -123.83433282, + 44.36461474 + ], + [ + -123.83404859, + 44.36509528 + ], + [ + -123.83375641, + 44.36552674 + ], + [ + -123.83348665, + 44.36592645 + ], + [ + -123.83352719, + 44.36641625 + ], + [ + -123.83354167, + 44.36687226 + ], + [ + -123.83352598, + 44.36733983 + ], + [ + -123.83357856, + 44.36781268 + ], + [ + -123.83358707, + 44.36828114 + ], + [ + -123.83361502, + 44.36877025 + ], + [ + -123.83363983, + 44.36924809 + ], + [ + -123.83386927, + 44.36974131 + ], + [ + -123.83398366, + 44.37020602 + ], + [ + -123.83411017, + 44.37066634 + ], + [ + -123.83422771, + 44.37115498 + ], + [ + -123.83440837, + 44.37157793 + ], + [ + -123.83451758, + 44.37203463 + ], + [ + -123.83466984, + 44.37246002 + ], + [ + -123.83476675, + 44.3729088 + ], + [ + -123.834789, + 44.37317881 + ], + [ + -123.8346991, + 44.37369173 + ], + [ + -123.83454395, + 44.37417495 + ], + [ + -123.83441269, + 44.37465505 + ], + [ + -123.83417986, + 44.37507302 + ], + [ + -123.83364152, + 44.37526 + ], + [ + -123.83321353, + 44.37557739 + ], + [ + -123.83285218, + 44.37595532 + ], + [ + -123.83248264, + 44.37637684 + ], + [ + -123.83225679, + 44.37665008 + ], + [ + -123.83191251, + 44.37707752 + ], + [ + -123.83159357, + 44.37751562 + ], + [ + -123.83134601, + 44.37796816 + ], + [ + -123.83118921, + 44.37842778 + ], + [ + -123.83090169, + 44.37889258 + ], + [ + -123.83070078, + 44.37934341 + ], + [ + -123.83056763, + 44.37979938 + ], + [ + -123.83053986, + 44.38025897 + ], + [ + -123.83063844, + 44.38064949 + ], + [ + -123.8307725, + 44.38109651 + ], + [ + -123.83083629, + 44.38148235 + ], + [ + -123.83082114, + 44.3819181 + ], + [ + -123.83065815, + 44.38231241 + ], + [ + -123.83050646, + 44.38273143 + ], + [ + -123.83030168, + 44.38315663 + ], + [ + -123.82998372, + 44.38356024 + ], + [ + -123.82974685, + 44.38396369 + ], + [ + -123.82954343, + 44.38431339 + ], + [ + -123.82937698, + 44.38464023 + ], + [ + -123.82929339, + 44.38499412 + ], + [ + -123.82929866, + 44.38537351 + ], + [ + -123.82929649, + 44.38572262 + ], + [ + -123.82939712, + 44.3861449 + ], + [ + -123.82974721, + 44.38640976 + ], + [ + -123.83006661, + 44.38665424 + ], + [ + -123.83047099, + 44.38693426 + ], + [ + -123.83085114, + 44.38712547 + ], + [ + -123.83131994, + 44.38731023 + ], + [ + -123.83186324, + 44.38761938 + ], + [ + -123.83217948, + 44.38780359 + ], + [ + -123.83273301, + 44.3880341 + ], + [ + -123.83332735, + 44.38824105 + ], + [ + -123.8340571, + 44.38841128 + ], + [ + -123.83465999, + 44.38859294 + ], + [ + -123.83528877, + 44.38859602 + ], + [ + -123.83569405, + 44.38844339 + ], + [ + -123.83638628, + 44.3884207 + ], + [ + -123.8370251, + 44.38844967 + ], + [ + -123.83739577, + 44.38837795 + ], + [ + -123.83776722, + 44.38831733 + ], + [ + -123.83837884, + 44.38836701 + ], + [ + -123.83900529, + 44.38838659 + ], + [ + -123.83961918, + 44.38831371 + ], + [ + -123.84021405, + 44.38829042 + ], + [ + -123.84086954, + 44.38828232 + ], + [ + -123.84151231, + 44.3883489 + ], + [ + -123.84204361, + 44.38864686 + ], + [ + -123.84250872, + 44.38883971 + ], + [ + -123.84286235, + 44.38913828 + ], + [ + -123.84327839, + 44.38943857 + ], + [ + -123.84351162, + 44.38965811 + ], + [ + -123.8437019, + 44.38990892 + ], + [ + -123.84414825, + 44.39024774 + ], + [ + -123.84457698, + 44.39057986 + ], + [ + -123.8450298, + 44.39091025 + ], + [ + -123.84540377, + 44.39127727 + ], + [ + -123.84576513, + 44.39169169 + ], + [ + -123.84620505, + 44.3920822 + ], + [ + -123.84662036, + 44.39243773 + ], + [ + -123.84701835, + 44.39281331 + ], + [ + -123.84736426, + 44.39303992 + ], + [ + -123.84774171, + 44.39336675 + ], + [ + -123.84750211, + 44.39375524 + ], + [ + -123.84730976, + 44.39415078 + ], + [ + -123.84716074, + 44.39450914 + ], + [ + -123.83325795, + 44.39231346 + ], + [ + -123.83287897, + 44.39233478 + ], + [ + -123.83242812, + 44.39225423 + ], + [ + -123.8320242, + 44.39214754 + ], + [ + -123.831443, + 44.39216949 + ], + [ + -123.83081285, + 44.39222948 + ], + [ + -123.83042339, + 44.39237674 + ], + [ + -123.8298725, + 44.39246101 + ], + [ + -123.82948222, + 44.39289454 + ], + [ + -123.82948876, + 44.39341478 + ], + [ + -123.82929042, + 44.39364585 + ], + [ + -123.82889206, + 44.39403331 + ], + [ + -123.82849602, + 44.39438788 + ], + [ + -123.82814269, + 44.39466477 + ], + [ + -123.82774371, + 44.39497413 + ], + [ + -123.82797044, + 44.39558031 + ], + [ + -123.82824962, + 44.39610349 + ], + [ + -123.82823647, + 44.39653022 + ], + [ + -123.82841452, + 44.3970331 + ], + [ + -123.82846666, + 44.39744215 + ], + [ + -123.82881905, + 44.39761326 + ], + [ + -123.82910502, + 44.39782317 + ], + [ + -123.82933156, + 44.39827824 + ], + [ + -123.82958303, + 44.39860292 + ], + [ + -123.82970897, + 44.39887799 + ], + [ + -123.82998729, + 44.39910031 + ], + [ + -123.83048205, + 44.39929464 + ], + [ + -123.83095576, + 44.3995244 + ], + [ + -123.83147986, + 44.39985473 + ], + [ + -123.83202919, + 44.40011745 + ], + [ + -123.83272727, + 44.40023748 + ], + [ + -123.83340891, + 44.40029896 + ], + [ + -123.8340274, + 44.40029109 + ], + [ + -123.83472264, + 44.40026772 + ], + [ + -123.83508238, + 44.40017841 + ], + [ + -123.83575472, + 44.40010627 + ], + [ + -123.83643769, + 44.40001533 + ], + [ + -123.8370988, + 44.39997518 + ], + [ + -123.83747722, + 44.39992662 + ], + [ + -123.83818459, + 44.39988528 + ], + [ + -123.83883679, + 44.3997823 + ], + [ + -123.8394548, + 44.39967891 + ], + [ + -123.84008445, + 44.39954732 + ], + [ + -123.84070208, + 44.39939815 + ], + [ + -123.84131372, + 44.39917183 + ], + [ + -123.84187299, + 44.39896379 + ], + [ + -123.84244572, + 44.39868752 + ], + [ + -123.84296973, + 44.3984023 + ], + [ + -123.84350996, + 44.3981352 + ], + [ + -123.84392876, + 44.39799545 + ], + [ + -123.8447125, + 44.39786568 + ], + [ + -123.84510842, + 44.39787915 + ], + [ + -123.84579844, + 44.39787518 + ], + [ + -123.84650467, + 44.39794333 + ], + [ + -123.84717138, + 44.39808825 + ], + [ + -123.84788597, + 44.39825368 + ], + [ + -123.84843146, + 44.3984778 + ], + [ + -123.84908022, + 44.39868748 + ], + [ + -123.84973524, + 44.39883781 + ], + [ + -123.85018943, + 44.39913399 + ], + [ + -123.85072511, + 44.39937269 + ], + [ + -123.85126588, + 44.39963369 + ], + [ + -123.85183667, + 44.39984811 + ], + [ + -123.85253322, + 44.39995526 + ], + [ + -123.85315519, + 44.40007652 + ], + [ + -123.85383831, + 44.40018159 + ], + [ + -123.85422651, + 44.4002215 + ], + [ + -123.85489009, + 44.40030811 + ], + [ + -123.85557778, + 44.40030578 + ], + [ + -123.85617964, + 44.40025503 + ], + [ + -123.85685093, + 44.40020889 + ], + [ + -123.85749307, + 44.40014005 + ], + [ + -123.85815502, + 44.39999251 + ], + [ + -123.85878967, + 44.39987297 + ], + [ + -123.85940186, + 44.39975461 + ], + [ + -123.86014717, + 44.39970844 + ], + [ + -123.86067393, + 44.39969683 + ], + [ + -123.86126228, + 44.39957493 + ], + [ + -123.86187423, + 44.39946623 + ], + [ + -123.86252734, + 44.39941413 + ], + [ + -123.86316943, + 44.39930916 + ], + [ + -123.86376752, + 44.39917205 + ], + [ + -123.86436596, + 44.39901877 + ], + [ + -123.86498829, + 44.39890866 + ], + [ + -123.86564018, + 44.39889606 + ], + [ + -123.86633351, + 44.39891627 + ], + [ + -123.86693144, + 44.39910351 + ], + [ + -123.86755934, + 44.39920612 + ], + [ + -123.86821285, + 44.39938466 + ], + [ + -123.86888417, + 44.39956356 + ], + [ + -123.86935838, + 44.3997763 + ], + [ + -123.86982656, + 44.40003146 + ], + [ + -123.87021351, + 44.40040625 + ], + [ + -123.87070082, + 44.40066815 + ], + [ + -123.8712128, + 44.40097838 + ], + [ + -123.87173204, + 44.40127655 + ], + [ + -123.8722167, + 44.40153571 + ], + [ + -123.87257382, + 44.40162574 + ], + [ + -123.87310406, + 44.40189762 + ], + [ + -123.87359914, + 44.40206826 + ], + [ + -123.87412929, + 44.40230976 + ], + [ + -123.87488722, + 44.40247685 + ], + [ + -123.87547359, + 44.40268243 + ], + [ + -123.87591649, + 44.40303744 + ], + [ + -123.87639193, + 44.40329141 + ], + [ + -123.87685593, + 44.403575 + ], + [ + -123.8773683, + 44.40388809 + ], + [ + -123.87787402, + 44.40421161 + ], + [ + -123.87830627, + 44.40450556 + ], + [ + -123.87875463, + 44.40481816 + ], + [ + -123.87921462, + 44.4051345 + ], + [ + -123.87965761, + 44.40550009 + ], + [ + -123.88006274, + 44.40581375 + ], + [ + -123.880311, + 44.40601844 + ], + [ + -123.88050868, + 44.40625212 + ], + [ + -123.88092865, + 44.40670517 + ], + [ + -123.88140728, + 44.40695894 + ], + [ + -123.88196001, + 44.40719543 + ], + [ + -123.88246063, + 44.40746501 + ], + [ + -123.88290241, + 44.40761001 + ], + [ + -123.88326407, + 44.40770471 + ], + [ + -123.88369986, + 44.4077935 + ], + [ + -123.88410483, + 44.40781332 + ], + [ + -123.88477941, + 44.40788478 + ], + [ + -123.88546521, + 44.40792777 + ], + [ + -123.88613991, + 44.40800486 + ], + [ + -123.88679371, + 44.40802335 + ], + [ + -123.88743945, + 44.40803797 + ], + [ + -123.88778308, + 44.40792528 + ], + [ + -123.88816662, + 44.40788622 + ], + [ + -123.88878509, + 44.4077292 + ], + [ + -123.88939277, + 44.40746818 + ], + [ + -123.88992761, + 44.40728381 + ], + [ + -123.89042965, + 44.40706805 + ], + [ + -123.89091789, + 44.40679144 + ], + [ + -123.89146513, + 44.40661118 + ], + [ + -123.89204869, + 44.40645954 + ], + [ + -123.8924492, + 44.40642341 + ], + [ + -123.89306481, + 44.40632346 + ], + [ + -123.89363697, + 44.4061784 + ], + [ + -123.89424605, + 44.40607274 + ], + [ + -123.89472907, + 44.40585515 + ], + [ + -123.89529258, + 44.4055676 + ], + [ + -123.89577479, + 44.40534867 + ], + [ + -123.89623146, + 44.40510029 + ], + [ + -123.89669813, + 44.4049264 + ], + [ + -123.89703676, + 44.40479792 + ], + [ + -123.89759604, + 44.40489638 + ], + [ + -123.89796954, + 44.40480068 + ], + [ + -123.89776908, + 44.40510428 + ], + [ + -123.89763026, + 44.40537959 + ], + [ + -123.89775748, + 44.40570888 + ], + [ + -123.89798825, + 44.40635395 + ], + [ + -123.89807914, + 44.40680006 + ], + [ + -123.8981605, + 44.40723602 + ], + [ + -123.89851731, + 44.40788018 + ], + [ + -123.89870319, + 44.40827993 + ], + [ + -123.89885188, + 44.40854481 + ], + [ + -123.89912201, + 44.4090699 + ], + [ + -123.89931266, + 44.40932872 + ], + [ + -123.89955343, + 44.40989939 + ], + [ + -123.89964612, + 44.41020136 + ], + [ + -123.89998865, + 44.41067162 + ], + [ + -123.90009915, + 44.41095871 + ], + [ + -123.90046547, + 44.41136472 + ], + [ + -123.90081575, + 44.41179523 + ], + [ + -123.90126973, + 44.41207393 + ], + [ + -123.90161867, + 44.41223466 + ], + [ + -123.90219707, + 44.41242756 + ], + [ + -123.90279124, + 44.41262141 + ], + [ + -123.90336856, + 44.41283241 + ], + [ + -123.90394765, + 44.41301175 + ], + [ + -123.90452798, + 44.4132305 + ], + [ + -123.90508748, + 44.41340748 + ], + [ + -123.90568275, + 44.41360401 + ], + [ + -123.90619128, + 44.41366257 + ], + [ + -123.90681799, + 44.41364594 + ], + [ + -123.90740832, + 44.41355112 + ], + [ + -123.90794155, + 44.41343054 + ], + [ + -123.9084303, + 44.41325435 + ], + [ + -123.90894564, + 44.41307826 + ], + [ + -123.90948204, + 44.41291141 + ], + [ + -123.90995774, + 44.41274009 + ], + [ + -123.91036825, + 44.41253823 + ], + [ + -123.91080595, + 44.41227071 + ], + [ + -123.91134941, + 44.41206608 + ], + [ + -123.91180342, + 44.41179606 + ], + [ + -123.91209543, + 44.41147776 + ], + [ + -123.91238624, + 44.41111112 + ], + [ + -123.91263172, + 44.41080515 + ], + [ + -123.91286336, + 44.41047062 + ], + [ + -123.91307648, + 44.41010501 + ], + [ + -123.91325976, + 44.40971712 + ], + [ + -123.91339298, + 44.4093358 + ], + [ + -123.91354334, + 44.40889929 + ], + [ + -123.91359042, + 44.40842761 + ], + [ + -123.9136534, + 44.40793958 + ], + [ + -123.91371997, + 44.40748378 + ], + [ + -123.91383764, + 44.40705641 + ], + [ + -123.91391104, + 44.40664034 + ], + [ + -123.91409615, + 44.40628875 + ], + [ + -123.91423042, + 44.40591397 + ], + [ + -123.91436732, + 44.40559092 + ], + [ + -123.91472252, + 44.40528978 + ], + [ + -123.91508271, + 44.40495322 + ], + [ + -123.91541287, + 44.40453829 + ], + [ + -123.91587899, + 44.40423021 + ], + [ + -123.91632563, + 44.40388354 + ], + [ + -123.91680777, + 44.40357231 + ], + [ + -123.91735984, + 44.40326839 + ], + [ + -123.91772488, + 44.40295815 + ], + [ + -123.91819859, + 44.4026917 + ], + [ + -123.91869704, + 44.40248751 + ], + [ + -123.91955809, + 44.40241698 + ], + [ + -123.92028749, + 44.40232218 + ], + [ + -123.92093335, + 44.4022829 + ], + [ + -123.92157021, + 44.40219044 + ], + [ + -123.92214399, + 44.40207362 + ], + [ + -123.92273745, + 44.40191332 + ], + [ + -123.92329758, + 44.40173306 + ], + [ + -123.92374441, + 44.40145561 + ], + [ + -123.92426761, + 44.4011692 + ], + [ + -123.92461559, + 44.40083517 + ], + [ + -123.92494488, + 44.40048791 + ], + [ + -123.92525406, + 44.40014004 + ], + [ + -123.92551382, + 44.39976282 + ], + [ + -123.92590109, + 44.3994442 + ], + [ + -123.92633895, + 44.399155 + ], + [ + -123.92704252, + 44.39905127 + ], + [ + -123.92769566, + 44.39898868 + ], + [ + -123.92830885, + 44.39900414 + ], + [ + -123.92892625, + 44.39895612 + ], + [ + -123.92954142, + 44.39893004 + ], + [ + -123.93014359, + 44.39889021 + ], + [ + -123.93069157, + 44.3987535 + ], + [ + -123.93121382, + 44.39858483 + ], + [ + -123.93179926, + 44.39837244 + ], + [ + -123.9323001, + 44.39811884 + ], + [ + -123.93286139, + 44.39791318 + ], + [ + -123.93343306, + 44.39771814 + ], + [ + -123.93402862, + 44.39752484 + ], + [ + -123.93445539, + 44.3974262 + ], + [ + -123.93507567, + 44.39720532 + ], + [ + -123.93566616, + 44.39703623 + ], + [ + -123.93608247, + 44.39695579 + ], + [ + -123.93680653, + 44.3968801 + ], + [ + -123.93748702, + 44.39688852 + ], + [ + -123.93801284, + 44.39704153 + ], + [ + -123.93862307, + 44.39713536 + ], + [ + -123.93909178, + 44.39738882 + ], + [ + -123.93958546, + 44.39763696 + ], + [ + -123.94004078, + 44.39791133 + ], + [ + -123.93992079, + 44.39849658 + ], + [ + -123.93951288, + 44.39911698 + ], + [ + -123.93937417, + 44.39938235 + ], + [ + -123.93930383, + 44.39977924 + ], + [ + -123.93916448, + 44.4000305 + ], + [ + -123.93901945, + 44.4003674 + ], + [ + -123.93904872, + 44.40078397 + ], + [ + -123.93909322, + 44.40129273 + ], + [ + -123.93915007, + 44.40175556 + ], + [ + -123.93925609, + 44.4022171 + ], + [ + -123.93943907, + 44.40268108 + ], + [ + -123.93960631, + 44.40322234 + ], + [ + -123.93982983, + 44.40361487 + ], + [ + -123.94014536, + 44.40397834 + ], + [ + -123.94026341, + 44.40429241 + ], + [ + -123.94057373, + 44.40447186 + ], + [ + -123.94105541, + 44.40474705 + ], + [ + -123.94160399, + 44.40494901 + ], + [ + -123.94220706, + 44.40502569 + ], + [ + -123.94279816, + 44.40506358 + ], + [ + -123.94340299, + 44.40507666 + ], + [ + -123.94402474, + 44.40510153 + ], + [ + -123.94462844, + 44.40520934 + ], + [ + -123.94524185, + 44.40526414 + ], + [ + -123.94588166, + 44.40528919 + ], + [ + -123.94651777, + 44.40533917 + ], + [ + -123.94717463, + 44.40539583 + ], + [ + -123.94782596, + 44.40545025 + ], + [ + -123.94847524, + 44.40549078 + ], + [ + -123.94908205, + 44.40554706 + ], + [ + -123.94968558, + 44.40556505 + ], + [ + -123.95032322, + 44.40564387 + ], + [ + -123.95088722, + 44.40579685 + ], + [ + -123.951475, + 44.40591513 + ], + [ + -123.95203642, + 44.40600215 + ], + [ + -123.95262381, + 44.40610039 + ], + [ + -123.95320377, + 44.40618497 + ], + [ + -123.95380631, + 44.40626162 + ], + [ + -123.95437712, + 44.40634471 + ], + [ + -123.95493238, + 44.40645369 + ], + [ + -123.95548339, + 44.40657689 + ], + [ + -123.95596045, + 44.40677881 + ], + [ + -123.95634357, + 44.40692054 + ], + [ + -123.95678154, + 44.40725095 + ], + [ + -123.95728515, + 44.40745667 + ], + [ + -123.9578236, + 44.4076733 + ], + [ + -123.95841299, + 44.40795093 + ], + [ + -123.95895545, + 44.40818203 + ], + [ + -123.95949965, + 44.40842223 + ], + [ + -123.95978424, + 44.40863051 + ], + [ + -123.96033444, + 44.40888121 + ], + [ + -123.96087367, + 44.4091309 + ], + [ + -123.96145696, + 44.40940761 + ], + [ + -123.96197166, + 44.4096763 + ], + [ + -123.96254326, + 44.40995239 + ], + [ + -123.96291887, + 44.41004019 + ], + [ + -123.96345949, + 44.41039994 + ], + [ + -123.96382274, + 44.4104883 + ], + [ + -123.96448741, + 44.41064768 + ], + [ + -123.96507192, + 44.41089011 + ], + [ + -123.96567255, + 44.41110579 + ], + [ + -123.96628875, + 44.41130712 + ], + [ + -123.96687554, + 44.4115252 + ], + [ + -123.96748682, + 44.41170485 + ], + [ + -123.96812516, + 44.4118425 + ], + [ + -123.96879175, + 44.41195063 + ], + [ + -123.96940244, + 44.41210901 + ], + [ + -123.96998386, + 44.41215632 + ], + [ + -123.97070257, + 44.41207678 + ], + [ + -123.97121878, + 44.41188922 + ], + [ + -123.9719615, + 44.41184233 + ], + [ + -123.97264813, + 44.41178434 + ], + [ + -123.97333195, + 44.41170379 + ], + [ + -123.9740139, + 44.41166369 + ], + [ + -123.974735, + 44.41159337 + ], + [ + -123.97534859, + 44.41154521 + ], + [ + -123.97597454, + 44.41151545 + ], + [ + -123.97657051, + 44.41142758 + ], + [ + -123.977225, + 44.41141165 + ], + [ + -123.97789065, + 44.41136242 + ], + [ + -123.97855006, + 44.411291 + ], + [ + -123.97922159, + 44.41131766 + ], + [ + -123.97987871, + 44.41131188 + ], + [ + -123.98055407, + 44.41134369 + ], + [ + -123.98121029, + 44.41132718 + ], + [ + -123.98184957, + 44.4114154 + ], + [ + -123.98245005, + 44.41138605 + ], + [ + -123.98307313, + 44.41141705 + ], + [ + -123.98369401, + 44.41139145 + ], + [ + -123.98440539, + 44.41135395 + ], + [ + -123.98511358, + 44.4113503 + ], + [ + -123.98671941, + 44.41152246 + ], + [ + -123.98748945, + 44.41152462 + ], + [ + -123.9882401, + 44.41152883 + ], + [ + -123.98889219, + 44.41159485 + ], + [ + -123.98946553, + 44.41174715 + ], + [ + -123.99005421, + 44.41187194 + ], + [ + -123.99053595, + 44.41199176 + ], + [ + -123.99112282, + 44.41208699 + ], + [ + -123.9917098, + 44.41221487 + ], + [ + -123.9923444, + 44.41227068 + ], + [ + -123.99298967, + 44.41233859 + ], + [ + -123.99366116, + 44.4123239 + ], + [ + -123.99425938, + 44.41231871 + ], + [ + -123.99488136, + 44.41231232 + ], + [ + -123.99551957, + 44.41230265 + ], + [ + -123.99616306, + 44.41226539 + ], + [ + -123.99679546, + 44.41222111 + ], + [ + -123.99739403, + 44.41220866 + ], + [ + -123.99802346, + 44.41219235 + ], + [ + -123.99863466, + 44.41223578 + ], + [ + -123.99926345, + 44.41228427 + ], + [ + -123.99984754, + 44.41237385 + ], + [ + -124.00048214, + 44.41239248 + ], + [ + -124.00114048, + 44.41245646 + ], + [ + -124.00178649, + 44.41250322 + ], + [ + -124.00242568, + 44.41254112 + ], + [ + -124.00302101, + 44.41260424 + ], + [ + -124.00366056, + 44.41272726 + ], + [ + -124.00431346, + 44.41279803 + ], + [ + -124.00495665, + 44.4128499 + ], + [ + -124.00579352, + 44.41288924 + ], + [ + -124.00624914, + 44.41287201 + ], + [ + -124.0068697, + 44.41285621 + ], + [ + -124.00755761, + 44.41290728 + ], + [ + -124.00823004, + 44.41289992 + ], + [ + -124.00860708, + 44.41299905 + ], + [ + -124.00932836, + 44.41308644 + ], + [ + -124.00997898, + 44.41306819 + ], + [ + -124.01056621, + 44.41316267 + ], + [ + -124.0111938, + 44.41317779 + ], + [ + -124.01185685, + 44.41324235 + ], + [ + -124.01249612, + 44.41327547 + ], + [ + -124.01314373, + 44.41326774 + ], + [ + -124.01379886, + 44.41329262 + ], + [ + -124.01443035, + 44.41329667 + ], + [ + -124.01504742, + 44.41325602 + ], + [ + -124.01567696, + 44.41326543 + ], + [ + -124.0163176, + 44.41323321 + ], + [ + -124.01697681, + 44.41320211 + ], + [ + -124.0176808, + 44.41319297 + ], + [ + -124.01830344, + 44.41318806 + ], + [ + -124.01892875, + 44.41316995 + ], + [ + -124.01957479, + 44.41310311 + ], + [ + -124.02028666, + 44.41296881 + ], + [ + -124.02096835, + 44.41287308 + ], + [ + -124.02159251, + 44.41281857 + ], + [ + -124.02222162, + 44.41283223 + ], + [ + -124.02293347, + 44.41285626 + ], + [ + -124.02358937, + 44.4128672 + ], + [ + -124.02419598, + 44.41289626 + ], + [ + -124.02482112, + 44.41293497 + ], + [ + -124.02548339, + 44.41297929 + ], + [ + -124.02611148, + 44.41299481 + ], + [ + -124.0266979, + 44.41313225 + ], + [ + -124.02736855, + 44.41333595 + ], + [ + -124.02783454, + 44.41368598 + ], + [ + -124.02836911, + 44.41389146 + ], + [ + -124.02897219, + 44.41403678 + ], + [ + -124.029629, + 44.41416364 + ], + [ + -124.03033955, + 44.41430962 + ], + [ + -124.03100129, + 44.41447188 + ], + [ + -124.03157854, + 44.4145831 + ], + [ + -124.03213505, + 44.41468656 + ], + [ + -124.03269749, + 44.41490901 + ], + [ + -124.033154, + 44.41508231 + ], + [ + -124.03359996, + 44.41520344 + ], + [ + -124.03408523, + 44.41530917 + ], + [ + -124.0346166, + 44.41543075 + ], + [ + -124.03512713, + 44.41554203 + ], + [ + -124.03564424, + 44.41566261 + ], + [ + -124.03605195, + 44.41585219 + ], + [ + -124.03654838, + 44.41591092 + ], + [ + -124.03701368, + 44.41610872 + ], + [ + -124.03751824, + 44.41637551 + ], + [ + -124.03799254, + 44.41658715 + ], + [ + -124.0384103, + 44.41683276 + ], + [ + -124.03883734, + 44.41708857 + ], + [ + -124.03925739, + 44.41737799 + ], + [ + -124.03971456, + 44.41764979 + ], + [ + -124.04013647, + 44.41789315 + ], + [ + -124.04054395, + 44.41813668 + ], + [ + -124.04097723, + 44.41838177 + ], + [ + -124.04146112, + 44.4186056 + ], + [ + -124.04185121, + 44.41889254 + ], + [ + -124.04228709, + 44.41915181 + ], + [ + -124.04260596, + 44.41950951 + ], + [ + -124.04295319, + 44.41978532 + ], + [ + -124.0433162, + 44.42011499 + ], + [ + -124.0436819, + 44.42043111 + ], + [ + -124.04408065, + 44.42071266 + ], + [ + -124.04439889, + 44.42100308 + ], + [ + -124.04478977, + 44.4212684 + ], + [ + -124.04517681, + 44.42157563 + ], + [ + -124.04553017, + 44.42187406 + ], + [ + -124.04588278, + 44.42214059 + ], + [ + -124.04625229, + 44.42241312 + ], + [ + -124.04662308, + 44.42269237 + ], + [ + -124.04695262, + 44.42303343 + ], + [ + -124.04714038, + 44.42343828 + ], + [ + -124.04741315, + 44.42376849 + ], + [ + -124.04768053, + 44.42407676 + ], + [ + -124.04780435, + 44.42435651 + ], + [ + -124.04732634, + 44.42489447 + ], + [ + -124.04702656, + 44.42523888 + ], + [ + -124.04687808, + 44.4257034 + ], + [ + -124.04689221, + 44.42611206 + ], + [ + -124.04694745, + 44.42650644 + ], + [ + -124.04699714, + 44.42683515 + ], + [ + -124.04711255, + 44.42722664 + ], + [ + -124.04718166, + 44.42755012 + ], + [ + -124.04735098, + 44.42792237 + ], + [ + -124.04744022, + 44.42823233 + ], + [ + -124.04763186, + 44.42858768 + ], + [ + -124.04782294, + 44.42893506 + ], + [ + -124.04795772, + 44.42927056 + ], + [ + -124.04812008, + 44.42954357 + ], + [ + -124.0482655, + 44.42985726 + ], + [ + -124.04841015, + 44.43016916 + ], + [ + -124.04959029, + 44.43019059 + ], + [ + -124.04958402, + 44.43058002 + ], + [ + -124.05003768, + 44.43060595 + ], + [ + -124.05056385, + 44.43056855 + ], + [ + -124.0509838, + 44.43054737 + ], + [ + -124.05142502, + 44.4304973 + ], + [ + -124.05188644, + 44.43042265 + ], + [ + -124.05234342, + 44.4303942 + ], + [ + -124.05285804, + 44.43048907 + ], + [ + -124.05322937, + 44.43062561 + ], + [ + -124.05355872, + 44.43079039 + ], + [ + -124.05393383, + 44.43093127 + ], + [ + -124.05434019, + 44.4310527 + ], + [ + -124.05478282, + 44.43112744 + ], + [ + -124.05524487, + 44.43116655 + ], + [ + -124.05570963, + 44.43125383 + ], + [ + -124.05620541, + 44.43119684 + ], + [ + -124.0566196, + 44.43110111 + ], + [ + -124.05700451, + 44.43095856 + ], + [ + -124.05735068, + 44.4308297 + ], + [ + -124.0576967, + 44.4306475 + ], + [ + -124.05806766, + 44.43046741 + ], + [ + -124.05842788, + 44.43029024 + ], + [ + -124.0587761, + 44.43014354 + ], + [ + -124.05919087, + 44.42992754 + ], + [ + -124.05955409, + 44.42970128 + ], + [ + -124.05993269, + 44.42959332 + ], + [ + -124.0600291, + 44.42991412 + ], + [ + -124.06039563, + 44.42997867 + ], + [ + -124.06040845, + 44.42966802 + ], + [ + -124.06039705, + 44.42937148 + ], + [ + -124.06062818, + 44.42914606 + ], + [ + -124.06099005, + 44.42900989 + ], + [ + -124.06106585, + 44.42873816 + ], + [ + -124.06133563, + 44.42851991 + ], + [ + -124.06164997, + 44.42832205 + ], + [ + -124.06198476, + 44.42810412 + ], + [ + -124.06232868, + 44.42788506 + ], + [ + -124.0626385, + 44.42768829 + ], + [ + -124.06294375, + 44.42749466 + ], + [ + -124.06324718, + 44.42728655 + ], + [ + -124.06356995, + 44.42711808 + ], + [ + -124.06394055, + 44.42699164 + ], + [ + -124.06434683, + 44.42693523 + ], + [ + -124.06477167, + 44.42693652 + ], + [ + -124.06518523, + 44.42695944 + ], + [ + -124.06558096, + 44.42698015 + ], + [ + -124.0659813, + 44.42700063 + ], + [ + -124.06638206, + 44.42699874 + ], + [ + -124.066768, + 44.42700564 + ], + [ + -124.06714626, + 44.42700383 + ], + [ + -124.06733695, + 44.42673471 + ], + [ + -124.06735524, + 44.42643001 + ], + [ + -124.06741351, + 44.42614907 + ], + [ + -124.06751697, + 44.42582062 + ], + [ + -124.06767438, + 44.42549643 + ], + [ + -124.06783809, + 44.42525326 + ], + [ + -124.06804478, + 44.42500646 + ], + [ + -124.06828641, + 44.42478841 + ], + [ + -124.06867087, + 44.42453262 + ], + [ + -124.06911546, + 44.42428148 + ], + [ + -124.06962386, + 44.42408709 + ], + [ + -124.0699778, + 44.42397249 + ], + [ + -124.07046375, + 44.42374579 + ], + [ + -124.07076916, + 44.4235611 + ], + [ + -124.07104161, + 44.42335428 + ], + [ + -124.07130694, + 44.42312002 + ], + [ + -124.07160346, + 44.42287778 + ], + [ + -124.07193864, + 44.42264133 + ], + [ + -124.07229798, + 44.42242491 + ], + [ + -124.07268246, + 44.42218728 + ], + [ + -124.0730827, + 44.42194548 + ], + [ + -124.07350536, + 44.42171291 + ], + [ + -124.07391474, + 44.42147584 + ], + [ + -124.07431838, + 44.42125 + ], + [ + -124.07469786, + 44.42101658 + ], + [ + -124.07507283, + 44.4207555 + ], + [ + -124.07544303, + 44.42051063 + ], + [ + -124.07584042, + 44.42027326 + ], + [ + -124.07619407, + 44.42003165 + ], + [ + -124.07656189, + 44.41980864 + ], + [ + -124.07690587, + 44.41959394 + ], + [ + -124.07721702, + 44.41933004 + ], + [ + -124.07750715, + 44.41906131 + ], + [ + -124.07779686, + 44.41879036 + ], + [ + -124.07809044, + 44.41852666 + ], + [ + -124.07838983, + 44.41828726 + ], + [ + -124.07869746, + 44.41803038 + ], + [ + -124.07899261, + 44.41776279 + ], + [ + -124.07928888, + 44.41749579 + ], + [ + -124.07959817, + 44.4172429 + ], + [ + -124.07991585, + 44.41697402 + ], + [ + -124.08021911, + 44.41670149 + ], + [ + -124.08051445, + 44.41644058 + ], + [ + -124.08081398, + 44.41617324 + ], + [ + -124.08111657, + 44.41591081 + ], + [ + -124.08140945, + 44.41563878 + ], + [ + -124.08169799, + 44.41537443 + ], + [ + -124.08196931, + 44.41511894 + ], + [ + -124.08223731, + 44.41484764 + ], + [ + -124.08248837, + 44.41455977 + ], + [ + -124.08273127, + 44.41426732 + ], + [ + -124.08295988, + 44.41394897 + ], + [ + -124.08318646, + 44.41361575 + ], + [ + -124.08339613, + 44.41326079 + ], + [ + -124.08360565, + 44.41286803 + ], + [ + -124.08378138, + 44.41243915 + ], + [ + -124.08392812, + 44.41199675 + ], + [ + -124.08407669, + 44.41155153 + ], + [ + -124.08416379, + 44.41110435 + ], + [ + -124.08424807, + 44.41065802 + ], + [ + -124.08433027, + 44.41021677 + ], + [ + -124.08440363, + 44.40977697 + ], + [ + -124.0844971, + 44.40934979 + ], + [ + -124.08457662, + 44.40890334 + ], + [ + -124.08463357, + 44.40843865 + ], + [ + -124.08470493, + 44.40798972 + ], + [ + -124.08478255, + 44.40755327 + ], + [ + -124.08485464, + 44.40710002 + ], + [ + -124.084937, + 44.40665373 + ], + [ + -124.08500794, + 44.4062263 + ], + [ + -124.08509662, + 44.40579608 + ], + [ + -124.0851855, + 44.40537637 + ], + [ + -124.08526469, + 44.40493355 + ], + [ + -124.0853604, + 44.40448814 + ], + [ + -124.0854256, + 44.40405236 + ], + [ + -124.08549662, + 44.40364048 + ], + [ + -124.08556736, + 44.40322146 + ], + [ + -124.08563999, + 44.40282071 + ], + [ + -124.08569912, + 44.40241828 + ], + [ + -124.08575541, + 44.40200769 + ], + [ + -124.08579996, + 44.40158931 + ], + [ + -124.08583788, + 44.40116359 + ], + [ + -124.08586248, + 44.40074857 + ], + [ + -124.08588751, + 44.40032682 + ], + [ + -124.08591715, + 44.39990584 + ], + [ + -124.08594765, + 44.3994889 + ], + [ + -124.08598338, + 44.39907611 + ], + [ + -124.08601174, + 44.39866195 + ], + [ + -124.08602915, + 44.3982504 + ], + [ + -124.08605424, + 44.39785357 + ], + [ + -124.08608075, + 44.39746382 + ], + [ + -124.08610102, + 44.39706608 + ], + [ + -124.08612618, + 44.39666548 + ], + [ + -124.08614935, + 44.3962578 + ], + [ + -124.08617283, + 44.3958356 + ], + [ + -124.08619864, + 44.39539612 + ], + [ + -124.08622245, + 44.39494482 + ], + [ + -124.08625353, + 44.39448402 + ], + [ + -124.08627856, + 44.39402613 + ], + [ + -124.08632344, + 44.39356685 + ], + [ + -124.08635422, + 44.39310132 + ], + [ + -124.08641151, + 44.39265309 + ], + [ + -124.08655568, + 44.39222757 + ], + [ + -124.0867262, + 44.39180388 + ], + [ + -124.08690547, + 44.39139068 + ], + [ + -124.08709086, + 44.39098651 + ], + [ + -124.0872532, + 44.39059634 + ], + [ + -124.0874169, + 44.39021887 + ], + [ + -124.08759701, + 44.38985034 + ], + [ + -124.08773617, + 44.38947703 + ], + [ + -124.08786768, + 44.38909557 + ], + [ + -124.08799708, + 44.38870543 + ], + [ + -124.08812654, + 44.38832237 + ], + [ + -124.08824476, + 44.38795648 + ], + [ + -124.08836949, + 44.38759741 + ], + [ + -124.08848898, + 44.38723755 + ], + [ + -124.0886004, + 44.38688288 + ], + [ + -124.08868703, + 44.38652479 + ], + [ + -124.0887235, + 44.38615643 + ], + [ + -124.0887073, + 44.38578298 + ], + [ + -124.08866765, + 44.3854133 + ], + [ + -124.08862364, + 44.38502272 + ], + [ + -124.08857869, + 44.38464463 + ], + [ + -124.08852475, + 44.38428098 + ], + [ + -124.08848203, + 44.383933 + ], + [ + -124.08842158, + 44.383597 + ], + [ + -124.08835965, + 44.3832785 + ], + [ + -124.08830479, + 44.38294095 + ], + [ + -124.08826863, + 44.38260108 + ], + [ + -124.08820845, + 44.3822522 + ], + [ + -124.08816678, + 44.38191104 + ], + [ + -124.08809489, + 44.38155442 + ], + [ + -124.08801834, + 44.38118953 + ], + [ + -124.08799307, + 44.38083131 + ], + [ + -124.08798255, + 44.38046027 + ], + [ + -124.08795659, + 44.38011778 + ], + [ + -124.08794419, + 44.37976553 + ], + [ + -124.08797682, + 44.37942379 + ], + [ + -124.08800555, + 44.37907677 + ], + [ + -124.08807389, + 44.37872006 + ], + [ + -124.08815757, + 44.37836394 + ], + [ + -124.08825646, + 44.37800067 + ], + [ + -124.08831758, + 44.37758827 + ], + [ + -124.0884206, + 44.37717262 + ], + [ + -124.08853293, + 44.37672522 + ], + [ + -124.08862997, + 44.37627187 + ], + [ + -124.0887306, + 44.37582995 + ], + [ + -124.08882129, + 44.37538556 + ], + [ + -124.08891044, + 44.37493614 + ], + [ + -124.08902176, + 44.37449193 + ], + [ + -124.08912412, + 44.37403556 + ], + [ + -124.08922632, + 44.37359816 + ], + [ + -124.08932993, + 44.37315501 + ], + [ + -124.08943379, + 44.37270285 + ], + [ + -124.08953036, + 44.37224868 + ], + [ + -124.08962632, + 44.37178984 + ], + [ + -124.0897062, + 44.37134743 + ], + [ + -124.08979663, + 44.37090437 + ], + [ + -124.08989389, + 44.37045203 + ], + [ + -124.08998729, + 44.36999483 + ], + [ + -124.09008152, + 44.36954793 + ], + [ + -124.09017757, + 44.36911563 + ], + [ + -124.09026309, + 44.36870016 + ], + [ + -124.09033758, + 44.36829176 + ], + [ + -124.09042925, + 44.36791484 + ], + [ + -124.09051605, + 44.36755222 + ], + [ + -124.09059652, + 44.36722549 + ], + [ + -124.09067102, + 44.36688946 + ], + [ + -124.09073613, + 44.36658666 + ], + [ + -124.0908498, + 44.3663165 + ], + [ + -124.09123576, + 44.36621449 + ], + [ + -124.09152652, + 44.3664172 + ], + [ + -124.09150175, + 44.36675248 + ], + [ + -124.09151938, + 44.36705164 + ], + [ + -124.0918594, + 44.36718891 + ], + [ + -124.0922132, + 44.36698833 + ], + [ + -124.09238998, + 44.3666993 + ], + [ + -124.0924104, + 44.36642336 + ], + [ + -124.09232828, + 44.36610462 + ], + [ + -124.09243297, + 44.36578117 + ], + [ + -124.0925485, + 44.36547432 + ] + ] + }, + "properties": {}, + "bbox": [ + [ + -124.09386637, + 44.34348063 + ], + [ + -124.09386637, + 44.56531305 + ], + [ + -123.26148271, + 44.56531305 + ], + [ + -123.26148271, + 44.34348063 + ] + ] +} diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index 8f4109fce..ae45e1821 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -1,6 +1,7 @@ package com.mapbox.mapboxgl.testapp; import android.content.Context; +import android.graphics.Color; import android.graphics.Matrix; import android.graphics.PointF; import android.hardware.GeomagneticField; @@ -25,6 +26,8 @@ import android.widget.TextView; import com.mapbox.mapboxgl.annotations.Marker; import com.mapbox.mapboxgl.annotations.MarkerOptions; +import com.mapbox.mapboxgl.annotations.Polyline; +import com.mapbox.mapboxgl.annotations.PolylineOptions; import com.mapbox.mapboxgl.geometry.LatLng; import com.mapbox.mapboxgl.views.MapView; import com.mapzen.android.lost.api.LocationListener; @@ -32,6 +35,9 @@ import com.mapzen.android.lost.api.LocationRequest; import com.mapzen.android.lost.api.LocationServices; import com.mapzen.android.lost.api.LostApiClient; +import org.json.JSONException; + +import java.io.IOException; import java.util.ArrayList; public class MainActivity extends ActionBarActivity { @@ -270,6 +276,7 @@ public class MainActivity extends ActionBarActivity { if (!mIsMarkersOn) { mIsMarkersOn = true; addMarkers(); + addPolyline(); } } else { if (mIsMarkersOn) { @@ -288,6 +295,22 @@ public class MainActivity extends ActionBarActivity { .snippet("The back lot behind my house")); } + private void addPolyline() { + try { + String geojsonStr = Util.loadStringFromAssets(this, "tillicum.geojson"); + LatLng[] latLngs = Util.parseGeoJSONCoordinates(geojsonStr); + MapView map = mMapFragment.getMap(); +// Polyline line = map.addPolyline(new PolylineOptions() +// .add(new LatLng(51.5, -0.1), new LatLng(40.7, -74.0)) +// .width(5) +// .color(Color.RED)); + } catch (IOException e) { + e.printStackTrace(); + } catch (JSONException e) { + e.printStackTrace(); + } + } + private void removeMarkers() { marker.remove(); } diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/Util.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/Util.java new file mode 100644 index 000000000..ec73c1249 --- /dev/null +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/Util.java @@ -0,0 +1,53 @@ +package com.mapbox.mapboxgl.testapp; + +import android.content.Context; +import android.text.TextUtils; + +import com.mapbox.mapboxgl.geometry.LatLng; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.nio.charset.Charset; + +public class Util { + + public static String loadStringFromAssets(final Context context, final String fileName) throws IOException { + if (TextUtils.isEmpty(fileName)) { + throw new NullPointerException("No GeoJSON File Name passed in."); + } + InputStream is = context.getAssets().open(fileName); + BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8"))); + return readAll(rd); + } + + public static LatLng[] parseGeoJSONCoordinates(String geojsonStr) throws JSONException { + JSONObject jsonObject = new JSONObject(geojsonStr); + JSONObject geometry = jsonObject.getJSONObject("geometry"); + JSONArray coordinates = geometry.getJSONArray("coordinates"); + int len = coordinates.length(); + LatLng[] latLngs = new LatLng[coordinates.length()]; + for (int i = 0; i < len; ++i) { + JSONArray coord = coordinates.getJSONArray(i); + double lng = coord.getDouble(0); + double lat = coord.getDouble(1); + latLngs[i] = new LatLng(lat, lng); + } + return latLngs; + } + + private static String readAll(Reader rd) throws IOException { + StringBuilder sb = new StringBuilder(); + int cp; + while ((cp = rd.read()) != -1) { + sb.append((char) cp); + } + return sb.toString(); + } +} From 297190ecf114bf653d226ac979191ca5efcc6406 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Wed, 15 Jul 2015 10:36:24 -0700 Subject: [PATCH 09/30] working on pollens #1716 --- .../src/main/java/com/mapbox/mapboxgl/views/MapView.java | 9 ++++++--- .../java/com/mapbox/mapboxgl/views/NativeMapView.java | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java index 29a9f227a..9e4e6e6cf 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java @@ -216,8 +216,8 @@ public class MapView extends SurfaceView { public Marker addMarker(MarkerOptions markerOptions) { Marker marker = markerOptions.getMarker(); - Long markerId = mNativeMapView.addMarker(marker); - marker.setId(markerId); // the annotation needs to know its id + Long id = mNativeMapView.addMarker(marker); + marker.setId(id); // the annotation needs to know its id marker.setMapView(this); // the annotation needs to know which map view it is in annotations.add(marker); return marker; @@ -225,7 +225,10 @@ public class MapView extends SurfaceView { public Polyline addPolyline(PolylineOptions polylineOptions) { Polyline polyline = polylineOptions.getPolyline(); - + Long id = mNativeMapView.addPolyline(polyline); + polyline.setId(id); + polyline.setMapView(this); + annotations.add(polyline); return polyline; } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java index 13260a64b..449eeb857 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java @@ -4,6 +4,7 @@ import android.graphics.PointF; import android.view.Surface; import com.mapbox.mapboxgl.annotations.Marker; +import com.mapbox.mapboxgl.annotations.Polyline; import com.mapbox.mapboxgl.geometry.LatLng; import com.mapbox.mapboxgl.geometry.LatLngZoom; import com.mapbox.mapboxgl.geometry.ProjectedMeters; @@ -219,6 +220,11 @@ class NativeMapView { return nativeAddMarker(mNativeMapViewPtr, latLng); } + public long addPolyline(Polyline polyline) { + + return -1; + } + public void removeAnnotation(long id) { nativeRemoveAnnotation(mNativeMapViewPtr, id); } From 6335aecfadede438bff84c1498828f0ed61ad514 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Wed, 15 Jul 2015 12:29:57 -0700 Subject: [PATCH 10/30] constructs polyline object, ready to rock JNI #1716 --- .../java/com/mapbox/mapboxgl/annotations/MultiPoint.java | 1 + .../java/com/mapbox/mapboxgl/annotations/Polyline.java | 1 - .../java/com/mapbox/mapboxgl/testapp/MainActivity.java | 8 ++++---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPoint.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPoint.java index 4f01f2c1e..530ad1d45 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPoint.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPoint.java @@ -10,6 +10,7 @@ public abstract class MultiPoint extends Annotation { List points; public MultiPoint() { + super(); points = new ArrayList<>(); } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java index 703e5d524..fdfcc6149 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java @@ -10,7 +10,6 @@ public class Polyline extends MultiPoint { int color = Color.BLACK; // default color is black float width = 10; // As specified by Google API Docs (in pixels) - List points; public Polyline() { super(); diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index ae45e1821..13f4cef28 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -300,10 +300,10 @@ public class MainActivity extends ActionBarActivity { String geojsonStr = Util.loadStringFromAssets(this, "tillicum.geojson"); LatLng[] latLngs = Util.parseGeoJSONCoordinates(geojsonStr); MapView map = mMapFragment.getMap(); -// Polyline line = map.addPolyline(new PolylineOptions() -// .add(new LatLng(51.5, -0.1), new LatLng(40.7, -74.0)) -// .width(5) -// .color(Color.RED)); + Polyline line = map.addPolyline(new PolylineOptions() + .add(new LatLng(51.5, -0.1), new LatLng(40.7, -74.0)) + .width(5) + .color(Color.RED)); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { From 441c84c213384e531915c95ea8825127f2e0c28d Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Wed, 15 Jul 2015 14:29:19 -0700 Subject: [PATCH 11/30] JNI is compiling with the polyline object #1716 --- android/cpp/jni.cpp | 11 +++++++++++ .../java/com/mapbox/mapboxgl/views/NativeMapView.java | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 0e26311f4..d517bfa62 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -455,6 +455,15 @@ jlong JNICALL nativeAddMarker(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, return (jlong) nativeMapView->getMap().addPointAnnotation(mbgl::PointAnnotation(mbgl::LatLng(latitude, longitude), std::string("default_marker"))); } +jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject polyline) { + mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddPolyline"); + assert(nativeMapViewPtr != 0); + // NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); + + + return -1; +} + void JNICALL nativeRemoveAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jlong annotationId) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeRemoveAnnotation"); assert(nativeMapViewPtr != 0); @@ -1007,6 +1016,8 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { reinterpret_cast(&nativeSetLatLng)}, {"nativeAddMarker", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)J", reinterpret_cast(&nativeAddMarker)}, + {"nativeAddPolyline", "(JLcom/mapbox/mapboxgl/annotations/Polyline;)J", + reinterpret_cast(&nativeAddPolyline)}, {"nativeRemoveAnnotation", "(JJ)V", reinterpret_cast(&nativeRemoveAnnotation)}, {"nativeGetLatLng", "(J)Lcom/mapbox/mapboxgl/geometry/LatLng;", reinterpret_cast(&nativeGetLatLng)}, diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java index 449eeb857..f28cf88eb 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java @@ -221,8 +221,7 @@ class NativeMapView { } public long addPolyline(Polyline polyline) { - - return -1; + return nativeAddPolyline(mNativeMapViewPtr, polyline); } public void removeAnnotation(long id) { @@ -463,6 +462,8 @@ class NativeMapView { private native long nativeAddMarker(long nativeMapViewPtr, LatLng latLng); + private native long nativeAddPolyline(long nativeMapViewPtr, Polyline polyline); + private native void nativeRemoveAnnotation(long nativeMapViewPtr, long id); private native LatLng nativeGetLatLng(long nativeMapViewPtr); From 8107501edb90ee3a971744ea2c3e568787b1a3b6 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Wed, 15 Jul 2015 17:31:37 -0700 Subject: [PATCH 12/30] able to get a field from Polyline in JNI #1716 --- android/cpp/jni.cpp | 48 ++++++++++++++++++- .../mapbox/mapboxgl/views/NativeMapView.java | 1 + 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index d517bfa62..ab83b2f43 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -40,6 +40,10 @@ jmethodID latLngConstructorId = nullptr; jfieldID latLngLatitudeId = nullptr; jfieldID latLngLongitudeId = nullptr; +jclass polylineClass = nullptr; +jmethodID polylineConstructorId = nullptr; +jfieldID polylineAlphaId = nullptr; + jclass latLngZoomClass = nullptr; jmethodID latLngZoomConstructorId = nullptr; jfieldID latLngZoomLatitudeId = nullptr; @@ -460,8 +464,21 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr assert(nativeMapViewPtr != 0); // NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); + // ***** Java fields ***** // - return -1; + // float alpha; + // boolean visible; + // List points + // int color + // float width + + jfloat alpha = env->GetFloatField(polyline, polylineAlphaId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return -1; + } + + return (jlong)alpha; } void JNICALL nativeRemoveAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jlong annotationId) { @@ -821,6 +838,24 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_ERR; } + polylineClass = env->FindClass("com/mapbox/mapboxgl/annotations/Polyline"); + if (polylineClass == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + polylineConstructorId = env->GetMethodID(polylineClass, "", "()V"); + if (polylineConstructorId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + polylineAlphaId = env->GetFieldID(polylineClass, "alpha", "F"); + if (polylineAlphaId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + latLngZoomClass = env->FindClass("com/mapbox/mapboxgl/geometry/LatLngZoom"); if (latLngZoomClass == nullptr) { env->ExceptionDescribe(); @@ -1069,6 +1104,12 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_ERR; } + polylineClass = reinterpret_cast(env->NewGlobalRef(polylineClass)); + if (polylineClass == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + latLngZoomClass = reinterpret_cast(env->NewGlobalRef(latLngZoomClass)); if (latLngZoomClass == nullptr) { env->ExceptionDescribe(); @@ -1152,6 +1193,11 @@ extern "C" JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) { latLngLongitudeId = nullptr; latLngLatitudeId = nullptr; + env->DeleteGlobalRef(polylineClass); + polylineClass = nullptr; + polylineConstructorId = nullptr; + polylineAlphaId = nullptr; + env->DeleteGlobalRef(latLngZoomClass); latLngZoomClass = nullptr; latLngZoomConstructorId = nullptr; diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java index f28cf88eb..be1680aba 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java @@ -221,6 +221,7 @@ class NativeMapView { } public long addPolyline(Polyline polyline) { + // NH TODO Throw exception if returns -1 return nativeAddPolyline(mNativeMapViewPtr, polyline); } From 062a942c462a04c729907365ab7b0fc025d5683d Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Wed, 15 Jul 2015 18:08:23 -0700 Subject: [PATCH 13/30] JNI - getting all of the primitives from Polyline #1716 --- android/cpp/jni.cpp | 47 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index ab83b2f43..e635eaa25 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -43,6 +43,9 @@ jfieldID latLngLongitudeId = nullptr; jclass polylineClass = nullptr; jmethodID polylineConstructorId = nullptr; jfieldID polylineAlphaId = nullptr; +jfieldID polylineVisibleId = nullptr; +jfieldID polylineColorId = nullptr; +jfieldID polylineWidthId = nullptr; jclass latLngZoomClass = nullptr; jmethodID latLngZoomConstructorId = nullptr; @@ -465,20 +468,40 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr // NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); // ***** Java fields ***** // - // float alpha; // boolean visible; - // List points // int color // float width + // List points jfloat alpha = env->GetFloatField(polyline, polylineAlphaId); if (env->ExceptionCheck()) { env->ExceptionDescribe(); return -1; } + ++alpha; - return (jlong)alpha; + jboolean visible = env->GetBooleanField(polyline, polylineVisibleId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return -1; + } + visible = JNI_TRUE; + + jint color = env->GetIntField(polyline, polylineColorId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return -1; + } + ++color; + + jfloat width = env->GetFloatField(polyline, polylineWidthId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return -1; + } + + return (jlong)width; } void JNICALL nativeRemoveAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jlong annotationId) { @@ -856,6 +879,24 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_ERR; } + polylineVisibleId = env->GetFieldID(polylineClass, "visible", "Z"); + if (polylineVisibleId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + polylineColorId = env->GetFieldID(polylineClass, "color", "I"); + if (polylineColorId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + polylineWidthId = env->GetFieldID(polylineClass, "width", "F"); + if (polylineWidthId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + latLngZoomClass = env->FindClass("com/mapbox/mapboxgl/geometry/LatLngZoom"); if (latLngZoomClass == nullptr) { env->ExceptionDescribe(); From 8589cee9e28306adbfc6fffa417432ab9d9bfd95 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 07:39:14 -0700 Subject: [PATCH 14/30] accessing points list #1716 --- android/cpp/jni.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index e635eaa25..bb815fefd 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -46,6 +46,7 @@ jfieldID polylineAlphaId = nullptr; jfieldID polylineVisibleId = nullptr; jfieldID polylineColorId = nullptr; jfieldID polylineWidthId = nullptr; +jfieldID polylinePointsId = nullptr; jclass latLngZoomClass = nullptr; jmethodID latLngZoomConstructorId = nullptr; @@ -501,6 +502,15 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr return -1; } + jobject points = env->GetObjectField(polyline, polylinePointsId); + if (points == nullptr) { + if (env->ThrowNew(nullPointerExceptionClass, "List cannot be null.") < 0) { + env->ExceptionDescribe(); + return -1; + } + return -1; + } + return (jlong)width; } @@ -897,6 +907,12 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_ERR; } + polylinePointsId = env->GetFieldID(polylineClass, "points", "Ljava/util/List;"); + if (polylineWidthId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + latLngZoomClass = env->FindClass("com/mapbox/mapboxgl/geometry/LatLngZoom"); if (latLngZoomClass == nullptr) { env->ExceptionDescribe(); From 61cfcdb33b75a9e3d0581edf1bd3adee82b78adf Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 07:50:30 -0700 Subject: [PATCH 15/30] turning list into array #1716 --- android/cpp/jni.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index bb815fefd..0b5344178 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -511,6 +511,19 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr return -1; } + jobjectArray array = + reinterpret_cast(env->CallObjectMethod(points, listToArrayId)); + if (env->ExceptionCheck() || (array == nullptr)) { + env->ExceptionDescribe(); + return -1; + } + + jsize len = env->GetArrayLength(array); + if (len < 0) { + env->ExceptionDescribe(); + return -1; + } + return (jlong)width; } From 7954c7d1abbb591c3ebd36a70987b4c879477173 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 07:55:10 -0700 Subject: [PATCH 16/30] iterating through list of lat legs #1716 --- android/cpp/jni.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 0b5344178..81cf6160b 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -524,6 +524,16 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr return -1; } + for (jsize i = 0; i < len; i++) { + jobject jobj = reinterpret_cast(env->GetObjectArrayElement(array, i)); + if (jobj == nullptr) { + env->ExceptionDescribe(); + return -1; + } + + // vector.push_back(std_string_from_jstring(env, jstr)); + } + return (jlong)width; } From a203538886f7bfae4fb274536cfd035c40b5c46a Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 08:03:17 -0700 Subject: [PATCH 17/30] extracting latitude and longitude #1716 --- android/cpp/jni.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 81cf6160b..9049c8566 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -525,13 +525,24 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr } for (jsize i = 0; i < len; i++) { - jobject jobj = reinterpret_cast(env->GetObjectArrayElement(array, i)); - if (jobj == nullptr) { + jobject latLng = reinterpret_cast(env->GetObjectArrayElement(array, i)); + if (latLng == nullptr) { env->ExceptionDescribe(); return -1; } - // vector.push_back(std_string_from_jstring(env, jstr)); + jdouble latitude = env->GetDoubleField(latLng, latLngLatitudeId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return -1; + } + latitude++; + jdouble longitude = env->GetDoubleField(latLng, latLngLongitudeId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return -1; + } + longitude++; } return (jlong)width; From aebd4196ac345a1eb49f0c9e2f8ec2215cad4ad7 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 10:08:02 -0700 Subject: [PATCH 18/30] attempting to make ShapeAnnotation with segment and properties #1716 --- android/cpp/jni.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 9049c8566..fcf53ad0c 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -466,7 +467,7 @@ jlong JNICALL nativeAddMarker(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject polyline) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddPolyline"); assert(nativeMapViewPtr != 0); - // NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); + NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); // ***** Java fields ***** // // float alpha; @@ -480,7 +481,6 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr env->ExceptionDescribe(); return -1; } - ++alpha; jboolean visible = env->GetBooleanField(polyline, polylineVisibleId); if (env->ExceptionCheck()) { @@ -502,6 +502,14 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr return -1; } + mbgl::StyleProperties shapeProperties; + mbgl::LineProperties lineProperties; + lineProperties.opacity = alpha; + lineProperties.color = {{ 0.3, 0.7, 0.1, 1 }};; + lineProperties.width = width; + shapeProperties.set(lineProperties); + + jobject points = env->GetObjectField(polyline, polylinePointsId); if (points == nullptr) { if (env->ThrowNew(nullPointerExceptionClass, "List cannot be null.") < 0) { @@ -524,6 +532,9 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr return -1; } + mbgl::AnnotationSegment segment; + segment.reserve(len); + for (jsize i = 0; i < len; i++) { jobject latLng = reinterpret_cast(env->GetObjectArrayElement(array, i)); if (latLng == nullptr) { @@ -536,16 +547,19 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr env->ExceptionDescribe(); return -1; } - latitude++; + jdouble longitude = env->GetDoubleField(latLng, latLngLongitudeId); if (env->ExceptionCheck()) { env->ExceptionDescribe(); return -1; } - longitude++; + + segment.push_back(mbgl::LatLng(latitude, longitude)); } - return (jlong)width; + + + return (jlong) nativeMapView->getMap().addShapeAnnotation(mbgl::ShapeAnnotation(segment, shapeProperties)); } void JNICALL nativeRemoveAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jlong annotationId) { From f911cf310702f1840c49334d63a814b52cbc8005 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 10:24:27 -0700 Subject: [PATCH 19/30] successful shape annotation #1716 --- android/cpp/jni.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index fcf53ad0c..a7098f620 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -557,9 +557,12 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr segment.push_back(mbgl::LatLng(latitude, longitude)); } + std::vector shapes; + shapes.emplace_back(mbgl::AnnotationSegments {{ segment }}, shapeProperties); - - return (jlong) nativeMapView->getMap().addShapeAnnotation(mbgl::ShapeAnnotation(segment, shapeProperties)); + std::vector shapeAnnotationIDs = nativeMapView->getMap().addShapeAnnotations(shapes); + uint32_t id = shapeAnnotationIDs.at(0); + return (jlong) id; } void JNICALL nativeRemoveAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jlong annotationId) { From d6bc8367e4e7bb438b16e355739daabbe0bc01c2 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 11:09:35 -0700 Subject: [PATCH 20/30] color is set for line stroke #1716 --- android/cpp/jni.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index a7098f620..22322d800 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -494,7 +494,11 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr env->ExceptionDescribe(); return -1; } - ++color; + + int r = (color>>16)&0xFF; + int g = (color>>8)&0xFF; + int b = (color)&0xFF; + int a = (color>>24)&0xFF; jfloat width = env->GetFloatField(polyline, polylineWidthId); if (env->ExceptionCheck()) { @@ -505,7 +509,7 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr mbgl::StyleProperties shapeProperties; mbgl::LineProperties lineProperties; lineProperties.opacity = alpha; - lineProperties.color = {{ 0.3, 0.7, 0.1, 1 }};; + lineProperties.color = {{ (float)r, (float)g, (float)b, (float)a }}; lineProperties.width = width; shapeProperties.set(lineProperties); From e28c7773075865276d2c140d91eca72f3c63326d Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 11:31:01 -0700 Subject: [PATCH 21/30] drawing geojson line #1716 --- .../src/main/assets/small_line.geojson | 1 + .../src/main/assets/tillicum.geojson | 4063 ----------------- .../mapbox/mapboxgl/testapp/MainActivity.java | 6 +- .../com/mapbox/mapboxgl/testapp/Util.java | 4 +- 4 files changed, 7 insertions(+), 4067 deletions(-) create mode 100644 android/java/MapboxGLAndroidSDKTestApp/src/main/assets/small_line.geojson delete mode 100644 android/java/MapboxGLAndroidSDKTestApp/src/main/assets/tillicum.geojson diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/assets/small_line.geojson b/android/java/MapboxGLAndroidSDKTestApp/src/main/assets/small_line.geojson new file mode 100644 index 000000000..ef76eaf56 --- /dev/null +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/assets/small_line.geojson @@ -0,0 +1 @@ +{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"LineString","coordinates":[[-121.3714599609375,38.64583568648869],[-121.48681640624999,38.64047263931154],[-121.53076171875,38.61579745317875],[-121.56509399414061,38.57823196583313],[-121.75186157226561,38.533127435052776],[-121.97021484374999,38.35350340353833],[-122.08007812499999,38.24680876017446],[-122.16796875,38.19718009396176],[-122.23800659179686,38.09457899232253],[-122.27371215820312,38.01455819225337],[-122.33551025390625,37.94094845586459],[-122.27371215820312,37.81846319511331],[-122.4151611328125,37.7652868250379]]}}]} \ No newline at end of file diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/assets/tillicum.geojson b/android/java/MapboxGLAndroidSDKTestApp/src/main/assets/tillicum.geojson deleted file mode 100644 index 2324e9ddc..000000000 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/assets/tillicum.geojson +++ /dev/null @@ -1,4063 +0,0 @@ -{ - "type": "Feature", - "geometry": { - "type": "LineString", - "coordinates": [ - [ - -123.77252789, - 44.37857221 - ], - [ - -123.77317087, - 44.37864694 - ], - [ - -123.77383407, - 44.37875853 - ], - [ - -123.7744676, - 44.37886305 - ], - [ - -123.77507677, - 44.37893017 - ], - [ - -123.77566451, - 44.37901047 - ], - [ - -123.77605842, - 44.37892161 - ], - [ - -123.77660114, - 44.37895724 - ], - [ - -123.77720403, - 44.37897655 - ], - [ - -123.77781983, - 44.37900344 - ], - [ - -123.77838906, - 44.37898221 - ], - [ - -123.7789954, - 44.37899854 - ], - [ - -123.77951988, - 44.37891571 - ], - [ - -123.78004217, - 44.37883105 - ], - [ - -123.78056503, - 44.37875077 - ], - [ - -123.78105914, - 44.37868172 - ], - [ - -123.78156765, - 44.37852908 - ], - [ - -123.78211778, - 44.37847079 - ], - [ - -123.78269313, - 44.37840336 - ], - [ - -123.78319893, - 44.37834025 - ], - [ - -123.79013846, - 44.37675321 - ], - [ - -123.79067206, - 44.37666117 - ], - [ - -123.79122235, - 44.37667708 - ], - [ - -123.79156935, - 44.37655781 - ], - [ - -123.79231801, - 44.37652196 - ], - [ - -123.79301538, - 44.37651473 - ], - [ - -123.79359988, - 44.37656075 - ], - [ - -123.79428722, - 44.37655133 - ], - [ - -123.79487322, - 44.37661456 - ], - [ - -123.79548606, - 44.37666101 - ], - [ - -123.79603541, - 44.37670013 - ], - [ - -123.79660795, - 44.37662235 - ], - [ - -123.79718365, - 44.37650581 - ], - [ - -123.79780967, - 44.37653439 - ], - [ - -123.79831292, - 44.37685522 - ], - [ - -123.79883296, - 44.37696685 - ], - [ - -123.7993581, - 44.37709195 - ], - [ - -123.79988118, - 44.37718879 - ], - [ - -123.80039793, - 44.37728202 - ], - [ - -123.80089376, - 44.37738925 - ], - [ - -123.80142092, - 44.37766936 - ], - [ - -123.80179753, - 44.37789379 - ], - [ - -123.80233272, - 44.37795562 - ], - [ - -123.80277717, - 44.37816047 - ], - [ - -123.80331138, - 44.3783486 - ], - [ - -123.80381643, - 44.37850233 - ], - [ - -123.80420021, - 44.37865152 - ], - [ - -123.80474815, - 44.37882091 - ], - [ - -123.80522525, - 44.37906232 - ], - [ - -123.80570349, - 44.37922411 - ], - [ - -123.80620571, - 44.37941275 - ], - [ - -123.80673037, - 44.37965326 - ], - [ - -123.80735339, - 44.37979863 - ], - [ - -123.80784469, - 44.37999957 - ], - [ - -123.80837458, - 44.37998017 - ], - [ - -123.80899232, - 44.380014 - ], - [ - -123.80952307, - 44.37993165 - ], - [ - -123.80987634, - 44.37978153 - ], - [ - -123.81017161, - 44.37953295 - ], - [ - -123.81074873, - 44.37925199 - ], - [ - -123.81119243, - 44.37897587 - ], - [ - -123.81154793, - 44.37873989 - ], - [ - -123.81198778, - 44.37842102 - ], - [ - -123.81235373, - 44.37816192 - ], - [ - -123.81275348, - 44.37788448 - ], - [ - -123.81310351, - 44.37766604 - ], - [ - -123.81337983, - 44.37730145 - ], - [ - -123.81357531, - 44.37692989 - ], - [ - -123.81361254, - 44.37647844 - ], - [ - -123.81353376, - 44.37594116 - ], - [ - -123.813198, - 44.37561605 - ], - [ - -123.81284754, - 44.37547955 - ], - [ - -123.81254975, - 44.37524719 - ], - [ - -123.81227721, - 44.37500803 - ], - [ - -123.81207289, - 44.3746695 - ], - [ - -123.81171276, - 44.37434638 - ], - [ - -123.81097859, - 44.37413431 - ], - [ - -123.81041401, - 44.37394429 - ], - [ - -123.80976458, - 44.37373029 - ], - [ - -123.80923389, - 44.37352906 - ], - [ - -123.80863022, - 44.37335692 - ], - [ - -123.80827452, - 44.37322894 - ], - [ - -123.8079216, - 44.37304699 - ], - [ - -123.80755687, - 44.37290854 - ], - [ - -123.80710749, - 44.37269837 - ], - [ - -123.80659847, - 44.37245911 - ], - [ - -123.80613857, - 44.37221401 - ], - [ - -123.80573546, - 44.37193255 - ], - [ - -123.80540784, - 44.37151577 - ], - [ - -123.80511308, - 44.37120469 - ], - [ - -123.80500888, - 44.37078896 - ], - [ - -123.80529524, - 44.37037566 - ], - [ - -123.80558562, - 44.37019806 - ], - [ - -123.80585412, - 44.36996992 - ], - [ - -123.80610692, - 44.36970942 - ], - [ - -123.80661414, - 44.36946727 - ], - [ - -123.80708477, - 44.36926607 - ], - [ - -123.80747679, - 44.36907467 - ], - [ - -123.80784949, - 44.368733 - ], - [ - -123.80826348, - 44.36838459 - ], - [ - -123.80868817, - 44.36802111 - ], - [ - -123.80912729, - 44.36773598 - ], - [ - -123.80960812, - 44.36738742 - ], - [ - -123.81008551, - 44.36707347 - ], - [ - -123.81063481, - 44.36684946 - ], - [ - -123.81115119, - 44.36661789 - ], - [ - -123.811705, - 44.36640043 - ], - [ - -123.81227943, - 44.36624681 - ], - [ - -123.81272103, - 44.36622733 - ], - [ - -123.81348991, - 44.36635102 - ], - [ - -123.81411031, - 44.36622347 - ], - [ - -123.81475065, - 44.3661859 - ], - [ - -123.81536292, - 44.36625908 - ], - [ - -123.8160232, - 44.36634012 - ], - [ - -123.81661561, - 44.36646415 - ], - [ - -123.81719049, - 44.36652826 - ], - [ - -123.81784426, - 44.36665079 - ], - [ - -123.81846565, - 44.36680154 - ], - [ - -123.81905878, - 44.36690594 - ], - [ - -123.81970058, - 44.36704457 - ], - [ - -123.82030833, - 44.36728783 - ], - [ - -123.82091327, - 44.36747762 - ], - [ - -123.82156675, - 44.36747158 - ], - [ - -123.82213205, - 44.36750236 - ], - [ - -123.8227688, - 44.36753587 - ], - [ - -123.82339934, - 44.36749609 - ], - [ - -123.82400308, - 44.36747441 - ], - [ - -123.82437384, - 44.36736178 - ], - [ - -123.82498006, - 44.36711433 - ], - [ - -123.82554355, - 44.36692204 - ], - [ - -123.82599663, - 44.36659999 - ], - [ - -123.82653738, - 44.36631833 - ], - [ - -123.82687629, - 44.36595919 - ], - [ - -123.82730895, - 44.36559104 - ], - [ - -123.82752535, - 44.36508675 - ], - [ - -123.82778797, - 44.36466732 - ], - [ - -123.8280572, - 44.36424929 - ], - [ - -123.82826364, - 44.36381812 - ], - [ - -123.8284935, - 44.36337296 - ], - [ - -123.82872595, - 44.36288338 - ], - [ - -123.82894503, - 44.36243078 - ], - [ - -123.82914801, - 44.36196883 - ], - [ - -123.82942984, - 44.36158184 - ], - [ - -123.82967989, - 44.36114209 - ], - [ - -123.82984482, - 44.36067615 - ], - [ - -123.83000072, - 44.36021653 - ], - [ - -123.8302136, - 44.35975596 - ], - [ - -123.83043508, - 44.35927715 - ], - [ - -123.83043676, - 44.35897974 - ], - [ - -123.83066164, - 44.3585452 - ], - [ - -123.83087389, - 44.35808419 - ], - [ - -123.83123077, - 44.35771716 - ], - [ - -123.83149219, - 44.35730191 - ], - [ - -123.8317935, - 44.35689183 - ], - [ - -123.83221309, - 44.35652466 - ], - [ - -123.83264602, - 44.35620468 - ], - [ - -123.83295909, - 44.35604074 - ], - [ - -123.83322863, - 44.35582838 - ], - [ - -123.83363274, - 44.35546781 - ], - [ - -123.8339284, - 44.35504505 - ], - [ - -123.83421101, - 44.35462757 - ], - [ - -123.83441642, - 44.35420053 - ], - [ - -123.83459364, - 44.35374425 - ], - [ - -123.83484153, - 44.35328064 - ], - [ - -123.83503992, - 44.35279836 - ], - [ - -123.83532486, - 44.35239401 - ], - [ - -123.83558141, - 44.35190388 - ], - [ - -123.83584591, - 44.35144822 - ], - [ - -123.8362086, - 44.35106632 - ], - [ - -123.83646984, - 44.35061601 - ], - [ - -123.83682396, - 44.35027306 - ], - [ - -123.83741823, - 44.35002993 - ], - [ - -123.83797977, - 44.34977041 - ], - [ - -123.8384272, - 44.34973236 - ], - [ - -123.83891831, - 44.34973886 - ], - [ - -123.8393342, - 44.34980157 - ], - [ - -123.83983914, - 44.34970795 - ], - [ - -123.8402702, - 44.34971164 - ], - [ - -123.84067923, - 44.34973058 - ], - [ - -123.8410633, - 44.34970312 - ], - [ - -123.84147372, - 44.34971455 - ], - [ - -123.84204825, - 44.3498711 - ], - [ - -123.84264285, - 44.34994949 - ], - [ - -123.84321946, - 44.35001037 - ], - [ - -123.84377642, - 44.35003907 - ], - [ - -123.84432658, - 44.35025777 - ], - [ - -123.84203507, - 44.35487086 - ], - [ - -123.84165892, - 44.35522761 - ], - [ - -123.84141926, - 44.35562524 - ], - [ - -123.8411565, - 44.35599439 - ], - [ - -123.8410185, - 44.3562787 - ], - [ - -123.84055746, - 44.35664891 - ], - [ - -123.8402963, - 44.35698133 - ], - [ - -123.83992088, - 44.35727933 - ], - [ - -123.83973137, - 44.35754806 - ], - [ - -123.83932875, - 44.35773088 - ], - [ - -123.83914337, - 44.3580173 - ], - [ - -123.83895031, - 44.35825633 - ], - [ - -123.83850815, - 44.35862331 - ], - [ - -123.83822746, - 44.35907347 - ], - [ - -123.83796045, - 44.35949625 - ], - [ - -123.83768553, - 44.35990376 - ], - [ - -123.83745996, - 44.3604108 - ], - [ - -123.83714948, - 44.36078632 - ], - [ - -123.83691018, - 44.36125106 - ], - [ - -123.83671357, - 44.36176473 - ], - [ - -123.83643361, - 44.36221479 - ], - [ - -123.83615206, - 44.36264813 - ], - [ - -123.83578463, - 44.36307576 - ], - [ - -123.83542661, - 44.36349149 - ], - [ - -123.83506758, - 44.36384017 - ], - [ - -123.83472312, - 44.36423027 - ], - [ - -123.83433282, - 44.36461474 - ], - [ - -123.83404859, - 44.36509528 - ], - [ - -123.83375641, - 44.36552674 - ], - [ - -123.83348665, - 44.36592645 - ], - [ - -123.83352719, - 44.36641625 - ], - [ - -123.83354167, - 44.36687226 - ], - [ - -123.83352598, - 44.36733983 - ], - [ - -123.83357856, - 44.36781268 - ], - [ - -123.83358707, - 44.36828114 - ], - [ - -123.83361502, - 44.36877025 - ], - [ - -123.83363983, - 44.36924809 - ], - [ - -123.83386927, - 44.36974131 - ], - [ - -123.83398366, - 44.37020602 - ], - [ - -123.83411017, - 44.37066634 - ], - [ - -123.83422771, - 44.37115498 - ], - [ - -123.83440837, - 44.37157793 - ], - [ - -123.83451758, - 44.37203463 - ], - [ - -123.83466984, - 44.37246002 - ], - [ - -123.83476675, - 44.3729088 - ], - [ - -123.834789, - 44.37317881 - ], - [ - -123.8346991, - 44.37369173 - ], - [ - -123.83454395, - 44.37417495 - ], - [ - -123.83441269, - 44.37465505 - ], - [ - -123.83417986, - 44.37507302 - ], - [ - -123.83364152, - 44.37526 - ], - [ - -123.83321353, - 44.37557739 - ], - [ - -123.83285218, - 44.37595532 - ], - [ - -123.83248264, - 44.37637684 - ], - [ - -123.83225679, - 44.37665008 - ], - [ - -123.83191251, - 44.37707752 - ], - [ - -123.83159357, - 44.37751562 - ], - [ - -123.83134601, - 44.37796816 - ], - [ - -123.83118921, - 44.37842778 - ], - [ - -123.83090169, - 44.37889258 - ], - [ - -123.83070078, - 44.37934341 - ], - [ - -123.83056763, - 44.37979938 - ], - [ - -123.83053986, - 44.38025897 - ], - [ - -123.83063844, - 44.38064949 - ], - [ - -123.8307725, - 44.38109651 - ], - [ - -123.83083629, - 44.38148235 - ], - [ - -123.83082114, - 44.3819181 - ], - [ - -123.83065815, - 44.38231241 - ], - [ - -123.83050646, - 44.38273143 - ], - [ - -123.83030168, - 44.38315663 - ], - [ - -123.82998372, - 44.38356024 - ], - [ - -123.82974685, - 44.38396369 - ], - [ - -123.82954343, - 44.38431339 - ], - [ - -123.82937698, - 44.38464023 - ], - [ - -123.82929339, - 44.38499412 - ], - [ - -123.82929866, - 44.38537351 - ], - [ - -123.82929649, - 44.38572262 - ], - [ - -123.82939712, - 44.3861449 - ], - [ - -123.82974721, - 44.38640976 - ], - [ - -123.83006661, - 44.38665424 - ], - [ - -123.83047099, - 44.38693426 - ], - [ - -123.83085114, - 44.38712547 - ], - [ - -123.83131994, - 44.38731023 - ], - [ - -123.83186324, - 44.38761938 - ], - [ - -123.83217948, - 44.38780359 - ], - [ - -123.83273301, - 44.3880341 - ], - [ - -123.83332735, - 44.38824105 - ], - [ - -123.8340571, - 44.38841128 - ], - [ - -123.83465999, - 44.38859294 - ], - [ - -123.83528877, - 44.38859602 - ], - [ - -123.83569405, - 44.38844339 - ], - [ - -123.83638628, - 44.3884207 - ], - [ - -123.8370251, - 44.38844967 - ], - [ - -123.83739577, - 44.38837795 - ], - [ - -123.83776722, - 44.38831733 - ], - [ - -123.83837884, - 44.38836701 - ], - [ - -123.83900529, - 44.38838659 - ], - [ - -123.83961918, - 44.38831371 - ], - [ - -123.84021405, - 44.38829042 - ], - [ - -123.84086954, - 44.38828232 - ], - [ - -123.84151231, - 44.3883489 - ], - [ - -123.84204361, - 44.38864686 - ], - [ - -123.84250872, - 44.38883971 - ], - [ - -123.84286235, - 44.38913828 - ], - [ - -123.84327839, - 44.38943857 - ], - [ - -123.84351162, - 44.38965811 - ], - [ - -123.8437019, - 44.38990892 - ], - [ - -123.84414825, - 44.39024774 - ], - [ - -123.84457698, - 44.39057986 - ], - [ - -123.8450298, - 44.39091025 - ], - [ - -123.84540377, - 44.39127727 - ], - [ - -123.84576513, - 44.39169169 - ], - [ - -123.84620505, - 44.3920822 - ], - [ - -123.84662036, - 44.39243773 - ], - [ - -123.84701835, - 44.39281331 - ], - [ - -123.84736426, - 44.39303992 - ], - [ - -123.84774171, - 44.39336675 - ], - [ - -123.84750211, - 44.39375524 - ], - [ - -123.84730976, - 44.39415078 - ], - [ - -123.84716074, - 44.39450914 - ], - [ - -123.83325795, - 44.39231346 - ], - [ - -123.83287897, - 44.39233478 - ], - [ - -123.83242812, - 44.39225423 - ], - [ - -123.8320242, - 44.39214754 - ], - [ - -123.831443, - 44.39216949 - ], - [ - -123.83081285, - 44.39222948 - ], - [ - -123.83042339, - 44.39237674 - ], - [ - -123.8298725, - 44.39246101 - ], - [ - -123.82948222, - 44.39289454 - ], - [ - -123.82948876, - 44.39341478 - ], - [ - -123.82929042, - 44.39364585 - ], - [ - -123.82889206, - 44.39403331 - ], - [ - -123.82849602, - 44.39438788 - ], - [ - -123.82814269, - 44.39466477 - ], - [ - -123.82774371, - 44.39497413 - ], - [ - -123.82797044, - 44.39558031 - ], - [ - -123.82824962, - 44.39610349 - ], - [ - -123.82823647, - 44.39653022 - ], - [ - -123.82841452, - 44.3970331 - ], - [ - -123.82846666, - 44.39744215 - ], - [ - -123.82881905, - 44.39761326 - ], - [ - -123.82910502, - 44.39782317 - ], - [ - -123.82933156, - 44.39827824 - ], - [ - -123.82958303, - 44.39860292 - ], - [ - -123.82970897, - 44.39887799 - ], - [ - -123.82998729, - 44.39910031 - ], - [ - -123.83048205, - 44.39929464 - ], - [ - -123.83095576, - 44.3995244 - ], - [ - -123.83147986, - 44.39985473 - ], - [ - -123.83202919, - 44.40011745 - ], - [ - -123.83272727, - 44.40023748 - ], - [ - -123.83340891, - 44.40029896 - ], - [ - -123.8340274, - 44.40029109 - ], - [ - -123.83472264, - 44.40026772 - ], - [ - -123.83508238, - 44.40017841 - ], - [ - -123.83575472, - 44.40010627 - ], - [ - -123.83643769, - 44.40001533 - ], - [ - -123.8370988, - 44.39997518 - ], - [ - -123.83747722, - 44.39992662 - ], - [ - -123.83818459, - 44.39988528 - ], - [ - -123.83883679, - 44.3997823 - ], - [ - -123.8394548, - 44.39967891 - ], - [ - -123.84008445, - 44.39954732 - ], - [ - -123.84070208, - 44.39939815 - ], - [ - -123.84131372, - 44.39917183 - ], - [ - -123.84187299, - 44.39896379 - ], - [ - -123.84244572, - 44.39868752 - ], - [ - -123.84296973, - 44.3984023 - ], - [ - -123.84350996, - 44.3981352 - ], - [ - -123.84392876, - 44.39799545 - ], - [ - -123.8447125, - 44.39786568 - ], - [ - -123.84510842, - 44.39787915 - ], - [ - -123.84579844, - 44.39787518 - ], - [ - -123.84650467, - 44.39794333 - ], - [ - -123.84717138, - 44.39808825 - ], - [ - -123.84788597, - 44.39825368 - ], - [ - -123.84843146, - 44.3984778 - ], - [ - -123.84908022, - 44.39868748 - ], - [ - -123.84973524, - 44.39883781 - ], - [ - -123.85018943, - 44.39913399 - ], - [ - -123.85072511, - 44.39937269 - ], - [ - -123.85126588, - 44.39963369 - ], - [ - -123.85183667, - 44.39984811 - ], - [ - -123.85253322, - 44.39995526 - ], - [ - -123.85315519, - 44.40007652 - ], - [ - -123.85383831, - 44.40018159 - ], - [ - -123.85422651, - 44.4002215 - ], - [ - -123.85489009, - 44.40030811 - ], - [ - -123.85557778, - 44.40030578 - ], - [ - -123.85617964, - 44.40025503 - ], - [ - -123.85685093, - 44.40020889 - ], - [ - -123.85749307, - 44.40014005 - ], - [ - -123.85815502, - 44.39999251 - ], - [ - -123.85878967, - 44.39987297 - ], - [ - -123.85940186, - 44.39975461 - ], - [ - -123.86014717, - 44.39970844 - ], - [ - -123.86067393, - 44.39969683 - ], - [ - -123.86126228, - 44.39957493 - ], - [ - -123.86187423, - 44.39946623 - ], - [ - -123.86252734, - 44.39941413 - ], - [ - -123.86316943, - 44.39930916 - ], - [ - -123.86376752, - 44.39917205 - ], - [ - -123.86436596, - 44.39901877 - ], - [ - -123.86498829, - 44.39890866 - ], - [ - -123.86564018, - 44.39889606 - ], - [ - -123.86633351, - 44.39891627 - ], - [ - -123.86693144, - 44.39910351 - ], - [ - -123.86755934, - 44.39920612 - ], - [ - -123.86821285, - 44.39938466 - ], - [ - -123.86888417, - 44.39956356 - ], - [ - -123.86935838, - 44.3997763 - ], - [ - -123.86982656, - 44.40003146 - ], - [ - -123.87021351, - 44.40040625 - ], - [ - -123.87070082, - 44.40066815 - ], - [ - -123.8712128, - 44.40097838 - ], - [ - -123.87173204, - 44.40127655 - ], - [ - -123.8722167, - 44.40153571 - ], - [ - -123.87257382, - 44.40162574 - ], - [ - -123.87310406, - 44.40189762 - ], - [ - -123.87359914, - 44.40206826 - ], - [ - -123.87412929, - 44.40230976 - ], - [ - -123.87488722, - 44.40247685 - ], - [ - -123.87547359, - 44.40268243 - ], - [ - -123.87591649, - 44.40303744 - ], - [ - -123.87639193, - 44.40329141 - ], - [ - -123.87685593, - 44.403575 - ], - [ - -123.8773683, - 44.40388809 - ], - [ - -123.87787402, - 44.40421161 - ], - [ - -123.87830627, - 44.40450556 - ], - [ - -123.87875463, - 44.40481816 - ], - [ - -123.87921462, - 44.4051345 - ], - [ - -123.87965761, - 44.40550009 - ], - [ - -123.88006274, - 44.40581375 - ], - [ - -123.880311, - 44.40601844 - ], - [ - -123.88050868, - 44.40625212 - ], - [ - -123.88092865, - 44.40670517 - ], - [ - -123.88140728, - 44.40695894 - ], - [ - -123.88196001, - 44.40719543 - ], - [ - -123.88246063, - 44.40746501 - ], - [ - -123.88290241, - 44.40761001 - ], - [ - -123.88326407, - 44.40770471 - ], - [ - -123.88369986, - 44.4077935 - ], - [ - -123.88410483, - 44.40781332 - ], - [ - -123.88477941, - 44.40788478 - ], - [ - -123.88546521, - 44.40792777 - ], - [ - -123.88613991, - 44.40800486 - ], - [ - -123.88679371, - 44.40802335 - ], - [ - -123.88743945, - 44.40803797 - ], - [ - -123.88778308, - 44.40792528 - ], - [ - -123.88816662, - 44.40788622 - ], - [ - -123.88878509, - 44.4077292 - ], - [ - -123.88939277, - 44.40746818 - ], - [ - -123.88992761, - 44.40728381 - ], - [ - -123.89042965, - 44.40706805 - ], - [ - -123.89091789, - 44.40679144 - ], - [ - -123.89146513, - 44.40661118 - ], - [ - -123.89204869, - 44.40645954 - ], - [ - -123.8924492, - 44.40642341 - ], - [ - -123.89306481, - 44.40632346 - ], - [ - -123.89363697, - 44.4061784 - ], - [ - -123.89424605, - 44.40607274 - ], - [ - -123.89472907, - 44.40585515 - ], - [ - -123.89529258, - 44.4055676 - ], - [ - -123.89577479, - 44.40534867 - ], - [ - -123.89623146, - 44.40510029 - ], - [ - -123.89669813, - 44.4049264 - ], - [ - -123.89703676, - 44.40479792 - ], - [ - -123.89759604, - 44.40489638 - ], - [ - -123.89796954, - 44.40480068 - ], - [ - -123.89776908, - 44.40510428 - ], - [ - -123.89763026, - 44.40537959 - ], - [ - -123.89775748, - 44.40570888 - ], - [ - -123.89798825, - 44.40635395 - ], - [ - -123.89807914, - 44.40680006 - ], - [ - -123.8981605, - 44.40723602 - ], - [ - -123.89851731, - 44.40788018 - ], - [ - -123.89870319, - 44.40827993 - ], - [ - -123.89885188, - 44.40854481 - ], - [ - -123.89912201, - 44.4090699 - ], - [ - -123.89931266, - 44.40932872 - ], - [ - -123.89955343, - 44.40989939 - ], - [ - -123.89964612, - 44.41020136 - ], - [ - -123.89998865, - 44.41067162 - ], - [ - -123.90009915, - 44.41095871 - ], - [ - -123.90046547, - 44.41136472 - ], - [ - -123.90081575, - 44.41179523 - ], - [ - -123.90126973, - 44.41207393 - ], - [ - -123.90161867, - 44.41223466 - ], - [ - -123.90219707, - 44.41242756 - ], - [ - -123.90279124, - 44.41262141 - ], - [ - -123.90336856, - 44.41283241 - ], - [ - -123.90394765, - 44.41301175 - ], - [ - -123.90452798, - 44.4132305 - ], - [ - -123.90508748, - 44.41340748 - ], - [ - -123.90568275, - 44.41360401 - ], - [ - -123.90619128, - 44.41366257 - ], - [ - -123.90681799, - 44.41364594 - ], - [ - -123.90740832, - 44.41355112 - ], - [ - -123.90794155, - 44.41343054 - ], - [ - -123.9084303, - 44.41325435 - ], - [ - -123.90894564, - 44.41307826 - ], - [ - -123.90948204, - 44.41291141 - ], - [ - -123.90995774, - 44.41274009 - ], - [ - -123.91036825, - 44.41253823 - ], - [ - -123.91080595, - 44.41227071 - ], - [ - -123.91134941, - 44.41206608 - ], - [ - -123.91180342, - 44.41179606 - ], - [ - -123.91209543, - 44.41147776 - ], - [ - -123.91238624, - 44.41111112 - ], - [ - -123.91263172, - 44.41080515 - ], - [ - -123.91286336, - 44.41047062 - ], - [ - -123.91307648, - 44.41010501 - ], - [ - -123.91325976, - 44.40971712 - ], - [ - -123.91339298, - 44.4093358 - ], - [ - -123.91354334, - 44.40889929 - ], - [ - -123.91359042, - 44.40842761 - ], - [ - -123.9136534, - 44.40793958 - ], - [ - -123.91371997, - 44.40748378 - ], - [ - -123.91383764, - 44.40705641 - ], - [ - -123.91391104, - 44.40664034 - ], - [ - -123.91409615, - 44.40628875 - ], - [ - -123.91423042, - 44.40591397 - ], - [ - -123.91436732, - 44.40559092 - ], - [ - -123.91472252, - 44.40528978 - ], - [ - -123.91508271, - 44.40495322 - ], - [ - -123.91541287, - 44.40453829 - ], - [ - -123.91587899, - 44.40423021 - ], - [ - -123.91632563, - 44.40388354 - ], - [ - -123.91680777, - 44.40357231 - ], - [ - -123.91735984, - 44.40326839 - ], - [ - -123.91772488, - 44.40295815 - ], - [ - -123.91819859, - 44.4026917 - ], - [ - -123.91869704, - 44.40248751 - ], - [ - -123.91955809, - 44.40241698 - ], - [ - -123.92028749, - 44.40232218 - ], - [ - -123.92093335, - 44.4022829 - ], - [ - -123.92157021, - 44.40219044 - ], - [ - -123.92214399, - 44.40207362 - ], - [ - -123.92273745, - 44.40191332 - ], - [ - -123.92329758, - 44.40173306 - ], - [ - -123.92374441, - 44.40145561 - ], - [ - -123.92426761, - 44.4011692 - ], - [ - -123.92461559, - 44.40083517 - ], - [ - -123.92494488, - 44.40048791 - ], - [ - -123.92525406, - 44.40014004 - ], - [ - -123.92551382, - 44.39976282 - ], - [ - -123.92590109, - 44.3994442 - ], - [ - -123.92633895, - 44.399155 - ], - [ - -123.92704252, - 44.39905127 - ], - [ - -123.92769566, - 44.39898868 - ], - [ - -123.92830885, - 44.39900414 - ], - [ - -123.92892625, - 44.39895612 - ], - [ - -123.92954142, - 44.39893004 - ], - [ - -123.93014359, - 44.39889021 - ], - [ - -123.93069157, - 44.3987535 - ], - [ - -123.93121382, - 44.39858483 - ], - [ - -123.93179926, - 44.39837244 - ], - [ - -123.9323001, - 44.39811884 - ], - [ - -123.93286139, - 44.39791318 - ], - [ - -123.93343306, - 44.39771814 - ], - [ - -123.93402862, - 44.39752484 - ], - [ - -123.93445539, - 44.3974262 - ], - [ - -123.93507567, - 44.39720532 - ], - [ - -123.93566616, - 44.39703623 - ], - [ - -123.93608247, - 44.39695579 - ], - [ - -123.93680653, - 44.3968801 - ], - [ - -123.93748702, - 44.39688852 - ], - [ - -123.93801284, - 44.39704153 - ], - [ - -123.93862307, - 44.39713536 - ], - [ - -123.93909178, - 44.39738882 - ], - [ - -123.93958546, - 44.39763696 - ], - [ - -123.94004078, - 44.39791133 - ], - [ - -123.93992079, - 44.39849658 - ], - [ - -123.93951288, - 44.39911698 - ], - [ - -123.93937417, - 44.39938235 - ], - [ - -123.93930383, - 44.39977924 - ], - [ - -123.93916448, - 44.4000305 - ], - [ - -123.93901945, - 44.4003674 - ], - [ - -123.93904872, - 44.40078397 - ], - [ - -123.93909322, - 44.40129273 - ], - [ - -123.93915007, - 44.40175556 - ], - [ - -123.93925609, - 44.4022171 - ], - [ - -123.93943907, - 44.40268108 - ], - [ - -123.93960631, - 44.40322234 - ], - [ - -123.93982983, - 44.40361487 - ], - [ - -123.94014536, - 44.40397834 - ], - [ - -123.94026341, - 44.40429241 - ], - [ - -123.94057373, - 44.40447186 - ], - [ - -123.94105541, - 44.40474705 - ], - [ - -123.94160399, - 44.40494901 - ], - [ - -123.94220706, - 44.40502569 - ], - [ - -123.94279816, - 44.40506358 - ], - [ - -123.94340299, - 44.40507666 - ], - [ - -123.94402474, - 44.40510153 - ], - [ - -123.94462844, - 44.40520934 - ], - [ - -123.94524185, - 44.40526414 - ], - [ - -123.94588166, - 44.40528919 - ], - [ - -123.94651777, - 44.40533917 - ], - [ - -123.94717463, - 44.40539583 - ], - [ - -123.94782596, - 44.40545025 - ], - [ - -123.94847524, - 44.40549078 - ], - [ - -123.94908205, - 44.40554706 - ], - [ - -123.94968558, - 44.40556505 - ], - [ - -123.95032322, - 44.40564387 - ], - [ - -123.95088722, - 44.40579685 - ], - [ - -123.951475, - 44.40591513 - ], - [ - -123.95203642, - 44.40600215 - ], - [ - -123.95262381, - 44.40610039 - ], - [ - -123.95320377, - 44.40618497 - ], - [ - -123.95380631, - 44.40626162 - ], - [ - -123.95437712, - 44.40634471 - ], - [ - -123.95493238, - 44.40645369 - ], - [ - -123.95548339, - 44.40657689 - ], - [ - -123.95596045, - 44.40677881 - ], - [ - -123.95634357, - 44.40692054 - ], - [ - -123.95678154, - 44.40725095 - ], - [ - -123.95728515, - 44.40745667 - ], - [ - -123.9578236, - 44.4076733 - ], - [ - -123.95841299, - 44.40795093 - ], - [ - -123.95895545, - 44.40818203 - ], - [ - -123.95949965, - 44.40842223 - ], - [ - -123.95978424, - 44.40863051 - ], - [ - -123.96033444, - 44.40888121 - ], - [ - -123.96087367, - 44.4091309 - ], - [ - -123.96145696, - 44.40940761 - ], - [ - -123.96197166, - 44.4096763 - ], - [ - -123.96254326, - 44.40995239 - ], - [ - -123.96291887, - 44.41004019 - ], - [ - -123.96345949, - 44.41039994 - ], - [ - -123.96382274, - 44.4104883 - ], - [ - -123.96448741, - 44.41064768 - ], - [ - -123.96507192, - 44.41089011 - ], - [ - -123.96567255, - 44.41110579 - ], - [ - -123.96628875, - 44.41130712 - ], - [ - -123.96687554, - 44.4115252 - ], - [ - -123.96748682, - 44.41170485 - ], - [ - -123.96812516, - 44.4118425 - ], - [ - -123.96879175, - 44.41195063 - ], - [ - -123.96940244, - 44.41210901 - ], - [ - -123.96998386, - 44.41215632 - ], - [ - -123.97070257, - 44.41207678 - ], - [ - -123.97121878, - 44.41188922 - ], - [ - -123.9719615, - 44.41184233 - ], - [ - -123.97264813, - 44.41178434 - ], - [ - -123.97333195, - 44.41170379 - ], - [ - -123.9740139, - 44.41166369 - ], - [ - -123.974735, - 44.41159337 - ], - [ - -123.97534859, - 44.41154521 - ], - [ - -123.97597454, - 44.41151545 - ], - [ - -123.97657051, - 44.41142758 - ], - [ - -123.977225, - 44.41141165 - ], - [ - -123.97789065, - 44.41136242 - ], - [ - -123.97855006, - 44.411291 - ], - [ - -123.97922159, - 44.41131766 - ], - [ - -123.97987871, - 44.41131188 - ], - [ - -123.98055407, - 44.41134369 - ], - [ - -123.98121029, - 44.41132718 - ], - [ - -123.98184957, - 44.4114154 - ], - [ - -123.98245005, - 44.41138605 - ], - [ - -123.98307313, - 44.41141705 - ], - [ - -123.98369401, - 44.41139145 - ], - [ - -123.98440539, - 44.41135395 - ], - [ - -123.98511358, - 44.4113503 - ], - [ - -123.98671941, - 44.41152246 - ], - [ - -123.98748945, - 44.41152462 - ], - [ - -123.9882401, - 44.41152883 - ], - [ - -123.98889219, - 44.41159485 - ], - [ - -123.98946553, - 44.41174715 - ], - [ - -123.99005421, - 44.41187194 - ], - [ - -123.99053595, - 44.41199176 - ], - [ - -123.99112282, - 44.41208699 - ], - [ - -123.9917098, - 44.41221487 - ], - [ - -123.9923444, - 44.41227068 - ], - [ - -123.99298967, - 44.41233859 - ], - [ - -123.99366116, - 44.4123239 - ], - [ - -123.99425938, - 44.41231871 - ], - [ - -123.99488136, - 44.41231232 - ], - [ - -123.99551957, - 44.41230265 - ], - [ - -123.99616306, - 44.41226539 - ], - [ - -123.99679546, - 44.41222111 - ], - [ - -123.99739403, - 44.41220866 - ], - [ - -123.99802346, - 44.41219235 - ], - [ - -123.99863466, - 44.41223578 - ], - [ - -123.99926345, - 44.41228427 - ], - [ - -123.99984754, - 44.41237385 - ], - [ - -124.00048214, - 44.41239248 - ], - [ - -124.00114048, - 44.41245646 - ], - [ - -124.00178649, - 44.41250322 - ], - [ - -124.00242568, - 44.41254112 - ], - [ - -124.00302101, - 44.41260424 - ], - [ - -124.00366056, - 44.41272726 - ], - [ - -124.00431346, - 44.41279803 - ], - [ - -124.00495665, - 44.4128499 - ], - [ - -124.00579352, - 44.41288924 - ], - [ - -124.00624914, - 44.41287201 - ], - [ - -124.0068697, - 44.41285621 - ], - [ - -124.00755761, - 44.41290728 - ], - [ - -124.00823004, - 44.41289992 - ], - [ - -124.00860708, - 44.41299905 - ], - [ - -124.00932836, - 44.41308644 - ], - [ - -124.00997898, - 44.41306819 - ], - [ - -124.01056621, - 44.41316267 - ], - [ - -124.0111938, - 44.41317779 - ], - [ - -124.01185685, - 44.41324235 - ], - [ - -124.01249612, - 44.41327547 - ], - [ - -124.01314373, - 44.41326774 - ], - [ - -124.01379886, - 44.41329262 - ], - [ - -124.01443035, - 44.41329667 - ], - [ - -124.01504742, - 44.41325602 - ], - [ - -124.01567696, - 44.41326543 - ], - [ - -124.0163176, - 44.41323321 - ], - [ - -124.01697681, - 44.41320211 - ], - [ - -124.0176808, - 44.41319297 - ], - [ - -124.01830344, - 44.41318806 - ], - [ - -124.01892875, - 44.41316995 - ], - [ - -124.01957479, - 44.41310311 - ], - [ - -124.02028666, - 44.41296881 - ], - [ - -124.02096835, - 44.41287308 - ], - [ - -124.02159251, - 44.41281857 - ], - [ - -124.02222162, - 44.41283223 - ], - [ - -124.02293347, - 44.41285626 - ], - [ - -124.02358937, - 44.4128672 - ], - [ - -124.02419598, - 44.41289626 - ], - [ - -124.02482112, - 44.41293497 - ], - [ - -124.02548339, - 44.41297929 - ], - [ - -124.02611148, - 44.41299481 - ], - [ - -124.0266979, - 44.41313225 - ], - [ - -124.02736855, - 44.41333595 - ], - [ - -124.02783454, - 44.41368598 - ], - [ - -124.02836911, - 44.41389146 - ], - [ - -124.02897219, - 44.41403678 - ], - [ - -124.029629, - 44.41416364 - ], - [ - -124.03033955, - 44.41430962 - ], - [ - -124.03100129, - 44.41447188 - ], - [ - -124.03157854, - 44.4145831 - ], - [ - -124.03213505, - 44.41468656 - ], - [ - -124.03269749, - 44.41490901 - ], - [ - -124.033154, - 44.41508231 - ], - [ - -124.03359996, - 44.41520344 - ], - [ - -124.03408523, - 44.41530917 - ], - [ - -124.0346166, - 44.41543075 - ], - [ - -124.03512713, - 44.41554203 - ], - [ - -124.03564424, - 44.41566261 - ], - [ - -124.03605195, - 44.41585219 - ], - [ - -124.03654838, - 44.41591092 - ], - [ - -124.03701368, - 44.41610872 - ], - [ - -124.03751824, - 44.41637551 - ], - [ - -124.03799254, - 44.41658715 - ], - [ - -124.0384103, - 44.41683276 - ], - [ - -124.03883734, - 44.41708857 - ], - [ - -124.03925739, - 44.41737799 - ], - [ - -124.03971456, - 44.41764979 - ], - [ - -124.04013647, - 44.41789315 - ], - [ - -124.04054395, - 44.41813668 - ], - [ - -124.04097723, - 44.41838177 - ], - [ - -124.04146112, - 44.4186056 - ], - [ - -124.04185121, - 44.41889254 - ], - [ - -124.04228709, - 44.41915181 - ], - [ - -124.04260596, - 44.41950951 - ], - [ - -124.04295319, - 44.41978532 - ], - [ - -124.0433162, - 44.42011499 - ], - [ - -124.0436819, - 44.42043111 - ], - [ - -124.04408065, - 44.42071266 - ], - [ - -124.04439889, - 44.42100308 - ], - [ - -124.04478977, - 44.4212684 - ], - [ - -124.04517681, - 44.42157563 - ], - [ - -124.04553017, - 44.42187406 - ], - [ - -124.04588278, - 44.42214059 - ], - [ - -124.04625229, - 44.42241312 - ], - [ - -124.04662308, - 44.42269237 - ], - [ - -124.04695262, - 44.42303343 - ], - [ - -124.04714038, - 44.42343828 - ], - [ - -124.04741315, - 44.42376849 - ], - [ - -124.04768053, - 44.42407676 - ], - [ - -124.04780435, - 44.42435651 - ], - [ - -124.04732634, - 44.42489447 - ], - [ - -124.04702656, - 44.42523888 - ], - [ - -124.04687808, - 44.4257034 - ], - [ - -124.04689221, - 44.42611206 - ], - [ - -124.04694745, - 44.42650644 - ], - [ - -124.04699714, - 44.42683515 - ], - [ - -124.04711255, - 44.42722664 - ], - [ - -124.04718166, - 44.42755012 - ], - [ - -124.04735098, - 44.42792237 - ], - [ - -124.04744022, - 44.42823233 - ], - [ - -124.04763186, - 44.42858768 - ], - [ - -124.04782294, - 44.42893506 - ], - [ - -124.04795772, - 44.42927056 - ], - [ - -124.04812008, - 44.42954357 - ], - [ - -124.0482655, - 44.42985726 - ], - [ - -124.04841015, - 44.43016916 - ], - [ - -124.04959029, - 44.43019059 - ], - [ - -124.04958402, - 44.43058002 - ], - [ - -124.05003768, - 44.43060595 - ], - [ - -124.05056385, - 44.43056855 - ], - [ - -124.0509838, - 44.43054737 - ], - [ - -124.05142502, - 44.4304973 - ], - [ - -124.05188644, - 44.43042265 - ], - [ - -124.05234342, - 44.4303942 - ], - [ - -124.05285804, - 44.43048907 - ], - [ - -124.05322937, - 44.43062561 - ], - [ - -124.05355872, - 44.43079039 - ], - [ - -124.05393383, - 44.43093127 - ], - [ - -124.05434019, - 44.4310527 - ], - [ - -124.05478282, - 44.43112744 - ], - [ - -124.05524487, - 44.43116655 - ], - [ - -124.05570963, - 44.43125383 - ], - [ - -124.05620541, - 44.43119684 - ], - [ - -124.0566196, - 44.43110111 - ], - [ - -124.05700451, - 44.43095856 - ], - [ - -124.05735068, - 44.4308297 - ], - [ - -124.0576967, - 44.4306475 - ], - [ - -124.05806766, - 44.43046741 - ], - [ - -124.05842788, - 44.43029024 - ], - [ - -124.0587761, - 44.43014354 - ], - [ - -124.05919087, - 44.42992754 - ], - [ - -124.05955409, - 44.42970128 - ], - [ - -124.05993269, - 44.42959332 - ], - [ - -124.0600291, - 44.42991412 - ], - [ - -124.06039563, - 44.42997867 - ], - [ - -124.06040845, - 44.42966802 - ], - [ - -124.06039705, - 44.42937148 - ], - [ - -124.06062818, - 44.42914606 - ], - [ - -124.06099005, - 44.42900989 - ], - [ - -124.06106585, - 44.42873816 - ], - [ - -124.06133563, - 44.42851991 - ], - [ - -124.06164997, - 44.42832205 - ], - [ - -124.06198476, - 44.42810412 - ], - [ - -124.06232868, - 44.42788506 - ], - [ - -124.0626385, - 44.42768829 - ], - [ - -124.06294375, - 44.42749466 - ], - [ - -124.06324718, - 44.42728655 - ], - [ - -124.06356995, - 44.42711808 - ], - [ - -124.06394055, - 44.42699164 - ], - [ - -124.06434683, - 44.42693523 - ], - [ - -124.06477167, - 44.42693652 - ], - [ - -124.06518523, - 44.42695944 - ], - [ - -124.06558096, - 44.42698015 - ], - [ - -124.0659813, - 44.42700063 - ], - [ - -124.06638206, - 44.42699874 - ], - [ - -124.066768, - 44.42700564 - ], - [ - -124.06714626, - 44.42700383 - ], - [ - -124.06733695, - 44.42673471 - ], - [ - -124.06735524, - 44.42643001 - ], - [ - -124.06741351, - 44.42614907 - ], - [ - -124.06751697, - 44.42582062 - ], - [ - -124.06767438, - 44.42549643 - ], - [ - -124.06783809, - 44.42525326 - ], - [ - -124.06804478, - 44.42500646 - ], - [ - -124.06828641, - 44.42478841 - ], - [ - -124.06867087, - 44.42453262 - ], - [ - -124.06911546, - 44.42428148 - ], - [ - -124.06962386, - 44.42408709 - ], - [ - -124.0699778, - 44.42397249 - ], - [ - -124.07046375, - 44.42374579 - ], - [ - -124.07076916, - 44.4235611 - ], - [ - -124.07104161, - 44.42335428 - ], - [ - -124.07130694, - 44.42312002 - ], - [ - -124.07160346, - 44.42287778 - ], - [ - -124.07193864, - 44.42264133 - ], - [ - -124.07229798, - 44.42242491 - ], - [ - -124.07268246, - 44.42218728 - ], - [ - -124.0730827, - 44.42194548 - ], - [ - -124.07350536, - 44.42171291 - ], - [ - -124.07391474, - 44.42147584 - ], - [ - -124.07431838, - 44.42125 - ], - [ - -124.07469786, - 44.42101658 - ], - [ - -124.07507283, - 44.4207555 - ], - [ - -124.07544303, - 44.42051063 - ], - [ - -124.07584042, - 44.42027326 - ], - [ - -124.07619407, - 44.42003165 - ], - [ - -124.07656189, - 44.41980864 - ], - [ - -124.07690587, - 44.41959394 - ], - [ - -124.07721702, - 44.41933004 - ], - [ - -124.07750715, - 44.41906131 - ], - [ - -124.07779686, - 44.41879036 - ], - [ - -124.07809044, - 44.41852666 - ], - [ - -124.07838983, - 44.41828726 - ], - [ - -124.07869746, - 44.41803038 - ], - [ - -124.07899261, - 44.41776279 - ], - [ - -124.07928888, - 44.41749579 - ], - [ - -124.07959817, - 44.4172429 - ], - [ - -124.07991585, - 44.41697402 - ], - [ - -124.08021911, - 44.41670149 - ], - [ - -124.08051445, - 44.41644058 - ], - [ - -124.08081398, - 44.41617324 - ], - [ - -124.08111657, - 44.41591081 - ], - [ - -124.08140945, - 44.41563878 - ], - [ - -124.08169799, - 44.41537443 - ], - [ - -124.08196931, - 44.41511894 - ], - [ - -124.08223731, - 44.41484764 - ], - [ - -124.08248837, - 44.41455977 - ], - [ - -124.08273127, - 44.41426732 - ], - [ - -124.08295988, - 44.41394897 - ], - [ - -124.08318646, - 44.41361575 - ], - [ - -124.08339613, - 44.41326079 - ], - [ - -124.08360565, - 44.41286803 - ], - [ - -124.08378138, - 44.41243915 - ], - [ - -124.08392812, - 44.41199675 - ], - [ - -124.08407669, - 44.41155153 - ], - [ - -124.08416379, - 44.41110435 - ], - [ - -124.08424807, - 44.41065802 - ], - [ - -124.08433027, - 44.41021677 - ], - [ - -124.08440363, - 44.40977697 - ], - [ - -124.0844971, - 44.40934979 - ], - [ - -124.08457662, - 44.40890334 - ], - [ - -124.08463357, - 44.40843865 - ], - [ - -124.08470493, - 44.40798972 - ], - [ - -124.08478255, - 44.40755327 - ], - [ - -124.08485464, - 44.40710002 - ], - [ - -124.084937, - 44.40665373 - ], - [ - -124.08500794, - 44.4062263 - ], - [ - -124.08509662, - 44.40579608 - ], - [ - -124.0851855, - 44.40537637 - ], - [ - -124.08526469, - 44.40493355 - ], - [ - -124.0853604, - 44.40448814 - ], - [ - -124.0854256, - 44.40405236 - ], - [ - -124.08549662, - 44.40364048 - ], - [ - -124.08556736, - 44.40322146 - ], - [ - -124.08563999, - 44.40282071 - ], - [ - -124.08569912, - 44.40241828 - ], - [ - -124.08575541, - 44.40200769 - ], - [ - -124.08579996, - 44.40158931 - ], - [ - -124.08583788, - 44.40116359 - ], - [ - -124.08586248, - 44.40074857 - ], - [ - -124.08588751, - 44.40032682 - ], - [ - -124.08591715, - 44.39990584 - ], - [ - -124.08594765, - 44.3994889 - ], - [ - -124.08598338, - 44.39907611 - ], - [ - -124.08601174, - 44.39866195 - ], - [ - -124.08602915, - 44.3982504 - ], - [ - -124.08605424, - 44.39785357 - ], - [ - -124.08608075, - 44.39746382 - ], - [ - -124.08610102, - 44.39706608 - ], - [ - -124.08612618, - 44.39666548 - ], - [ - -124.08614935, - 44.3962578 - ], - [ - -124.08617283, - 44.3958356 - ], - [ - -124.08619864, - 44.39539612 - ], - [ - -124.08622245, - 44.39494482 - ], - [ - -124.08625353, - 44.39448402 - ], - [ - -124.08627856, - 44.39402613 - ], - [ - -124.08632344, - 44.39356685 - ], - [ - -124.08635422, - 44.39310132 - ], - [ - -124.08641151, - 44.39265309 - ], - [ - -124.08655568, - 44.39222757 - ], - [ - -124.0867262, - 44.39180388 - ], - [ - -124.08690547, - 44.39139068 - ], - [ - -124.08709086, - 44.39098651 - ], - [ - -124.0872532, - 44.39059634 - ], - [ - -124.0874169, - 44.39021887 - ], - [ - -124.08759701, - 44.38985034 - ], - [ - -124.08773617, - 44.38947703 - ], - [ - -124.08786768, - 44.38909557 - ], - [ - -124.08799708, - 44.38870543 - ], - [ - -124.08812654, - 44.38832237 - ], - [ - -124.08824476, - 44.38795648 - ], - [ - -124.08836949, - 44.38759741 - ], - [ - -124.08848898, - 44.38723755 - ], - [ - -124.0886004, - 44.38688288 - ], - [ - -124.08868703, - 44.38652479 - ], - [ - -124.0887235, - 44.38615643 - ], - [ - -124.0887073, - 44.38578298 - ], - [ - -124.08866765, - 44.3854133 - ], - [ - -124.08862364, - 44.38502272 - ], - [ - -124.08857869, - 44.38464463 - ], - [ - -124.08852475, - 44.38428098 - ], - [ - -124.08848203, - 44.383933 - ], - [ - -124.08842158, - 44.383597 - ], - [ - -124.08835965, - 44.3832785 - ], - [ - -124.08830479, - 44.38294095 - ], - [ - -124.08826863, - 44.38260108 - ], - [ - -124.08820845, - 44.3822522 - ], - [ - -124.08816678, - 44.38191104 - ], - [ - -124.08809489, - 44.38155442 - ], - [ - -124.08801834, - 44.38118953 - ], - [ - -124.08799307, - 44.38083131 - ], - [ - -124.08798255, - 44.38046027 - ], - [ - -124.08795659, - 44.38011778 - ], - [ - -124.08794419, - 44.37976553 - ], - [ - -124.08797682, - 44.37942379 - ], - [ - -124.08800555, - 44.37907677 - ], - [ - -124.08807389, - 44.37872006 - ], - [ - -124.08815757, - 44.37836394 - ], - [ - -124.08825646, - 44.37800067 - ], - [ - -124.08831758, - 44.37758827 - ], - [ - -124.0884206, - 44.37717262 - ], - [ - -124.08853293, - 44.37672522 - ], - [ - -124.08862997, - 44.37627187 - ], - [ - -124.0887306, - 44.37582995 - ], - [ - -124.08882129, - 44.37538556 - ], - [ - -124.08891044, - 44.37493614 - ], - [ - -124.08902176, - 44.37449193 - ], - [ - -124.08912412, - 44.37403556 - ], - [ - -124.08922632, - 44.37359816 - ], - [ - -124.08932993, - 44.37315501 - ], - [ - -124.08943379, - 44.37270285 - ], - [ - -124.08953036, - 44.37224868 - ], - [ - -124.08962632, - 44.37178984 - ], - [ - -124.0897062, - 44.37134743 - ], - [ - -124.08979663, - 44.37090437 - ], - [ - -124.08989389, - 44.37045203 - ], - [ - -124.08998729, - 44.36999483 - ], - [ - -124.09008152, - 44.36954793 - ], - [ - -124.09017757, - 44.36911563 - ], - [ - -124.09026309, - 44.36870016 - ], - [ - -124.09033758, - 44.36829176 - ], - [ - -124.09042925, - 44.36791484 - ], - [ - -124.09051605, - 44.36755222 - ], - [ - -124.09059652, - 44.36722549 - ], - [ - -124.09067102, - 44.36688946 - ], - [ - -124.09073613, - 44.36658666 - ], - [ - -124.0908498, - 44.3663165 - ], - [ - -124.09123576, - 44.36621449 - ], - [ - -124.09152652, - 44.3664172 - ], - [ - -124.09150175, - 44.36675248 - ], - [ - -124.09151938, - 44.36705164 - ], - [ - -124.0918594, - 44.36718891 - ], - [ - -124.0922132, - 44.36698833 - ], - [ - -124.09238998, - 44.3666993 - ], - [ - -124.0924104, - 44.36642336 - ], - [ - -124.09232828, - 44.36610462 - ], - [ - -124.09243297, - 44.36578117 - ], - [ - -124.0925485, - 44.36547432 - ] - ] - }, - "properties": {}, - "bbox": [ - [ - -124.09386637, - 44.34348063 - ], - [ - -124.09386637, - 44.56531305 - ], - [ - -123.26148271, - 44.56531305 - ], - [ - -123.26148271, - 44.34348063 - ] - ] -} diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index 13f4cef28..9c1547feb 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -297,12 +297,12 @@ public class MainActivity extends ActionBarActivity { private void addPolyline() { try { - String geojsonStr = Util.loadStringFromAssets(this, "tillicum.geojson"); + String geojsonStr = Util.loadStringFromAssets(this, "small_line.geojson"); LatLng[] latLngs = Util.parseGeoJSONCoordinates(geojsonStr); MapView map = mMapFragment.getMap(); Polyline line = map.addPolyline(new PolylineOptions() - .add(new LatLng(51.5, -0.1), new LatLng(40.7, -74.0)) - .width(5) + .add(latLngs) + .width(2) .color(Color.RED)); } catch (IOException e) { e.printStackTrace(); diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/Util.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/Util.java index ec73c1249..aee6e968a 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/Util.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/Util.java @@ -29,7 +29,9 @@ public class Util { public static LatLng[] parseGeoJSONCoordinates(String geojsonStr) throws JSONException { JSONObject jsonObject = new JSONObject(geojsonStr); - JSONObject geometry = jsonObject.getJSONObject("geometry"); + JSONArray features = jsonObject.getJSONArray("features"); + JSONObject feature = features.getJSONObject(0); + JSONObject geometry = feature.getJSONObject("geometry"); JSONArray coordinates = geometry.getJSONArray("coordinates"); int len = coordinates.length(); LatLng[] latLngs = new LatLng[coordinates.length()]; From d4407b7b109d76617e8a8b2b648cdb4f2f7f3819 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 11:56:27 -0700 Subject: [PATCH 22/30] creating an annotation segment from a LatLng jlist encapsulated in function #1716 --- android/cpp/jni.cpp | 97 ++++++++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 46 deletions(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 22322d800..b98db228f 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -165,6 +165,56 @@ std::vector std_vector_string_from_jobject(JNIEnv *env, jobject jli return vector; } +mbgl::AnnotationSegment annotation_segment_from_latlng_jlist(JNIEnv *env, jobject jlist) { + mbgl::AnnotationSegment segment; + + if (jlist == nullptr) { + if (env->ThrowNew(nullPointerExceptionClass, "List cannot be null.") < 0) { + env->ExceptionDescribe(); + return segment; + } + return segment; + } + + jobjectArray array = + reinterpret_cast(env->CallObjectMethod(jlist, listToArrayId)); + if (env->ExceptionCheck() || (array == nullptr)) { + env->ExceptionDescribe(); + return segment; + } + + jsize len = env->GetArrayLength(array); + if (len < 0) { + env->ExceptionDescribe(); + return segment; + } + + segment.reserve(len); + + for (jsize i = 0; i < len; i++) { + jobject latLng = reinterpret_cast(env->GetObjectArrayElement(array, i)); + if (latLng == nullptr) { + env->ExceptionDescribe(); + return segment; + } + + jdouble latitude = env->GetDoubleField(latLng, latLngLatitudeId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return segment; + } + + jdouble longitude = env->GetDoubleField(latLng, latLngLongitudeId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return segment; + } + + segment.push_back(mbgl::LatLng(latitude, longitude)); + } + return segment; +} + jobject std_vector_string_to_jobject(JNIEnv *env, std::vector vector) { jobject jlist = env->NewObject(arrayListClass, arrayListConstructorId); if (jlist == nullptr) { @@ -513,53 +563,8 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr lineProperties.width = width; shapeProperties.set(lineProperties); - jobject points = env->GetObjectField(polyline, polylinePointsId); - if (points == nullptr) { - if (env->ThrowNew(nullPointerExceptionClass, "List cannot be null.") < 0) { - env->ExceptionDescribe(); - return -1; - } - return -1; - } - - jobjectArray array = - reinterpret_cast(env->CallObjectMethod(points, listToArrayId)); - if (env->ExceptionCheck() || (array == nullptr)) { - env->ExceptionDescribe(); - return -1; - } - - jsize len = env->GetArrayLength(array); - if (len < 0) { - env->ExceptionDescribe(); - return -1; - } - - mbgl::AnnotationSegment segment; - segment.reserve(len); - - for (jsize i = 0; i < len; i++) { - jobject latLng = reinterpret_cast(env->GetObjectArrayElement(array, i)); - if (latLng == nullptr) { - env->ExceptionDescribe(); - return -1; - } - - jdouble latitude = env->GetDoubleField(latLng, latLngLatitudeId); - if (env->ExceptionCheck()) { - env->ExceptionDescribe(); - return -1; - } - - jdouble longitude = env->GetDoubleField(latLng, latLngLongitudeId); - if (env->ExceptionCheck()) { - env->ExceptionDescribe(); - return -1; - } - - segment.push_back(mbgl::LatLng(latitude, longitude)); - } + mbgl::AnnotationSegment segment = annotation_segment_from_latlng_jlist(env, points); std::vector shapes; shapes.emplace_back(mbgl::AnnotationSegments {{ segment }}, shapeProperties); From 9e3f60756f6e70fa8f4b0d5827127bd404b1baf6 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 14:52:54 -0700 Subject: [PATCH 23/30] Java Annotation API cleaner #1716 --- .../mapboxgl/annotations/Annotation.java | 19 ++- .../annotations/AnnotationOptions.java | 22 +++ .../mapboxgl/annotations/CircleOptions.java | 2 +- .../mapbox/mapboxgl/annotations/Marker.java | 35 +++-- .../mapboxgl/annotations/MarkerOptions.java | 132 ++++++++---------- .../mapboxgl/annotations/MultiPoint.java | 39 +++--- .../annotations/MultiPointOptions.java | 15 ++ .../mapbox/mapboxgl/annotations/Polygon.java | 33 ++--- .../mapboxgl/annotations/PolygonOptions.java | 41 +++--- .../mapbox/mapboxgl/annotations/Polyline.java | 14 +- .../mapboxgl/annotations/PolylineOptions.java | 54 ++----- 11 files changed, 194 insertions(+), 212 deletions(-) create mode 100644 android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/AnnotationOptions.java create mode 100644 android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPointOptions.java diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Annotation.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Annotation.java index 04fa5a4f2..e38af77cd 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Annotation.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Annotation.java @@ -7,7 +7,7 @@ public abstract class Annotation { /** * The annotation id - *

+ * * Internal C++ id is stored as unsigned int. */ protected Long id; // null unless added to a MapView @@ -19,6 +19,10 @@ public abstract class Annotation { public Annotation() {} + public float getAlpha() { + return alpha; + } + public long getId() { return id; } @@ -32,6 +36,10 @@ public abstract class Annotation { mapView.removeAnnotation(this); } + public void setAlpha(float alpha) { + this.alpha = alpha; + } + public void setId(Long id) { this.id = id; } @@ -44,4 +52,13 @@ public abstract class Annotation { this.visible = visible; } + // TODO: Implement getZIndex of Google Maps Android API +// public float getZIndex() { +// +// } + + // TODO: Implement setZIndex of Google Maps Android API +// public void setZIndex(float zIndex) { +// +// } } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/AnnotationOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/AnnotationOptions.java new file mode 100644 index 000000000..f03ff45f7 --- /dev/null +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/AnnotationOptions.java @@ -0,0 +1,22 @@ +package com.mapbox.mapboxgl.annotations; + +public abstract class AnnotationOptions { + + protected Annotation annotation; + + public AnnotationOptions() {} + + public AnnotationOptions alpha(float alpha) { + annotation.alpha = alpha; + return this; + } + + public float getAlpha() { + return annotation.alpha; + } + + public boolean isVisible() { + return annotation.visible; + } + +} diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java index 43643c0fd..8a488e072 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java @@ -3,7 +3,7 @@ package com.mapbox.mapboxgl.annotations; import com.mapbox.mapboxgl.geometry.LatLng; -public class CircleOptions { +public class CircleOptions extends AnnotationOptions { private Circle circle; diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java index 34413fb97..ba8174a66 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java @@ -5,11 +5,6 @@ import com.mapbox.mapboxgl.geometry.LatLng; public class Marker extends Annotation { - /** - * Member fields are without access qualifiers - * so that they can be directly set by MarkerOptions - * from within the module. - */ float anchorU; float anchorV; boolean draggable; @@ -36,6 +31,14 @@ public class Marker extends Annotation { return alpha; } + public float getAnchorU() { + return anchorU; + } + + public float getAnchorV() { + return anchorV; + } + /** * NOTE: Google Maps Android API uses String for IDs. * @@ -63,9 +66,6 @@ public class Marker extends Annotation { return title; } -// Method in Google Maps Android API -// public int hashCode() - public void hideInfoWindow() { //TODO hideInfoWindow infoWindowShown = false; @@ -83,8 +83,9 @@ public class Marker extends Annotation { return infoWindowShown; } - void setAlpha(float alpha) { - this.alpha = alpha; + void setAnchor(float u, float v) { + this.anchorU = u; + this.anchorV = v; } void setDraggable(boolean draggable) { @@ -95,11 +96,6 @@ public class Marker extends Annotation { this.flat = flat; } - // TODO: Implement this method of Google Maps Android API -// void setIcon(BitmapDescriptor icon) { -// -// } - void setInfoWindowAnchor(float u, float v) { infoWindowAnchorU = u; infoWindowAnchorV = v; @@ -124,4 +120,13 @@ public class Marker extends Annotation { void showInfoWindow() { infoWindowShown = true; } + + + // TODO Method in Google Maps Android API +// public int hashCode() + + // TODO: Implement this method of Google Maps Android API +// void setIcon(BitmapDescriptor icon) { +// +// } } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MarkerOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MarkerOptions.java index 723707a85..f1764df77 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MarkerOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MarkerOptions.java @@ -2,49 +2,34 @@ package com.mapbox.mapboxgl.annotations; import com.mapbox.mapboxgl.geometry.LatLng; -/** - * Created by Nicholas Hallahan on 7/13/15. - * nick@theoutpost.io - */ -public class MarkerOptions { - - private Marker marker; +public class MarkerOptions extends AnnotationOptions { public MarkerOptions() { - marker = new Marker(); - } - - public MarkerOptions alpha(float alpha) { - marker.alpha = alpha; - return this; + annotation = new Marker(); } public MarkerOptions anchor(float u, float v) { - marker.anchorU = u; - marker.anchorV = v; + ((Marker)annotation).anchorU = u; + ((Marker)annotation).anchorV = v; return this; } public MarkerOptions draggable(boolean draggable) { - marker.draggable = draggable; + ((Marker)annotation).draggable = draggable; return this; } public MarkerOptions flat(boolean flat) { - marker.flat = flat; + ((Marker)annotation).flat = flat; return this; } - public float getAlpha() { - return marker.alpha; - } - public float getAnchorU() { - return marker.anchorU; + return ((Marker)annotation).anchorU; } public float getAnchorV() { - return marker.anchorV; + return ((Marker)annotation).anchorV; } // TODO: Implement this method of Google Maps Android API @@ -53,81 +38,82 @@ public class MarkerOptions { // } public float getInfoWindowAnchorU() { - return marker.infoWindowAnchorU; + return ((Marker)annotation).infoWindowAnchorU; } public float getInfoWindowAnchorV() { - return marker.infoWindowAnchorV; + return ((Marker)annotation).infoWindowAnchorV; } public Marker getMarker() { - return marker; + return (Marker)annotation; } public LatLng getPosition() { - return marker.position; + return ((Marker)annotation).position; } public float getRotation() { - return marker.rotation; + return ((Marker)annotation).rotation; } public String getSnippet() { - return marker.snippet; + return ((Marker)annotation).snippet; } public String getTitle() { - return marker.title; + return ((Marker)annotation).title; } + public MarkerOptions infoWindowAnchor(float u, float v) { + ((Marker)annotation).infoWindowAnchorU = u; + ((Marker)annotation).infoWindowAnchorV = v; + return this; + } + + public boolean isDraggable() { + return ((Marker)annotation).draggable; + } + + public boolean isFlat() { + return ((Marker)annotation).flat; + } + + public boolean isVisible() { + return ((Marker)annotation).visible; + } + + public MarkerOptions position(LatLng position) { + ((Marker)annotation).position = position; + return this; + } + + public MarkerOptions rotation(float rotation) { + ((Marker)annotation).rotation = rotation; + return this; + } + + public MarkerOptions snippet(String snippet) { + ((Marker)annotation).snippet = snippet; + return this; + } + + public MarkerOptions title(String title) { + ((Marker)annotation).title = title; + return this; + } + + public MarkerOptions visible(boolean visible) { + annotation.visible = visible; + return this; + } + + // TODO: Implement this method of Google Maps Android API // public MarkerOptions icon(BitmapDescriptor icon) { // // } - public MarkerOptions infoWindowAnchor(float u, float v) { - marker.infoWindowAnchorU = u; - marker.infoWindowAnchorV = v; - return this; - } - - public boolean isDraggable() { - return marker.draggable; - } - - public boolean isFlat() { - return marker.flat; - } - - public boolean isVisible() { - return marker.visible; - } - - public MarkerOptions position(LatLng position) { - marker.position = position; - return this; - } - - public MarkerOptions rotation(float rotation) { - marker.rotation = rotation; - return this; - } - - public MarkerOptions snippet(String snippet) { - marker.snippet = snippet; - return this; - } - - public MarkerOptions title(String title) { - marker.title = title; - return this; - } - - public MarkerOptions visible(boolean visible) { - marker.visible = visible; - return this; - } - // TODO: Implement this method of Google Maps Android API // public void writeToParcel (Parcel out, int flags) diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPoint.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPoint.java index 530ad1d45..4ebdd5071 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPoint.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPoint.java @@ -14,14 +14,26 @@ public abstract class MultiPoint extends Annotation { points = new ArrayList<>(); } + /** + * Returns a copy of the points. + * + * @return points - as a copy + */ public List getPoints() { - return points; + return new ArrayList<>(points); + } + + /** + * Sets the points of this polyline. This method will take a copy + * of the points, so further mutations to points will have no effect + * on this polyline. + * + * @param points + */ + void setPoints(List points) { + this.points = new ArrayList<>(points); } - // TODO: Implement getZIndex of Google Maps Android API -// public float getZIndex() { -// -// } // TODO: Implement hashCode of Google Maps Android API // public int hashCode() { @@ -33,18 +45,9 @@ public abstract class MultiPoint extends Annotation { // // } - /** - * Sets the points of this polyline. This method will take a copy - * of the points, so further mutations to points will have no effect - * on this polyline. - * - * @param points - */ - void setPoints(List points) { - this.points = new ArrayList<>(); - for (LatLng latLng : points) { - this.points.add(latLng); - } - } + // TODO: Implement setGeodesic of Google Maps Android API +// public void setGeodesic(boolean geodesic) { +// +// } } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPointOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPointOptions.java new file mode 100644 index 000000000..581c42bfd --- /dev/null +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MultiPointOptions.java @@ -0,0 +1,15 @@ +package com.mapbox.mapboxgl.annotations; + +import com.mapbox.mapboxgl.geometry.LatLng; + +import java.util.List; + +public abstract class MultiPointOptions extends AnnotationOptions { + + public MultiPointOptions() {} + + public List getPoints() { + // the getter gives us a copy, which is the safe thing to do... + return ((MultiPoint)annotation).getPoints(); + } +} diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java index 5e4abf680..475a2a93c 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java @@ -22,11 +22,6 @@ public class Polygon extends MultiPoint { holes = new ArrayList<>(); } - // TODO: Implement equals of Google Maps Android API -// public boolean equals (Object other) { -// -// } - public int getFillColor() { return fillColor; } @@ -43,16 +38,6 @@ public class Polygon extends MultiPoint { return strokeWidth; } - // TODO: Implement getZIndex of Google Maps Android API -// public float getZIndex() { -// -// } - - // TODO: Implement hashCode of Google Maps Android API -// public int hashCode () { -// -// } - public void setFillAlpha(float alpha) { this.alpha = alpha; } @@ -63,18 +48,14 @@ public class Polygon extends MultiPoint { /** * Sets the holes of this polygon. This method will take a copy of the holes, - * so further mutations to holes will have no effect on this polygon. + * so further mutations to holes parameter will have no effect on this polygon. * * @param holes */ public void setHoles(List> holes) { this.holes = new ArrayList<>(); for (List hole : holes) { - List newHole = new ArrayList<>(); - this.holes.add(newHole); - for (LatLng latLng : hole) { - newHole.add(latLng); - } + this.holes.add(new ArrayList<>(hole)); } } @@ -93,8 +74,14 @@ public class Polygon extends MultiPoint { strokeWidth = width; } - // TODO: Implement setZIndex of Google Maps Android API -// public void setZIndex(float zIndex) { + + // TODO: Implement equals of Google Maps Android API +// public boolean equals (Object other) { +// +// } + + // TODO: Implement hashCode of Google Maps Android API +// public int hashCode () { // // } } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java index 3ae47803d..a640b585d 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java @@ -6,16 +6,14 @@ import com.mapbox.mapboxgl.geometry.LatLng; import java.util.ArrayList; import java.util.List; -public class PolygonOptions { - - private Polygon polygon; +public class PolygonOptions extends MultiPointOptions { public PolygonOptions() { - polygon = new Polygon(); + annotation = new Polygon(); } public PolygonOptions add(LatLng point) { - polygon.points.add(point); + ((MultiPoint)annotation).points.add(point); return this; } @@ -38,47 +36,47 @@ public class PolygonOptions { for (LatLng point : points) { hole.add(point); } - polygon.holes.add(hole); + ((Polygon)annotation).holes.add(hole); return this; } public PolygonOptions fillColor(int color) { - polygon.fillColor = color; + ((Polygon)annotation).fillColor = color; return this; } public int getFillColor() { - return polygon.fillColor; + return ((Polygon)annotation).fillColor; } public List> getHoles() { - return polygon.holes; + return ((Polygon)annotation).holes; } public Polygon getPolygon() { - return polygon; + return ((Polygon)annotation); } public int getStrokeColor() { - return polygon.strokeColor; + return ((Polygon)annotation).strokeColor; } public float getStrokeWidth() { - return polygon.strokeWidth; + return ((Polygon)annotation).strokeWidth; } - // TODO: Implement getZIndex of Google Maps Android API -// public float getZIndex() { -// -// } - public PolygonOptions strokeColor(int color) { - polygon.strokeColor = color; + ((Polygon)annotation).strokeColor = color; return this; } public PolygonOptions strokeWidth(float width) { - polygon.strokeWidth = width; + ((Polygon)annotation).strokeWidth = width; + return this; + } + + public PolygonOptions visible(boolean visible) { + annotation.visible = visible; return this; } @@ -87,9 +85,4 @@ public class PolygonOptions { // // } - // TODO: Implement zIndex of Google Maps Android API -// public PolygonOptions zIndex(float zIndex) { -// -// return this; -// } } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java index fdfcc6149..764723833 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polyline.java @@ -15,11 +15,6 @@ public class Polyline extends MultiPoint { super(); } - // TODO: Implement equals of Google Maps Android API -// public boolean equals(Object other) { -// -// } - public int getColor() { return color; } @@ -38,10 +33,6 @@ public class Polyline extends MultiPoint { this.color = color; } - // TODO: Implement setGeodesic of Google Maps Android API -// public void setGeodesic(boolean geodesic) { -// -// } /** * Sets the width of the polyline. @@ -53,9 +44,8 @@ public class Polyline extends MultiPoint { this.width = width; } - // TODO: Implement setZIndex of Google Maps Android API -// public void setZIndex(float zIndex) { + // TODO: Implement equals of Google Maps Android API +// public boolean equals(Object other) { // // } - } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java index f87b91c98..41de7d51a 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java @@ -4,21 +4,14 @@ import com.mapbox.mapboxgl.geometry.LatLng; import java.util.List; -public class PolylineOptions { - - private Polyline polyline; +public class PolylineOptions extends MultiPointOptions { public PolylineOptions() { - polyline = new Polyline(); - } - - public PolylineOptions alpha(float alpha) { - polyline.alpha = alpha; - return this; + annotation = new Polyline(); } public PolylineOptions add(LatLng point) { - polyline.points.add(point); + ((MultiPoint)annotation).points.add(point); return this; } @@ -37,47 +30,24 @@ public class PolylineOptions { } public PolylineOptions color(int color) { - polyline.color = color; + ((Polyline)annotation).color = color; return this; } - // TODO: Implement geodesic of Google Maps Android API -// public PolylineOptions geodesic (boolean geodesic) { -// -// } - public int getColor() { - return polyline.color; - } - - public List getPoints() { - return polyline.points; + return ((Polyline)annotation).color; } public Polyline getPolyline() { - return polyline; + return ((Polyline)annotation); } public float getWidth() { - return polyline.width; - } - - // TODO: Implement getZIndex of Google Maps Android API -// public float getZIndex() { -// -// } - - // TODO: Implement isGeodesic of Google Maps Android API -// public boolean isGeodesic() { -// -// } - - public boolean isVisible() { - return polyline.visible; + return ((Polyline)annotation).width; } public PolylineOptions visible(boolean visible) { - polyline.visible = visible; + annotation.visible = visible; return this; } @@ -88,19 +58,13 @@ public class PolylineOptions { * @return */ public PolylineOptions width(float width) { - polyline.width = width; + ((Polyline)annotation).width = width; return this; } // TODO: Implement writeToParcel of Google Maps Android API // public void writeToParcel(Parcel out, int flags) { // -// } - - // TODO: Implement zIndex of Google Maps Android API -// public PolylineOptions zIndex(float zIndex) { -// -// return this; // } } From 0df1d6482375693f8c341b55eaab4ddf7783a88c Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 15:09:56 -0700 Subject: [PATCH 24/30] toggle removes all annotations. ready for polygon JNI #1716 --- .../com/mapbox/mapboxgl/views/MapView.java | 20 +++++++++++++++++++ .../mapbox/mapboxgl/views/NativeMapView.java | 8 ++++++++ .../mapbox/mapboxgl/testapp/MainActivity.java | 6 +++--- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java index 9e4e6e6cf..4a8ed42a5 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/MapView.java @@ -32,6 +32,8 @@ import com.almeros.android.multitouch.gesturedetectors.TwoFingerGestureDetector; import com.mapbox.mapboxgl.annotations.Annotation; import com.mapbox.mapboxgl.annotations.Marker; import com.mapbox.mapboxgl.annotations.MarkerOptions; +import com.mapbox.mapboxgl.annotations.Polygon; +import com.mapbox.mapboxgl.annotations.PolygonOptions; import com.mapbox.mapboxgl.annotations.Polyline; import com.mapbox.mapboxgl.annotations.PolylineOptions; import com.mapbox.mapboxgl.geometry.LatLng; @@ -232,11 +234,29 @@ public class MapView extends SurfaceView { return polyline; } + public Polygon addPolygon(PolygonOptions polygonOptions) { + Polygon polygon = polygonOptions.getPolygon(); + Long id = mNativeMapView.addPolygon(polygon); + polygon.setId(id); + polygon.setMapView(this); + annotations.add(polygon); + return polygon; + } + public void removeAnnotation(Annotation annotation) { long id = annotation.getId(); mNativeMapView.removeAnnotation(id); } + public void removeAnnotation(long annotationId) { + mNativeMapView.removeAnnotation(annotationId); + } + + public void removeAnnotations() { + for (Annotation annotation : annotations) { + annotation.remove(); + } + } // // Property methods diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java index be1680aba..ac4f571a7 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java @@ -4,6 +4,7 @@ import android.graphics.PointF; import android.view.Surface; import com.mapbox.mapboxgl.annotations.Marker; +import com.mapbox.mapboxgl.annotations.Polygon; import com.mapbox.mapboxgl.annotations.Polyline; import com.mapbox.mapboxgl.geometry.LatLng; import com.mapbox.mapboxgl.geometry.LatLngZoom; @@ -225,6 +226,11 @@ class NativeMapView { return nativeAddPolyline(mNativeMapViewPtr, polyline); } + public long addPolygon(Polygon polygon) { + // NH TODO Throw exception if returns -1 + return nativeAddPolygon(mNativeMapViewPtr, polygon); + } + public void removeAnnotation(long id) { nativeRemoveAnnotation(mNativeMapViewPtr, id); } @@ -465,6 +471,8 @@ class NativeMapView { private native long nativeAddPolyline(long nativeMapViewPtr, Polyline polyline); + private native long nativeAddPolygon(long mNativeMapViewPtr, Polygon polygon); + private native void nativeRemoveAnnotation(long nativeMapViewPtr, long id); private native LatLng nativeGetLatLng(long nativeMapViewPtr); diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index 9c1547feb..4c25e241e 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -281,7 +281,7 @@ public class MainActivity extends ActionBarActivity { } else { if (mIsMarkersOn) { mIsMarkersOn = false; - removeMarkers(); + removeAnnotations(); } } } @@ -311,8 +311,8 @@ public class MainActivity extends ActionBarActivity { } } - private void removeMarkers() { - marker.remove(); + private void removeAnnotations() { + mMapFragment.getMap().removeAnnotations(); } // This class forwards location updates to updateLocation() From e84e13a85aab93d8e91dc8c94799a1076cfb892d Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 17:38:23 -0700 Subject: [PATCH 25/30] polygon JNI #1716 --- android/cpp/jni.cpp | 162 ++++++++++++++++++ .../src/main/assets/small_poly.geojson | 1 + .../mapbox/mapboxgl/testapp/MainActivity.java | 20 +++ 3 files changed, 183 insertions(+) create mode 100644 android/java/MapboxGLAndroidSDKTestApp/src/main/assets/small_poly.geojson diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index b98db228f..7f4a817bd 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -49,6 +49,17 @@ jfieldID polylineColorId = nullptr; jfieldID polylineWidthId = nullptr; jfieldID polylinePointsId = nullptr; +jclass polygonClass = nullptr; +jmethodID polygonConstructorId = nullptr; +jfieldID polygonAlphaId = nullptr; +jfieldID polygonVisibleId = nullptr; +jfieldID polygonFillColorId = nullptr; +jfieldID polygonStrokeColorId = nullptr; +jfieldID polygonStrokeWidthId = nullptr; +jfieldID polygonPointsId = nullptr; +jfieldID polygonHolesId = nullptr; + + jclass latLngZoomClass = nullptr; jmethodID latLngZoomConstructorId = nullptr; jfieldID latLngZoomLatitudeId = nullptr; @@ -574,6 +585,79 @@ jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr return (jlong) id; } +jlong JNICALL nativeAddPolygon(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject polygon) { + mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddPolygon"); + assert(nativeMapViewPtr != 0); + NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); + + // ***** Java fields ***** // + // float alpha; + // boolean visible; + // int fillColor + // int strokeColor + // float strokeWidth + // List points + // List> holes + + jfloat alpha = env->GetFloatField(polygon, polygonAlphaId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return -1; + } + + jboolean visible = env->GetBooleanField(polygon, polygonVisibleId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return -1; + } + visible = JNI_TRUE; + + jint fillColor = env->GetIntField(polygon, polygonFillColorId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return -1; + } + + jint strokeColor = env->GetIntField(polygon, polygonStrokeColorId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return -1; + } + + int rF = (fillColor>>16)&0xFF; + int gF = (fillColor>>8)&0xFF; + int bF = (fillColor)&0xFF; + int aF = (fillColor>>24)&0xFF; + + int rS = (strokeColor>>16)&0xFF; + int gS = (strokeColor>>8)&0xFF; + int bS = (strokeColor)&0xFF; + int aS = (strokeColor>>24)&0xFF; + + // jfloat strokeWidth = env->GetFloatField(polygon, polygonStrokeWidthId); + // if (env->ExceptionCheck()) { + // env->ExceptionDescribe(); + // return -1; + // } + + mbgl::StyleProperties shapeProperties; + mbgl::FillProperties fillProperties; + fillProperties.opacity = alpha; + fillProperties.stroke_color = {{ (float)rS, (float)gS, (float)bS, (float)aS }}; + fillProperties.fill_color = {{ (float)rF, (float)gF, (float)bF, (float)aF }}; + shapeProperties.set(fillProperties); + + jobject points = env->GetObjectField(polygon, polygonPointsId); + mbgl::AnnotationSegment segment = annotation_segment_from_latlng_jlist(env, points); + + std::vector shapes; + shapes.emplace_back(mbgl::AnnotationSegments {{ segment }}, shapeProperties); + + std::vector shapeAnnotationIDs = nativeMapView->getMap().addShapeAnnotations(shapes); + uint32_t id = shapeAnnotationIDs.at(0); + return (jlong) id; +} + void JNICALL nativeRemoveAnnotation(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jlong annotationId) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeRemoveAnnotation"); assert(nativeMapViewPtr != 0); @@ -973,6 +1057,60 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_ERR; } + polygonClass = env->FindClass("com/mapbox/mapboxgl/annotations/Polygon"); + if (polygonClass == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + polygonConstructorId = env->GetMethodID(polygonClass, "", "()V"); + if (polylineConstructorId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + polygonAlphaId = env->GetFieldID(polygonClass, "alpha", "F"); + if (polygonAlphaId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + polygonVisibleId = env->GetFieldID(polygonClass, "visible", "Z"); + if (polygonVisibleId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + polygonFillColorId = env->GetFieldID(polygonClass, "fillColor", "I"); + if (polygonFillColorId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + polygonStrokeColorId = env->GetFieldID(polygonClass, "strokeColor", "I"); + if (polygonStrokeColorId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + polygonStrokeWidthId = env->GetFieldID(polygonClass, "strokeWidth", "F"); + if (polygonStrokeWidthId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + polygonPointsId = env->GetFieldID(polygonClass, "points", "Ljava/util/List;"); + if (polygonPointsId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + polygonHolesId = env->GetFieldID(polygonClass, "holes", "Ljava/util/List;"); + if (polygonHolesId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + latLngZoomClass = env->FindClass("com/mapbox/mapboxgl/geometry/LatLngZoom"); if (latLngZoomClass == nullptr) { env->ExceptionDescribe(); @@ -1170,6 +1308,8 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { reinterpret_cast(&nativeAddMarker)}, {"nativeAddPolyline", "(JLcom/mapbox/mapboxgl/annotations/Polyline;)J", reinterpret_cast(&nativeAddPolyline)}, + {"nativeAddPolygon", "(JLcom/mapbox/mapboxgl/annotations/Polygon;)J", + reinterpret_cast(&nativeAddPolygon)}, {"nativeRemoveAnnotation", "(JJ)V", reinterpret_cast(&nativeRemoveAnnotation)}, {"nativeGetLatLng", "(J)Lcom/mapbox/mapboxgl/geometry/LatLng;", reinterpret_cast(&nativeGetLatLng)}, @@ -1227,6 +1367,12 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_ERR; } + polygonClass = reinterpret_cast(env->NewGlobalRef(polygonClass)); + if (polygonClass == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + latLngZoomClass = reinterpret_cast(env->NewGlobalRef(latLngZoomClass)); if (latLngZoomClass == nullptr) { env->ExceptionDescribe(); @@ -1314,6 +1460,22 @@ extern "C" JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) { polylineClass = nullptr; polylineConstructorId = nullptr; polylineAlphaId = nullptr; + polylineVisibleId = nullptr; + polylineColorId = nullptr; + polylineWidthId = nullptr; + polylinePointsId = nullptr; + + env->DeleteGlobalRef(polygonClass); + polygonClass = nullptr; + polygonConstructorId = nullptr; + polygonAlphaId = nullptr; + polygonVisibleId = nullptr; + polygonFillColorId = nullptr; + polygonStrokeColorId = nullptr; + polygonStrokeWidthId = nullptr; + polygonPointsId = nullptr; + polygonHolesId = nullptr; + env->DeleteGlobalRef(latLngZoomClass); latLngZoomClass = nullptr; diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/assets/small_poly.geojson b/android/java/MapboxGLAndroidSDKTestApp/src/main/assets/small_poly.geojson new file mode 100644 index 000000000..ec61303c7 --- /dev/null +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/assets/small_poly.geojson @@ -0,0 +1 @@ +{"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"type":"Polygon","coordinates":[[[-122.28813171386719,38.617406963286136],[-122.26959228515624,38.6833657775237],[-122.18238830566406,38.55568323796419],[-122.10617065429688,38.51378825951165],[-122.11509704589845,38.50465406475561],[-122.18307495117188,38.542795073979015],[-122.19955444335938,38.496593518947556],[-122.28813171386719,38.617406963286136]]]}}]} \ No newline at end of file diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index 4c25e241e..a1cd2e660 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -26,6 +26,8 @@ import android.widget.TextView; import com.mapbox.mapboxgl.annotations.Marker; import com.mapbox.mapboxgl.annotations.MarkerOptions; +import com.mapbox.mapboxgl.annotations.Polygon; +import com.mapbox.mapboxgl.annotations.PolygonOptions; import com.mapbox.mapboxgl.annotations.Polyline; import com.mapbox.mapboxgl.annotations.PolylineOptions; import com.mapbox.mapboxgl.geometry.LatLng; @@ -277,6 +279,7 @@ public class MainActivity extends ActionBarActivity { mIsMarkersOn = true; addMarkers(); addPolyline(); + addPolygon(); } } else { if (mIsMarkersOn) { @@ -311,6 +314,23 @@ public class MainActivity extends ActionBarActivity { } } + private void addPolygon() { + String geojsonStr = null; + try { + geojsonStr = Util.loadStringFromAssets(this, "small_polygon.geojson"); + LatLng[] latLngs = Util.parseGeoJSONCoordinates(geojsonStr); + MapView map = mMapFragment.getMap(); + Polygon polygon = map.addPolygon(new PolygonOptions() + .add(new LatLng(0, 0), new LatLng(0, 5), new LatLng(3, 5), new LatLng(0, 0)) + .strokeColor(Color.MAGENTA) + .fillColor(Color.BLUE)); + } catch (IOException e) { + e.printStackTrace(); + } catch (JSONException e) { + e.printStackTrace(); + } + } + private void removeAnnotations() { mMapFragment.getMap().removeAnnotations(); } From e1cdc8209cf3bcef0af960dc50c511900143d4bd Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 18:04:46 -0700 Subject: [PATCH 26/30] yay, polygon! #1716 --- .../java/com/mapbox/mapboxgl/testapp/MainActivity.java | 2 +- .../src/main/java/com/mapbox/mapboxgl/testapp/Util.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index a1cd2e660..ed163c1d0 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -317,7 +317,7 @@ public class MainActivity extends ActionBarActivity { private void addPolygon() { String geojsonStr = null; try { - geojsonStr = Util.loadStringFromAssets(this, "small_polygon.geojson"); + geojsonStr = Util.loadStringFromAssets(this, "small_poly.geojson"); LatLng[] latLngs = Util.parseGeoJSONCoordinates(geojsonStr); MapView map = mMapFragment.getMap(); Polygon polygon = map.addPolygon(new PolygonOptions() diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/Util.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/Util.java index aee6e968a..74b909cec 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/Util.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/Util.java @@ -32,7 +32,13 @@ public class Util { JSONArray features = jsonObject.getJSONArray("features"); JSONObject feature = features.getJSONObject(0); JSONObject geometry = feature.getJSONObject("geometry"); - JSONArray coordinates = geometry.getJSONArray("coordinates"); + String type = geometry.getString("type"); + JSONArray coordinates; + if (type.equals("Polygon")) { + coordinates = geometry.getJSONArray("coordinates").getJSONArray(0); + } else { + coordinates = geometry.getJSONArray("coordinates"); + } int len = coordinates.length(); LatLng[] latLngs = new LatLng[coordinates.length()]; for (int i = 0; i < len; ++i) { From ed650b412834b1b40efbbdd7c7873c9081a41faa Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Thu, 16 Jul 2015 18:26:58 -0700 Subject: [PATCH 27/30] showing polygon, line, and markers together #1716 --- .../java/com/mapbox/mapboxgl/testapp/MainActivity.java | 8 +++++++- .../java/com/mapbox/mapboxgl/testapp/MapFragment.java | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index ed163c1d0..c017eb790 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -296,6 +296,12 @@ public class MainActivity extends ActionBarActivity { .position(backLot) .title("Back Lot") .snippet("The back lot behind my house")); + + LatLng cheeseRoom = new LatLng(38.531577,-122.010646); + map.addMarker(new MarkerOptions() + .position(cheeseRoom) + .title("Cheese Room") + .snippet("The only air conditioned room on the property!")); } private void addPolyline() { @@ -321,7 +327,7 @@ public class MainActivity extends ActionBarActivity { LatLng[] latLngs = Util.parseGeoJSONCoordinates(geojsonStr); MapView map = mMapFragment.getMap(); Polygon polygon = map.addPolygon(new PolygonOptions() - .add(new LatLng(0, 0), new LatLng(0, 5), new LatLng(3, 5), new LatLng(0, 0)) + .add(latLngs) .strokeColor(Color.MAGENTA) .fillColor(Color.BLUE)); } catch (IOException e) { diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MapFragment.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MapFragment.java index b78926b9e..d3a6d2ad1 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MapFragment.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MapFragment.java @@ -7,6 +7,7 @@ import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import com.mapbox.mapboxgl.geometry.LatLng; import com.mapbox.mapboxgl.views.MapView; import java.io.BufferedReader; @@ -77,6 +78,8 @@ public class MapFragment extends Fragment { // Need to pass on to view mMap.onStart(); + mMap.setCenterCoordinate(new LatLng(38.247887,-121.843872)); + mMap.setZoomLevel(7); } // Called when the fragment is invisible From aafcdd2ef0e4cb42c45d213b90a02c73a142d249 Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Fri, 17 Jul 2015 08:25:48 -0700 Subject: [PATCH 28/30] added ability to specify sprite in marker #1716 --- android/cpp/jni.cpp | 62 +++++++++++++++++-- .../mapbox/mapboxgl/annotations/Marker.java | 5 ++ .../mapboxgl/annotations/MarkerOptions.java | 5 ++ .../mapbox/mapboxgl/views/NativeMapView.java | 5 +- .../mapbox/mapboxgl/testapp/MainActivity.java | 1 + 5 files changed, 69 insertions(+), 9 deletions(-) diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 7f4a817bd..1e2288c61 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -41,6 +41,11 @@ jmethodID latLngConstructorId = nullptr; jfieldID latLngLatitudeId = nullptr; jfieldID latLngLongitudeId = nullptr; +jclass markerClass = nullptr; +jmethodID markerConstructorId = nullptr; +jfieldID markerPositionId = nullptr; +jfieldID markerSpriteId = nullptr; + jclass polylineClass = nullptr; jmethodID polylineConstructorId = nullptr; jfieldID polylineAlphaId = nullptr; @@ -504,25 +509,34 @@ void JNICALL nativeSetLatLng(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, j nativeMapView->getMap().setLatLng(mbgl::LatLng(latitude, longitude), std::chrono::milliseconds(duration)); } -jlong JNICALL nativeAddMarker(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject latLng) { +jlong JNICALL nativeAddMarker(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject marker) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddMarker"); assert(nativeMapViewPtr != 0); NativeMapView *nativeMapView = reinterpret_cast(nativeMapViewPtr); - jdouble latitude = env->GetDoubleField(latLng, latLngLatitudeId); + jobject position = env->GetObjectField(marker, markerPositionId); if (env->ExceptionCheck()) { env->ExceptionDescribe(); return -1; } - jdouble longitude = env->GetDoubleField(latLng, latLngLongitudeId); + jstring jsprite = (jstring)env->GetObjectField(marker, markerSpriteId); + std::string sprite = std_string_from_jstring(env, jsprite); + + jdouble latitude = env->GetDoubleField(position, latLngLatitudeId); + if (env->ExceptionCheck()) { + env->ExceptionDescribe(); + return -1; + } + + jdouble longitude = env->GetDoubleField(position, latLngLongitudeId); if (env->ExceptionCheck()) { env->ExceptionDescribe(); return -1; } // Because Java only has int, not unsigned int, we need to bump the annotation id up to a long. - return (jlong) nativeMapView->getMap().addPointAnnotation(mbgl::PointAnnotation(mbgl::LatLng(latitude, longitude), std::string("default_marker"))); + return (jlong) nativeMapView->getMap().addPointAnnotation(mbgl::PointAnnotation(mbgl::LatLng(latitude, longitude), sprite)); } jlong JNICALL nativeAddPolyline(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, jobject polyline) { @@ -1015,6 +1029,30 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_ERR; } + markerClass = env->FindClass("com/mapbox/mapboxgl/annotations/Marker"); + if (markerClass == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + markerConstructorId = env->GetMethodID(markerClass, "", "()V"); + if (markerConstructorId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + markerPositionId = env->GetFieldID(markerClass, "position", "Lcom/mapbox/mapboxgl/geometry/LatLng;"); + if (markerPositionId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + + markerSpriteId = env->GetFieldID(markerClass, "sprite", "Ljava/lang/String;"); + if (markerSpriteId == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + polylineClass = env->FindClass("com/mapbox/mapboxgl/annotations/Polyline"); if (polylineClass == nullptr) { env->ExceptionDescribe(); @@ -1064,7 +1102,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { } polygonConstructorId = env->GetMethodID(polygonClass, "", "()V"); - if (polylineConstructorId == nullptr) { + if (polygonConstructorId == nullptr) { env->ExceptionDescribe(); return JNI_ERR; } @@ -1304,7 +1342,7 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { {"nativeMoveBy", "(JDDJ)V", reinterpret_cast(&nativeMoveBy)}, {"nativeSetLatLng", "(JLcom/mapbox/mapboxgl/geometry/LatLng;J)V", reinterpret_cast(&nativeSetLatLng)}, - {"nativeAddMarker", "(JLcom/mapbox/mapboxgl/geometry/LatLng;)J", + {"nativeAddMarker", "(JLcom/mapbox/mapboxgl/annotations/Marker;)J", reinterpret_cast(&nativeAddMarker)}, {"nativeAddPolyline", "(JLcom/mapbox/mapboxgl/annotations/Polyline;)J", reinterpret_cast(&nativeAddPolyline)}, @@ -1361,6 +1399,12 @@ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { return JNI_ERR; } + markerClass = reinterpret_cast(env->NewGlobalRef(markerClass)); + if (markerClass == nullptr) { + env->ExceptionDescribe(); + return JNI_ERR; + } + polylineClass = reinterpret_cast(env->NewGlobalRef(polylineClass)); if (polylineClass == nullptr) { env->ExceptionDescribe(); @@ -1456,6 +1500,12 @@ extern "C" JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) { latLngLongitudeId = nullptr; latLngLatitudeId = nullptr; + env->DeleteGlobalRef(markerClass); + markerClass = nullptr; + markerConstructorId = nullptr; + markerPositionId = nullptr; + markerSpriteId = nullptr; + env->DeleteGlobalRef(polylineClass); polylineClass = nullptr; polylineConstructorId = nullptr; diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java index ba8174a66..ea4fc41e2 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java @@ -14,6 +14,7 @@ public class Marker extends Annotation { LatLng position; float rotation; String snippet; + String sprite = "default_marker"; String title; private boolean infoWindowShown = false; @@ -113,6 +114,10 @@ public class Marker extends Annotation { this.snippet = snippet; } + void setSprite(String sprite) { + this.sprite = sprite; + } + void setTitle(String title) { this.title = title; } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MarkerOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MarkerOptions.java index f1764df77..2e577067d 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MarkerOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/MarkerOptions.java @@ -98,6 +98,11 @@ public class MarkerOptions extends AnnotationOptions { return this; } + public MarkerOptions sprite(String sprite) { + ((Marker)annotation).sprite = sprite; + return this; + } + public MarkerOptions title(String title) { ((Marker)annotation).title = title; return this; diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java index ac4f571a7..6cab4bbd0 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/views/NativeMapView.java @@ -217,8 +217,7 @@ class NativeMapView { } public long addMarker(Marker marker) { - LatLng latLng = marker.getPosition(); - return nativeAddMarker(mNativeMapViewPtr, latLng); + return nativeAddMarker(mNativeMapViewPtr, marker); } public long addPolyline(Polyline polyline) { @@ -467,7 +466,7 @@ class NativeMapView { private native void nativeSetLatLng(long nativeMapViewPtr, LatLng latLng, long duration); - private native long nativeAddMarker(long nativeMapViewPtr, LatLng latLng); + private native long nativeAddMarker(long nativeMapViewPtr, Marker marker); private native long nativeAddPolyline(long nativeMapViewPtr, Polyline polyline); diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index c017eb790..f8c35897c 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -300,6 +300,7 @@ public class MainActivity extends ActionBarActivity { LatLng cheeseRoom = new LatLng(38.531577,-122.010646); map.addMarker(new MarkerOptions() .position(cheeseRoom) + .sprite("dog-park-15") .title("Cheese Room") .snippet("The only air conditioned room on the property!")); } From 5363fc8dc0c0ac7025d50bcd9d41a1cef0e95afa Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Fri, 17 Jul 2015 11:13:31 -0700 Subject: [PATCH 29/30] commenting #1716 --- .../mapbox/mapboxgl/annotations/Circle.java | 6 +++ .../mapboxgl/annotations/CircleOptions.java | 16 +++----- .../mapbox/mapboxgl/annotations/Marker.java | 8 ++++ .../mapbox/mapboxgl/annotations/Polygon.java | 12 ++++++ .../mapboxgl/annotations/PolygonOptions.java | 37 +++++++++++++++++++ .../mapboxgl/annotations/PolylineOptions.java | 5 +++ 6 files changed, 74 insertions(+), 10 deletions(-) diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Circle.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Circle.java index 6111e959f..f8908465b 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Circle.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Circle.java @@ -5,6 +5,12 @@ import android.graphics.Color; import com.mapbox.mapboxgl.geometry.LatLng; +/** + * UNIMPLEMENTED: Needs implementation in Native. + * + * https://github.com/mapbox/mapbox-gl-native/issues/1882 + * https://github.com/mapbox/mapbox-gl-native/issues/1726 + */ public class Circle extends Annotation { LatLng center; diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java index 8a488e072..5e97d5b5e 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/CircleOptions.java @@ -3,6 +3,12 @@ package com.mapbox.mapboxgl.annotations; import com.mapbox.mapboxgl.geometry.LatLng; +/** + * UNIMPLEMENTED: Needs implementation in Native. + * + * https://github.com/mapbox/mapbox-gl-native/issues/1882 + * https://github.com/mapbox/mapbox-gl-native/issues/1726 + */ public class CircleOptions extends AnnotationOptions { private Circle circle; @@ -40,11 +46,6 @@ public class CircleOptions extends AnnotationOptions { return circle.strokeWidth; } - // TODO: Implement getZIndex of Google Maps Android API -// public float getZIndex () { -// -// } - public CircleOptions radius (double radius) { circle.radius = radius; return this; @@ -60,9 +61,4 @@ public class CircleOptions extends AnnotationOptions { return this; } - // TODO: Implement zIndex of Google Maps Android API -// public CircleOptions zIndex (float zIndex) { -// -// } - } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java index ea4fc41e2..5a3c44bdd 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java @@ -114,6 +114,14 @@ public class Marker extends Annotation { this.snippet = snippet; } + /** + * You can specify the name of a sprite to get a marker other than the default marker. + * This name can be found in the sprite json file: + * + * https://github.com/mapbox/mapbox-gl-styles/blob/mb-pages/sprites/mapbox-streets.json + * + * @param sprite + */ void setSprite(String sprite) { this.sprite = sprite; } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java index 475a2a93c..41edb2a5d 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Polygon.java @@ -34,6 +34,11 @@ public class Polygon extends MultiPoint { return strokeColor; } + /** + * UNIMPLEMENTED: Needs implementation in Native. + * https://github.com/mapbox/mapbox-gl-native/issues/1737 + * @return stroke width as float + */ public float getStrokeWidth() { return strokeWidth; } @@ -61,6 +66,8 @@ public class Polygon extends MultiPoint { /** * Sets the alpha (opacity) of the stroke + * + * UNIMPLEMENTED: Needs implementation in Native. */ public void setStrokeAlpha(float alpha) { strokeAlpha = alpha; @@ -70,6 +77,11 @@ public class Polygon extends MultiPoint { strokeColor = color; } + /** + * UNIMPLEMENTED: Needs implementation in Native. + * https://github.com/mapbox/mapbox-gl-native/issues/1737 + * @return stroke width as float + */ public void setStrokeWidth(float width) { strokeWidth = width; } diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java index a640b585d..25ee75019 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolygonOptions.java @@ -31,6 +31,13 @@ public class PolygonOptions extends MultiPointOptions { return this; } + /** + * UNIMPLEMENTED: Needs implementation in Native. + * https://github.com/mapbox/mapbox-gl-native/issues/1729 + * + * @param points - an iterable (list) of points for cutting a hole + * @return PolygonOptions - the options object + */ public PolygonOptions addHole (Iterable points) { List hole = new ArrayList<>(); for (LatLng point : points) { @@ -40,6 +47,12 @@ public class PolygonOptions extends MultiPointOptions { return this; } + /** + * Sets the color of the polygon. + * + * @param color - the color in ARGB format + * @return PolygonOptions - the options object + */ public PolygonOptions fillColor(int color) { ((Polygon)annotation).fillColor = color; return this; @@ -49,6 +62,12 @@ public class PolygonOptions extends MultiPointOptions { return ((Polygon)annotation).fillColor; } + /** + * UNIMPLEMENTED: Needs implementation in Native. + * https://github.com/mapbox/mapbox-gl-native/issues/1729 + * + * @return a list of lists of points for cutting holes + */ public List> getHoles() { return ((Polygon)annotation).holes; } @@ -61,15 +80,33 @@ public class PolygonOptions extends MultiPointOptions { return ((Polygon)annotation).strokeColor; } + /** + * UNIMPLEMENTED: Needs implementation in Native. + * https://github.com/mapbox/mapbox-gl-native/issues/1737 + * + * @return stroke width as float + */ public float getStrokeWidth() { return ((Polygon)annotation).strokeWidth; } + /** + * Sets the color of the stroke of the polygon. + * + * @param color - the color in ARGB format + * @return PolygonOptions - the options object + */ public PolygonOptions strokeColor(int color) { ((Polygon)annotation).strokeColor = color; return this; } + /** + * UNIMPLEMENTED: Needs implementation in Native. + * https://github.com/mapbox/mapbox-gl-native/issues/1737 + * + * @return stroke width as float + */ public PolygonOptions strokeWidth(float width) { ((Polygon)annotation).strokeWidth = width; return this; diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java index 41de7d51a..d825399f7 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/PolylineOptions.java @@ -29,6 +29,11 @@ public class PolylineOptions extends MultiPointOptions { return this; } + /** + * Sets the color of the polyline. + * + * @param color - the color in ARGB format + */ public PolylineOptions color(int color) { ((Polyline)annotation).color = color; return this; From 0f56c2b0d5766996d51c73f5e131ec8df21d5fca Mon Sep 17 00:00:00 2001 From: Nicholas Hallahan Date: Fri, 17 Jul 2015 13:12:47 -0700 Subject: [PATCH 30/30] marker equals method #1716 --- .../com/mapbox/mapboxgl/annotations/Marker.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java index 5a3c44bdd..f0c53a36c 100644 --- a/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java +++ b/android/java/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxgl/annotations/Marker.java @@ -21,11 +21,20 @@ public class Marker extends Annotation { public Marker() {} + /** + * If two markers have the same LatLng, they are equal. + * + * @param other object + * @return boolean - do they have the same LatLng + */ public boolean equals(Object other) { + if (!(other instanceof Marker)) return false; double lat = position.getLatitude(); double lng = position.getLongitude(); - // TODO Implement equals - return false; + LatLng otherPosition = ((Marker)other).getPosition(); + double otherLat = otherPosition.getLatitude(); + double otherLng = otherPosition.getLongitude(); + return (lat == otherLat && otherLng == lng); } public float getAlpha() {