forked from organicmaps/organicmaps
[android] Implements Track Editing
Signed-off-by: kavikhalique <kavikhalique3@gmail.com>
This commit is contained in:
parent
957b379e18
commit
55038e1cd6
11 changed files with 282 additions and 22 deletions
|
@ -583,11 +583,21 @@ void Framework::ReplaceBookmark(kml::MarkId markId, kml::BookmarkData & bm)
|
|||
m_work.GetBookmarkManager().GetEditSession().UpdateBookmark(markId, bm);
|
||||
}
|
||||
|
||||
void Framework::ReplaceTrack(kml::TrackId trackId, kml::TrackData & trackData)
|
||||
{
|
||||
m_work.GetBookmarkManager().GetEditSession().UpdateTrack(trackId, trackData);
|
||||
}
|
||||
|
||||
void Framework::MoveBookmark(kml::MarkId markId, kml::MarkGroupId curCat, kml::MarkGroupId newCat)
|
||||
{
|
||||
m_work.GetBookmarkManager().GetEditSession().MoveBookmark(markId, curCat, newCat);
|
||||
}
|
||||
|
||||
void Framework::MoveTrack(kml::TrackId trackId, kml::MarkGroupId curCat, kml::MarkGroupId newCat)
|
||||
{
|
||||
m_work.GetBookmarkManager().GetEditSession().MoveTrack(trackId, curCat, newCat);
|
||||
}
|
||||
|
||||
void Framework::ExecuteMapApiRequest()
|
||||
{
|
||||
return m_work.ExecuteMapApiRequest();
|
||||
|
|
|
@ -159,7 +159,9 @@ namespace android
|
|||
void Scale(m2::PointD const & centerPt, int targetZoom, bool animate);
|
||||
|
||||
void ReplaceBookmark(kml::MarkId markId, kml::BookmarkData & bm);
|
||||
void ReplaceTrack(kml::TrackId trackId, kml::TrackData & trackData);
|
||||
void MoveBookmark(kml::MarkId markId, kml::MarkGroupId curCat, kml::MarkGroupId newCat);
|
||||
void MoveTrack(kml::TrackId trackId, kml::MarkGroupId curCat, kml::MarkGroupId newCat);
|
||||
|
||||
::Framework * NativeFramework();
|
||||
|
||||
|
|
|
@ -790,6 +790,32 @@ Java_app_organicmaps_bookmarks_data_BookmarkManager_nativeSetBookmarkParams(
|
|||
g_framework->ReplaceBookmark(static_cast<kml::MarkId>(bmk), bmData);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_bookmarks_data_BookmarkManager_nativeSetTrackParams(
|
||||
JNIEnv * env, jclass, jlong trackId,
|
||||
jstring name, jint color, jstring descr)
|
||||
{
|
||||
auto const * nTrack = frm()->GetBookmarkManager().GetTrack(static_cast<kml::TrackId>(trackId));
|
||||
ASSERT(nTrack, ("Track must not be null with id:", trackId));
|
||||
|
||||
kml::TrackData trackData(nTrack->GetData());
|
||||
auto const trkName = jni::ToNativeString(env, name);
|
||||
if (nTrack->GetName() != trkName)
|
||||
kml::SetDefaultStr(trackData.m_name, trkName);
|
||||
if (descr)
|
||||
kml::SetDefaultStr(trackData.m_description, jni::ToNativeString(env, descr));
|
||||
trackData.m_layers[0].m_color.m_rgba = static_cast<uint32_t>((color << 8) + 255);
|
||||
|
||||
g_framework->ReplaceTrack(static_cast<kml::TrackId>(trackId), trackData);
|
||||
}
|
||||
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_app_organicmaps_bookmarks_data_BookmarkManager_nativeGetTrackDescription(
|
||||
JNIEnv * env, jclass, jlong trackId)
|
||||
{
|
||||
return jni::ToJavaString(env, frm()->GetBookmarkManager().GetTrack(static_cast<kml::TrackId>(trackId))->GetDescription());
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_bookmarks_data_BookmarkManager_nativeChangeBookmarkCategory(
|
||||
JNIEnv *, jclass, jlong oldCat, jlong newCat, jlong bmk)
|
||||
|
@ -798,6 +824,14 @@ Java_app_organicmaps_bookmarks_data_BookmarkManager_nativeChangeBookmarkCategory
|
|||
static_cast<kml::MarkGroupId>(newCat));
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL
|
||||
Java_app_organicmaps_bookmarks_data_BookmarkManager_nativeChangeTrackCategory(
|
||||
JNIEnv *, jclass, jlong oldCat, jlong newCat, jlong trackId)
|
||||
{
|
||||
g_framework->MoveTrack(static_cast<kml::TrackId>(trackId), static_cast<kml::MarkGroupId>(oldCat),
|
||||
static_cast<kml::MarkGroupId>(newCat));
|
||||
}
|
||||
|
||||
JNIEXPORT jobject JNICALL
|
||||
Java_app_organicmaps_bookmarks_data_BookmarkManager_nativeGetBookmarkXY(
|
||||
JNIEnv * env, jclass, jlong bmk)
|
||||
|
|
|
@ -677,6 +677,20 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<ConcatAdapter
|
|||
});
|
||||
}
|
||||
|
||||
private void onTrackEditActionSelected()
|
||||
{
|
||||
Track track = (Track) getBookmarkListAdapter().getItem(mSelectedPosition);
|
||||
EditBookmarkFragment.editTrack(
|
||||
track.getCategoryId(), track.getTrackId(), requireActivity(), getChildFragmentManager(),
|
||||
(trackId, movedFromCategory) ->
|
||||
{
|
||||
if (movedFromCategory)
|
||||
resetSearchAndSort();
|
||||
else
|
||||
getBookmarkListAdapter().notifyDataSetChanged();
|
||||
});
|
||||
}
|
||||
|
||||
private void onDeleteActionSelected()
|
||||
{
|
||||
BookmarkListAdapter adapter = getBookmarkListAdapter();
|
||||
|
@ -742,6 +756,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<ConcatAdapter
|
|||
private ArrayList<MenuBottomSheetItem> getTrackMenuItems(final Track track)
|
||||
{
|
||||
ArrayList<MenuBottomSheetItem> items = new ArrayList<>();
|
||||
items.add(new MenuBottomSheetItem(R.string.edit, R.drawable.ic_edit, this::onTrackEditActionSelected));
|
||||
items.add(new MenuBottomSheetItem(R.string.delete, R.drawable.ic_delete, () -> onDeleteTrackSelected(track.getTrackId())));
|
||||
return items;
|
||||
}
|
||||
|
|
|
@ -608,6 +608,11 @@ public enum BookmarkManager
|
|||
return nativeGetBookmarkDescription(bookmarkId);
|
||||
}
|
||||
|
||||
public String getTrackDescription(@IntRange(from = 0) long trackId)
|
||||
{
|
||||
return nativeGetTrackDescription(trackId);
|
||||
}
|
||||
|
||||
public double getBookmarkScale(@IntRange(from = 0) long bookmarkId)
|
||||
{
|
||||
return nativeGetBookmarkScale(bookmarkId);
|
||||
|
@ -625,6 +630,12 @@ public enum BookmarkManager
|
|||
nativeSetBookmarkParams(bookmarkId, name, color, descr);
|
||||
}
|
||||
|
||||
public void setTrackParams(@IntRange(from = 0) long trackId, @NonNull String name,
|
||||
@Icon.PredefinedColor int color, @NonNull String descr)
|
||||
{
|
||||
nativeSetTrackParams(trackId, name, color, descr);
|
||||
}
|
||||
|
||||
public void changeBookmarkCategory(@IntRange(from = 0) long oldCatId,
|
||||
@IntRange(from = 0) long newCatId,
|
||||
@IntRange(from = 0) long bookmarkId)
|
||||
|
@ -632,6 +643,13 @@ public enum BookmarkManager
|
|||
nativeChangeBookmarkCategory(oldCatId, newCatId, bookmarkId);
|
||||
}
|
||||
|
||||
public void changeTrackCategory(@IntRange(from = 0) long oldCatId,
|
||||
@IntRange(from = 0) long newCatId,
|
||||
@IntRange(from = 0) long trackId)
|
||||
{
|
||||
nativeChangeTrackCategory(oldCatId, newCatId, trackId);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getBookmarkAddress(@IntRange(from = 0) long bookmarkId)
|
||||
{
|
||||
|
@ -647,6 +665,15 @@ public enum BookmarkManager
|
|||
changeBookmarkCategory(bookmarkInfo.getCategoryId(), catId, bookmarkInfo.getBookmarkId());
|
||||
}
|
||||
|
||||
public void notifyCategoryChanging(@NonNull Track track,
|
||||
@IntRange(from = 0) long catId)
|
||||
{
|
||||
if (catId == track.getCategoryId())
|
||||
return;
|
||||
|
||||
changeTrackCategory(track.getCategoryId(), catId, track.getTrackId());
|
||||
}
|
||||
|
||||
public void notifyCategoryChanging(@NonNull Bookmark bookmark, @IntRange(from = 0) long catId)
|
||||
{
|
||||
if (catId == bookmark.getCategoryId())
|
||||
|
@ -682,6 +709,16 @@ public enum BookmarkManager
|
|||
}
|
||||
}
|
||||
|
||||
public void notifyParametersUpdating(@NonNull Track track, @NonNull String name,
|
||||
@Nullable int color, @NonNull String description)
|
||||
{
|
||||
if (!name.equals(track.getName()) || !(color == track.getColor()) ||
|
||||
!description.equals(getTrackDescription(track.getTrackId())))
|
||||
{
|
||||
setTrackParams(track.getTrackId(), name, color, description);
|
||||
}
|
||||
}
|
||||
|
||||
public double getElevationCurPositionDistance(long trackId)
|
||||
{
|
||||
return nativeGetElevationCurPositionDistance(trackId);
|
||||
|
@ -818,6 +855,7 @@ public enum BookmarkManager
|
|||
@NonNull
|
||||
private static native String nativeGetBookmarkDescription(@IntRange(from = 0) long bookmarkId);
|
||||
|
||||
private static native String nativeGetTrackDescription(@IntRange(from = 0) long trackId);
|
||||
private static native double nativeGetBookmarkScale(@IntRange(from = 0) long bookmarkId);
|
||||
|
||||
@NonNull
|
||||
|
@ -829,10 +867,19 @@ public enum BookmarkManager
|
|||
@Icon.PredefinedColor int color,
|
||||
@NonNull String descr);
|
||||
|
||||
private static native void nativeSetTrackParams(@IntRange(from = 0) long trackId,
|
||||
@NonNull String name,
|
||||
@Icon.PredefinedColor int color,
|
||||
@NonNull String descr);
|
||||
|
||||
private static native void nativeChangeBookmarkCategory(@IntRange(from = 0) long oldCatId,
|
||||
@IntRange(from = 0) long newCatId,
|
||||
@IntRange(from = 0) long bookmarkId);
|
||||
|
||||
private static native void nativeChangeTrackCategory(@IntRange(from = 0) long oldCatId,
|
||||
@IntRange(from = 0) long newCatId,
|
||||
@IntRange(from = 0) long trackId);
|
||||
|
||||
@NonNull
|
||||
private static native String nativeGetBookmarkAddress(@IntRange(from = 0) long bookmarkId);
|
||||
|
||||
|
|
|
@ -33,4 +33,9 @@ public class Track
|
|||
public long getTrackId() { return mTrackId; }
|
||||
|
||||
public long getCategoryId() { return mCategoryId; }
|
||||
|
||||
public String getTrackDescription()
|
||||
{
|
||||
return BookmarkManager.INSTANCE.getTrackDescription(mTrackId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import app.organicmaps.bookmarks.data.BookmarkCategory;
|
|||
import app.organicmaps.bookmarks.data.BookmarkInfo;
|
||||
import app.organicmaps.bookmarks.data.BookmarkManager;
|
||||
import app.organicmaps.bookmarks.data.Icon;
|
||||
import app.organicmaps.bookmarks.data.Track;
|
||||
import app.organicmaps.util.Graphics;
|
||||
import app.organicmaps.util.InputUtils;
|
||||
import app.organicmaps.util.UiUtils;
|
||||
|
@ -41,6 +42,8 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
|
|||
{
|
||||
public static final String EXTRA_CATEGORY_ID = "CategoryId";
|
||||
public static final String EXTRA_BOOKMARK_ID = "BookmarkId";
|
||||
public static final String EXTRA_BOOKMARK_TYPE = "BookmarkType";
|
||||
public static final String EXTRA_TRACK_ID = "TrackId";
|
||||
|
||||
private TextInputEditText mEtDescription;
|
||||
private TextInputEditText mEtName;
|
||||
|
@ -55,6 +58,9 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
|
|||
private BookmarkInfo mBookmark;
|
||||
@Nullable
|
||||
private EditBookmarkListener mListener;
|
||||
private Track mTrack;
|
||||
private int mType;
|
||||
private int mColor = -1;
|
||||
|
||||
public interface EditBookmarkListener
|
||||
{
|
||||
|
@ -66,6 +72,7 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
|
|||
@Nullable EditBookmarkListener listener)
|
||||
{
|
||||
final Bundle args = new Bundle();
|
||||
args.putInt(EXTRA_BOOKMARK_TYPE, 1);
|
||||
args.putLong(EXTRA_CATEGORY_ID, categoryId);
|
||||
args.putLong(EXTRA_BOOKMARK_ID, bookmarkId);
|
||||
String name = EditBookmarkFragment.class.getName();
|
||||
|
@ -76,6 +83,20 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
|
|||
fragment.show(manager, name);
|
||||
}
|
||||
|
||||
public static void editTrack(long categoryId, long trackId, Context context, FragmentManager manager, @Nullable EditBookmarkListener listener)
|
||||
{
|
||||
final Bundle args = new Bundle();
|
||||
args.putInt(EXTRA_BOOKMARK_TYPE, 2);
|
||||
args.putLong(EXTRA_CATEGORY_ID, categoryId);
|
||||
args.putLong(EXTRA_TRACK_ID, trackId);
|
||||
String name = EditBookmarkFragment.class.getName();
|
||||
final FragmentFactory factory = manager.getFragmentFactory();
|
||||
final EditBookmarkFragment fragment = (EditBookmarkFragment) factory.instantiate(context.getClassLoader(), name);
|
||||
fragment.setArguments(args);
|
||||
fragment.setEditBookmarkListener(listener);
|
||||
fragment.show(manager, name);
|
||||
}
|
||||
|
||||
public EditBookmarkFragment() {}
|
||||
|
||||
@Override
|
||||
|
@ -95,12 +116,7 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
|
|||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState)
|
||||
{
|
||||
final Bundle args = getArguments();
|
||||
long categoryId = args.getLong(EXTRA_CATEGORY_ID);
|
||||
mBookmarkCategory = BookmarkManager.INSTANCE.getCategoryById(categoryId);
|
||||
long bookmarkId = args.getLong(EXTRA_BOOKMARK_ID);
|
||||
mBookmark = BookmarkManager.INSTANCE.getBookmarkInfo(bookmarkId);
|
||||
if (mBookmark != null)
|
||||
mIcon = mBookmark.getIcon();
|
||||
mType = args.getInt(EXTRA_BOOKMARK_TYPE);
|
||||
mEtName = view.findViewById(R.id.et__bookmark_name);
|
||||
clearNameBtn = view.findViewById(R.id.edit_bookmark_name_input);
|
||||
clearNameBtn.setEndIconOnClickListener(v -> clearAndFocus(mEtName));
|
||||
|
@ -123,8 +139,35 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
|
|||
mTvBookmarkGroup.setOnClickListener(this);
|
||||
mIvColor = view.findViewById(R.id.iv__bookmark_color);
|
||||
mIvColor.setOnClickListener(this);
|
||||
refreshBookmark();
|
||||
initToolbar(view);
|
||||
|
||||
switch (mType)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
long categoryId = args.getLong(EXTRA_CATEGORY_ID);
|
||||
mBookmarkCategory = BookmarkManager.INSTANCE.getCategoryById(categoryId);
|
||||
long bookmarkId = args.getLong(EXTRA_BOOKMARK_ID);
|
||||
mBookmark = BookmarkManager.INSTANCE.getBookmarkInfo(bookmarkId);
|
||||
if (mBookmark != null)
|
||||
mIcon = mBookmark.getIcon();
|
||||
refreshBookmark();
|
||||
initToolbar(view);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
long categoryId = args.getLong(EXTRA_CATEGORY_ID);
|
||||
mBookmarkCategory = BookmarkManager.INSTANCE.getCategoryById(categoryId);
|
||||
long trackId = args.getLong(EXTRA_TRACK_ID);
|
||||
mTrack = BookmarkManager.INSTANCE.getTrack(trackId);
|
||||
mColor = mTrack.getColor();
|
||||
refreshTrack();
|
||||
initToolbar(view);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,7 +193,13 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
|
|||
ViewCompat.setOnApplyWindowInsetsListener(toolbar, PaddingInsetsListener.excludeBottom());
|
||||
|
||||
final ImageView imageView = toolbar.findViewById(R.id.save);
|
||||
imageView.setOnClickListener(v -> saveBookmark());
|
||||
switch (mType)
|
||||
{
|
||||
case 1:
|
||||
imageView.setOnClickListener(v -> saveBookmark());
|
||||
case 2:
|
||||
imageView.setOnClickListener(v -> saveTrack());
|
||||
}
|
||||
UiUtils.showHomeUpButton(toolbar);
|
||||
toolbar.setTitle(R.string.placepage_edit_bookmark_button);
|
||||
toolbar.setNavigationOnClickListener(v -> dismiss());
|
||||
|
@ -174,6 +223,25 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
|
|||
dismiss();
|
||||
}
|
||||
|
||||
private void saveTrack()
|
||||
{
|
||||
if (mTrack == null)
|
||||
{
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
boolean movedFromCategory = mTrack.getCategoryId() != mBookmarkCategory.getId();
|
||||
if (movedFromCategory)
|
||||
BookmarkManager.INSTANCE.notifyCategoryChanging(mTrack, mBookmarkCategory.getId());
|
||||
BookmarkManager.INSTANCE.notifyParametersUpdating(mTrack, mEtName.getText()
|
||||
.toString(), mColor, mEtDescription.getText()
|
||||
.toString());
|
||||
|
||||
if (mListener != null)
|
||||
mListener.onBookmarkSaved(mTrack.getTrackId(), movedFromCategory);
|
||||
dismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v)
|
||||
{
|
||||
|
@ -186,7 +254,7 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
|
|||
|
||||
private void selectBookmarkSet()
|
||||
{
|
||||
if (mBookmark == null)
|
||||
if (mBookmark == null && mTrack == null)
|
||||
return;
|
||||
|
||||
final Bundle args = new Bundle();
|
||||
|
@ -205,28 +273,48 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
|
|||
|
||||
private void selectBookmarkColor()
|
||||
{
|
||||
if (mIcon == null)
|
||||
if (mIcon == null && mTrack == null)
|
||||
return;
|
||||
|
||||
final Bundle args = new Bundle();
|
||||
args.putInt(BookmarkColorDialogFragment.ICON_TYPE, mIcon.getColor());
|
||||
|
||||
if (mTrack != null)
|
||||
args.putInt(BookmarkColorDialogFragment.ICON_TYPE, mTrack.getColor());
|
||||
else
|
||||
args.putInt(BookmarkColorDialogFragment.ICON_TYPE, mIcon.getColor());
|
||||
final FragmentManager manager = getChildFragmentManager();
|
||||
String className = BookmarkColorDialogFragment.class.getName();
|
||||
final FragmentFactory factory = manager.getFragmentFactory();
|
||||
final BookmarkColorDialogFragment dialogFragment =
|
||||
(BookmarkColorDialogFragment) factory.instantiate(getContext().getClassLoader(), className);
|
||||
dialogFragment.setArguments(args);
|
||||
dialogFragment.setOnColorSetListener(colorPos -> {
|
||||
final Icon newIcon = BookmarkManager.ICONS.get(colorPos);
|
||||
final String from = mIcon.getName();
|
||||
final String to = newIcon.getName();
|
||||
if (TextUtils.equals(from, to))
|
||||
return;
|
||||
switch (mType)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
dialogFragment.setOnColorSetListener(colorPos -> {
|
||||
final Icon newIcon = BookmarkManager.ICONS.get(colorPos);
|
||||
final String from = mTrack.getName();
|
||||
final String to = newIcon.getName();
|
||||
if (TextUtils.equals(from, to))
|
||||
return;
|
||||
|
||||
mIcon = newIcon;
|
||||
refreshColorMarker();
|
||||
});
|
||||
mIcon = newIcon;
|
||||
refreshColorMarker();
|
||||
});
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
dialogFragment.setOnColorSetListener(colorPos -> {
|
||||
int from = mTrack.getColor();
|
||||
int to = BookmarkManager.ICONS.get(colorPos).argb();
|
||||
if (from == to)
|
||||
return;
|
||||
mColor = to;
|
||||
refreshTrackColor();
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dialogFragment.show(requireActivity().getSupportFragmentManager(), null);
|
||||
}
|
||||
|
@ -244,6 +332,16 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
|
|||
}
|
||||
}
|
||||
|
||||
public void refreshTrackColor()
|
||||
{
|
||||
if (mColor == -1)
|
||||
return;
|
||||
Drawable circle = Graphics.drawCircle(mColor,
|
||||
R.dimen.track_circle_size,
|
||||
requireContext().getResources());
|
||||
mIvColor.setImageDrawable(circle);
|
||||
}
|
||||
|
||||
private void refreshCategory()
|
||||
{
|
||||
mTvBookmarkGroup.setText(mBookmarkCategory.getName());
|
||||
|
@ -266,6 +364,22 @@ public class EditBookmarkFragment extends BaseMwmDialogFragment implements View.
|
|||
refreshColorMarker();
|
||||
}
|
||||
|
||||
private void refreshTrack()
|
||||
{
|
||||
if (mTrack == null)
|
||||
return;
|
||||
|
||||
if (TextUtils.isEmpty(mEtName.getText()))
|
||||
mEtName.setText(mTrack.getName());
|
||||
|
||||
if (TextUtils.isEmpty(mEtDescription.getText()))
|
||||
{
|
||||
mEtDescription.setText(BookmarkManager.INSTANCE.getTrackDescription(mTrack.getTrackId()));
|
||||
}
|
||||
refreshCategory();
|
||||
refreshTrackColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCategoryChanged(BookmarkCategory newCategory)
|
||||
{
|
||||
|
|
|
@ -2316,6 +2316,19 @@ void BookmarkManager::UpdateBookmark(kml::MarkId bmID, kml::BookmarkData const &
|
|||
SetLastEditedBmColor(bookmark->GetColor());
|
||||
}
|
||||
|
||||
void BookmarkManager::UpdateTrack(kml::TrackId trackId, kml::TrackData const & trackData)
|
||||
{
|
||||
CHECK_THREAD_CHECKER(m_threadChecker, ());
|
||||
auto * track = GetTrackForEdit(trackId);
|
||||
|
||||
// auto const prevColor = track->GetColor(0);
|
||||
track->setData(trackData);
|
||||
ASSERT(track->GetGroupId() != kml::kInvalidTrackId, ());
|
||||
|
||||
// if (prevColor != track->GetColor())
|
||||
// SetLastEditedBmColor(track->GetColor());
|
||||
}
|
||||
|
||||
kml::MarkGroupId BookmarkManager::LastEditedBMCategory()
|
||||
{
|
||||
CHECK_THREAD_CHECKER(m_threadChecker, ());
|
||||
|
@ -3636,6 +3649,11 @@ void BookmarkManager::EditSession::UpdateBookmark(kml::MarkId bmId, kml::Bookmar
|
|||
return m_bmManager.UpdateBookmark(bmId, bm);
|
||||
}
|
||||
|
||||
void BookmarkManager::EditSession::UpdateTrack(kml::TrackId trackId, kml::TrackData const & trackData)
|
||||
{
|
||||
return m_bmManager.UpdateTrack(trackId,trackData);
|
||||
}
|
||||
|
||||
void BookmarkManager::EditSession::AttachBookmark(kml::MarkId bmId, kml::MarkGroupId groupId)
|
||||
{
|
||||
m_bmManager.AttachBookmark(bmId, groupId);
|
||||
|
|
|
@ -145,6 +145,7 @@ public:
|
|||
|
||||
void MoveBookmark(kml::MarkId bmID, kml::MarkGroupId curGroupID, kml::MarkGroupId newGroupID);
|
||||
void UpdateBookmark(kml::MarkId bmId, kml::BookmarkData const & bm);
|
||||
void UpdateTrack(kml::TrackId trackId, kml::TrackData const & trackData);
|
||||
|
||||
void AttachBookmark(kml::MarkId bmId, kml::MarkGroupId groupId);
|
||||
void DetachBookmark(kml::MarkId bmId, kml::MarkGroupId groupId);
|
||||
|
@ -599,6 +600,7 @@ private:
|
|||
|
||||
void MoveBookmark(kml::MarkId bmID, kml::MarkGroupId curGroupID, kml::MarkGroupId newGroupID);
|
||||
void UpdateBookmark(kml::MarkId bmId, kml::BookmarkData const & bm);
|
||||
void UpdateTrack(kml::TrackId trackId, kml::TrackData const & trackData);
|
||||
|
||||
UserMark const * GetMark(kml::MarkId markId) const;
|
||||
|
||||
|
|
|
@ -132,6 +132,17 @@ void Track::SetName(std::string const & name)
|
|||
kml::SetDefaultStr(m_data.m_name, name);
|
||||
}
|
||||
|
||||
std::string Track::GetDescription() const
|
||||
{
|
||||
return GetPreferredBookmarkStr(m_data.m_description);
|
||||
}
|
||||
|
||||
void Track::setData(kml::TrackData const & data)
|
||||
{
|
||||
m_isDirty = true;
|
||||
m_data = data;
|
||||
}
|
||||
|
||||
m2::RectD Track::GetLimitRect() const
|
||||
{
|
||||
if (m_interactionData)
|
||||
|
|
|
@ -19,9 +19,11 @@ public:
|
|||
void ResetChanges() const override { m_isDirty = false; }
|
||||
|
||||
kml::TrackData const & GetData() const { return m_data; }
|
||||
void setData(kml::TrackData const & data);
|
||||
|
||||
std::string GetName() const;
|
||||
void SetName(std::string const & name);
|
||||
std::string GetDescription() const;
|
||||
|
||||
m2::RectD GetLimitRect() const;
|
||||
double GetLengthMeters() const;
|
||||
|
|
Loading…
Add table
Reference in a new issue