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:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2019-11-25 13:24:52 +0300
committerArsentiy Milchakov <milcars@mapswithme.com>2020-01-13 12:04:14 +0300
commit524b980919bac17323b42fb98832c69eab749b2b (patch)
tree64356fe16194b2f1d558a7229c7c42b40e8d1d77 /kml
parent88d0ef3f563a1eeece359f4df77d5cf8d6bba4ca (diff)
[bookmarks] Extended colours palette. Upgraded KML version.
Diffstat (limited to 'kml')
-rw-r--r--kml/kml_tests/serdes_tests.cpp56
-rw-r--r--kml/kml_tests/tests_data.hpp6
-rw-r--r--kml/serdes.cpp24
-rw-r--r--kml/serdes_binary.hpp10
-rw-r--r--kml/types.hpp18
5 files changed, 107 insertions, 7 deletions
diff --git a/kml/kml_tests/serdes_tests.cpp b/kml/kml_tests/serdes_tests.cpp
index 4a0a208a51..cc21049120 100644
--- a/kml/kml_tests/serdes_tests.cpp
+++ b/kml/kml_tests/serdes_tests.cpp
@@ -166,6 +166,62 @@ char const * kGeneratedKml =
" </Icon>\n"
" </IconStyle>\n"
" </Style>\n"
+ " <Style id=\"placemark-deeppurple\">\n"
+ " <IconStyle>\n"
+ " <Icon>\n"
+ " <href>http://maps.me/placemarks/placemark-deeppurple.png</href>\n"
+ " </Icon>\n"
+ " </IconStyle>\n"
+ " </Style>\n"
+ " <Style id=\"placemark-lightblue\">\n"
+ " <IconStyle>\n"
+ " <Icon>\n"
+ " <href>http://maps.me/placemarks/placemark-lightblue.png</href>\n"
+ " </Icon>\n"
+ " </IconStyle>\n"
+ " </Style>\n"
+ " <Style id=\"placemark-cyan\">\n"
+ " <IconStyle>\n"
+ " <Icon>\n"
+ " <href>http://maps.me/placemarks/placemark-cyan.png</href>\n"
+ " </Icon>\n"
+ " </IconStyle>\n"
+ " </Style>\n"
+ " <Style id=\"placemark-teal\">\n"
+ " <IconStyle>\n"
+ " <Icon>\n"
+ " <href>http://maps.me/placemarks/placemark-teal.png</href>\n"
+ " </Icon>\n"
+ " </IconStyle>\n"
+ " </Style>\n"
+ " <Style id=\"placemark-lime\">\n"
+ " <IconStyle>\n"
+ " <Icon>\n"
+ " <href>http://maps.me/placemarks/placemark-lime.png</href>\n"
+ " </Icon>\n"
+ " </IconStyle>\n"
+ " </Style>\n"
+ " <Style id=\"placemark-deeporange\">\n"
+ " <IconStyle>\n"
+ " <Icon>\n"
+ " <href>http://maps.me/placemarks/placemark-deeporange.png</href>\n"
+ " </Icon>\n"
+ " </IconStyle>\n"
+ " </Style>\n"
+ " <Style id=\"placemark-gray\">\n"
+ " <IconStyle>\n"
+ " <Icon>\n"
+ " <href>http://maps.me/placemarks/placemark-gray.png</href>\n"
+ " </Icon>\n"
+ " </IconStyle>\n"
+ " </Style>\n"
+ " <Style id=\"placemark-bluegray\">\n"
+ " <IconStyle>\n"
+ " <Icon>\n"
+ " <href>http://maps.me/placemarks/placemark-bluegray.png</href>\n"
+ " </Icon>\n"
+ " </IconStyle>\n"
+ " </Style>\n"
" <name>Test category</name>\n"
" <description>Test description</description>\n"
" <visibility>1</visibility>\n"
diff --git a/kml/kml_tests/tests_data.hpp b/kml/kml_tests/tests_data.hpp
index fc0be10061..b81b5f8a8e 100644
--- a/kml/kml_tests/tests_data.hpp
+++ b/kml/kml_tests/tests_data.hpp
@@ -59,7 +59,7 @@ char const * kTextKml =
"<Placemark>"
"<name>Nebraska</name>"
"<description><![CDATA[]]></description>"
- "<styleUrl>#placemark-red</styleUrl>"
+ "<styleUrl>#placemark-lime</styleUrl>"
"<Point>"
"<coordinates>-99.901810,41.492538,0.000000</coordinates>"
"</Point>"
@@ -1364,12 +1364,12 @@ std::vector<uint8_t> const kBinKmlV4 = {
};
std::vector<uint8_t> const kBinKml = {
- 0x04, 0x00, 0x00, 0x1E, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4D, 0x00, 0x00, 0x00,
+ 0x05, 0x00, 0x00, 0x1E, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4D, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x74, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x01, 0x00,
0x01, 0x00, 0x01, 0x00, 0x02, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x04, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x8D, 0xB7, 0xF5, 0x71, 0xFC, 0x8C, 0xFC, 0xC0, 0x02, 0x00, 0x01, 0x05,
0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x01, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF3, 0xC2, 0xFB, 0xF9,
diff --git a/kml/serdes.cpp b/kml/serdes.cpp
index 6726df4b42..747d0e3813 100644
--- a/kml/serdes.cpp
+++ b/kml/serdes.cpp
@@ -101,6 +101,22 @@ PredefinedColor ExtractPlacemarkPredefinedColor(std::string const & s)
return PredefinedColor::Green;
if (s == "#placemark-orange")
return PredefinedColor::Orange;
+ if (s == "#placemark-deeppurple")
+ return PredefinedColor::DeepPurple;
+ if (s == "#placemark-lightblue")
+ return PredefinedColor::LightBlue;
+ if (s == "#placemark-cyan")
+ return PredefinedColor::Cyan;
+ if (s == "#placemark-teal")
+ return PredefinedColor::Teal;
+ if (s == "#placemark-lime")
+ return PredefinedColor::Lime;
+ if (s == "#placemark-deeporange")
+ return PredefinedColor::DeepOrange;
+ if (s == "#placemark-gray")
+ return PredefinedColor::Gray;
+ if (s == "#placemark-bluegray")
+ return PredefinedColor::BlueGray;
// Default color.
return PredefinedColor::Red;
@@ -118,6 +134,14 @@ std::string GetStyleForPredefinedColor(PredefinedColor color)
case PredefinedColor::Brown: return "placemark-brown";
case PredefinedColor::Green: return "placemark-green";
case PredefinedColor::Orange: return "placemark-orange";
+ case PredefinedColor::DeepPurple: return "placemark-deeppurple";
+ case PredefinedColor::LightBlue: return "placemark-lightblue";
+ case PredefinedColor::Cyan: return "placemark-cyan";
+ case PredefinedColor::Teal: return "placemark-teal";
+ case PredefinedColor::Lime: return "placemark-lime";
+ case PredefinedColor::DeepOrange: return "placemark-deeporange";
+ case PredefinedColor::Gray: return "placemark-gray";
+ case PredefinedColor::BlueGray: return "placemark-bluegray";
case PredefinedColor::None:
case PredefinedColor::Count:
return {};
diff --git a/kml/serdes_binary.hpp b/kml/serdes_binary.hpp
index d1e78e551c..a9e45e1984 100644
--- a/kml/serdes_binary.hpp
+++ b/kml/serdes_binary.hpp
@@ -24,8 +24,9 @@ enum class Version : uint8_t
V1 = 1, // 11th April 2018 (new Point2D storage, added deviceId, feature name -> custom name).
V2 = 2, // 25th April 2018 (added serverId).
V3 = 3, // 7th May 2018 (persistent feature types).
- V4 = 4, // 26th August 2019 (key-value properties and nearestToponym for bookmarks and tracks, cities -> toponyms)
- Latest = V4
+ V4 = 4, // 26th August 2019 (key-value properties and nearestToponym for bookmarks and tracks, cities -> toponyms).
+ V5 = 5, // 21st November 2019 (extended color palette).
+ Latest = V5
};
class SerializerKml
@@ -137,7 +138,7 @@ public:
NonOwningReaderSource source(reader);
auto const v = ReadPrimitiveFromSource<Version>(source);
- if (v != Version::Latest && v != Version::V2 && v != Version::V3)
+ if (v != Version::Latest && v != Version::V2 && v != Version::V3 && v != Version::V4)
MYTHROW(DeserializeException, ("Incorrect file version."));
ReadDeviceId(source);
@@ -147,8 +148,9 @@ public:
auto subReader = reader.CreateSubReader(source.Pos(), source.Size());
InitializeIfNeeded(*subReader);
- if (v == Version::V4)
+ if (v == Version::V5 || v == Version::V4)
{
+ // NOTE: v.4 and v.5 are binary compatible.
DeserializeCategory(subReader, m_data);
DeserializeBookmarks(subReader, m_data);
DeserializeTracks(subReader, m_data);
diff --git a/kml/types.hpp b/kml/types.hpp
index bf8e25a696..d4e94eb5e1 100644
--- a/kml/types.hpp
+++ b/kml/types.hpp
@@ -26,6 +26,16 @@ enum class PredefinedColor : uint8_t
Green,
Orange,
+ // Extended colors.
+ DeepPurple,
+ LightBlue,
+ Cyan,
+ Teal,
+ Lime,
+ DeepOrange,
+ Gray,
+ BlueGray,
+
Count
};
@@ -42,6 +52,14 @@ inline std::string DebugPrint(PredefinedColor color)
case PredefinedColor::Brown: return "Brown";
case PredefinedColor::Green: return "Green";
case PredefinedColor::Orange: return "Orange";
+ case PredefinedColor::DeepPurple: return "DeepPurple";
+ case PredefinedColor::LightBlue: return "LightBlue";
+ case PredefinedColor::Cyan: return "Cyan";
+ case PredefinedColor::Teal: return "Teal";
+ case PredefinedColor::Lime: return "Lime";
+ case PredefinedColor::DeepOrange: return "DeepOrange";
+ case PredefinedColor::Gray: return "Gray";
+ case PredefinedColor::BlueGray: return "BlueGray";
case PredefinedColor::Count: return {};
}
UNREACHABLE();