Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/kml
diff options
context:
space:
mode:
authorAnatoliy Tomilov <tomilovanatoliy@gmail.com>2020-09-21 13:20:01 +0300
committerArsentiy Milchakov <milcars@mapswithme.com>2020-09-21 14:58:28 +0300
commiteff3f5590a4c1700f43fe08f54c44a84770ab467 (patch)
treeea34e68f54c131f554a682d471e74bdc1cc92d32 /kml
parent95f8effcb9d240433f8d817bb5c77015a56aef9f (diff)
[kml] Support compilations in kml data structures MAPSME-14909
Diffstat (limited to 'kml')
-rw-r--r--kml/type_utils.hpp2
-rw-r--r--kml/types.hpp39
2 files changed, 39 insertions, 2 deletions
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<MarkId>;
using TrackIdCollection = std::vector<TrackId>;
@@ -40,6 +41,7 @@ using GroupIdSet = std::set<MarkGroupId>;
MarkGroupId constexpr kInvalidMarkGroupId = std::numeric_limits<MarkGroupId>::max();
MarkId constexpr kInvalidMarkId = std::numeric_limits<MarkId>::max();
TrackId constexpr kInvalidTrackId = std::numeric_limits<TrackId>::max();
+CompilationId constexpr kInvalidCompilationId = std::numeric_limits<CompilationId>::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<CompilationId> 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<BookmarkData> m_bookmarksData;
// Tracks collection.
std::vector<TrackData> m_tracksData;
+ // Compilation collection.
+ std::vector<CategoryData> m_compilationData;
};
inline std::string DebugPrint(BookmarkIcon icon)