fixes #476 & #853: pixel/meter/latlng conversion routines in core & iOS

This commit is contained in:
Justin R. Miller
2015-02-16 09:52:36 -08:00
parent ea31ad99a5
commit 6e41664cb0
19 changed files with 399 additions and 142 deletions

View File

@@ -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;