diff --git a/kml/type_utils.hpp b/kml/type_utils.hpp index 659fd538ae..15c80ac7b0 100644 --- a/kml/type_utils.hpp +++ b/kml/type_utils.hpp @@ -27,6 +27,7 @@ using MarkGroupId = uint64_t; using MarkId = uint64_t; using TrackId = uint64_t; using LocalId = uint8_t; +using CompilationId = uint64_t; using MarkIdCollection = std::vector; using TrackIdCollection = std::vector; @@ -40,6 +41,7 @@ using GroupIdSet = std::set; MarkGroupId constexpr kInvalidMarkGroupId = std::numeric_limits::max(); MarkId constexpr kInvalidMarkId = std::numeric_limits::max(); TrackId constexpr kInvalidTrackId = std::numeric_limits::max(); +CompilationId constexpr kInvalidCompilationId = std::numeric_limits::max(); inline uint64_t ToSecondsSinceEpoch(Timestamp const & time) { diff --git a/kml/types.hpp b/kml/types.hpp index 095a43a171..2ecefe664c 100644 --- a/kml/types.hpp +++ b/kml/types.hpp @@ -95,6 +95,28 @@ inline std::string DebugPrint(AccessRules accessRules) UNREACHABLE(); } +enum class CompilationType : uint8_t +{ + // Do not change the order because of binary serialization. + Category = 0, + Collection, + Day, + + Count +}; + +inline std::string DebugPrint(CompilationType compilationType) +{ + switch (compilationType) + { + case CompilationType::Category: return "Category"; + case CompilationType::Collection: return "Collection"; + case CompilationType::Day: return "Day"; + case CompilationType::Count: return {}; + } + UNREACHABLE(); +} + enum class BookmarkIcon : uint16_t { // Do not change the order because of binary serialization. @@ -207,6 +229,7 @@ struct BookmarkData visitor(m_visible, "visible"), visitor(m_nearestToponym, "nearestToponym"), visitor(m_properties, "properties"), + //visitor(m_compilations, "compilations"), // TODO(tomilov): enable ASAP VISITOR_COLLECTABLE) DECLARE_COLLECTABLE(LocalizableStringIndex, m_name, m_description, m_customName, @@ -225,7 +248,8 @@ struct BookmarkData m_boundTracks == data.m_boundTracks && m_visible == data.m_visible && m_nearestToponym == data.m_nearestToponym && - m_properties == data.m_properties; + m_properties == data.m_properties && + m_compilations == data.m_compilations; } bool operator!=(BookmarkData const & data) const { return !operator==(data); } @@ -259,6 +283,8 @@ struct BookmarkData std::string m_nearestToponym; // Key-value properties. Properties m_properties; + // List of compilationIds. + std::vector m_compilations; }; // Note: any changes in binary format of this structure @@ -339,6 +365,8 @@ struct TrackData struct CategoryData { DECLARE_VISITOR_AND_DEBUG_PRINT(CategoryData, visitor(m_id, "id"), + //visitor(m_compilationId, "compilationId"), // TODO(tomilov): enable ASAP + //visitor(m_type, "type"), // TODO(tomilov): enable ASAP visitor(m_name, "name"), visitor(m_imageUrl, "imageUrl"), visitor(m_annotation, "annotation"), @@ -362,7 +390,8 @@ struct CategoryData bool operator==(CategoryData const & data) const { double constexpr kEps = 1e-5; - return m_id == data.m_id && m_name == data.m_name && m_imageUrl == data.m_imageUrl && + return m_id == data.m_id && m_compilationId == data.m_compilationId && + m_type == data.m_type && m_name == data.m_name && m_imageUrl == data.m_imageUrl && m_annotation == data.m_annotation && m_description == data.m_description && m_visible == data.m_visible && m_accessRules == data.m_accessRules && m_authorName == data.m_authorName && m_authorId == data.m_authorId && @@ -376,6 +405,10 @@ struct CategoryData // Unique id (it will not be serialized in text files). MarkGroupId m_id = kInvalidMarkGroupId; + // Id unique within single kml (have to be serialized in text files). + CompilationId m_compilationId = kInvalidCompilationId; + // Compilation's type + CompilationType m_type = CompilationType::Category; // Category's name. LocalizableString m_name; // Image URL. @@ -433,6 +466,8 @@ struct FileData std::vector m_bookmarksData; // Tracks collection. std::vector m_tracksData; + // Compilation collection. + std::vector m_compilationData; }; inline std::string DebugPrint(BookmarkIcon icon)