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
diff options
context:
space:
mode:
authorMaxim Pimenov <m@maps.me>2018-04-09 20:40:11 +0300
committerRoman Kuznetsov <r.kuznetsow@gmail.com>2018-04-11 14:27:47 +0300
commit0dc0baa25593b462517e0a8e603154dcd917cdc5 (patch)
tree93452601558bbb6260e55962ba5360ebda8699ee /storage
parentb333719087bbe70c2e3d6ec03151b131670e2d26 (diff)
[coding] [geometry] Refactored geometry serialization.
This commit moves all the code related to geometry serialization from indexer/ and coding/ to a single place, namely coding/geometry_coding.{c,h}pp.
Diffstat (limited to 'storage')
-rw-r--r--storage/country_info_getter.cpp9
-rw-r--r--storage/country_polygon.hpp38
2 files changed, 23 insertions, 24 deletions
diff --git a/storage/country_info_getter.cpp b/storage/country_info_getter.cpp
index 665cbe113d..2dadcf3149 100644
--- a/storage/country_info_getter.cpp
+++ b/storage/country_info_getter.cpp
@@ -1,17 +1,16 @@
-#include "storage/country.hpp"
#include "storage/country_info_getter.hpp"
+
+#include "storage/country.hpp"
#include "storage/country_polygon.hpp"
#include "platform/local_country_file_utils.hpp"
-#include "indexer/geometry_serialization.hpp"
+#include "coding/read_write_utils.hpp"
#include "geometry/latlon.hpp"
#include "geometry/mercator.hpp"
#include "geometry/region2d.hpp"
-#include "coding/read_write_utils.hpp"
-
#include "base/logging.hpp"
#include "base/string_utils.hpp"
@@ -283,7 +282,7 @@ std::result_of_t<TFn(vector<m2::RegionD>)> CountryInfoReader::WithRegion(size_t
for (size_t i = 0; i < count; ++i)
{
std::vector<m2::PointD> points;
- serial::LoadOuterPath(src, serial::CodingParams(), points);
+ serial::LoadOuterPath(src, serial::GeometryCodingParams(), points);
rgns.emplace_back(move(points));
}
}
diff --git a/storage/country_polygon.hpp b/storage/country_polygon.hpp
index 9b7cf2b34e..70f1ad0d0c 100644
--- a/storage/country_polygon.hpp
+++ b/storage/country_polygon.hpp
@@ -2,31 +2,31 @@
#include "storage/country_decl.hpp"
-#include "indexer/coding_params.hpp"
-
+#include "coding/geometry_coding.hpp"
#include "coding/point_to_integer.hpp"
#include "coding/read_write_utils.hpp"
-
+#include "coding/varint.hpp"
namespace storage
{
- template <class TSource> void Read(TSource & src, CountryDef & p)
- {
- rw::Read(src, p.m_countryId);
+template <class TSource> void Read(TSource & src, CountryDef & p)
+{
+ rw::Read(src, p.m_countryId);
- pair<int64_t, int64_t> r;
- r.first = ReadVarInt<int64_t>(src);
- r.second = ReadVarInt<int64_t>(src);
- p.m_rect = Int64ToRectObsolete(r, serial::CodingParams().GetCoordBits());
- }
+ pair<int64_t, int64_t> r;
+ r.first = ReadVarInt<int64_t>(src);
+ r.second = ReadVarInt<int64_t>(src);
+ p.m_rect = Int64ToRectObsolete(r, serial::GeometryCodingParams().GetCoordBits());
+}
+
+template <class TSink> void Write(TSink & sink, CountryDef const & p)
+{
+ rw::Write(sink, p.m_countryId);
- template <class TSink> void Write(TSink & sink, CountryDef const & p)
- {
- rw::Write(sink, p.m_countryId);
+ pair<int64_t, int64_t> const r =
+ RectToInt64Obsolete(p.m_rect, serial::GeometryCodingParams().GetCoordBits());
- pair<int64_t, int64_t> const r =
- RectToInt64Obsolete(p.m_rect, serial::CodingParams().GetCoordBits());
- WriteVarInt(sink, r.first);
- WriteVarInt(sink, r.second);
- }
+ WriteVarInt(sink, r.first);
+ WriteVarInt(sink, r.second);
}
+} // namespace storage