diff options
author | Justin R. Miller <incanus@codesorcery.net> | 2015-02-16 09:52:36 -0800 |
---|---|---|
committer | Justin R. Miller <incanus@codesorcery.net> | 2015-02-16 09:52:36 -0800 |
commit | 6e41664cb033ee5edf6ae5ac66ed518d9f0d1f89 (patch) | |
tree | a70192b174ea6dc69b1fa0b13f9a33358a9110e5 /android | |
parent | ea31ad99a56f1e0afbcc7862ddc62dffd16bc5bb (diff) | |
download | qtlocation-mapboxgl-6e41664cb033ee5edf6ae5ac66ed518d9f0d1f89.tar.gz |
fixes #476 & #853: pixel/meter/latlng conversion routines in core & iOS
Diffstat (limited to 'android')
-rw-r--r-- | android/cpp/jni.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/android/cpp/jni.cpp b/android/cpp/jni.cpp index 56de8ff1b4..b1bfefe280 100644 --- a/android/cpp/jni.cpp +++ b/android/cpp/jni.cpp @@ -467,17 +467,16 @@ void JNICALL nativeSetLonLat(JNIEnv *env, jobject obj, jlong nativeMapViewPtr, j return; } - nativeMapView->getMap().setLonLat(lon, lat, std::chrono::milliseconds(duration)); + nativeMapView->getMap().setLatLng(mbgl::LatLng(lat, lon), std::chrono::milliseconds(duration)); } jobject JNICALL nativeGetLonLat(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetLonLat"); assert(nativeMapViewPtr != 0); NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); - double lon = 0.0, lat = 0.0; - nativeMapView->getMap().getLonLat(lon, lat); + mbgl::LatLng latLng = nativeMapView->getMap().getLatLng(); - jobject ret = env->NewObject(lonLatClass, lonLatConstructorId, lon, lat); + jobject ret = env->NewObject(lonLatClass, lonLatConstructorId, latLng.longitude, latLng.latitude); if (ret == nullptr) { env->ExceptionDescribe(); return nullptr; @@ -569,17 +568,17 @@ void JNICALL nativeSetLonLatZoom(JNIEnv *env, jobject obj, jlong nativeMapViewPt return; } - nativeMapView->getMap().setLonLatZoom(lon, lat, zoom, std::chrono::milliseconds(duration)); + nativeMapView->getMap().setLatLngZoom(mbgl::LatLng(lat, lon), zoom, std::chrono::milliseconds(duration)); } jobject JNICALL nativeGetLonLatZoom(JNIEnv *env, jobject obj, jlong nativeMapViewPtr) { mbgl::Log::Debug(mbgl::Event::JNI, "nativeGetLonLatZoom"); assert(nativeMapViewPtr != 0); NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr); - double lon = 0.0, lat = 0.0, zoom = 0.0; - nativeMapView->getMap().getLonLatZoom(lon, lat, zoom); + mbgl::LatLng latLng = nativeMapView->getMap().getLatLng(); + double zoom = nativeMapView->getMap().getZoom(); - jobject ret = env->NewObject(lonLatZoomClass, lonLatZoomConstructorId, lon, lat, zoom); + jobject ret = env->NewObject(lonLatZoomClass, lonLatZoomConstructorId, latLng.longitude, latLng.latitude, zoom); if (ret == nullptr) { env->ExceptionDescribe(); return nullptr; |