forked from organicmaps/organicmaps
Fixed bookmarks merge
This commit is contained in:
parent
dd92da277a
commit
b8d1d7cee1
1 changed files with 10 additions and 7 deletions
|
@ -1127,21 +1127,24 @@ void BookmarkManager::CreateCategories(KMLDataCollection && dataCollection, bool
|
|||
{
|
||||
ASSERT_THREAD_CHECKER(m_threadChecker, ());
|
||||
df::GroupIDSet loadedGroups;
|
||||
|
||||
std::vector<std::pair<df::MarkGroupID, BookmarkCategory *>> categoriesForMerge;
|
||||
categoriesForMerge.reserve(m_categories.size());
|
||||
for (auto const & c : m_categories)
|
||||
categoriesForMerge.emplace_back(c.first, c.second.get());
|
||||
|
||||
for (auto & data : dataCollection)
|
||||
{
|
||||
df::MarkGroupID groupId;
|
||||
BookmarkCategory * group = nullptr;
|
||||
|
||||
auto const it = std::find_if(m_categories.begin(), m_categories.end(),
|
||||
[&data](CategoriesCollection::value_type const & v)
|
||||
{
|
||||
return v.second->GetName() == data->m_name;
|
||||
});
|
||||
bool merge = it != m_categories.end();
|
||||
auto const it = std::find_if(categoriesForMerge.cbegin(), categoriesForMerge.cend(),
|
||||
[&data](auto const & v) { return v.second->GetName() == data->m_name; });
|
||||
bool const merge = it != categoriesForMerge.cend();
|
||||
if (merge)
|
||||
{
|
||||
groupId = it->first;
|
||||
group = it->second.get();
|
||||
group = it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue