diff options
author | Roman Romanov <rromanov@65gb.net> | 2016-11-24 07:44:23 +0300 |
---|---|---|
committer | Roman Romanov <rromanov@65gb.net> | 2016-11-24 07:46:03 +0300 |
commit | e197c059713ee2edbeccadc2a5a9f3cc042a12bb (patch) | |
tree | 87833d370c85bfce84e1d4b08921f189669a72c2 | |
parent | 228f3c130eef521f56355a81a222f2777ff7531b (diff) |
[android] Review fixes
-rw-r--r-- | android/jni/com/mapswithme/maps/Framework.cpp | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index 3940fe0622..6fd1ed8af1 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -625,42 +625,45 @@ Java_com_mapswithme_maps_Framework_nativeSetMapObjectListener(JNIEnv * env, jcla }); } -JNIEXPORT void JNICALL Java_com_mapswithme_maps_Framework_nativeRestoreMapObject(JNIEnv * env, - jclass clazz, - jobject jMapObject) +JNIEXPORT void JNICALL +Java_com_mapswithme_maps_Framework_nativeRestoreMapObject(JNIEnv * env, jclass clazz, + jobject jMapObject) { - jmethodID const getMapObjectTypeId = jni::GetMethodID(env, jMapObject, "getMapObjectType", "()I"); + static jmethodID const getMapObjectTypeId = + jni::GetMethodID(env, jMapObject, "getMapObjectType", "()I"); place_page::Info info; jint type = env->CallIntMethod(jMapObject, getMapObjectTypeId); switch (type) { - case 2: - { - jmethodID const getCategoryId = jni::GetMethodID(env, jMapObject, "getCategoryId", "()I"); - jmethodID const getBookmarkId = jni::GetMethodID(env, jMapObject, "getBookmarkId", "()I"); - jint categoryId = env->CallIntMethod(jMapObject, getCategoryId); - jint bookmarkId = env->CallIntMethod(jMapObject, getBookmarkId); - BookmarkAndCategory bnc = BookmarkAndCategory(bookmarkId, categoryId); - BookmarkCategory * pCat = frm()->GetBmCategory(categoryId); - Bookmark const * pBmk = static_cast<Bookmark const *>(pCat->GetUserMark(bookmarkId)); - frm()->FillBookmarkInfo(*pBmk, bnc, info); - break; - } - case 3: - { - frm()->FillMyPositionInfo(info); - break; - } - default: - { - jmethodID const getLatId = jni::GetMethodID(env, jMapObject, "getLat", "()D"); - jmethodID const getLonId = jni::GetMethodID(env, jMapObject, "getLon", "()D"); - jdouble lat = env->CallDoubleMethod(jMapObject, getLatId); - jdouble lon = env->CallDoubleMethod(jMapObject, getLonId); - frm()->FillPoiInfo(m2::PointD(MercatorBounds::FromLatLon(lat, lon)), info); - break; - } + case usermark_helper::kBookmark: + { + static jmethodID const getCategoryId = + jni::GetMethodID(env, jMapObject, "getCategoryId", "()I"); + static jmethodID const getBookmarkId = + jni::GetMethodID(env, jMapObject, "getBookmarkId", "()I"); + jint categoryId = env->CallIntMethod(jMapObject, getCategoryId); + jint bookmarkId = env->CallIntMethod(jMapObject, getBookmarkId); + BookmarkAndCategory bnc = BookmarkAndCategory(bookmarkId, categoryId); + BookmarkCategory * pCat = frm()->GetBmCategory(categoryId); + Bookmark const * pBmk = static_cast<Bookmark const *>(pCat->GetUserMark(bookmarkId)); + frm()->FillBookmarkInfo(*pBmk, bnc, info); + break; + } + case usermark_helper::kMyPosition: + { + frm()->FillMyPositionInfo(info); + break; + } + default: + { + static jmethodID const getLatId = jni::GetMethodID(env, jMapObject, "getLat", "()D"); + static jmethodID const getLonId = jni::GetMethodID(env, jMapObject, "getLon", "()D"); + jdouble lat = env->CallDoubleMethod(jMapObject, getLatId); + jdouble lon = env->CallDoubleMethod(jMapObject, getLonId); + frm()->FillPoiInfo(m2::PointD(MercatorBounds::FromLatLon(lat, lon)), info); + break; + } } g_framework->SetPlacePageInfo(info); |