Bookmarks refactoring.

This commit is contained in:
Daria Volvenkova 2018-04-03 17:34:43 +03:00 committed by Roman Kuznetsov
parent 5a53eed062
commit fd65179c89
17 changed files with 387 additions and 493 deletions

View file

@ -276,7 +276,7 @@ Java_com_mapswithme_maps_bookmarks_data_BookmarkManager_nativeAddBookmarkToLastE
bmData.m_point = MercatorBounds::FromLatLon(lat, lon);
auto const lastEditedCategory = frm()->LastEditedBMCategory();
auto const * createdBookmark = bmMng.GetEditSession().CreateBookmark(bmData, lastEditedCategory);
auto const * createdBookmark = bmMng.GetEditSession().CreateBookmark(std::move(bmData), lastEditedCategory);
place_page::Info & info = g_framework->GetPlacePageInfo();
frm()->FillBookmarkInfo(*createdBookmark, info);

View file

@ -31,6 +31,14 @@ void GetNameFromFullPath(string & name)
name = name.substr(i+1);
}
string GetNameFromFullPathWithoutExt(string const & path)
{
std::string name = path;
GetNameFromFullPath(name);
GetNameWithoutExt(name);
return name;
}
string GetDirectory(string const & name)
{
string const sep = GetNativeSeparator();

View file

@ -16,6 +16,9 @@ namespace my
/// Get file name from full path.
void GetNameFromFullPath(string & name);
/// Get file name from full path without extension.
string GetNameFromFullPathWithoutExt(string const & path);
/// Returns all but last components of the path. After dropping the last
/// component, all trailing slashes are removed, unless the result is a
/// root directory. If the argument is a single component, returns ".".

View file

@ -446,7 +446,7 @@ NSString * const kUserDefaultsLatLonAsDMSKey = @"UserDefaultsLatLonAsDMS";
bmData.m_color.m_predefinedColor = f.LastEditedBMColor();
bmData.m_point = self.mercator;
auto editSession = bmManager.GetEditSession();
auto const * bookmark = editSession.CreateBookmark(bmData, categoryId);
auto const * bookmark = editSession.CreateBookmark(std::move(bmData), categoryId);
f.FillBookmarkInfo(*bookmark, m_info);
m_sections.insert(m_sections.begin() + 1, Sections::Bookmark);
}

View file

@ -22,6 +22,8 @@ set(
booking_filter_cache.hpp
bookmark.cpp
bookmark.hpp
bookmark_helpers.cpp
bookmark_helpers.hpp
bookmark_manager.cpp
bookmark_manager.hpp
bookmarks_search_params.hpp

View file

@ -1,34 +1,4 @@
#include "map/bookmark.hpp"
#include "map/api_mark_point.hpp"
#include "map/bookmark_manager.hpp"
#include "map/track.hpp"
#include "kml/serdes.hpp"
#include "geometry/mercator.hpp"
#include "coding/file_reader.hpp"
#include "coding/hex.hpp"
#include "coding/parse_xml.hpp" // LoadFromKML
#include "coding/internal/file_data.hpp"
#include "drape/drape_global.hpp"
#include "drape/color.hpp"
#include "drape_frontend/color_constants.hpp"
#include "platform/platform.hpp"
#include "base/scope_guard.hpp"
#include "base/stl_add.hpp"
#include "base/string_utils.hpp"
#include <algorithm>
#include <fstream>
#include <iterator>
#include <map>
#include <memory>
#include <kml/serdes_binary.hpp>
Bookmark::Bookmark(m2::PointD const & ptOrg)
: Base(ptOrg, UserMark::BOOKMARK)
@ -38,9 +8,9 @@ Bookmark::Bookmark(m2::PointD const & ptOrg)
m_data.m_id = GetId();
}
Bookmark::Bookmark(kml::BookmarkData const & data)
Bookmark::Bookmark(kml::BookmarkData && data)
: Base(data.m_id, data.m_point, UserMark::BOOKMARK)
, m_data(data)
, m_data(std::move(data))
, m_groupId(kml::kInvalidMarkGroupId)
{
m_data.m_id = GetId();
@ -181,20 +151,17 @@ void Bookmark::Detach()
BookmarkCategory::BookmarkCategory(std::string const & name, kml::MarkGroupId groupId, bool autoSave)
: Base(UserMark::Type::BOOKMARK)
, m_groupId(groupId)
, m_autoSave(autoSave)
{
m_data.m_id = groupId;
SetName(name);
}
BookmarkCategory::BookmarkCategory(kml::CategoryData const & data, kml::MarkGroupId groupId, bool autoSave)
BookmarkCategory::BookmarkCategory(kml::CategoryData && data, bool autoSave)
: Base(UserMark::Type::BOOKMARK)
, m_groupId(groupId)
, m_autoSave(autoSave)
, m_data(data)
, m_data(std::move(data))
{
m_data.m_id = groupId;
Base::SetIsVisible(m_data.m_visible);
}
@ -224,40 +191,3 @@ kml::PredefinedColor BookmarkCategory::GetDefaultColor()
{
return kml::PredefinedColor::Red;
}
std::unique_ptr<kml::FileData> LoadKMLFile(std::string const & file, bool useBinary)
{
try
{
return LoadKMLData(FileReader(file), useBinary);
}
catch (std::exception const & e)
{
LOG(LWARNING, ("Error while loading bookmarks from", file, e.what()));
}
return nullptr;
}
std::unique_ptr<kml::FileData> LoadKMLData(Reader const & reader, bool useBinary)
{
auto data = std::make_unique<kml::FileData>();
try
{
if (useBinary)
{
kml::binary::DeserializerKml des(*data.get());
des.Deserialize(reader);
}
else
{
kml::DeserializerKml des(*data.get());
des.Deserialize(reader);
}
}
catch (FileReader::Exception const & exc)
{
LOG(LWARNING, ("KML ", useBinary ? "binary" : "text", " deserialization failure: ", exc.what()));
data.reset();
}
return data;
}

View file

@ -1,39 +1,20 @@
#pragma once
#include "map/track.hpp"
#include "map/user_mark.hpp"
#include "map/user_mark_layer.hpp"
#include "kml/types.hpp"
#include "coding/reader.hpp"
#include "geometry/point2d.hpp"
#include "geometry/rect2d.hpp"
#include "base/timer.hpp"
#include "std/noncopyable.hpp"
#include <iostream>
#include <memory>
#include <string>
#include <vector>
namespace anim
{
class Task;
}
class BookmarkManager;
class Bookmark : public UserMark
{
using Base = UserMark;
public:
Bookmark(m2::PointD const & ptOrg);
explicit Bookmark(m2::PointD const & ptOrg);
Bookmark(kml::BookmarkData const & data);
explicit Bookmark(kml::BookmarkData && data);
void SetData(kml::BookmarkData const & data);
kml::BookmarkData const & GetData() const;
@ -78,12 +59,12 @@ class BookmarkCategory : public UserMarkLayer
public:
BookmarkCategory(std::string const & name, kml::MarkGroupId groupId, bool autoSave);
BookmarkCategory(kml::CategoryData const & data, kml::MarkGroupId groupId, bool autoSave);
BookmarkCategory(kml::CategoryData && data, bool autoSave);
~BookmarkCategory() override;
static kml::PredefinedColor GetDefaultColor();
kml::MarkGroupId GetID() const { return m_groupId; }
kml::MarkGroupId GetID() const { return m_data.m_id; }
void SetIsVisible(bool isVisible) override;
void SetName(std::string const & name);
@ -97,12 +78,8 @@ public:
kml::CategoryData const & GetCategoryData() const { return m_data; }
private:
kml::MarkGroupId const m_groupId;
// Stores file name from which bookmarks were loaded.
std::string m_file;
bool m_autoSave = true;
kml::CategoryData m_data;
};
std::unique_ptr<kml::FileData> LoadKMLFile(std::string const & file, bool useBinary);
std::unique_ptr<kml::FileData> LoadKMLData(Reader const & reader, bool useBinary);

82
map/bookmark_helpers.cpp Normal file
View file

@ -0,0 +1,82 @@
#include "map/bookmark_helpers.hpp"
#include "kml/serdes.hpp"
#include "kml/serdes_binary.hpp"
#include "coding/file_reader.hpp"
#include "coding/file_writer.hpp"
std::unique_ptr<kml::FileData> LoadKmlFile(std::string const & file, bool useBinary)
{
try
{
return LoadKmlData(FileReader(file), useBinary);
}
catch (std::exception const & e)
{
LOG(LWARNING, ("Exception while loading bookmarks:", e.what(), "file", file));
}
return nullptr;
}
std::unique_ptr<kml::FileData> LoadKmlData(Reader const & reader, bool useBinary)
{
auto data = std::make_unique<kml::FileData>();
try
{
if (useBinary)
{
kml::binary::DeserializerKml des(*data.get());
des.Deserialize(reader);
}
else
{
kml::DeserializerKml des(*data.get());
des.Deserialize(reader);
}
}
catch (Reader::Exception const & e)
{
LOG(LWARNING, ("KML ", useBinary ? "binary" : "text", "deserialization failure:", e.what()));
data.reset();
}
return data;
}
bool SaveKmlFile(kml::FileData & kmlData, std::string const & file, bool useBinary)
{
try
{
FileWriter writer(file);
return SaveKmlData(kmlData, writer, useBinary);
}
catch (std::exception const & e)
{
LOG(LWARNING, ("Exception while saving bookmarks:", e.what(), "file", file));
return false;
}
return true;
}
bool SaveKmlData(kml::FileData & kmlData, Writer & writer, bool useBinary)
{
try
{
if (useBinary)
{
kml::binary::SerializerKml ser(kmlData);
ser.Serialize(writer);
}
else
{
kml::SerializerKml ser(kmlData);
ser.Serialize(writer);
}
}
catch (Writer::Exception const & e)
{
LOG(LWARNING, ("KML ", useBinary ? "binary" : "text", "serialization failure:", e.what()));
return false;
}
return true;
}

14
map/bookmark_helpers.hpp Normal file
View file

@ -0,0 +1,14 @@
#pragma once
#include "map/bookmark.hpp"
#include "coding/reader.hpp"
#include <memory>
#include <string>
std::unique_ptr<kml::FileData> LoadKmlFile(std::string const & file, bool useBinary);
std::unique_ptr<kml::FileData> LoadKmlData(Reader const & reader, bool useBinary);
bool SaveKmlFile(kml::FileData & kmlData, std::string const & file, bool useBinary);
bool SaveKmlData(kml::FileData & kmlData, Writer & writer, bool useBinary);

View file

@ -1,5 +1,6 @@
#include "map/bookmark_manager.hpp"
#include "map/api_mark_point.hpp"
#include "map/bookmark_helpers.hpp"
#include "map/local_ads_mark.hpp"
#include "map/routing_mark.hpp"
#include "map/search_mark.hpp"
@ -13,9 +14,6 @@
#include "indexer/scales.hpp"
#include "kml/serdes.hpp"
#include "kml/serdes_binary.hpp"
#include "coding/file_name_utils.hpp"
#include "coding/file_writer.hpp"
#include "coding/hex.hpp"
@ -44,11 +42,13 @@ using namespace std::placeholders;
namespace
{
std::string const kLastBookmarkCategoryId = "LastBookmarkCategoryId";
std::string const kLastBookmarkCategory = "LastBookmarkCategory";
std::string const kLastEditedBookmarkCategory = "LastBookmarkCategory";
// TODO(darina): Delete old setting.
std::string const kLastBookmarkType = "LastBookmarkType";
std::string const kLastBookmarkColor = "LastBookmarkColor";
std::string const kLastEditedBookmarkColor = "LastBookmarkColor";
std::string const kKmzExtension = ".kmz";
std::string const kBookmarksExt = ".kmb";
std::string const kKmlExtension = ".kml";
std::string const kKmbExtension = ".kmb";
uint64_t LoadLastBmCategoryId()
{
@ -145,10 +145,8 @@ BookmarkManager::SharingResult GetFileForSharing(kml::MarkGroupId categoryId, st
auto ext = my::GetFileExtension(filePath);
strings::AsciiToLower(ext);
std::string fileName = filePath;
my::GetNameFromFullPath(fileName);
my::GetNameWithoutExt(fileName);
auto const tmpFilePath = my::JoinFoldersToPath(GetPlatform().TmpDir(), fileName + kKmzExtension);
std::string fileName = my::GetNameFromFullPathWithoutExt(filePath);
auto const tmpFilePath = my::JoinPath(GetPlatform().TmpDir(), fileName + kKmzExtension);
if (ext == kKmzExtension)
{
if (my::CopyFileX(filePath, tmpFilePath))
@ -169,8 +167,21 @@ BookmarkManager::SharingResult GetFileForSharing(kml::MarkGroupId categoryId, st
bool ConvertBeforeUploading(std::string const & filePath, std::string const & convertedFilePath)
{
//TODO: convert from kmb to kmz.
return CreateZipFromPathDeflatedAndDefaultCompression(filePath, convertedFilePath);
std::string const fileName = my::GetNameFromFullPathWithoutExt(filePath);
auto const tmpFilePath = my::JoinPath(GetPlatform().TmpDir(), fileName + kKmlExtension);
MY_SCOPE_GUARD(fileGuard, bind(&FileWriter::DeleteFileX, tmpFilePath));
auto kmlData = LoadKmlFile(filePath, true /* binary */);
if (kmlData == nullptr)
return false;
if (!SaveKmlFile(*kmlData, tmpFilePath, false /* binary */))
{
my::DeleteFileX(tmpFilePath);
return false;
}
return CreateZipFromPathDeflatedAndDefaultCompression(tmpFilePath, convertedFilePath);
}
bool ConvertAfterDownloading(std::string const & filePath, std::string const & convertedFilePath)
@ -186,32 +197,11 @@ bool ConvertAfterDownloading(std::string const & filePath, std::string const & c
if (!GetPlatform().IsFileExistsByFullPath(unarchievedPath))
return false;
kml::FileData kmlData;
try
{
kml::DeserializerKml des(kmlData);
FileReader reader(unarchievedPath);
des.Deserialize(reader);
}
catch (FileReader::Exception const & exc)
{
LOG(LWARNING, ("KML text deserialization failure: ", exc.what(), "file:", unarchievedPath));
auto kmlData = LoadKmlFile(unarchievedPath, false /* binary */);
if (kmlData == nullptr)
return false;
}
try
{
kml::binary::SerializerKml ser(kmlData);
FileWriter writer(convertedFilePath);
ser.Serialize(writer);
}
catch (FileWriter::Exception const & exc)
{
LOG(LWARNING, ("KML binary serialization failure: ", exc.what(), "file:", convertedFilePath));
return false;
}
return true;
return SaveKmlFile(*kmlData, convertedFilePath, true /* binary */);
}
} // namespace
@ -254,9 +244,7 @@ bool BackupBookmarks(std::string const & backupDir,
{
for (auto const & f : files)
{
std::string fileName = f;
my::GetNameFromFullPath(fileName);
my::GetNameWithoutExt(fileName);
std::string fileName = my::GetNameFromFullPathWithoutExt(f);
auto const kmzPath = my::JoinPath(backupDir, fileName + kKmzExtension);
if (GetPlatform().IsFileExistsByFullPath(kmzPath))
continue;
@ -285,35 +273,17 @@ bool ConvertBookmarks(std::vector<std::string> const & files,
convertedFiles.reserve(files.size());
for (auto const & f : files)
{
std::string fileName = f;
my::GetNameFromFullPath(fileName);
my::GetNameWithoutExt(fileName);
auto const kmbPath = my::JoinPath(conversionFolder, fileName + kBookmarksExt);
std::string fileName = my::GetNameFromFullPathWithoutExt(f);
auto const kmbPath = my::JoinPath(conversionFolder, fileName + kKmbExtension);
if (!GetPlatform().IsFileExistsByFullPath(kmbPath))
{
kml::FileData kmlData;
try
{
kml::DeserializerKml des(kmlData);
FileReader reader(f);
des.Deserialize(reader);
}
catch (FileReader::Exception const &exc)
{
LOG(LDEBUG, ("KML text deserialization failure: ", exc.what(), "file", f));
auto kmlData = LoadKmlFile(f, false /* binary */);
if (kmlData == nullptr)
continue;
}
try
{
kml::binary::SerializerKml ser(kmlData);
FileWriter writer(kmbPath);
ser.Serialize(writer);
}
catch (FileWriter::Exception const &exc)
if (!SaveKmlFile(*kmlData, kmbPath, true /* binary */))
{
my::DeleteFileX(kmbPath);
LOG(LDEBUG, ("KML binary serialization failure: ", exc.what(), "file", f));
continue;
}
}
@ -331,15 +301,13 @@ bool ConvertBookmarks(std::vector<std::string> const & files,
// Move converted bookmark-files with respect of existing files.
for (auto const & f : convertedFiles)
{
std::string fileName = f;
my::GetNameFromFullPath(fileName);
my::GetNameWithoutExt(fileName);
auto kmbPath = my::JoinPath(newBookmarksDir, fileName + kBookmarksExt);
std::string fileName = my::GetNameFromFullPathWithoutExt(f);
auto kmbPath = my::JoinPath(newBookmarksDir, fileName + kKmbExtension);
size_t counter = 1;
while (Platform::IsFileExistsByFullPath(kmbPath))
{
kmbPath = my::JoinPath(newBookmarksDir,
fileName + strings::to_string(counter++) + kBookmarksExt);
fileName + strings::to_string(counter++) + kKmbExtension);
}
if (!my::RenameFileX(f, kmbPath))
@ -382,7 +350,7 @@ bool MigrateIfNeeded()
std::string const dir = GetPlatform().SettingsDir();
Platform::FilesList files;
Platform::GetFilesByExt(dir, BOOKMARKS_FILE_EXTENSION, files);
Platform::GetFilesByExt(dir, kKmlExtension, files);
if (files.empty())
{
auto const newBookmarksDir = GetBookmarksDirectory();
@ -410,9 +378,8 @@ bool MigrateIfNeeded()
return false;
}
//TODO(@darina): Uncomment after KMB integration.
//for (auto const & f : files)
// my::DeleteFileX(f);
for (auto const & f : files)
my::DeleteFileX(f);
OnMigrationSuccess(files.size(), convertedCount);
return true;
}
@ -426,7 +393,7 @@ BookmarkManager::BookmarkManager(Callbacks && callbacks)
, m_needTeardown(false)
, m_lastGroupID(LoadLastBmCategoryId())
, m_bookmarkCloud(Cloud::CloudParams("bmc.json", "bookmarks", "BookmarkCloudParam",
GetBookmarksDirectory(), std::string(kBookmarksExt),
GetBookmarksDirectory(), std::string(kKmbExtension),
std::bind(&ConvertBeforeUploading, _1, _2),
std::bind(&ConvertAfterDownloading, _1, _2)))
{
@ -491,13 +458,13 @@ void BookmarkManager::DeleteUserMark(kml::MarkId markId)
m_userMarks.erase(it);
}
Bookmark * BookmarkManager::CreateBookmark(kml::BookmarkData const & bmData)
Bookmark * BookmarkManager::CreateBookmark(kml::BookmarkData && bmData)
{
ASSERT_THREAD_CHECKER(m_threadChecker, ());
return AddBookmark(std::make_unique<Bookmark>(bmData));
return AddBookmark(std::make_unique<Bookmark>(std::move(bmData)));
}
Bookmark * BookmarkManager::CreateBookmark(kml::BookmarkData & bm, kml::MarkGroupId groupId)
Bookmark * BookmarkManager::CreateBookmark(kml::BookmarkData && bm, kml::MarkGroupId groupId)
{
ASSERT_THREAD_CHECKER(m_threadChecker, ());
GetPlatform().GetMarketingService().SendMarketingEvent(marketing::kBookmarksBookmarkAction,
@ -506,7 +473,7 @@ Bookmark * BookmarkManager::CreateBookmark(kml::BookmarkData & bm, kml::MarkGrou
bm.m_timestamp = std::chrono::system_clock::now();
bm.m_viewportScale = static_cast<uint8_t>(df::GetZoomLevel(m_viewport.GetScale()));
auto * bookmark = CreateBookmark(bm);
auto * bookmark = CreateBookmark(std::move(bm));
bookmark->Attach(groupId);
auto * group = GetBmCategory(groupId);
group->AttachUserMark(bookmark->GetId());
@ -565,10 +532,10 @@ void BookmarkManager::DeleteBookmark(kml::MarkId bmId)
m_bookmarks.erase(groupIt);
}
Track * BookmarkManager::CreateTrack(kml::TrackData const & trackData)
Track * BookmarkManager::CreateTrack(kml::TrackData && trackData)
{
ASSERT_THREAD_CHECKER(m_threadChecker, ());
return AddTrack(std::make_unique<Track>(trackData));
return AddTrack(std::make_unique<Track>(std::move(trackData)));
}
Track const * BookmarkManager::GetTrack(kml::TrackId trackId) const
@ -813,15 +780,15 @@ Track * BookmarkManager::AddTrack(std::unique_ptr<Track> && track)
void BookmarkManager::SaveState() const
{
settings::Set(kLastBookmarkCategory, m_lastCategoryUrl);
settings::Set(kLastBookmarkColor, static_cast<uint32_t>(m_lastColor));
settings::Set(kLastEditedBookmarkCategory, m_lastCategoryUrl);
settings::Set(kLastEditedBookmarkColor, static_cast<uint32_t>(m_lastColor));
}
void BookmarkManager::LoadState()
{
UNUSED_VALUE(settings::Get(kLastBookmarkCategory, m_lastCategoryUrl));
UNUSED_VALUE(settings::Get(kLastEditedBookmarkCategory, m_lastCategoryUrl));
uint32_t color;
if (settings::Get(kLastBookmarkColor, color) &&
if (settings::Get(kLastEditedBookmarkColor, color) &&
color > static_cast<uint32_t>(kml::PredefinedColor::None) &&
color < static_cast<uint32_t>(kml::PredefinedColor::Count))
{
@ -848,74 +815,23 @@ void BookmarkManager::ClearCategories()
m_tracks.clear();
}
std::shared_ptr<BookmarkManager::KMLDataCollection> BookmarkManager::LoadBookmarksKML(std::vector<std::string> & filePaths)
std::shared_ptr<BookmarkManager::KMLDataCollection> BookmarkManager::LoadBookmarks(std::string const & dir,
std::string const & ext,
bool binary,
std::vector<std::string> & filePaths)
{
std::string const dir = GetPlatform().SettingsDir();
Platform::FilesList files;
Platform::GetFilesByExt(dir, BOOKMARKS_FILE_EXTENSION, files);
Platform::GetFilesByExt(dir, ext, files);
auto collection = std::make_shared<KMLDataCollection>();
collection->reserve(files.size());
filePaths.reserve(files.size());
for (auto const & file : files)
{
auto const filePath = dir + file;
auto kmlData = std::make_unique<kml::FileData>();
try
{
kml::DeserializerKml des(*kmlData);
FileReader reader(filePath);
des.Deserialize(reader);
}
catch (FileReader::Exception const &exc)
{
LOG(LDEBUG, ("KML deserialization failure: ", exc.what(), "file", filePath));
continue;
}
if (m_needTeardown)
break;
filePaths.push_back(filePath);
collection->emplace_back(filePath, std::move(kmlData));
/*auto kmlData = LoadKMLFile(filePath);
if (m_needTeardown)
break;
if (kmlData)
{
filePaths.push_back(filePath);
collection->emplace_back(filePath, std::move(kmlData));
}*/
}
return collection;
}
std::shared_ptr<BookmarkManager::KMLDataCollection> BookmarkManager::LoadBookmarksKMB(std::vector<std::string> & filePaths)
{
std::string const dir = GetBookmarksDirectory();
Platform::FilesList files;
Platform::GetFilesByExt(dir, kBookmarksExt, files);
auto collection = std::make_shared<KMLDataCollection>();
collection->reserve(files.size());
filePaths.reserve(files.size());
for (auto const & file : files)
{
auto const filePath = my::JoinPath(dir, file);
auto kmlData = std::make_unique<kml::FileData>();
try
{
kml::binary::DeserializerKml des(*kmlData);
FileReader reader(filePath);
des.Deserialize(reader);
}
catch (FileReader::Exception const &exc)
{
LOG(LDEBUG, ("KML binary deserialization failure: ", exc.what(), "file", filePath));
auto kmlData = LoadKmlFile(filePath, binary);
if (kmlData == nullptr)
continue;
}
if (m_needTeardown)
break;
filePaths.push_back(filePath);
@ -934,13 +850,20 @@ void BookmarkManager::LoadBookmarks()
GetPlatform().RunTask(Platform::Thread::File, [this]()
{
bool const migrated = migration::MigrateIfNeeded();
std::string const dir = migrated ? GetBookmarksDirectory() : GetPlatform().SettingsDir();
std::string const filesExt = migrated ? kKmbExtension : kKmlExtension;
std::vector<std::string> filePaths;
auto collection = migrated ? LoadBookmarksKMB(filePaths) : LoadBookmarksKML(filePaths);
auto collection = LoadBookmarks(dir, filesExt, migrated, filePaths);
if (m_needTeardown)
return;
NotifyAboutFinishAsyncLoading(std::move(collection));
GetPlatform().RunTask(Platform::Thread::Gui,
[this, filePaths]() { m_bookmarkCloud.Init(filePaths); });
if (migrated)
{
GetPlatform().RunTask(Platform::Thread::Gui,
[this, filePaths]() { m_bookmarkCloud.Init(filePaths); });
}
});
LoadState();
@ -963,63 +886,52 @@ void BookmarkManager::LoadBookmarkRoutine(std::string const & filePath, bool isT
NotifyAboutStartAsyncLoading();
GetPlatform().RunTask(Platform::Thread::File, [this, filePath, isTemporaryFile]()
{
if (m_needTeardown)
return;
bool const migrated = migration::IsMigrationCompleted();
auto collection = std::make_shared<KMLDataCollection>();
auto kmlData = std::make_unique<kml::FileData>();
std::string fileSavePath;
auto collection = std::make_shared<KMLDataCollection>();
try
auto const savePath = GetKMLPath(filePath);
if (savePath)
{
auto const savePath = GetKMLPath(filePath);
if (m_needTeardown)
return;
if (savePath)
fileSavePath = savePath.get();
auto kmlData = LoadKmlFile(fileSavePath, false /* useBinary */);
if (kmlData != nullptr)
{
kml::DeserializerKml des(*kmlData);
FileReader reader(fileSavePath);
des.Deserialize(reader);
fileSavePath = savePath.get();
if (m_needTeardown)
return;
if (migrated)
{
std::string fileName = my::GetNameFromFullPathWithoutExt(fileSavePath);
my::DeleteFileX(fileSavePath);
fileSavePath = GenerateValidAndUniqueFilePathForKMB(fileName);
if (!SaveKmlFile(*kmlData, fileSavePath, true /* binary */))
{
my::DeleteFileX(fileSavePath);
fileSavePath.clear();
}
}
if (!fileSavePath.empty())
collection->emplace_back(fileSavePath, std::move(kmlData));
}
}
catch (FileReader::Exception const & exc)
{
LOG(LDEBUG, ("KML deserialization failure: ", exc.what(), "file", filePath));
}
if (m_needTeardown)
return;
if (migrated)
{
std::string fileName = fileSavePath;
my::DeleteFileX(fileSavePath);
my::GetNameFromFullPath(fileName);
my::GetNameWithoutExt(fileName);
fileSavePath = GenerateValidAndUniqueFilePathForKMB(fileName);
bool const success = !collection->empty();
try
{
kml::binary::SerializerKml ser(*kmlData);
FileWriter writer(fileSavePath);
ser.Serialize(writer);
}
catch (FileWriter::Exception const & exc)
{
my::DeleteFileX(fileSavePath);
LOG(LDEBUG, ("KML binary serialization failure: ", exc.what(), "file", fileSavePath));
fileSavePath.clear();
}
}
if (m_needTeardown)
return;
if (!fileSavePath.empty())
collection->emplace_back(fileSavePath, std::move(kmlData));
NotifyAboutFile(!fileSavePath.empty() /* success */, filePath, isTemporaryFile);
NotifyAboutFile(success, filePath, isTemporaryFile);
NotifyAboutFinishAsyncLoading(std::move(collection));
if (!fileSavePath.empty())
if (migrated && success)
{
// TODO(darina): should we use the cloud only for KMB?
GetPlatform().RunTask(Platform::Thread::Gui,
[this, fileSavePath]() { m_bookmarkCloud.Init({fileSavePath}); });
}
@ -1095,7 +1007,7 @@ boost::optional<std::string> BookmarkManager::GetKMLPath(std::string const & fil
{
std::string const fileExt = GetFileExt(filePath);
string fileSavePath;
if (fileExt == BOOKMARKS_FILE_EXTENSION)
if (fileExt == kKmlExtension)
{
fileSavePath = GenerateValidAndUniqueFilePathForKML(GetFileName(filePath));
if (!my::CopyFileX(filePath, fileSavePath))
@ -1112,7 +1024,7 @@ boost::optional<std::string> BookmarkManager::GetKMLPath(std::string const & fil
for (size_t i = 0; i < files.size(); ++i)
{
ext = GetFileExt(files[i].first);
if (ext == BOOKMARKS_FILE_EXTENSION)
if (ext == kKmlExtension)
{
kmlFileName = files[i].first;
break;
@ -1262,18 +1174,19 @@ bool BookmarkManager::HasBmCategory(kml::MarkGroupId groupId) const
return m_categories.find(groupId) != m_categories.end();
}
kml::MarkGroupId BookmarkManager::CreateBookmarkCategory(kml::CategoryData const & data, bool autoSave)
kml::MarkGroupId BookmarkManager::CreateBookmarkCategory(kml::CategoryData && data, bool autoSave)
{
ASSERT_THREAD_CHECKER(m_threadChecker, ());
auto groupId = data.m_id;
if (groupId == kml::kInvalidMarkGroupId)
if (data.m_id == kml::kInvalidMarkGroupId)
{
groupId = ++m_lastGroupID;
data.m_id = ++m_lastGroupID;
SaveLastBmCategoryId(m_lastGroupID);
}
auto groupId = data.m_id;
ASSERT_EQUAL(m_categories.count(groupId), 0, ());
auto & cat = m_categories[groupId];
cat = my::make_unique<BookmarkCategory>(data, groupId, autoSave);
cat = my::make_unique<BookmarkCategory>(std::move(data), autoSave);
m_bmGroupsIdList.push_back(groupId);
m_changesTracker.OnAddGroup(groupId);
return groupId;
@ -1414,8 +1327,8 @@ void BookmarkManager::CreateCategories(KMLDataCollection && dataCollection, bool
BookmarkCategory * group = nullptr;
auto const & fileName = data.first;
auto const * fileData = data.second.get();
auto const & categoryData = fileData->m_categoryData;
auto & fileData = *data.second.get();
auto & categoryData = fileData.m_categoryData;
auto const it = std::find_if(categoriesForMerge.cbegin(), categoriesForMerge.cend(),
[categoryData](auto const & v)
@ -1431,21 +1344,21 @@ void BookmarkManager::CreateCategories(KMLDataCollection && dataCollection, bool
else
{
bool const saveAfterCreation = categoryData.m_id == kml::kInvalidMarkGroupId;
groupId = CreateBookmarkCategory(categoryData, saveAfterCreation);
groupId = CreateBookmarkCategory(std::move(categoryData), saveAfterCreation);
loadedGroups.insert(groupId);
group = GetBmCategory(groupId);
group->SetFileName(fileName);
}
for (auto & bmData : fileData->m_bookmarksData)
for (auto & bmData : fileData.m_bookmarksData)
{
auto * bm = CreateBookmark(bmData);
auto * bm = CreateBookmark(std::move(bmData));
bm->Attach(groupId);
group->AttachUserMark(bm->GetId());
}
for (auto & trackData : fileData->m_tracksData)
for (auto & trackData : fileData.m_tracksData)
{
auto track = make_unique<Track>(trackData);
auto track = make_unique<Track>(std::move(trackData));
auto * t = AddTrack(std::move(track));
t->Attach(groupId);
group->AttachTrack(t->GetId());
@ -1490,34 +1403,21 @@ std::unique_ptr<kml::FileData> BookmarkManager::CollectBmGroupKMLData(BookmarkCa
bool BookmarkManager::SaveBookmarkCategory(kml::MarkGroupId groupId)
{
ASSERT_THREAD_CHECKER(m_threadChecker, ());
auto collection = PrepareToSaveBookmarks({groupId});
if (!collection || collection->empty())
return false;
auto const & file = collection->front().first;
auto & kmlData = *collection->front().second;
return SaveKMLData(file, kmlData, migration::IsMigrationCompleted());
return SaveKmlFileSafe(kmlData, file, migration::IsMigrationCompleted());
}
void BookmarkManager::SaveToFile(kml::MarkGroupId groupId, Writer & writer, bool useBinary) const
bool BookmarkManager::SaveBookmarkCategory(kml::MarkGroupId groupId, Writer & writer, bool useBinary) const
{
ASSERT_THREAD_CHECKER(m_threadChecker, ());
auto * group = GetBmCategory(groupId);
auto kmlData = CollectBmGroupKMLData(group);
SaveToFile(*kmlData, writer, useBinary);
}
void BookmarkManager::SaveToFile(kml::FileData & kmlData, Writer & writer, bool useBinary) const
{
if (useBinary)
{
kml::binary::SerializerKml ser(kmlData);
ser.Serialize(writer);
}
else
{
kml::SerializerKml ser(kmlData);
ser.Serialize(writer);
}
return SaveKmlData(*kmlData, writer, useBinary);
}
std::shared_ptr<BookmarkManager::KMLDataCollection> BookmarkManager::PrepareToSaveBookmarks(
@ -1526,7 +1426,7 @@ std::shared_ptr<BookmarkManager::KMLDataCollection> BookmarkManager::PrepareToSa
bool migrated = migration::IsMigrationCompleted();
std::string const fileDir = migrated ? GetBookmarksDirectory() : GetPlatform().SettingsDir();
std::string const fileExt = migrated ? kBookmarksExt : BOOKMARKS_FILE_EXTENSION;
std::string const fileExt = migrated ? kKmbExtension : kKmlExtension;
if (migrated && !GetPlatform().IsFileExistsByFullPath(fileDir) && !GetPlatform().MkDirChecked(fileDir))
return std::shared_ptr<KMLDataCollection>();
@ -1552,29 +1452,17 @@ std::shared_ptr<BookmarkManager::KMLDataCollection> BookmarkManager::PrepareToSa
return collection;
}
bool BookmarkManager::SaveKMLData(std::string const & file, kml::FileData & kmlData, bool useBinary)
bool BookmarkManager::SaveKmlFileSafe(kml::FileData & kmlData, std::string const & file, bool useBinary)
{
auto const fileTmp = file + ".tmp";
try
if (SaveKmlFile(kmlData, fileTmp, useBinary))
{
FileWriter writer(fileTmp);
SaveToFile(kmlData, writer, useBinary);
// Only after successful save we replace original file
// Only after successful save we replace original file.
my::DeleteFileX(file);
VERIFY(my::RenameFileX(fileTmp, file), (fileTmp, file));
return true;
}
catch (FileWriter::Exception const & exc)
{
LOG(LDEBUG, ("KML serialization failure:", exc.what(), "file", fileTmp));
}
catch (std::exception const & e)
{
LOG(LWARNING, ("Exception while saving bookmarks:", e.what(), "file", file));
}
// remove possibly left tmp file
// Remove possibly left tmp file.
my::DeleteFileX(fileTmp);
return false;
}
@ -1591,7 +1479,7 @@ void BookmarkManager::SaveBookmarks(kml::GroupIdCollection const & groupIdCollec
GetPlatform().RunTask(Platform::Thread::File, [this, migrated, kmlDataCollection]()
{
for (auto const & kmlItem : *kmlDataCollection)
SaveKMLData(kmlItem.first, *kmlItem.second, migrated);
SaveKmlFileSafe(*kmlItem.second, kmlItem.first, migrated);
});
}
@ -1691,23 +1579,23 @@ size_t BookmarkManager::GetKmlFilesCountForConversion() const
Platform::FilesList files;
Platform::GetFilesByExt(GetPlatform().SettingsDir(),
BOOKMARKS_FILE_EXTENSION, files);
kKmlExtension, files);
return files.size();
}
void BookmarkManager::ConvertAllKmlFiles(ConversionHandler && handler) const
void BookmarkManager::ConvertAllKmlFiles(ConversionHandler && handler)
{
// The conversion available only after successful migration.
if (!migration::IsMigrationCompleted())
return;
GetPlatform().RunTask(Platform::Thread::File, [handler = std::move(handler)]()
GetPlatform().RunTask(Platform::Thread::File, [this, handler = std::move(handler)]()
{
auto const oldDir = GetPlatform().SettingsDir();
Platform::FilesList files;
Platform::GetFilesByExt(oldDir, BOOKMARKS_FILE_EXTENSION, files);
Platform::GetFilesByExt(oldDir, kKmlExtension, files);
for (auto & f : files)
f = my::JoinFoldersToPath(oldDir, f);
f = my::JoinPath(oldDir, f);
auto const newDir = GetBookmarksDirectory();
if (!GetPlatform().IsFileExistsByFullPath(newDir) && !GetPlatform().MkDirChecked(newDir))
@ -1716,55 +1604,44 @@ void BookmarkManager::ConvertAllKmlFiles(ConversionHandler && handler) const
return;
}
std::vector<std::pair<std::string, kml::FileData>> fileData;
fileData.reserve(files.size());
auto fileData = std::make_shared<KMLDataCollection>();
// TODO(darina): Check this refactoring.
bool allConverted = true;
for (auto const & f : files)
{
std::string fileName = f;
my::GetNameFromFullPath(fileName);
my::GetNameWithoutExt(fileName);
auto kmbPath = my::JoinPath(newDir, fileName + kBookmarksExt);
std::string fileName = my::GetNameFromFullPathWithoutExt(f);
auto kmbPath = my::JoinPath(newDir, fileName + kKmbExtension);
size_t counter = 1;
while (Platform::IsFileExistsByFullPath(kmbPath))
kmbPath = my::JoinPath(newDir, fileName + strings::to_string(counter++) + kBookmarksExt);
kmbPath = my::JoinPath(newDir, fileName + strings::to_string(counter++) + kKmbExtension);
kml::FileData kmlData;
try
std::unique_ptr<kml::FileData> kmlData = LoadKmlFile(f, false /* binary */);
if (kmlData == nullptr)
{
kml::DeserializerKml des(kmlData);
FileReader reader(f);
des.Deserialize(reader);
}
catch (FileReader::Exception const & exc)
{
LOG(LDEBUG, ("KML text deserialization failure: ", exc.what(), "file", f));
handler(false /* success */);
return;
allConverted = false;
continue;
}
try
if (!SaveKmlFile(*kmlData, kmbPath, true /* binary */))
{
kml::binary::SerializerKml ser(kmlData);
FileWriter writer(kmbPath);
ser.Serialize(writer);
}
catch (FileWriter::Exception const & exc)
{
my::DeleteFileX(kmbPath);
LOG(LDEBUG, ("KML binary serialization failure: ", exc.what(), "file", f));
handler(false /* success */);
return;
allConverted = false;
continue;
}
fileData.emplace_back(kmbPath, std::move(kmlData));
fileData->emplace_back(kmbPath, std::move(kmlData));
my::DeleteFileX(f);
}
for (auto const & f : files)
my::DeleteFileX(f);
if (!fileData->empty())
{
GetPlatform().RunTask(Platform::Thread::Gui, [this, fileData = std::move(fileData)]() mutable
{
CreateCategories(std::move(*fileData), true /* autoSave */);
});
}
//TODO(@darina): add fileData to m_categories.
handler(true /* success */);
handler(allConverted);
});
}
@ -2003,14 +1880,14 @@ std::string BookmarkManager::GenerateUniqueFileName(const std::string & path, st
std::string BookmarkManager::GenerateValidAndUniqueFilePathForKML(std::string const & fileName)
{
std::string filePath = RemoveInvalidSymbols(fileName);
return GenerateUniqueFileName(GetPlatform().SettingsDir(), filePath, BOOKMARKS_FILE_EXTENSION);
return GenerateUniqueFileName(GetPlatform().SettingsDir(), filePath, kKmlExtension);
}
// static
std::string BookmarkManager::GenerateValidAndUniqueFilePathForKMB(std::string const & fileName)
{
std::string filePath = RemoveInvalidSymbols(fileName);
return GenerateUniqueFileName(GetBookmarksDirectory(), filePath, kBookmarksExt);
return GenerateUniqueFileName(GetBookmarksDirectory(), filePath, kKmbExtension);
}
// static
@ -2030,19 +1907,19 @@ BookmarkManager::EditSession::~EditSession()
m_bmManager.OnEditSessionClosed();
}
Bookmark * BookmarkManager::EditSession::CreateBookmark(kml::BookmarkData const & bm)
Bookmark * BookmarkManager::EditSession::CreateBookmark(kml::BookmarkData && bmData)
{
return m_bmManager.CreateBookmark(bm);
return m_bmManager.CreateBookmark(std::move(bmData));
}
Bookmark * BookmarkManager::EditSession::CreateBookmark(kml::BookmarkData & bm, kml::MarkGroupId groupId)
Bookmark * BookmarkManager::EditSession::CreateBookmark(kml::BookmarkData && bmData, kml::MarkGroupId groupId)
{
return m_bmManager.CreateBookmark(bm, groupId);
return m_bmManager.CreateBookmark(std::move(bmData), groupId);
}
Track * BookmarkManager::EditSession::CreateTrack(kml::TrackData const & trackData)
Track * BookmarkManager::EditSession::CreateTrack(kml::TrackData && trackData)
{
return m_bmManager.CreateTrack(trackData);
return m_bmManager.CreateTrack(std::move(trackData));
}
Bookmark * BookmarkManager::EditSession::GetBookmarkForEdit(kml::MarkId markId)

View file

@ -2,10 +2,9 @@
#include "map/bookmark.hpp"
#include "map/cloud.hpp"
#include "map/track.hpp"
#include "map/user_mark_layer.hpp"
#include "kml/types.hpp"
#include "drape_frontend/drape_engine_safe_ptr.hpp"
#include "geometry/any_rect2d.hpp"
@ -85,9 +84,9 @@ public:
return m_bmManager.CreateUserMark<UserMarkT>(ptOrg);
}
Bookmark * CreateBookmark(kml::BookmarkData const & bm);
Bookmark * CreateBookmark(kml::BookmarkData & bm, kml::MarkGroupId groupId);
Track * CreateTrack(kml::TrackData const & trackData);
Bookmark * CreateBookmark(kml::BookmarkData && bmData);
Bookmark * CreateBookmark(kml::BookmarkData && bmData, kml::MarkGroupId groupId);
Track * CreateTrack(kml::TrackData && trackData);
template <typename UserMarkT>
UserMarkT * GetMarkForEdit(kml::MarkId markId)
@ -165,7 +164,7 @@ public:
bool IsVisible(kml::MarkGroupId groupId) const;
kml::MarkGroupId CreateBookmarkCategory(kml::CategoryData const & data, bool autoSave = true);
kml::MarkGroupId CreateBookmarkCategory(kml::CategoryData && data, bool autoSave = true);
kml::MarkGroupId CreateBookmarkCategory(std::string const & name, bool autoSave = true);
std::string GetCategoryName(kml::MarkGroupId categoryId) const;
@ -184,11 +183,11 @@ public:
UserMark const * FindNearestUserMark(m2::AnyRectD const & rect) const;
UserMark const * FindMarkInRect(kml::MarkGroupId groupId, m2::AnyRectD const & rect, double & d) const;
/// Scans and loads all kml files with bookmarks in WritableDir.
std::shared_ptr<KMLDataCollection> LoadBookmarksKML(std::vector<std::string> & filePaths);
std::shared_ptr<KMLDataCollection> LoadBookmarksKMB(std::vector<std::string> & filePaths);
/// Scans and loads all kml files with bookmarks.
void LoadBookmarks();
void LoadBookmark(std::string const & filePath, bool isTemporaryFile);
std::shared_ptr<KMLDataCollection> LoadBookmarks(std::string const & dir, std::string const & ext, bool binary,
std::vector<std::string> & filePaths);
/// Uses the same file name from which was loaded, or
/// creates unique file name on first save and uses it every time.
@ -253,7 +252,7 @@ public:
// Convert all found kml files to the binary format.
using ConversionHandler = platform::SafeCallback<void(bool success)>;
void ConvertAllKmlFiles(ConversionHandler && handler) const;
void ConvertAllKmlFiles(ConversionHandler && handler);
// These handlers are always called from UI-thread.
void SetCloudHandlers(Cloud::SynchronizationStartedHandler && onSynchronizationStarted,
@ -267,7 +266,7 @@ public:
/// These functions are public for unit tests only. You shouldn't call them from client code.
bool SaveBookmarkCategory(kml::MarkGroupId groupId);
void SaveToFile(kml::MarkGroupId groupId, Writer & writer, bool useBinary) const;
bool SaveBookmarkCategory(kml::MarkGroupId groupId, Writer & writer, bool useBinary) const;
void CreateCategories(KMLDataCollection && dataCollection, bool autoSave = true);
static std::string RemoveInvalidSymbols(std::string const & name);
static std::string GenerateUniqueFileName(std::string const & path, std::string name, std::string const & fileExt);
@ -367,15 +366,15 @@ private:
UserMark * GetUserMarkForEdit(kml::MarkId markId);
void DeleteUserMark(kml::MarkId markId);
Bookmark * CreateBookmark(kml::BookmarkData const & bm);
Bookmark * CreateBookmark(kml::BookmarkData & bm, kml::MarkGroupId groupId);
Bookmark * CreateBookmark(kml::BookmarkData && bmData);
Bookmark * CreateBookmark(kml::BookmarkData && bmData, kml::MarkGroupId groupId);
Bookmark * GetBookmarkForEdit(kml::MarkId markId);
void AttachBookmark(kml::MarkId bmId, kml::MarkGroupId groupId);
void DetachBookmark(kml::MarkId bmId, kml::MarkGroupId groupId);
void DeleteBookmark(kml::MarkId bmId);
Track * CreateTrack(kml::TrackData const & trackData);
Track * CreateTrack(kml::TrackData && trackData);
void AttachTrack(kml::TrackId trackId, kml::MarkGroupId groupId);
void DetachTrack(kml::TrackId trackId, kml::MarkGroupId groupId);
@ -422,9 +421,8 @@ private:
void CheckAndResetLastIds();
std::unique_ptr<kml::FileData> CollectBmGroupKMLData(BookmarkCategory const * group) const;
void SaveToFile(kml::FileData & kmlData, Writer & writer, bool useBinary) const;
std::shared_ptr<KMLDataCollection> PrepareToSaveBookmarks(kml::GroupIdCollection const & groupIdCollection);
bool SaveKMLData(std::string const & file, kml::FileData & kmlData, bool useBinary);
bool SaveKmlFileSafe(kml::FileData & kmlData, std::string const & file, bool useBinary);
void OnSynchronizationStarted(Cloud::SynchronizationType type);
void OnSynchronizationFinished(Cloud::SynchronizationType type, Cloud::SynchronizationResult result,

View file

@ -4,6 +4,7 @@
#include "indexer/data_header.hpp"
#include "map/bookmark_helpers.hpp"
#include "map/framework.hpp"
#include "search/result.hpp"
@ -180,7 +181,7 @@ UNIT_CLASS_TEST(Runner, Bookmarks_ImportKML)
BookmarkManager::KMLDataCollection kmlDataCollection;
kmlDataCollection.emplace_back(""/* filePath */,
LoadKMLData(MemReader(kmlString, strlen(kmlString)), false /* useBinary */));
LoadKmlData(MemReader(kmlString, strlen(kmlString)), false /* useBinary */));
TEST(kmlDataCollection.back().second, ());
bmManager.CreateCategories(std::move(kmlDataCollection), false /* autoSave */);
TEST_EQUAL(bmManager.GetBmGroupsIdList().size(), 1, ());
@ -201,7 +202,7 @@ UNIT_CLASS_TEST(Runner, Bookmarks_ExportKML)
BookmarkManager::KMLDataCollection kmlDataCollection;
kmlDataCollection.emplace_back(""/* filePath */,
LoadKMLData(MemReader(kmlString, strlen(kmlString)), false /* useBinary */));
LoadKmlData(MemReader(kmlString, strlen(kmlString)), false /* useBinary */));
bmManager.CreateCategories(std::move(kmlDataCollection), false /* autoSave */);
TEST_EQUAL(bmManager.GetBmGroupsIdList().size(), 1, ());
@ -215,9 +216,8 @@ UNIT_CLASS_TEST(Runner, Bookmarks_ExportKML)
TEST_EQUAL(bmManager.IsVisible(groupId1), true, ());
{
LOG(LWARNING, ("SaveToKML (", fileName, ")"));
FileWriter writer(fileName);
bmManager.SaveToFile(groupId1, writer, false /* useBinary */);
bmManager.SaveBookmarkCategory(groupId1, writer, false /* useBinary */);
}
bmManager.GetEditSession().ClearGroup(groupId1);
@ -228,7 +228,7 @@ UNIT_CLASS_TEST(Runner, Bookmarks_ExportKML)
TEST_EQUAL(bmManager.GetBmGroupsIdList().size(), 0, ());
kmlDataCollection.clear();
kmlDataCollection.emplace_back("", LoadKMLData(FileReader(fileName), false /* useBinary */));
kmlDataCollection.emplace_back("", LoadKmlData(FileReader(fileName), false /* useBinary */));
TEST(kmlDataCollection.back().second, ());
bmManager.CreateCategories(std::move(kmlDataCollection), false /* autoSave */);
@ -241,9 +241,8 @@ UNIT_CLASS_TEST(Runner, Bookmarks_ExportKML)
bmManager.GetEditSession().DeleteBmCategory(groupId2);
TEST_EQUAL(bmManager.HasBmCategory(groupId2), false, ());
LOG(LWARNING, ("LoadKMLFile(", fileName, ")"));
kmlDataCollection.clear();
kmlDataCollection.emplace_back("", LoadKMLFile(fileName, false /* useBinary */));
kmlDataCollection.emplace_back("", LoadKmlFile(fileName, false /* useBinary */));
TEST(kmlDataCollection.back().second, ());
bmManager.CreateCategories(std::move(kmlDataCollection), false /* autoSave */);
@ -313,16 +312,17 @@ UNIT_TEST(Bookmarks_Timestamp)
b1.m_point = orgPoint;
auto cat1 = bmManager.CreateBookmarkCategory(arrCat[0], false /* autoSave */);
Bookmark const * pBm1 = bmManager.GetEditSession().CreateBookmark(b1, cat1);
Bookmark const * pBm1 = bmManager.GetEditSession().CreateBookmark(std::move(b1), cat1);
TEST_NOT_EQUAL(kml::ToSecondsSinceEpoch(pBm1->GetTimeStamp()), 0, ());
kml::BookmarkData b2;
kml::SetDefaultStr(b2.m_name, "newName");
b2.m_point = orgPoint;
Bookmark const * pBm2 = bmManager.GetEditSession().CreateBookmark(b2, cat1);
kml::BookmarkData b22 = b2;
Bookmark const * pBm2 = bmManager.GetEditSession().CreateBookmark(std::move(b2), cat1);
auto cat2 = bmManager.CreateBookmarkCategory(arrCat[0], false /* autoSave */);
Bookmark const * pBm3 = bmManager.GetEditSession().CreateBookmark(b2, cat2);
Bookmark const * pBm3 = bmManager.GetEditSession().CreateBookmark(std::move(b22), cat2);
// Check bookmarks order here. First added should be in the bottom of the list.
auto const firstId = * bmManager.GetUserMarkIds(cat1).rbegin();
@ -364,18 +364,20 @@ UNIT_TEST(Bookmarks_Getting)
auto const cat2 = bmManager.CreateBookmarkCategory(arrCat[1], false /* autoSave */);
auto const cat3 = bmManager.CreateBookmarkCategory(arrCat[2], false /* autoSave */);
kml::BookmarkData bm;
kml::SetDefaultStr(bm.m_name, "1");
bm.m_point = m2::PointD(38, 20);
auto const * pBm1 = bmManager.GetEditSession().CreateBookmark(bm, cat1);
kml::BookmarkData bm1;
kml::SetDefaultStr(bm1.m_name, "1");
bm1.m_point = m2::PointD(38, 20);
auto const * pBm1 = bmManager.GetEditSession().CreateBookmark(std::move(bm1), cat1);
kml::SetDefaultStr(bm.m_name, "2");
bm.m_point = m2::PointD(41, 20);
auto const * pBm2 = bmManager.GetEditSession().CreateBookmark(bm, cat2);
kml::BookmarkData bm2;
kml::SetDefaultStr(bm2.m_name, "2");
bm2.m_point = m2::PointD(41, 20);
auto const * pBm2 = bmManager.GetEditSession().CreateBookmark(std::move(bm2), cat2);
kml::SetDefaultStr(bm.m_name, "3");
bm.m_point = m2::PointD(41, 40);
auto const * pBm3 = bmManager.GetEditSession().CreateBookmark(bm, cat3);
kml::BookmarkData bm3;
kml::SetDefaultStr(bm3.m_name, "3");
bm3.m_point = m2::PointD(41, 40);
auto const * pBm3 = bmManager.GetEditSession().CreateBookmark(std::move(bm3), cat3);
TEST_NOT_EQUAL(pBm1->GetGroupId(), pBm2->GetGroupId(), ());
TEST_NOT_EQUAL(pBm1->GetGroupId(), pBm3->GetGroupId(), ());
@ -394,10 +396,11 @@ UNIT_TEST(Bookmarks_Getting)
mark = GetBookmark(fm, m2::PointD(41, 40));
TEST_EQUAL(bmManager.GetCategoryName(mark->GetGroupId()), "cat3", ());
kml::SetDefaultStr(bm.m_name, "4");
bm.m_point = m2::PointD(41, 40);
bm.m_color.m_predefinedColor = kml::PredefinedColor::Blue;
auto const * pBm4 = bmManager.GetEditSession().CreateBookmark(bm, cat3);
kml::BookmarkData bm4;
kml::SetDefaultStr(bm4.m_name, "4");
bm4.m_point = m2::PointD(41, 40);
bm4.m_color.m_predefinedColor = kml::PredefinedColor::Blue;
auto const * pBm4 = bmManager.GetEditSession().CreateBookmark(std::move(bm4), cat3);
TEST_EQUAL(pBm3->GetGroupId(), pBm4->GetGroupId(), ());
@ -518,16 +521,17 @@ UNIT_TEST(Bookmarks_AddingMoving)
auto const cat1 = bmManager.CreateBookmarkCategory(arrCat[0], false /* autoSave */);
auto const cat2 = bmManager.CreateBookmarkCategory(arrCat[1], false /* autoSave */);
kml::BookmarkData bm;
kml::SetDefaultStr(bm.m_name, "name");
bm.m_point = globalPoint;
auto const * pBm1 = bmManager.GetEditSession().CreateBookmark(bm, cat1);
kml::BookmarkData bm1;
kml::SetDefaultStr(bm1.m_name, "name");
bm1.m_point = globalPoint;
auto const * pBm1 = bmManager.GetEditSession().CreateBookmark(std::move(bm1), cat1);
Bookmark const * mark = GetBookmarkPxPoint(fm, pixelPoint);
TEST_EQUAL(bmManager.GetCategoryName(mark->GetGroupId()), "cat1", ());
kml::SetDefaultStr(bm.m_name, "name2");
bm.m_color.m_predefinedColor = kml::PredefinedColor::Blue;
auto const * pBm11 = bmManager.GetEditSession().CreateBookmark(bm, cat1);
kml::BookmarkData bm2;
kml::SetDefaultStr(bm2.m_name, "name2");
bm2.m_color.m_predefinedColor = kml::PredefinedColor::Blue;
auto const * pBm11 = bmManager.GetEditSession().CreateBookmark(std::move(bm2), cat1);
TEST_EQUAL(pBm1->GetGroupId(), pBm11->GetGroupId(), ());
mark = GetBookmarkPxPoint(fm, pixelPoint);
TEST_EQUAL(bmManager.GetCategoryName(mark->GetGroupId()), "cat1", ());
@ -535,9 +539,10 @@ UNIT_TEST(Bookmarks_AddingMoving)
TEST_EQUAL(mark->GetColor(), kml::PredefinedColor::Blue, ());
// Edit name, type and category of bookmark
kml::SetDefaultStr(bm.m_name, "name3");
bm.m_color.m_predefinedColor = kml::PredefinedColor::Green;
auto const * pBm2 = bmManager.GetEditSession().CreateBookmark(bm, cat2);
kml::BookmarkData bm3;
kml::SetDefaultStr(bm3.m_name, "name3");
bm3.m_color.m_predefinedColor = kml::PredefinedColor::Green;
auto const * pBm2 = bmManager.GetEditSession().CreateBookmark(std::move(bm3), cat2);
TEST_NOT_EQUAL(pBm1->GetGroupId(), pBm2->GetGroupId(), ());
TEST_EQUAL(bmManager.GetBmGroupsIdList().size(), 2, ());
mark = GetBookmarkPxPoint(fm, pixelPoint);
@ -585,7 +590,7 @@ UNIT_CLASS_TEST(Runner, Bookmarks_InnerFolder)
BookmarkManager::KMLDataCollection kmlDataCollection;
kmlDataCollection.emplace_back("" /* filePath */,
LoadKMLData(MemReader(kmlString2, strlen(kmlString2)), false /* useBinary */));
LoadKmlData(MemReader(kmlString2, strlen(kmlString2)), false /* useBinary */));
bmManager.CreateCategories(std::move(kmlDataCollection), false /* autoSave */);
auto const & groupIds = bmManager.GetBmGroupsIdList();
TEST_EQUAL(groupIds.size(), 1, ());
@ -598,7 +603,7 @@ UNIT_CLASS_TEST(Runner, BookmarkCategory_EmptyName)
auto const catId = bmManager.CreateBookmarkCategory("", false /* autoSave */);
kml::BookmarkData bm;
bm.m_point = m2::PointD(0, 0);
bmManager.GetEditSession().CreateBookmark(bm, catId);
bmManager.GetEditSession().CreateBookmark(std::move(bm), catId);
TEST(bmManager.SaveBookmarkCategory(catId), ());
@ -651,7 +656,7 @@ UNIT_CLASS_TEST(Runner, Bookmarks_SpecialXMLNames)
BookmarkManager bmManager((BookmarkManager::Callbacks(bmCallbacks)));
BookmarkManager::KMLDataCollection kmlDataCollection;
kmlDataCollection.emplace_back("" /* filePath */,
LoadKMLData(MemReader(kmlString3, strlen(kmlString3)), false /* useBinary */));
LoadKmlData(MemReader(kmlString3, strlen(kmlString3)), false /* useBinary */));
bmManager.CreateCategories(std::move(kmlDataCollection), false /* autoSave */);
auto const & groupIds = bmManager.GetBmGroupsIdList();
@ -668,7 +673,7 @@ UNIT_CLASS_TEST(Runner, Bookmarks_SpecialXMLNames)
editSession.SetCategoryName(catId, "test");
kmlDataCollection.clear();
kmlDataCollection.emplace_back(fileName, LoadKMLFile(fileName, BookmarkManager::IsMigrated()));
kmlDataCollection.emplace_back(fileName, LoadKmlFile(fileName, BookmarkManager::IsMigrated()));
bmManager.CreateCategories(std::move(kmlDataCollection), false /* autoSave */);
TEST_EQUAL(bmManager.GetBmGroupsIdList().size(), 2, ());
auto const catId2 = bmManager.GetBmGroupsIdList().back();
@ -692,7 +697,7 @@ UNIT_CLASS_TEST(Runner, TrackParsingTest_1)
string const kmlFile = GetPlatform().TestsDataPathForFile("kml-with-track-kml.test");
BookmarkManager bmManager((BookmarkManager::Callbacks(bmCallbacks)));
BookmarkManager::KMLDataCollection kmlDataCollection;
kmlDataCollection.emplace_back(kmlFile, LoadKMLFile(kmlFile, false /* useBinary */));
kmlDataCollection.emplace_back(kmlFile, LoadKmlFile(kmlFile, false /* useBinary */));
TEST(kmlDataCollection.back().second, ("KML can't be loaded"));
bmManager.CreateCategories(std::move(kmlDataCollection), false /* autoSave */);
@ -725,7 +730,7 @@ UNIT_CLASS_TEST(Runner, TrackParsingTest_2)
string const kmlFile = GetPlatform().TestsDataPathForFile("kml-with-track-from-google-earth.test");
BookmarkManager bmManager((BookmarkManager::Callbacks(bmCallbacks)));
BookmarkManager::KMLDataCollection kmlDataCollection;
kmlDataCollection.emplace_back(kmlFile, LoadKMLFile(kmlFile, false /* useBinary */));
kmlDataCollection.emplace_back(kmlFile, LoadKmlFile(kmlFile, false /* useBinary */));
TEST(kmlDataCollection.back().second, ("KML can't be loaded"));
bmManager.CreateCategories(std::move(kmlDataCollection), false /* autoSave */);
@ -794,15 +799,16 @@ UNIT_CLASS_TEST(Runner, Bookmarks_Listeners)
{
auto editSession = bmManager.GetEditSession();
kml::BookmarkData data;
kml::SetDefaultStr(data.m_name, "name 0");
data.m_point = m2::PointD(0.0, 0.0);
auto * bookmark0 = editSession.CreateBookmark(data);
kml::BookmarkData data0;
kml::SetDefaultStr(data0.m_name, "name 0");
data0.m_point = m2::PointD(0.0, 0.0);
auto * bookmark0 = editSession.CreateBookmark(std::move(data0));
editSession.AttachBookmark(bookmark0->GetId(), catId);
createdMarks.insert(bookmark0->GetId());
kml::SetDefaultStr(data.m_name, "name 1");
auto * bookmark1 = editSession.CreateBookmark(data);
kml::BookmarkData data1;
kml::SetDefaultStr(data1.m_name, "name 1");
auto * bookmark1 = editSession.CreateBookmark(std::move(data1));
editSession.AttachBookmark(bookmark1->GetId(), catId);
createdMarks.insert(bookmark1->GetId());
@ -826,7 +832,7 @@ UNIT_CLASS_TEST(Runner, Bookmarks_Listeners)
kml::BookmarkData data;
kml::SetDefaultStr(data.m_name, "name 5");
data.m_point = m2::PointD(0.0, 0.0);
auto * bookmark1 = editSession.CreateBookmark(data);
auto * bookmark1 = editSession.CreateBookmark(std::move(data));
createdMarks.insert(bookmark1->GetId());
}
checkNotifications();
@ -835,19 +841,19 @@ UNIT_CLASS_TEST(Runner, Bookmarks_Listeners)
UNIT_CLASS_TEST(Runner, Bookmarks_AutoSave)
{
BookmarkManager bmManager((BookmarkManager::Callbacks(bmCallbacks)));
kml::BookmarkData data;
kml::BookmarkData data0;
kml::MarkId bmId0;
auto const catId = bmManager.CreateBookmarkCategory("test");
data.m_point = m2::PointD(0.0, 0.0);
data0.m_point = m2::PointD(0.0, 0.0);
{
kml::SetDefaultStr(data.m_name, "name 0");
kml::SetDefaultStr(data0.m_name, "name 0");
auto editSession = bmManager.GetEditSession();
bmId0 = editSession.CreateBookmark(data)->GetId();
bmId0 = editSession.CreateBookmark(std::move(data0))->GetId();
editSession.AttachBookmark(bmId0, catId);
}
auto const fileName = bmManager.GetCategoryFileName(catId);
auto kmlData = LoadKMLFile(fileName, BookmarkManager::IsMigrated());
auto kmlData = LoadKmlFile(fileName, BookmarkManager::IsMigrated());
TEST(kmlData != nullptr, ());
TEST_EQUAL(kmlData->m_bookmarksData.size(), 1, ());
TEST_EQUAL(kml::GetDefaultStr(kmlData->m_bookmarksData.front().m_name), "name 0", ());
@ -856,32 +862,35 @@ UNIT_CLASS_TEST(Runner, Bookmarks_AutoSave)
auto editSession = bmManager.GetEditSession();
editSession.GetBookmarkForEdit(bmId0)->SetName("name 0 renamed");
kml::SetDefaultStr(data.m_name, "name 1");
auto bmId = editSession.CreateBookmark(data)->GetId();
kml::BookmarkData data1;
kml::SetDefaultStr(data1.m_name, "name 1");
auto bmId = editSession.CreateBookmark(std::move(data1))->GetId();
editSession.AttachBookmark(bmId, catId);
kml::SetDefaultStr(data.m_name, "name 2");
bmId = editSession.CreateBookmark(data)->GetId();
kml::BookmarkData data2;
kml::SetDefaultStr(data2.m_name, "name 2");
bmId = editSession.CreateBookmark(std::move(data2))->GetId();
editSession.AttachBookmark(bmId, catId);
kml::SetDefaultStr(data.m_name, "name 3");
bmId = editSession.CreateBookmark(data)->GetId();
kml::BookmarkData data3;
kml::SetDefaultStr(data3.m_name, "name 3");
bmId = editSession.CreateBookmark(std::move(data3))->GetId();
editSession.AttachBookmark(bmId, catId);
kmlData = LoadKMLFile(fileName, BookmarkManager::IsMigrated());
kmlData = LoadKmlFile(fileName, BookmarkManager::IsMigrated());
TEST(kmlData != nullptr, ());
TEST_EQUAL(kmlData->m_bookmarksData.size(), 1, ());
TEST_EQUAL(kml::GetDefaultStr(kmlData->m_bookmarksData.front().m_name), "name 0", ());
}
kmlData = LoadKMLFile(fileName, BookmarkManager::IsMigrated());
kmlData = LoadKmlFile(fileName, BookmarkManager::IsMigrated());
TEST(kmlData != nullptr, ());
TEST_EQUAL(kmlData->m_bookmarksData.size(), 4, ());
TEST_EQUAL(kml::GetDefaultStr(kmlData->m_bookmarksData.front().m_name), "name 0 renamed", ());
bmManager.GetEditSession().DeleteBookmark(bmId0);
kmlData = LoadKMLFile(fileName, BookmarkManager::IsMigrated());
kmlData = LoadKmlFile(fileName, BookmarkManager::IsMigrated());
TEST(kmlData != nullptr, ());
TEST_EQUAL(kmlData->m_bookmarksData.size(), 3, ());
TEST_EQUAL(kml::GetDefaultStr(kmlData->m_bookmarksData.front().m_name), "name 1", ());
@ -890,13 +899,13 @@ UNIT_CLASS_TEST(Runner, Bookmarks_AutoSave)
auto const movedBmId = *bmManager.GetUserMarkIds(catId).begin();
bmManager.GetEditSession().MoveBookmark(movedBmId, catId, catId2);
kmlData = LoadKMLFile(fileName, BookmarkManager::IsMigrated());
kmlData = LoadKmlFile(fileName, BookmarkManager::IsMigrated());
TEST(kmlData != nullptr, ());
TEST_EQUAL(kmlData->m_bookmarksData.size(), 2, ());
TEST_EQUAL(kml::GetDefaultStr(kmlData->m_bookmarksData.front().m_name), "name 1", ());
auto const fileName2 = bmManager.GetCategoryFileName(catId2);
auto kmlData2 = LoadKMLFile(fileName2, BookmarkManager::IsMigrated());
auto kmlData2 = LoadKmlFile(fileName2, BookmarkManager::IsMigrated());
TEST(kmlData2 != nullptr, ());
TEST_EQUAL(kmlData2->m_bookmarksData.size(), 1, ());
TEST_EQUAL(kml::GetDefaultStr(kmlData2->m_bookmarksData.front().m_name), "name 3", ());

View file

@ -1,5 +1,6 @@
#include "testing/testing.hpp"
#include "map/bookmark_helpers.hpp"
#include "map/framework.hpp"
#include "platform/platform.hpp"
@ -35,7 +36,7 @@ UNIT_TEST(KMZ_UnzipTest)
MY_SCOPE_GUARD(fileGuard, bind(&FileWriter::DeleteFileX, kmlFile));
ZipFileReader::UnzipFile(kmzFile, "doc.kml", kmlFile);
auto kmlData = LoadKMLData(FileReader(kmlFile), false /* useBinary */);
auto kmlData = LoadKmlData(FileReader(kmlFile), false /* useBinary */);
TEST(kmlData != nullptr, ());
TEST_EQUAL(files.size(), 6, ("KMZ file wrong number of files"));
@ -43,7 +44,7 @@ UNIT_TEST(KMZ_UnzipTest)
TEST_EQUAL(kmlData->m_bookmarksData.size(), 6, ("Category wrong number of bookmarks"));
{
Bookmark const bm(kmlData->m_bookmarksData[0]);
Bookmark const bm(std::move(kmlData->m_bookmarksData[0]));
TEST_EQUAL(bm.GetName(), ("Lahaina Breakwall"), ("KML wrong name!"));
TEST_EQUAL(bm.GetColor(), kml::PredefinedColor::Red, ("KML wrong type!"));
TEST_ALMOST_EQUAL_ULPS(bm.GetPivot().x, -156.6777046791284, ("KML wrong org x!"));
@ -51,7 +52,7 @@ UNIT_TEST(KMZ_UnzipTest)
TEST_EQUAL(bm.GetScale(), 0, ("KML wrong scale!"));
}
{
Bookmark const bm(kmlData->m_bookmarksData[1]);
Bookmark const bm(std::move(kmlData->m_bookmarksData[1]));
TEST_EQUAL(bm.GetName(), ("Seven Sacred Pools, Kipahulu"), ("KML wrong name!"));
TEST_EQUAL(bm.GetColor(), kml::PredefinedColor::Red, ("KML wrong type!"));
TEST_ALMOST_EQUAL_ULPS(bm.GetPivot().x, -156.0405130750025, ("KML wrong org x!"));

View file

@ -1,10 +1,7 @@
#include "map/track.hpp"
#include "geometry/mercator.hpp"
#include "drape/color.hpp"
#include "geometry/distance_on_sphere.hpp"
#include "geometry/mercator.hpp"
#include "platform/platform.hpp"
@ -46,9 +43,9 @@ kml::TrackId GetNextUserLineId(bool reset = false)
} // namespace
Track::Track(kml::TrackData const & data)
: df::UserLineMark(data.m_id == kml::kInvalidTrackId ? GetNextUserLineId() : data.m_id)
, m_data(data)
Track::Track(kml::TrackData && data)
: Base(data.m_id == kml::kInvalidTrackId ? GetNextUserLineId() : data.m_id)
, m_data(std::move(data))
, m_groupID(0)
{
m_data.m_id = GetId();

View file

@ -3,24 +3,12 @@
#include "kml/types.hpp"
#include "drape_frontend/user_marks_provider.hpp"
#include "drape/color.hpp"
#include "geometry/polyline2d.hpp"
#include "base/buffer_vector.hpp"
#include "base/macros.hpp"
namespace location
{
class RouteMatchingInfo;
}
class Track : public df::UserLineMark
{
DISALLOW_COPY_AND_MOVE(Track);
using Base = df::UserLineMark;
public:
explicit Track(kml::TrackData const & data);
explicit Track(kml::TrackData && data);
static void ResetLastId();
@ -42,12 +30,12 @@ public:
std::vector<m2::PointD> const & GetPoints() const override;
kml::MarkGroupId GetGroupId() const { return m_groupID; }
void Attach(kml::MarkGroupId groupId);
void Detach();
private:
kml::TrackData m_data;
kml::MarkGroupId m_groupID;
mutable bool m_isDirty = true;
};

View file

@ -375,7 +375,7 @@ void DrawWidget::SubmitBookmark(m2::PointD const & pt)
kml::BookmarkData data;
data.m_color.m_predefinedColor = kml::PredefinedColor::Red;
data.m_point = m_framework.P3dtoG(pt);
m_framework.GetBookmarkManager().GetEditSession().CreateBookmark(data, m_bookmarksCategoryId);
m_framework.GetBookmarkManager().GetEditSession().CreateBookmark(std::move(data), m_bookmarksCategoryId);
}
void DrawWidget::FollowRoute()

View file

@ -127,6 +127,8 @@
BB4E5F261FCC664A00A77250 /* transit_display.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BB4E5F221FCC664A00A77250 /* transit_display.hpp */; };
BB4E5F271FCC664A00A77250 /* transit_reader.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BB4E5F231FCC664A00A77250 /* transit_reader.hpp */; };
BB4E5F281FCC664A00A77250 /* transit_reader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BB4E5F241FCC664A00A77250 /* transit_reader.cpp */; };
BBA014AD2073C784007402E4 /* bookmark_helpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BBA014AB2073C783007402E4 /* bookmark_helpers.cpp */; };
BBA014AE2073C784007402E4 /* bookmark_helpers.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BBA014AC2073C784007402E4 /* bookmark_helpers.hpp */; };
BBD9E2C61EE9D01900DF189A /* routing_mark.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BBD9E2C41EE9D01900DF189A /* routing_mark.cpp */; };
BBD9E2C71EE9D01900DF189A /* routing_mark.hpp in Headers */ = {isa = PBXBuildFile; fileRef = BBD9E2C51EE9D01900DF189A /* routing_mark.hpp */; };
BBFC7E3A202D29C000531BE7 /* user_mark_layer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BBFC7E38202D29BF00531BE7 /* user_mark_layer.cpp */; };
@ -296,6 +298,8 @@
BB4E5F221FCC664A00A77250 /* transit_display.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = transit_display.hpp; path = transit/transit_display.hpp; sourceTree = "<group>"; };
BB4E5F231FCC664A00A77250 /* transit_reader.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = transit_reader.hpp; path = transit/transit_reader.hpp; sourceTree = "<group>"; };
BB4E5F241FCC664A00A77250 /* transit_reader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = transit_reader.cpp; path = transit/transit_reader.cpp; sourceTree = "<group>"; };
BBA014AB2073C783007402E4 /* bookmark_helpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = bookmark_helpers.cpp; sourceTree = "<group>"; };
BBA014AC2073C784007402E4 /* bookmark_helpers.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = bookmark_helpers.hpp; sourceTree = "<group>"; };
BBD9E2C41EE9D01900DF189A /* routing_mark.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = routing_mark.cpp; sourceTree = "<group>"; };
BBD9E2C51EE9D01900DF189A /* routing_mark.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = routing_mark.hpp; sourceTree = "<group>"; };
BBFC7E38202D29BF00531BE7 /* user_mark_layer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = user_mark_layer.cpp; sourceTree = "<group>"; };
@ -523,10 +527,12 @@
3D4E999E1FB4A6400025B48C /* booking_filter_cache.hpp */,
3D4E99A01FB4A6410025B48C /* booking_filter.cpp */,
3D4E99A11FB4A6410025B48C /* booking_filter.hpp */,
675345D91A4054E800A0A8C3 /* bookmark_manager.cpp */,
675345DA1A4054E800A0A8C3 /* bookmark_manager.hpp */,
675345DB1A4054E800A0A8C3 /* bookmark.cpp */,
675345DC1A4054E800A0A8C3 /* bookmark.hpp */,
BBA014AB2073C783007402E4 /* bookmark_helpers.cpp */,
BBA014AC2073C784007402E4 /* bookmark_helpers.hpp */,
675345D91A4054E800A0A8C3 /* bookmark_manager.cpp */,
675345DA1A4054E800A0A8C3 /* bookmark_manager.hpp */,
0831F23B200E53600034C365 /* bookmarks_search_params.hpp */,
348AB57A1D7EE0C6009F8301 /* chart_generator.cpp */,
348AB57B1D7EE0C6009F8301 /* chart_generator.hpp */,
@ -631,6 +637,7 @@
675346671A4054E800A0A8C3 /* ge0_parser.hpp in Headers */,
675346A21A4054E800A0A8C3 /* user_mark.hpp in Headers */,
454649F21F2728CE00EF4064 /* local_ads_mark.hpp in Headers */,
BBA014AE2073C784007402E4 /* bookmark_helpers.hpp in Headers */,
F6B283061C1B03320081957A /* gps_track_filter.hpp in Headers */,
F69687C8201B4A3600457650 /* discovery_search_params.hpp in Headers */,
3D4E99831FB462B60025B48C /* viewport_search_params.hpp in Headers */,
@ -800,6 +807,7 @@
45201E931CE4AC90008A4842 /* api_mark_point.cpp in Sources */,
F6FC3CB61FC323430001D929 /* discovery_manager.cpp in Sources */,
675346661A4054E800A0A8C3 /* ge0_parser.cpp in Sources */,
BBA014AD2073C784007402E4 /* bookmark_helpers.cpp in Sources */,
F6D2CE7E1EDEB7F500636DFD /* routing_manager.cpp in Sources */,
3D74ABBE1EA76F1D0063A898 /* local_ads_supported_types.cpp in Sources */,
45A2D9D51F7556EB003310A0 /* user.cpp in Sources */,