forked from organicmaps/organicmaps
[android] [bookmarks] Fixes according to code review.
This commit is contained in:
parent
d8f5301f4c
commit
aaa038a0ee
21 changed files with 113 additions and 180 deletions
|
@ -292,7 +292,7 @@ namespace android
|
|||
|
||||
if (eventType == NV_MULTITOUCH_MOVE)
|
||||
{
|
||||
double const minDist = m_work.GetRenderPolicy()->VisualScale() * 10.0;
|
||||
double const minDist = m_work.GetVisualScale() * 10.0;
|
||||
if ((fabs(x1 - m_lastX1) > minDist) || (fabs(y1 - m_lastY1) > minDist))
|
||||
{
|
||||
m_isCleanSingleClick = false;
|
||||
|
@ -560,7 +560,7 @@ namespace android
|
|||
|
||||
// 1. check if we tapped on existing bookmark - show popup and exit
|
||||
BookmarkAndCategory bac = m_work.GetBookmark(pt);
|
||||
if (ValidateBookmarkAndCategory(bac))
|
||||
if (IsValid(bac))
|
||||
{
|
||||
Bookmark const * pBM = m_work.GetBmCategory(bac.first)->GetBookmark(bac.second);
|
||||
ActivatePopup(pBM->GetOrg(), pBM->GetName(), IMAGE_ARROW);
|
||||
|
@ -635,7 +635,7 @@ namespace android
|
|||
if (GetPlatform().IsPro())
|
||||
{
|
||||
bac = m_work.GetBookmark(m_work.GtoP(balloon->glbPivot()));
|
||||
if (!ValidateBookmarkAndCategory(bac))
|
||||
if (!IsValid(bac))
|
||||
{
|
||||
// add new bookmark
|
||||
Bookmark bm(balloon->glbPivot(), balloon->bookmarkName(), m_bmType);
|
||||
|
|
|
@ -65,11 +65,6 @@ namespace android
|
|||
|
||||
void ActivatePopupWithAddressInfo(m2::PointD const & pos, ::Framework::AddressInfo const & addrInfo);
|
||||
|
||||
static inline bool ValidateBookmarkAndCategory(BookmarkAndCategory const & bac)
|
||||
{
|
||||
return (bac.first > -1 && bac.second > -1);
|
||||
}
|
||||
|
||||
shared_ptr<BookmarkBalloon> m_bmBaloon;
|
||||
string m_bmCategory;
|
||||
string m_bmType;
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
#include "../core/jni_helper.hpp"
|
||||
|
||||
#include "../../../../../indexer/mercator.hpp"
|
||||
|
||||
|
||||
class SearchAdapter
|
||||
{
|
||||
|
@ -236,8 +234,6 @@ Java_com_mapswithme_maps_SearchActivity_nativeGetResult(
|
|||
}
|
||||
}
|
||||
|
||||
m2::PointD rp = res->GetFeatureCenter();
|
||||
m2::PointD mer(rp.x, rp.y);
|
||||
return env->NewObject(klass, methodID,
|
||||
jni::ToJavaString(env, res->GetString()),
|
||||
jni::ToJavaString(env, res->GetRegionString()),
|
||||
|
|
|
@ -20,27 +20,27 @@ namespace
|
|||
extern "C"
|
||||
{
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_nGtoP(JNIEnv * env, jobject thiz, jdouble x, jdouble y)
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_g2p(JNIEnv * env, jobject thiz, jdouble x, jdouble y)
|
||||
{
|
||||
return jni::GetNewParcelablePointD(env, frm()->GtoP(m2::PointD(x, y)));
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_nGetName(
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_getName(
|
||||
JNIEnv * env, jobject thiz, jint cat, jlong bmk)
|
||||
{
|
||||
return jni::ToJavaString(env, getBookmark(cat, bmk)->GetName());
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_nGetBookmarkDescription(
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_getBookmarkDescription(
|
||||
JNIEnv * env, jobject thiz, jint cat, jlong bmk)
|
||||
{
|
||||
return jni::ToJavaString(env, getBookmark(cat, bmk)->GetDescription());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_nSetBookmarkDescription(
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_setBookmarkDescription(
|
||||
JNIEnv * env, jobject thiz, jint cat, jlong bmk, jstring newDescr)
|
||||
{
|
||||
// do edit bookmark's description without AddBookmark routine
|
||||
|
@ -50,7 +50,7 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_nGetNamePos(
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_getNamePos(
|
||||
JNIEnv * env, jobject thiz, jint px, jint py)
|
||||
{
|
||||
BookmarkAndCategory bc = frm()->GetBookmark(m2::PointD(px, py));
|
||||
|
@ -58,14 +58,14 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_nGetIcon(
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_getIcon(
|
||||
JNIEnv * env, jobject thiz, jint cat, jlong bmk)
|
||||
{
|
||||
return jni::ToJavaString(env, getBookmark(cat, bmk)->GetType());
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_nGetIconPos(
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_getIconPos(
|
||||
JNIEnv * env, jobject thiz, jint px, jint py)
|
||||
{
|
||||
BookmarkAndCategory bc = frm()->GetBookmark(m2::PointD(px, py));
|
||||
|
@ -73,7 +73,7 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_nChangeBookmark(
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_changeBookmark(
|
||||
JNIEnv * env, jobject thiz, jdouble x, jdouble y, jstring cat, jstring name, jstring type)
|
||||
{
|
||||
// get existing bookmark under point
|
||||
|
@ -81,7 +81,7 @@ extern "C"
|
|||
|
||||
// initialize new bookmark
|
||||
Bookmark bm(m2::PointD(x, y), jni::ToNativeString(env, name), jni::ToNativeString(env, type));
|
||||
if (bac.first > -1 && bac.second > -1)
|
||||
if (IsValid(bac))
|
||||
bm.SetDescription(getBookmark(bac.first, bac.second)->GetDescription());
|
||||
|
||||
// add new bookmark
|
||||
|
@ -98,14 +98,14 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_nPtoG(
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_p2g(
|
||||
JNIEnv * env, jobject thiz, jdouble px, jdouble py)
|
||||
{
|
||||
return jni::GetNewParcelablePointD(env, frm()->PtoG(m2::PointD(px, py)));
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_nGetDistanceAndAzimuth(
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_getDistanceAndAzimut(
|
||||
JNIEnv * env, jobject thiz, jdouble x, jdouble y, jdouble cLat, jdouble cLon, jdouble north)
|
||||
{
|
||||
string distance;
|
||||
|
@ -113,7 +113,7 @@ extern "C"
|
|||
g_framework->NativeFramework()->GetDistanceAndAzimut(
|
||||
m2::PointD(x, y), cLat, cLon, north, distance, azimut);
|
||||
|
||||
jclass klass = env->FindClass("com/mapswithme/maps/bookmarks/data/DistanceAndAthimuth");
|
||||
jclass klass = env->FindClass("com/mapswithme/maps/bookmarks/data/DistanceAndAzimut");
|
||||
ASSERT ( klass, () );
|
||||
jmethodID methodID = env->GetMethodID(
|
||||
klass, "<init>",
|
||||
|
@ -126,7 +126,7 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_nGetXY(
|
||||
Java_com_mapswithme_maps_bookmarks_data_Bookmark_getXY(
|
||||
JNIEnv * env, jobject thiz, jint cat, jlong bmk)
|
||||
{
|
||||
return jni::GetNewParcelablePointD(env, getBookmark(cat, bmk)->GetOrg());
|
||||
|
|
|
@ -18,14 +18,14 @@ extern "C"
|
|||
{
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkCategory_nIsVisible(
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkCategory_isVisible(
|
||||
JNIEnv * env, jobject thiz, jint id)
|
||||
{
|
||||
return getBmCategory(id)->IsVisible();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkCategory_nSetVisibility(
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkCategory_setVisibility(
|
||||
JNIEnv * env, jobject thiz, jint id, jboolean b)
|
||||
{
|
||||
BookmarkCategory * pCat = getBmCategory(id);
|
||||
|
@ -34,7 +34,7 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkCategory_nSetName(
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkCategory_setName(
|
||||
JNIEnv * env, jobject thiz, jint id, jstring n)
|
||||
{
|
||||
BookmarkCategory * pCat = getBmCategory(id);
|
||||
|
@ -43,14 +43,14 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkCategory_nGetName(
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkCategory_getName(
|
||||
JNIEnv * env, jobject thiz, jint id)
|
||||
{
|
||||
return jni::ToJavaString(env, getBmCategory(id)->GetName());
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkCategory_nGetSize(
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkCategory_getSize(
|
||||
JNIEnv * env, jobject thiz, jint id)
|
||||
{
|
||||
return getBmCategory(id)->GetBookmarksCount();
|
||||
|
|
|
@ -10,33 +10,29 @@ namespace
|
|||
extern "C"
|
||||
{
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nGetPOI(
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_getPOI(
|
||||
JNIEnv * env, jobject thiz, jdouble px, jdouble py)
|
||||
{
|
||||
Framework::AddressInfo adInfo;
|
||||
Framework::AddressInfo addrInfo;
|
||||
m2::PointD pxPivot;
|
||||
if (frm()->GetVisiblePOI(m2::PointD(px, py), pxPivot, adInfo))
|
||||
{
|
||||
return jni::GetNewAddressInfo(env, adInfo, pxPivot);
|
||||
}
|
||||
if (frm()->GetVisiblePOI(m2::PointD(px, py), pxPivot, addrInfo))
|
||||
return jni::GetNewAddressInfo(env, addrInfo, pxPivot);
|
||||
else
|
||||
{
|
||||
return env->NewGlobalRef(NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nGetAddressInfo(
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_getAddressInfo(
|
||||
JNIEnv * env, jobject thiz, jdouble px, jdouble py)
|
||||
{
|
||||
m2::PointD point(px, py);
|
||||
Framework::AddressInfo adInfo;
|
||||
frm()->GetAddressInfo(point, adInfo);
|
||||
return jni::GetNewAddressInfo(env, adInfo, point);
|
||||
Framework::AddressInfo addrInfo;
|
||||
frm()->GetAddressInfo(point, addrInfo);
|
||||
return jni::GetNewAddressInfo(env, addrInfo, point);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nShowBookmark(
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_showBookmarkOnMap(
|
||||
JNIEnv * env, jobject thiz, jint c, jint b)
|
||||
{
|
||||
frm()->ShowBookmark(*(frm()->GetBmCategory(c)->GetBookmark(b)));
|
||||
|
@ -44,7 +40,7 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nLoadBookmarks(JNIEnv * env, jobject thiz)
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_loadBookmarks(JNIEnv * env, jobject thiz)
|
||||
{
|
||||
frm()->LoadBookmarks();
|
||||
}
|
||||
|
@ -56,21 +52,21 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nIsCategoryExist(
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_isCategoryExist(
|
||||
JNIEnv * env, jobject thiz, jstring name)
|
||||
{
|
||||
return frm()->IsCategoryExist(jni::ToNativeString(env, name));
|
||||
}
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nDeleteCategory(
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_deleteCategory(
|
||||
JNIEnv * env, jobject thiz, jint index)
|
||||
{
|
||||
return frm()->DeleteBmCategory(index);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nDeleteBookmark(
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_deleteBookmark(
|
||||
JNIEnv * env, jobject thiz, jint cat, jint bmk)
|
||||
{
|
||||
BookmarkCategory * pCat = frm()->GetBmCategory(cat);
|
||||
|
@ -82,11 +78,10 @@ extern "C"
|
|||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nGetBookmark(
|
||||
Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_getBookmark(
|
||||
JNIEnv * env, jobject thiz, jdouble px, jdouble py)
|
||||
{
|
||||
BookmarkAndCategory bac = frm()->GetBookmark(m2::PointD(px, py));
|
||||
|
||||
BookmarkAndCategory const bac = frm()->GetBookmark(m2::PointD(px, py));
|
||||
return jni::GetNewPoint(env, m2::PointI(bac.first, bac.second));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<scale xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="125"
|
||||
android:fromXScale="0."
|
||||
android:fromYScale="0."
|
||||
android:pivotX="50%"
|
||||
android:pivotY="100%"
|
||||
android:toXScale="1."
|
||||
android:toYScale="1." >
|
||||
|
||||
</scale>
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<scale xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="125"
|
||||
android:fromXScale="1."
|
||||
android:fromYScale="1."
|
||||
android:pivotX="50%"
|
||||
android:pivotY="100%"
|
||||
android:toXScale="0."
|
||||
android:toYScale="0." >
|
||||
|
||||
</scale>
|
|
@ -1,8 +0,0 @@
|
|||
<resources>
|
||||
|
||||
<style name="PopupWindowAnimation" parent="android:Animation">
|
||||
<item name="android:windowEnterAnimation">@anim/popup_appear</item>
|
||||
<item name="android:windowExitAnimation">@anim/popup_disappear</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
|
@ -50,14 +50,15 @@ public class BookmarkActivity extends AbstractBookmarkActivity
|
|||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.pin);
|
||||
if (getIntent().getExtras().containsKey(PIN))
|
||||
{
|
||||
Point mPinPair = ((ParcelablePoint)getIntent().getParcelableExtra(PIN)).getPoint();
|
||||
mCurrentCategoryId = mPinPair.x;
|
||||
mPin = mManager.getBookmark(mPinPair.x, mPinPair.y);
|
||||
}
|
||||
|
||||
setContentView(R.layout.add_or_edit_bookmark);
|
||||
|
||||
assert(getIntent().getExtras().containsKey(PIN));
|
||||
final Point p = ((ParcelablePoint)getIntent().getParcelableExtra(PIN)).getPoint();
|
||||
|
||||
mPin = mManager.getBookmark(p.x, p.y);
|
||||
mCurrentCategoryId = mPin.getCategoryId();
|
||||
|
||||
setTitle(mPin.getName());
|
||||
setUpViews();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class BookmarkListActivity extends AbstractBookmarkListActivity
|
|||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.pins);
|
||||
setContentView(R.layout.bookmarks_list);
|
||||
final int setIndex = getIntent().getIntExtra(BookmarkActivity.PIN_SET, -1);
|
||||
mEditContent = getIntent().getBooleanExtra(EDIT_CONTENT, true);
|
||||
mEditedSet = mManager.getCategoryById(setIndex);
|
||||
|
|
|
@ -13,7 +13,7 @@ import com.mapswithme.maps.ArrowImage;
|
|||
import com.mapswithme.maps.R;
|
||||
import com.mapswithme.maps.bookmarks.data.Bookmark;
|
||||
import com.mapswithme.maps.bookmarks.data.BookmarkCategory;
|
||||
import com.mapswithme.maps.bookmarks.data.DistanceAndAthimuth;
|
||||
import com.mapswithme.maps.bookmarks.data.DistanceAndAzimut;
|
||||
import com.mapswithme.maps.location.LocationService;
|
||||
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class BookmarkListAdapter extends BaseAdapter implements LocationService.
|
|||
{
|
||||
if (convertView == null)
|
||||
{
|
||||
convertView = LayoutInflater.from(mContext).inflate(R.layout.pin_item, null);
|
||||
convertView = LayoutInflater.from(mContext).inflate(R.layout.bookmark_item, null);
|
||||
convertView.setTag(new PinHolder(convertView));
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class BookmarkListAdapter extends BaseAdapter implements LocationService.
|
|||
final Location loc = mLocation.getLastKnown();
|
||||
if (loc != null)
|
||||
{
|
||||
DistanceAndAthimuth daa = item.getDistanceAndAthimuth(loc.getLatitude(), loc.getLongitude(), mNorth);
|
||||
DistanceAndAzimut daa = item.getDistanceAndAzimut(loc.getLatitude(), loc.getLongitude(), mNorth);
|
||||
holder.distance.setText(daa.getDistance());
|
||||
|
||||
if (daa.getAthimuth() >= 0.0)
|
||||
|
|
|
@ -42,7 +42,7 @@ public class Bookmark
|
|||
String name = getName();
|
||||
mCategoryId = nextCat;
|
||||
changeBookmark(getCategoryName(), name, mIcon.getType());
|
||||
Point bookmark = BookmarkManager.nGetBookmark(position.x, position.y);
|
||||
Point bookmark = BookmarkManager.getBookmark(position.x, position.y);
|
||||
mBookmark = bookmark.y;
|
||||
Log.d("Bookmark indices", " " + mCategoryId+ " "+ mBookmark);
|
||||
}
|
||||
|
@ -60,50 +60,50 @@ public class Bookmark
|
|||
|
||||
private void getXY(ParcelablePointD position)
|
||||
{
|
||||
ParcelablePointD ll = nPtoG(position.x, position.y);
|
||||
ParcelablePointD ll = p2g(position.x, position.y);
|
||||
mMercatorX = ll.x;
|
||||
mMercatorY = ll.y;
|
||||
}
|
||||
|
||||
public static ParcelablePointD GtoP(ParcelablePointD p)
|
||||
{
|
||||
return nGtoP(p.x, p.y);
|
||||
return g2p(p.x, p.y);
|
||||
}
|
||||
|
||||
public static ParcelablePointD PtoG(ParcelablePointD p)
|
||||
{
|
||||
return nPtoG(p.x, p.y);
|
||||
return p2g(p.x, p.y);
|
||||
}
|
||||
|
||||
private native DistanceAndAthimuth nGetDistanceAndAzimuth(double x, double y, double cLat, double cLon, double north);
|
||||
private static native ParcelablePointD nGtoP(double x, double y);
|
||||
private static native ParcelablePointD nPtoG(double px, double py);
|
||||
private native ParcelablePointD nGetXY(int c, long b);
|
||||
private native String nGetNamePos(double px, double py);
|
||||
private native String nGetName(int c, long b);
|
||||
private native String nGetIconPos(double px, double py);
|
||||
private native String nGetIcon(int c, long b);
|
||||
private native void nChangeBookmark(double x, double y, String category, String name, String type);
|
||||
private native String nGetBookmarkDescription(int categoryId, long bookmark);
|
||||
private native void nSetBookmarkDescription(int categoryId, long bookmark, String newDescr);
|
||||
private native String nGetBookmarkDescriptionPos(int categoryId, int bookmark);
|
||||
private native DistanceAndAzimut getDistanceAndAzimut(double x, double y, double cLat, double cLon, double north);
|
||||
private static native ParcelablePointD g2p(double x, double y);
|
||||
private static native ParcelablePointD p2g(double px, double py);
|
||||
private native ParcelablePointD getXY(int c, long b);
|
||||
private native String getNamePos(double px, double py);
|
||||
private native String getName(int c, long b);
|
||||
private native String getIconPos(double px, double py);
|
||||
private native String getIcon(int c, long b);
|
||||
private native void changeBookmark(double x, double y, String category, String name, String type);
|
||||
private native String getBookmarkDescription(int categoryId, long bookmark);
|
||||
private native void setBookmarkDescription(int categoryId, long bookmark, String newDescr);
|
||||
private native String getBookmarkDescriptionPos(int categoryId, int bookmark);
|
||||
|
||||
void getXY()
|
||||
{
|
||||
ParcelablePointD ll = nGetXY(mCategoryId, mBookmark);
|
||||
ParcelablePointD ll = getXY(mCategoryId, mBookmark);
|
||||
mMercatorX = ll.x;
|
||||
mMercatorY = ll.y;
|
||||
mPosition = nGtoP(mMercatorX, mMercatorY);
|
||||
mPosition = g2p(mMercatorX, mMercatorY);
|
||||
}
|
||||
|
||||
public DistanceAndAthimuth getDistanceAndAthimuth(double cLat, double cLon, double north)
|
||||
public DistanceAndAzimut getDistanceAndAzimut(double cLat, double cLon, double north)
|
||||
{
|
||||
return nGetDistanceAndAzimuth(mMercatorX, mMercatorY, cLat, cLon, north);
|
||||
return getDistanceAndAzimut(mMercatorX, mMercatorY, cLat, cLon, north);
|
||||
}
|
||||
|
||||
public ParcelablePointD getPosition()
|
||||
{
|
||||
return nGtoP(mMercatorX, mMercatorY);
|
||||
return g2p(mMercatorX, mMercatorY);
|
||||
}
|
||||
|
||||
public double getLat()
|
||||
|
@ -118,15 +118,7 @@ public class Bookmark
|
|||
|
||||
private Icon getIconInternal()
|
||||
{
|
||||
if (mCategoryId > -1)
|
||||
{
|
||||
return BookmarkManager.getBookmarkManager(mContext).getIconByName(nGetIcon(mCategoryId, mBookmark));
|
||||
}
|
||||
else
|
||||
{
|
||||
return BookmarkManager.getBookmarkManager(mContext).getIconByName("");
|
||||
}
|
||||
|
||||
return BookmarkManager.getBookmarkManager(mContext).getIconByName((mCategoryId >= 0) ? getIcon(mCategoryId, mBookmark) : "");
|
||||
}
|
||||
|
||||
public Icon getIcon()
|
||||
|
@ -136,9 +128,9 @@ public class Bookmark
|
|||
|
||||
public String getName()
|
||||
{
|
||||
if (mCategoryId > -1 && BookmarkManager.getBookmarkManager(mContext).getCategoryById(mCategoryId).getSize() > mBookmark)
|
||||
if (mCategoryId >= 0 && BookmarkManager.getBookmarkManager(mContext).getCategoryById(mCategoryId).getSize() > mBookmark)
|
||||
{
|
||||
return nGetName(mCategoryId, mBookmark);
|
||||
return getName(mCategoryId, mBookmark);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -186,7 +178,7 @@ public class Bookmark
|
|||
|
||||
private void changeBookmark(String category, String name, String type)
|
||||
{
|
||||
nChangeBookmark(mMercatorX, mMercatorY, category, name, type);
|
||||
changeBookmark(mMercatorX, mMercatorY, category, name, type);
|
||||
}
|
||||
|
||||
public int getCategoryId()
|
||||
|
@ -203,7 +195,7 @@ public class Bookmark
|
|||
{
|
||||
//if (!mIsPreviewBookmark)
|
||||
//{
|
||||
return nGetBookmarkDescription(mCategoryId, mBookmark);
|
||||
return getBookmarkDescription(mCategoryId, mBookmark);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
|
@ -213,6 +205,6 @@ public class Bookmark
|
|||
|
||||
public void setDescription(String n)
|
||||
{
|
||||
nSetBookmarkDescription(mCategoryId, mBookmark, n);
|
||||
setBookmarkDescription(mCategoryId, mBookmark, n);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,13 +14,13 @@ public class BookmarkCategory
|
|||
mId = id;
|
||||
}
|
||||
|
||||
private native boolean nIsVisible(int id);
|
||||
private native void nSetVisibility(int id, boolean v);
|
||||
private native boolean isVisible(int id);
|
||||
private native void setVisibility(int id, boolean v);
|
||||
|
||||
private native String nGetName(int id);
|
||||
private native void nSetName(int old, String n);
|
||||
private native String getName(int id);
|
||||
private native void setName(int old, String n);
|
||||
|
||||
private native int nGetSize(int id);
|
||||
private native int getSize(int id);
|
||||
|
||||
public int getId()
|
||||
{
|
||||
|
@ -29,28 +29,28 @@ public class BookmarkCategory
|
|||
|
||||
public String getName()
|
||||
{
|
||||
return mName == null? nGetName(mId): mName;
|
||||
return (mName == null ? getName(mId) : mName);
|
||||
}
|
||||
|
||||
public boolean isVisible()
|
||||
{
|
||||
return nIsVisible(mId);
|
||||
return isVisible(mId);
|
||||
}
|
||||
|
||||
public void setVisibility(boolean b)
|
||||
{
|
||||
nSetVisibility(mId, b);
|
||||
setVisibility(mId, b);
|
||||
}
|
||||
|
||||
public void setName(String name)
|
||||
{
|
||||
nSetName(mId, name);
|
||||
setName(mId, name);
|
||||
mName = name;
|
||||
}
|
||||
|
||||
public int getSize()
|
||||
{
|
||||
return nGetSize(mId);
|
||||
return getSize(mId);
|
||||
}
|
||||
|
||||
public Bookmark getBookmark(int b)
|
||||
|
|
|
@ -35,22 +35,17 @@ public class BookmarkManager
|
|||
|
||||
private void refreshList()
|
||||
{
|
||||
nLoadBookmarks();
|
||||
loadBookmarks();
|
||||
}
|
||||
|
||||
private native void nLoadBookmarks();
|
||||
private native void loadBookmarks();
|
||||
|
||||
public void deleteBookmark(Bookmark bmk)
|
||||
{
|
||||
nDeleteBookmark(bmk.getCategoryId(), bmk.getBookmarkId());
|
||||
deleteBookmark(bmk.getCategoryId(), bmk.getBookmarkId());
|
||||
}
|
||||
|
||||
public void deleteBookmark(int cat, int bmk)
|
||||
{
|
||||
nDeleteBookmark(cat, bmk);
|
||||
}
|
||||
|
||||
private native void nDeleteBookmark(int c, int b);
|
||||
public native void deleteBookmark(int c, int b);
|
||||
|
||||
public BookmarkCategory getCategoryById(int id)
|
||||
{
|
||||
|
@ -66,14 +61,9 @@ public class BookmarkManager
|
|||
|
||||
public native int getCategoriesCount();
|
||||
|
||||
public void deleteCategory(int index)
|
||||
{
|
||||
nDeleteCategory(index);
|
||||
}
|
||||
public native boolean deleteCategory(int index);
|
||||
|
||||
private native boolean nDeleteCategory(int index);
|
||||
|
||||
Icon getIconByName(String name)
|
||||
public Icon getIconByName(String name)
|
||||
{
|
||||
return mIconManager.getIcon(name);
|
||||
}
|
||||
|
@ -85,10 +75,11 @@ public class BookmarkManager
|
|||
|
||||
public Bookmark getBookmark(ParcelablePointD p)
|
||||
{
|
||||
Point bookmark = nGetBookmark(p.x, p.y);
|
||||
Point bookmark = getBookmark(p.x, p.y);
|
||||
if (bookmark.x == -1 && bookmark.y == -1)
|
||||
{
|
||||
return new Bookmark(mContext, p, getCategoriesCount() - 1, getCategoriesCount() - 1 >= 0 ? getCategoryById(getCategoriesCount() - 1).getSize() : 0);
|
||||
final int index = getCategoriesCount() - 1;
|
||||
return new Bookmark(mContext, p, index, index >= 0 ? getCategoryById(index).getSize() : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -98,16 +89,14 @@ public class BookmarkManager
|
|||
|
||||
public ParcelablePoint findBookmark(ParcelablePointD p)
|
||||
{
|
||||
Point bookmark = nGetBookmark(p.x, p.y);
|
||||
if (bookmark.x>=0 && bookmark.y>=0)
|
||||
{
|
||||
Point bookmark = getBookmark(p.x, p.y);
|
||||
if (bookmark.x >= 0 && bookmark.y >= 0)
|
||||
return new ParcelablePoint(bookmark);
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
static native Point nGetBookmark(double px, double py);
|
||||
public static native Point getBookmark(double px, double py);
|
||||
|
||||
public Bookmark getBookmark(int cat, int bmk)
|
||||
{
|
||||
|
@ -120,7 +109,7 @@ public class BookmarkManager
|
|||
|
||||
/// @todo Probably adding "-copy" suffix is better here (Mac OS style).
|
||||
int i = 0;
|
||||
while (nIsCategoryExist(name))
|
||||
while (isCategoryExist(name))
|
||||
name = newName + " " + (++i);
|
||||
|
||||
return name;
|
||||
|
@ -137,7 +126,7 @@ public class BookmarkManager
|
|||
cat.setName(getUniqueName(newName));
|
||||
}
|
||||
|
||||
private native boolean nIsCategoryExist(String name);
|
||||
private native boolean isCategoryExist(String name);
|
||||
|
||||
/*
|
||||
public Bookmark previewBookmark(AddressInfo info)
|
||||
|
@ -146,29 +135,24 @@ public class BookmarkManager
|
|||
}
|
||||
*/
|
||||
|
||||
private native void nShowBookmark(int c, int b);
|
||||
public native void showBookmarkOnMap(int c, int b);
|
||||
|
||||
public void showBookmarkOnMap(int c, int b)
|
||||
{
|
||||
nShowBookmark(c, b);
|
||||
}
|
||||
|
||||
private native String nGetNameForPlace(double px, double py);
|
||||
private native String getNameForPlace(double px, double py);
|
||||
|
||||
public String getNameForPlace(ParcelablePointD p)
|
||||
{
|
||||
return Utils.toTitleCase(nGetNameForPlace(p.x,p.y));
|
||||
return Utils.toTitleCase(getNameForPlace(p.x,p.y));
|
||||
}
|
||||
|
||||
public AddressInfo getPOI(ParcelablePointD px)
|
||||
{
|
||||
return nGetPOI(px.x, px.y);
|
||||
return getPOI(px.x, px.y);
|
||||
}
|
||||
private native AddressInfo nGetPOI(double px, double py);
|
||||
private native AddressInfo getPOI(double px, double py);
|
||||
|
||||
public AddressInfo getAddressInfo(ParcelablePointD px)
|
||||
{
|
||||
return nGetAddressInfo(px.x, px.y);
|
||||
return getAddressInfo(px.x, px.y);
|
||||
}
|
||||
private native AddressInfo nGetAddressInfo(double px, double py);
|
||||
private native AddressInfo getAddressInfo(double px, double py);
|
||||
}
|
||||
|
|
|
@ -86,12 +86,6 @@ protected:
|
|||
|
||||
scoped_ptr<RenderPolicy> m_renderPolicy;
|
||||
|
||||
/// Safe function to get current visual scale.
|
||||
/// Call it when you need do calculate pixel rect (not matter if m_renderPolicy == 0).
|
||||
/// @return 1.0 if m_renderPolicy == 0 (possible for Android).
|
||||
double GetVisualScale() const;
|
||||
int GetScaleEtalonSize() const;
|
||||
|
||||
double m_StartForegroundTime;
|
||||
|
||||
//bool m_hasPendingInvalidate, m_doForceUpdate, m_queryMaxScaleMode, m_drawPlacemark, m_hasPendingShowRectFixed;
|
||||
|
@ -245,6 +239,12 @@ public:
|
|||
InformationDisplay & GetInformationDisplay();
|
||||
CountryStatusDisplay * GetCountryStatusDisplay() const;
|
||||
|
||||
/// Safe function to get current visual scale.
|
||||
/// Call it when you need do calculate pixel rect (not matter if m_renderPolicy == 0).
|
||||
/// @return 1.0 if m_renderPolicy == 0 (possible for Android).
|
||||
double GetVisualScale() const;
|
||||
int GetScaleEtalonSize() const;
|
||||
|
||||
void PrepareToShutdown();
|
||||
|
||||
void SetupMeasurementSystem();
|
||||
|
|
Loading…
Add table
Reference in a new issue